text:
import os
import sys
import subprocess
import tempfile
import time
import random
import optparse
import string

def run_subprocess(cmd):
    print("Running '%s'" % (' '.join(cmd)))

    proc = subprocess.Popen(cmd, bufsize=-1)
    proc.communicate()

    if proc.returncode != 0:
        print('Running "%s" failed rc %d' % (' '.join(cmd), proc.returncode))
        sys.exit(proc.returncode)

def spawn_server(cmd):
    print("Spawning '%s'" % (' '.join(cmd)))
    return subprocess.Popen(cmd, bufsize=-1)#,stdout=subprocess.PIPE,stderr=subprocess.PIPE)

def main(args=None):
    if args is None:
        args = sys.argv

    parser = optparse.OptionParser()

    parser.add_option('--type', default='tests',
                      help='Which TLS-Attacker tests to run (tests, policy, fuzzer)')
    parser.add_option('--src-dir', metavar='DIR', default='./src',
                      help='Specify path to botan sources (default "%default")')
    parser.add_option('--verbose', action='store_true',
                      help='Be noisy')

    (options, args) = parser.parse_args(args)

    if len(args) != 3:
        print("Usage: %s botan_cli_exe botan_ci_tools" % (args[0]))
        return 1

    cli_exe = args[1]
    ci_tools = args[2]
    test_type = options.type
    src_dir = options.src_dir

    if test_type not in ['tests', 'policy', 'fuzzer']:
        print("Unknown --type %s" % (options.test_type))
        return 1

    if os.access(cli_exe, os.X_OK) != True:
        print("Unable to find CLI tool at %s" % (cli_exe))
        return 1

    if os.access(src_dir, os.X_OK) != True:
        print("Unable to find src dir at %s" % (src_dir))
        return 1

    test_data_dir = os.path.join(src_dir, 'tests/data')

    lax_policy_txt = os.path.join(test_data_dir, 'tls-policy/compat.txt')
    bsi_policy_txt = os.path.join(test_data_dir, 'tls-policy/bsi.txt')

    tls_attacker_dir = os.path.join(ci_tools, 'TLS-Attacker')
    tls_attacker_jar = os.path.join(tls_attacker_dir, 'TLS-Attacker-1.2.jar')
    tls_attacker_testsuites = os.path.join(tls_attacker_dir, 'resources/testsuite')
    tls_fuzzer_workflows = os.path.join(tls_attacker_dir, 'resources/fuzzing/workflows')

    if os.access(tls_attacker_jar, os.R_OK) != True:
        print("Unable to find TLS-Attacker jar at %s" % (tls_attacker_jar))
        return 1

    rsa_key = tempfile.NamedTemporaryFile(prefix='rsa_key_')
    rsa_crt = tempfile.NamedTemporaryFile(prefix='rsa_crt_')

    run_subprocess([cli_exe, 'keygen', '--algo=RSA', '--params=2048', '--output=%s' % (rsa_key.name)])
    run_subprocess([cli_exe, 'gen_self_signed', rsa_key.name, 'localhost', '--output=%s' % (rsa_crt.name)])

    server_log = 'botan_log.txt'
    server_err_log = 'botan_err_log.txt'

    tls_port = random.randint(50000, 60000)

    botan_server_cmd = [cli_exe, 'tls_server', rsa_crt.name, rsa_key.name,
                        '--port=%d' % (tls_port),
                        '--output='+server_log,
                        '--error-output='+server_err_log]

    java_tls_attacker = ['java', '-jar', tls_attacker_jar,
                         '-loglevel', 'DEBUG' if options.verbose else 'ERROR']
    tls_attacker_opts = ['-tls_timeout', '300', '-connect', 'localhost:%d' % (tls_port)]

    if test_type == 'tests':
        try:
            server_process = spawn_server(botan_server_cmd +
                                          ['--policy=%s' % (lax_policy_txt)])
            time.sleep(1)
            run_subprocess(java_tls_attacker + ['testsuite_server'] + tls_attacker_opts +
                           ['-folder', tls_attacker_testsuites])
        finally:
            server_process.terminate()
    elif test_type == 'policy':
        try:
            server_process = spawn_server(botan_server_cmd +
                                          ['--policy=%s' % (bsi_policy_txt)])
            time.sleep(1)
            run_subprocess(java_tls_attacker + ['testtls_server'] + tls_attacker_opts +
                           ['-policy', bsi_policy_txt])
        finally:
            server_process.terminate()
    elif test_type == 'fuzzer':

        template_mapping = {
            'rsa_key': rsa_key.name,
            'rsa_cert': rsa_crt.name,
            'botan_cli': cli_exe,
            'workflow_dir': tls_fuzzer_workflows,
            'fuzz_policy': lax_policy_txt,
            'tls_port': str(tls_port),
            'PORT': '$PORT' # this is a var for TLS-Attacker don't touch it
        }

        template_txt = open(os.path.join(src_dir, 'scripts/fuzzer.xml')).read()

        config = string.Template(template_txt).substitute(template_mapping)

        fuzzer_config = tempfile.NamedTemporaryFile(prefix='fuzzer_cfg_', delete=False)
        fuzzer_config.write(config.encode('ascii'))
        fuzzer_config.close()

        run_subprocess(java_tls_attacker + ['multi_fuzzer'] +
                       ['-startup_command_file', fuzzer_config.name])

if __name__ == '__main__':
    sys.exit(main())


text:
package com.imu.coursenet.dao.impl;

import java.util.List;

import com.imu.coursenet.dao.*;
import com.imu.coursenet.domain.CourseWork;
import com.imu.coursenet.domain.CourseWorkRequirement;
import com.imu.coursenet.support.YeekuHibernateDaoSupport;

public class CourseWorkRequirementDaoImpl extends YeekuHibernateDaoSupport
		implements CourseWorkRequirementDao {

	@Override
	public CourseWorkRequirement get(Integer courseWorkRequirementId) {
		return getHibernateTemplate().get(CourseWorkRequirement.class,
				courseWorkRequirementId);
	}

	@Override
	public Integer save(CourseWorkRequirement courseWorkRequirement) {
		return (Integer) getHibernateTemplate().save(courseWorkRequirement);
	}

	@Override
	public void update(CourseWorkRequirement courseWorkRequirement) {
		getHibernateTemplate().update(courseWorkRequirement);

	}

	@Override
	public void delete(CourseWorkRequirement courseWorkRequirement) {
		getHibernateTemplate().delete(courseWorkRequirement);

	}

	@Override
	public void delete(Integer courseWorkRequirementId) {
		getHibernateTemplate().delete(get(courseWorkRequirementId));

	}

	@Override
	public List<CourseWorkRequirement> findAll() {
		return (List<CourseWorkRequirement>) getHibernateTemplate().find(
				"from CourseWorkRequirement ");
	}

	@Override
	public List<CourseWorkRequirement> findByCourseDetailId(
			Integer courseDetailId) {
		return (List<CourseWorkRequirement>) getHibernateTemplate()
				.find("from CourseWorkRequirement c where c.courseDetail.courseDetailId=?",
						courseDetailId);
	}

}

redpajama_set_name: RedPajamaGithub


text:
package com.intellij.navigation;

import com.intellij.ide.projectView.PresentationData;
import com.intellij.ide.projectView.impl.ProjectRootsUtil;
import com.intellij.openapi.application.ex.ApplicationInfoEx;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.roots.SourceFolder;
import com.intellij.openapi.roots.ui.configuration.SourceRootPresentation;
import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiDirectory;
import com.intellij.util.PlatformIcons;

import javax.swing.*;

public class DirectoryPresentationProvider implements ItemPresentationProvider<PsiDirectory> {
  @Override
  public ItemPresentation getPresentation(final PsiDirectory directory) {
    final VirtualFile vFile = directory.getVirtualFile();
    final Project project = directory.getProject();
    final String locationString = vFile.getPath();

    if (ProjectRootsUtil.isProjectHome(directory)) {
      final Icon projectIcon = IconLoader.getIcon(ApplicationInfoEx.getInstanceEx().getSmallIconUrl());
      return new PresentationData(project.getName(), locationString, projectIcon, null);
    }

    if (ProjectRootsUtil.isModuleContentRoot(directory)) {
      final Module module = ProjectRootManager.getInstance(project).getFileIndex().getModuleForFile(vFile);
      assert module != null : directory;
      return new PresentationData(module.getName(), locationString,
                                  PlatformIcons.CONTENT_ROOT_ICON_CLOSED, null);
    }

    if (ProjectRootsUtil.isSourceRoot(directory)) {
      SourceFolder sourceRoot = ProjectRootsUtil.getModuleSourceRoot(vFile, project);
      if (sourceRoot != null) {
        Icon icon = SourceRootPresentation.getSourceRootIcon(sourceRoot);
        return new PresentationData(directory.getName(), locationString, icon, null);
      }
    }

    return new PresentationData(directory.getName(), locationString,
                                PlatformIcons.DIRECTORY_CLOSED_ICON, null);
  }
}


text:
@interface Datasource (Private)

- (void) appendStaticQuestions;
- (void) appendLastQuestion;
- (void) appendQuestion: (NSString *) question
             withAnswer: (BOOL) answer;
- (void) appendQuestion: (NSString *) question
             withAnswer: (BOOL) answer
       andLoadingScreen: (BOOL) loadingScreen;

@end

@implementation Datasource

SYNTHESIZE_SINGLETON_FOR_CLASS(Datasource);

- (id)init
{
	self = [super init];
	if (self != nil)
	{
        appendedLastQuestion = NO;
        lastRetrieveSucceeded = YES;
        currentPage = 1;
        displayedStates = [[NSMutableArray alloc] init];
        questions = [[NSMutableArray alloc] init];
        loadingScreens = [[NSMutableArray alloc] init];
        [self appendQuestion: @"Is it an App?" withAnswer: YES];
	}
	return self;
}

- (void) dealloc
{
    [displayedStates release];
    [questions release];
    [loadingScreens release];
    [super dealloc];
}

// exposing this for the DS consumers' benefit
- (NSInteger) questionsCountPerPage
{
  return QUESTIONS_PER_PAGE;
}

- (NSInteger) questionCount
{
	return [questions count];
}

- (NSDictionary *) dataForQuestion: (NSInteger) index
{
	return [questions objectAtIndex: index];
}

- (BOOL) retrieveMoreQuestions
{
  if (!lastRetrieveSucceeded) return lastRetrieveSucceeded;

	NSURL *jsonURL = [NSURL URLWithString: [NSString stringWithFormat: QUESTIONS_URL,
                                          currentPage, nil]];
	NSLog(@"fetching %@", jsonURL);
	NSString *jsonData = [[[NSString alloc] initWithContentsOfURL: jsonURL] autorelease];
	if (jsonData == nil)
	{
        [self appendStaticQuestions];
        [self appendLastQuestion];
        lastRetrieveSucceeded = NO;
	}
	else
	{
        NSArray *fetched = [[jsonData JSONValue] shuffledArray];
        for (int i = 0; i < [fetched count]; i++)
        {
            [questions addObject: [fetched objectAtIndex: i]];
            [displayedStates addObject: [NSNumber numberWithInteger: 0]];
            [loadingScreens addObject: [NSNumber numberWithInteger: 0]];

            if ([fetched count] >= QUESTIONS_PER_PAGE && i == (QUESTIONS_PER_PAGE / 2))
            {
                [self appendQuestion: @"Have more questions been loaded?" withAnswer: YES andLoadingScreen: YES];
            }
        }
        // if we received less than a whole pages worth of questions, add the last question
        if ([fetched count] < QUESTIONS_PER_PAGE)
        {
          [self appendLastQuestion];
        }
        NSLog(@"added another %i questions, total: %i", [fetched count], [questions count]);
        lastRetrieveSucceeded = YES;
        currentPage += 1;
	}
	//[jsonData release];

    return lastRetrieveSucceeded;
}

- (BOOL) displayedYet: (NSInteger) index
{
    if (index >= 0 && index < [displayedStates count])
    {
        return [[displayedStates objectAtIndex: index] intValue] == 1;
    }
    return NO;
}
- (void) setHasBeenDisplayed: (NSInteger) index
{
    if (index >= 0 && index < [displayedStates count])
    {
        [displayedStates replaceObjectAtIndex: index withObject: [NSNumber numberWithInteger: 1]];
    }
}

- (BOOL) isLoadingScreen: (NSInteger) index
{
    if (index >= 0 && index < [loadingScreens count])
    {
        return [[loadingScreens objectAtIndex: index] intValue] == 1;
    }
    return NO;
}

- (void) cleanupOldQuestions
{
  // TODO, clear out some of the older question entries to free up memory
}

#pragma mark Private

- (void) appendStaticQuestions
{
    [self appendQuestion: @"Is life fair?" withAnswer: NO];
    [self appendQuestion: @"Are you awesome?" withAnswer: NO];
    [self appendQuestion: @"Am I tired?" withAnswer: YES];
    [self appendQuestion: @"Is my computer on?" withAnswer: YES];
    [self appendQuestion: @"Has the Large Hadron Collider destroyed the world yet?" withAnswer: NO];
    [self appendQuestion: @"Is Helvetica the best font?" withAnswer: NO];
    [self appendQuestion: @"Is Barack Obama Muslin?" withAnswer: NO];
    [self appendQuestion: @"Do websites need to look exactly the same in every browser?" withAnswer: NO];
    [self appendQuestion: @"Does Internet Explorer suck?" withAnswer: YES];
    [self appendQuestion: @"Is it ok to use Comic Sans yet?" withAnswer: NO];
    [self appendQuestion: @"Is 0.999... equal to 1?" withAnswer: YES];
    [self appendQuestion: @"Is it secret, is it safe?" withAnswer: YES];
    [self appendQuestion: @"Do all your base belong to us?" withAnswer: YES];
    [self appendQuestion: @"Is Keyboard Cat alive and well?" withAnswer: NO];
    [self appendQuestion: @"I know, right?" withAnswer: NO];
}

- (void) appendLastQuestion
{
    if (appendedLastQuestion) return;
    [self appendQuestion: @"Is this the last question?" withAnswer: YES];
    appendedLastQuestion = YES;
}

- (void) appendQuestion: (NSString *) question
             withAnswer: (BOOL) answer
{
    [self appendQuestion: question withAnswer: answer andLoadingScreen: NO];
}

- (void) appendQuestion: (NSString *) question
             withAnswer: (BOOL) answer
       andLoadingScreen: (BOOL) loadingScreen
{
    NSArray *keys = [NSArray arrayWithObjects: @"question", @"answer", nil];
    NSArray *objects = [NSArray arrayWithObjects: question, answer ? @"1" : @"0", nil];
    [questions addObject: [NSDictionary dictionaryWithObjects: objects forKeys: keys]];
    [displayedStates addObject: [NSNumber numberWithInteger: 0]];
    [loadingScreens addObject: [NSNumber numberWithInteger: loadingScreen]];
}

@end


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center_vertical"
    android:background="@drawable/sliding_menu_item_selector" >

    <ImageView
        android:id="@+id/menu_group_icon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginRight="10dp"
        android:src="@drawable/menu_more_icon" />

    <TextView
        android:id="@+id/menu_group_text"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_toRightOf="@+id/menu_group_icon"
        android:text="Medium Text"
        android:shadowColor="@android:color/black"
        android:shadowDx="2"
        android:shadowDy="1"
        android:shadowRadius="1"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <ImageView
        android:id="@+id/menu_group_arrow"
        android:layout_width="16dp"
        android:layout_height="16dp"
        android:layout_marginRight="10dp"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"
        android:src="@drawable/right" />

</RelativeLayout>


text:
#import "ZIMSqlStatement.h"
#import "ZIMSqlDataDefinitionCommand.h"

/*!
 @class					ZIMSqlAlterTableStatement
 @discussion			This class represents an SQL alter table statement.
 @updated				2012-03-18
 @see					http://www.sqlite.org/lang_altertable.html
 */
@interface ZIMSqlAlterTableStatement : NSObject <ZIMSqlStatement, ZIMSqlDataDefinitionCommand, NSXMLParserDelegate> {

	@protected
		NSString *_table;
		NSString *_clause;
		NSMutableDictionary *_schema;
		NSMutableArray *_stack;
		NSUInteger _counter;
		NSError *_error;

}
/*!
 @method				initWithXmlSchema:withChanges:error:
 @discussion			This method initializes the class via an XML file following Ziminji's "XML to DDL" schema.
 @param before			The UTF-8 encoded string of XML.
 @param after			The UTF-8 encoded string of XML with the changes.
 @param error           Used when an error occurs while processing the XML data. May be NULL.
 @return                An instance of this class.
 @updated				2011-10-19
 @see					http://db.apache.org/ddlutils/
 @see					http://db.apache.org/ddlutils/schema/
 */
- (instancetype) initWithXmlSchema: (NSData *)before withChanges: (NSData *)after error: (NSError **)error;
/*!
 @method				init
 @discussion			This method initializes the class.
 @return                An instance of this class.
 @updated				2012-03-20
 */
- (instancetype) init;
/*!
 @method				table:
 @discussion			This method will set the table used in the SQL statement.
 @param table			The table that will be used in the SQL statement.
 @updated				2011-10-30
 */
- (void) table: (NSString *)table;
/*!
 @method				autoincrement:
 @discussion			This method will change the autoincrement position.  WARNING: ALTERING TABLE VIA THIS
						METHOD MAY CAUSE PROBLEMS WITH THE AUTOINCREMENT KEY GENERATION ALGORITHM.
 @param position		The position to which the autoincrementer will be set.
 @updated				2012-03-18
 @see					http://sqlite.org/autoinc.html
 @see					http://stackoverflow.com/questions/3443630/reset-the-row-number-count-in-sqlite3-mysql
 */
- (void) autoincrement: (NSUInteger)position;
/*!
 @method				column:type:
 @discussion			This method will create a column with the specified parameters.
 @param column			The column to be created.
 @param type			The datatype of the column.
 @updated				2011-10-30
 */
- (void) column: (NSString *)column type: (NSString *)type;
/*!
 @method				column:type:defaultValue:
 @discussion			This method will create a column with the specified parameters.
 @param column			The column to be created.
 @param type			The datatype of the column.
 @param value			The default value to be used when no data is provided.
 @updated				2011-10-30
 */
- (void) column: (NSString *)column type: (NSString *)type defaultValue: (NSString *)value;
/*!
 @method				column:type:primaryKey:
 @discussion			This method will create a column with the specified parameters.
 @param column			The column to be created.
 @param type			The datatype of the column.
 @param primaryKey		This marks the specified column as the primary key.
 @updated				2011-10-30
 */
- (void) column: (NSString *)column type: (NSString *)type primaryKey: (BOOL)primaryKey;
/*!
 @method				column:type:unique:
 @discussion			This method will create a column with the specified datatype. It also provides
						the option to ensure that all values in the column are distinct.
 @param column			The column to be created.
 @param type			The datatype of the column.
 @param unique			This constrains the column to only unique values.
 @updated				2011-10-30
 */
- (void) column: (NSString *)column type: (NSString *)type unique: (BOOL)unique;
/*!
 @method				rename:
 @discussion			This method will set the table used in the SQL statement.
 @param table			The table that will be used in the SQL statement.
 @updated				2011-10-30
 */
- (void) rename: (NSString *)table;
/*!
 @method				statement
 @discussion			This method will return the SQL statement.
 @return				The SQL statement that was constructed.
 @updated				2011-10-30
 */
- (NSString *) statement;

@end


text:
namespace ChilliSource
{
    namespace UI
    {
        namespace
        {
            //------------------------------------------------------------------------------
            /// Parses the given cell order string. If the string is not a valid cell order
            /// the app is considered to be in an irrecoverable state and will terminate.
            ///
            /// @author Ian Copland
            ///
            /// @param The cell order in string form.
            ///
            /// @return The parsed cell order.
            //------------------------------------------------------------------------------
            GridLayout::CellOrder ParseCellOrder(const std::string& in_cellOrderString)
            {
                const char k_columnMajor[] = "colmajor";
                const char k_rowMajor[] = "rowmajor";

                std::string cellOrderString = in_cellOrderString;
                Core::StringUtils::ToLowerCase(cellOrderString);

                if(cellOrderString == k_columnMajor)
                {
                    return GridLayout::CellOrder::k_colMajor;
                }
                else if(cellOrderString == k_rowMajor)
                {
                    return GridLayout::CellOrder::k_rowMajor;
                }

                CS_LOG_FATAL("Unknown GridLayout cell order: " + in_cellOrderString);
                return GridLayout::CellOrder::k_colMajor;
            }
        }

        CS_DEFINE_NAMEDTYPE(GridLayoutDef);
        //------------------------------------------------------------------------------
        //------------------------------------------------------------------------------
        GridLayoutDef::GridLayoutDef(const Json::Value& in_json)
        {
            const char k_typeKey[] = "Type";
            const char k_cellOrderKey[] = "CellOrder";
            const char k_numRowsKey[] = "NumRows";
            const char k_numColumnsKey[] = "NumCols";
            const char k_relativeMarginsKey[] = "RelMargins";
            const char k_absoluteMarginsKey[] = "AbsMargins";
            const char k_relativeHSpacingKey[] = "RelHSpacing";
            const char k_absoluteHSpacingKey[] = "AbsHSpacing";
            const char k_relativeVSpacingKey[] = "RelVSpacing";
            const char k_absoluteVSpacingKey[] = "AbsVSpacing";

            for(auto it = in_json.begin(); it != in_json.end(); ++it)
            {
                CS_ASSERT((*it).isString() == true, "All properties in a Layout Def must be a string: " + std::string(it.memberName()));

                std::string key = it.memberName();
                std::string value = (*it).asString();

                if (key == k_relativeMarginsKey)
                {
                    m_relativeMargins = Core::ParseVector4(value);
                }
                else if (key == k_absoluteMarginsKey)
                {
                    m_absoluteMargins = Core::ParseVector4(value);
                }
                else if (key == k_numRowsKey)
                {
                    m_numRows = Core::ParseU32(value);
                }
                else if (key == k_numColumnsKey)
                {
                    m_numCols = Core::ParseU32(value);
                }
                else if (key == k_relativeHSpacingKey)
                {
                    m_relativeHSpacing = Core::ParseF32(value);
                }
                else if (key == k_absoluteHSpacingKey)
                {
                    m_absoluteHSpacing = Core::ParseF32(value);
                }
                else if (key == k_relativeVSpacingKey)
                {
                    m_relativeVSpacing = Core::ParseF32(value);
                }
                else if (key == k_absoluteVSpacingKey)
                {
                    m_absoluteVSpacing = Core::ParseF32(value);
                }
                else if (key == k_cellOrderKey)
                {
                    m_cellOrder = ParseCellOrder(value);
                }
                else if (key == k_typeKey)
                {
                    //ignore
                }
                else
                {
                    CS_LOG_FATAL("Invalid property found in a Grid layout description: " + key);
                }
            }
        }
        //------------------------------------------------------------------------------
        //------------------------------------------------------------------------------
        GridLayoutDef::GridLayoutDef(GridLayout::CellOrder in_cellOrder, u32 in_numRows, u32 in_numCols, const Core::Vector4& in_relMargins, const Core::Vector4& in_absMargins,
                      f32 in_relHorizSpacing, f32 in_absHorizSpacing, f32 in_relVertSpacing, f32 in_absVertSpacing)
            : m_cellOrder(in_cellOrder), m_numRows(in_numRows), m_numCols(in_numCols), m_relativeMargins(in_relMargins), m_absoluteMargins(in_absMargins), m_relativeHSpacing(in_relHorizSpacing),
              m_absoluteHSpacing(in_absHorizSpacing), m_relativeVSpacing(in_relVertSpacing), m_absoluteVSpacing(in_absVertSpacing)
        {
        }
        //------------------------------------------------------------------------------
        //------------------------------------------------------------------------------
        bool GridLayoutDef::IsA(Core::InterfaceIDType in_interfaceId) const
        {
            return (LayoutDef::InterfaceID == in_interfaceId || GridLayoutDef::InterfaceID == in_interfaceId);
        }
        //------------------------------------------------------------------------------
        //------------------------------------------------------------------------------
        u32 GridLayoutDef::GetNumRows() const
        {
            return m_numRows;
        }
        //------------------------------------------------------------------------------
        //------------------------------------------------------------------------------
        u32 GridLayoutDef::GetNumCols() const
        {
            return m_numCols;
        }
        //------------------------------------------------------------------------------
        //------------------------------------------------------------------------------
        Core::Vector4 GridLayoutDef::GetRelativeMargins() const
        {
            return m_relativeMargins;
        }
        //------------------------------------------------------------------------------
        //------------------------------------------------------------------------------
        Core::Vector4 GridLayoutDef::GetAbsoluteMargins() const
        {
            return m_absoluteMargins;
        }
        //------------------------------------------------------------------------------
        //------------------------------------------------------------------------------
        f32 GridLayoutDef::GetRelativeHSpacing() const
        {
            return m_relativeHSpacing;
        }
        //------------------------------------------------------------------------------
        //------------------------------------------------------------------------------
        f32 GridLayoutDef::GetAbsoluteHSpacing() const
        {
            return m_absoluteHSpacing;
        }
        //------------------------------------------------------------------------------
        //------------------------------------------------------------------------------
        f32 GridLayoutDef::GetRelativeVSpacing() const
        {
            return m_relativeVSpacing;
        }
        //------------------------------------------------------------------------------
        //------------------------------------------------------------------------------
        f32 GridLayoutDef::GetAbsoluteVSpacing() const
        {
            return m_absoluteVSpacing;
        }
        //------------------------------------------------------------------------------
        //------------------------------------------------------------------------------
        GridLayout::CellOrder GridLayoutDef::GetCellOrder() const
        {
            return m_cellOrder;
        }
        //------------------------------------------------------------------------------
        //------------------------------------------------------------------------------
        LayoutUPtr GridLayoutDef::CreateLayout(LayoutComponent* in_owner) const
        {
            return LayoutUPtr(new GridLayout(in_owner, m_cellOrder, m_numRows, m_numCols, m_relativeMargins, m_absoluteMargins, m_relativeHSpacing, m_absoluteHSpacing, m_relativeVSpacing, m_absoluteVSpacing));
        }
    }
}


text:
nvmd = "/software/.nvm"
nvms = "/software/.nvm/nvm.sh"

bash 'download_nvm' do
  cwd ::File.dirname('./')
  code <<-EOH
    curl --silent --location https://deb.nodesource.com/setup_0.12 | NVM_DIR=#{nvmd} sudo bash -

    EOH
end


text:
CWallet* pwalletMain;
CClientUIInterface uiInterface;

extern bool fPrintToConsole;
extern void noui_connect();

struct TestingSetup {
    CCoinsViewDB *pcoinsdbview;
    boost::filesystem::path pathTemp;

    TestingSetup() {
        fPrintToDebugger = true; // don't want to write to debug.log file
        noui_connect();
        bitdb.MakeMock();
        pathTemp = GetTempPath() / strprintf("test_bitcoin_%lu_%i", (unsigned long)GetTime(), (int)(GetRand(100000)));
        boost::filesystem::create_directories(pathTemp);
        mapArgs["-datadir"] = pathTemp.string();
        pblocktree = new CBlockTreeDB(1 << 20, true);
        pcoinsdbview = new CCoinsViewDB(1 << 23, true);
        pcoinsTip = new CCoinsViewCache(*pcoinsdbview);
        LoadBlockIndex();
        bool fFirstRun;
        pwalletMain = new CWallet("wallet.dat");
        pwalletMain->LoadWallet(fFirstRun);
        RegisterWallet(pwalletMain);
    }
    ~TestingSetup()
    {
        delete pwalletMain;
        pwalletMain = NULL;
        delete pcoinsTip;
        delete pcoinsdbview;
        delete pblocktree;
        bitdb.Flush(true);
        boost::filesystem::remove_all(pathTemp);
    }
};

BOOST_GLOBAL_FIXTURE(TestingSetup);

void Shutdown(void* parg)
{
  exit(0);
}

void StartShutdown()
{
  exit(0);
}


text:
@import Foundation;

@class PURow;

@interface PUSection : NSObject

@property (nonatomic) NSString *header;
@property (nonatomic) NSArray <PURow *>*rows;
@property (nonatomic) NSString *footer;

+ (PUSection *)sectionWithRows:(NSArray <PURow *>*)rows;
+ (PUSection *)sectionWithRows:(NSArray<PURow *> *)rows
                        header:(NSString *)header;
+ (PUSection *)sectionWithRows:(NSArray<PURow *> *)rows
                        footer:(NSString *)footer;
+ (PUSection *)sectionWithRows:(NSArray<PURow *> *)rows
                        header:(NSString *)header
                        footer:(NSString *)footer;

@end


text:
from __future__ import print_function
import time, sys, signal, atexit
from upm import pyupm_gas as upmGAS

def main():
    # Attach gas sensor to Analog A0
    sensor = upmGAS.MQ8(0)

    ## Exit handlers ##
    # This function stops python from printing a stacktrace when you hit control-C
    def SIGINTHandler(signum, frame):
        raise SystemExit

    # This function lets you run code on exit, including functions from sensor
    def exitHandler():
        print("Exiting")
        sys.exit(0)

    # Register exit handlers
    atexit.register(exitHandler)
    signal.signal(signal.SIGINT, SIGINTHandler)

    threshContext = upmGAS.thresholdContext()
    threshContext.averageReading = 0
    threshContext.runningAverage = 0
    threshContext.averagedOver = 2

    # Infinite loop, ends when script is cancelled
    # Repeatedly, take a sample every 2 microseconds;
    # find the average of 128 samples; and
    # print a running graph of asteriskss as averages
    mybuffer = upmGAS.uint16Array(128)
    while(1):
        samplelen = sensor.getSampledWindow(2, 128, mybuffer)
        if samplelen:
            thresh = sensor.findThreshold(threshContext, 30, mybuffer, samplelen)
            sensor.printGraph(threshContext, 5)
    #               if(thresh):
    #                       print "Threshold is ", thresh

if __name__ == '__main__':
    main()


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--

    Most of the code in the Qalingo project is copyrighted Hoteia and licensed
    under the Apache License Version 2.0 (release version 0.8.0)
            http://www.apache.org/licenses/LICENSE-2.0

                      Copyright (c) Hoteia, 2012-2014
    http://www.hoteia.com - http://twitter.com/hoteia - contact@hoteia.com

-->
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	   xmlns:tx="http://www.springframework.org/schema/tx"
	   xmlns:p="http://www.springframework.org/schema/p"
	   xmlns:context="http://www.springframework.org/schema/context"
       xmlns:aop="http://www.springframework.org/schema/aop"
	   xmlns:cache="http://www.springframework.org/schema/cache"
	   xsi:schemaLocation="http://www.springframework.org/schema/beans
						   http://www.springframework.org/schema/beans/spring-beans.xsd
						   http://www.springframework.org/schema/tx
						   http://www.springframework.org/schema/tx/spring-tx.xsd
					   	   http://www.springframework.org/schema/context
						   http://www.springframework.org/schema/context/spring-context.xsd
                           http://www.springframework.org/schema/aop
                           http://www.springframework.org/schema/aop/spring-aop.xsd
						   http://www.springframework.org/schema/cache
						   http://www.springframework.org/schema/cache/spring-cache.xsd">

    <aop:config>
        <aop:aspect id="triggerCacheRequestUtil" ref="cacheManagementAspect">
            <aop:pointcut id="requestUtilPointcut" expression="execution(* org.hoteia.qalingo.core.web.util.RequestUtil.getCurrentContextNameValue(..))" />
            <aop:around method="around" pointcut-ref="requestUtilPointcut" />
        </aop:aspect>
        <aop:aspect id="triggerCacheAttributeService" ref="cacheManagementAspect">
            <aop:pointcut id="attributeServicePointcut" expression="execution(* org.hoteia.qalingo.core.service.AttributeService.get*(..))" />
            <aop:around method="around" pointcut-ref="attributeServicePointcut" />
        </aop:aspect>
        <aop:aspect id="triggerCacheCartService" ref="cacheManagementAspect">
            <aop:pointcut id="cartServicePointcut" expression="execution(* org.hoteia.qalingo.core.service.CartService.get*(..))" />
            <aop:around method="around" pointcut-ref="cartServicePointcut" />
        </aop:aspect>
        <aop:aspect id="triggerCacheCatalogCategoryService" ref="cacheManagementAspect">
            <aop:pointcut id="catalogCategoryServicePointcut" expression="execution(* org.hoteia.qalingo.core.service.CatalogCategoryService.get*(..))" />
            <aop:around method="around" pointcut-ref="catalogCategoryServicePointcut" />
        </aop:aspect>
        <aop:aspect id="triggerCacheCatalogService" ref="cacheManagementAspect">
            <aop:pointcut id="catalogServicePointcut" expression="execution(* org.hoteia.qalingo.core.service.CatalogService.get*(..))" />
            <aop:around method="around" pointcut-ref="catalogServicePointcut" />
        </aop:aspect>
        <aop:aspect id="triggerCacheCurrencyReferentialService" ref="cacheManagementAspect">
            <aop:pointcut id="currencyReferentialServicePointcut" expression="execution(* org.hoteia.qalingo.core.service.CurrencyReferentialService.get*(..))" />
            <aop:around method="around" pointcut-ref="currencyReferentialServicePointcut" />
        </aop:aspect>
        <aop:aspect id="triggerCacheCustomerConnectionLogService" ref="cacheManagementAspect">
            <aop:pointcut id="customerConnectionLogServicePointcut" expression="execution(* org.hoteia.qalingo.core.service.CustomerConnectionLogService.get*(..))" />
            <aop:around method="around" pointcut-ref="customerConnectionLogServicePointcut" />
        </aop:aspect>
        <aop:aspect id="triggerCacheCustomerService" ref="cacheManagementAspect">
            <aop:pointcut id="customerServicePointcut" expression="execution(* org.hoteia.qalingo.core.service.CustomerService.get*(..))" />
            <aop:around method="around" pointcut-ref="customerServicePointcut" />
        </aop:aspect>
        <aop:aspect id="triggerCacheCustomerWishlistService" ref="cacheManagementAspect">
            <aop:pointcut id="customerWishlistServicePointcut" expression="execution(* org.hoteia.qalingo.core.service.CustomerWishlistService.get*(..))" />
            <aop:around method="around" pointcut-ref="customerWishlistServicePointcut" />
        </aop:aspect>
        <aop:aspect id="triggerCacheDeliveryMethodService" ref="cacheManagementAspect">
            <aop:pointcut id="deliveryMethodServicePointcut" expression="execution(* org.hoteia.qalingo.core.service.DeliveryMethodService.get*(..))" />
            <aop:around method="around" pointcut-ref="deliveryMethodServicePointcut" />
        </aop:aspect>
        <aop:aspect id="triggerCacheEngineSessionService" ref="cacheManagementAspect">
            <aop:pointcut id="engineSessionServicePointcut" expression="execution(* org.hoteia.qalingo.core.service.EngineSessionService.get*(..))" />
            <aop:around method="around" pointcut-ref="engineSessionServicePointcut" />
        </aop:aspect>
        <aop:aspect id="triggerCacheEngineSettingService" ref="cacheManagementAspect">
            <aop:pointcut id="engineSettingServicePointcut" expression="execution(* org.hoteia.qalingo.core.service.EngineSettingService.get*(..))" />
            <aop:around method="around" pointcut-ref="engineSettingServicePointcut" />
        </aop:aspect>
        <aop:aspect id="triggerCacheGeolocService" ref="cacheManagementAspect">
            <aop:pointcut id="geolocServicePointcut" expression="execution(* org.hoteia.qalingo.core.service.GeolocService.get*(..))" />
            <aop:around method="around" pointcut-ref="geolocServicePointcut" />
        </aop:aspect>
        <aop:aspect id="triggerCacheLocalizationService" ref="cacheManagementAspect">
            <aop:pointcut id="localizationServicePointcut" expression="execution(* org.hoteia.qalingo.core.service.LocalizationService.get*(..))" />
            <aop:around method="around" pointcut-ref="localizationServicePointcut" />
        </aop:aspect>
        <aop:aspect id="triggerCacheMarketService" ref="cacheManagementAspect">
            <aop:pointcut id="marketServicePointcut" expression="execution(* org.hoteia.qalingo.core.service.MarketService.get*(..))" />
            <aop:around method="around" pointcut-ref="marketServicePointcut" />
        </aop:aspect>
        <aop:aspect id="triggerCacheNotificationService" ref="cacheManagementAspect">
            <aop:pointcut id="notificationServicePointcut" expression="execution(* org.hoteia.qalingo.core.service.NotificationService.get*(..))" />
            <aop:around method="around" pointcut-ref="notificationServicePointcut" />
        </aop:aspect>
        <aop:aspect id="triggerCacheOrderPurchaseService" ref="cacheManagementAspect">
            <aop:pointcut id="orderPurchaseServicePointcut" expression="execution(* org.hoteia.qalingo.core.service.OrderPurchaseService.get*(..))" />
            <aop:around method="around" pointcut-ref="orderPurchaseServicePointcut" />
        </aop:aspect>
        <aop:aspect id="triggerCachePaymentGatewayService" ref="cacheManagementAspect">
            <aop:pointcut id="paymentGatewayServicePointcut" expression="execution(* org.hoteia.qalingo.core.service.PaymentGatewayService.get*(..))" />
            <aop:around method="around" pointcut-ref="paymentGatewayServicePointcut" />
        </aop:aspect>
        <aop:aspect id="triggerProductService" ref="cacheManagementAspect">
            <aop:pointcut id="productServicePointcut" expression="execution(* org.hoteia.qalingo.core.service.ProductService.get*(..))" />
            <aop:around method="around" pointcut-ref="productServicePointcut" />
        </aop:aspect>
        <aop:aspect id="triggerCacheReferentialDataService" ref="cacheManagementAspect">
            <aop:pointcut id="referentialDataServicePointcut" expression="execution(* org.hoteia.qalingo.core.service.ReferentialDataService.get*(..))" />
            <aop:around method="around" pointcut-ref="referentialDataServicePointcut" />
        </aop:aspect>
        <aop:aspect id="triggerCacheRetailerService" ref="cacheManagementAspect">
            <aop:pointcut id="retailerServicePointcut" expression="execution(* org.hoteia.qalingo.core.service.RetailerService.get*(..))" />
            <aop:around method="around" pointcut-ref="retailerServicePointcut" />
        </aop:aspect>
        <aop:aspect id="triggerCacheServerService" ref="cacheManagementAspect">
            <aop:pointcut id="serverServicePointcut" expression="execution(* org.hoteia.qalingo.core.service.ServerService.get*(..))" />
            <aop:around method="around" pointcut-ref="serverServicePointcut" />
        </aop:aspect>
        <aop:aspect id="triggerCacheWarehouseService" ref="cacheManagementAspect">
            <aop:pointcut id="warehouseServicePointcut" expression="execution(* org.hoteia.qalingo.core.service.WarehouseService.get*(..))" />
            <aop:around method="around" pointcut-ref="warehouseServicePointcut" />
        </aop:aspect>
        <aop:aspect id="triggerCacheTaxService" ref="cacheManagementAspect">
            <aop:pointcut id="taxServicePointcut" expression="execution(* org.hoteia.qalingo.core.service.TaxService.get*(..))" />
            <aop:around method="around" pointcut-ref="taxServicePointcut" />
        </aop:aspect>
        <aop:aspect id="triggerUrlService" ref="cacheManagementAspect">
            <aop:pointcut id="urlServicePointcut" expression="execution(* org.hoteia.qalingo.core.service.UrlService.get*(..))" />
            <aop:around method="around" pointcut-ref="urlServicePointcut" />
        </aop:aspect>
        <aop:aspect id="triggerCacheUserConnectionLogService" ref="cacheManagementAspect">
            <aop:pointcut id="userConnectionLogServicePointcut" expression="execution(* org.hoteia.qalingo.core.service.UserConnectionLogService.get*(..))" />
            <aop:around method="around" pointcut-ref="userConnectionLogServicePointcut" />
        </aop:aspect>
        <aop:aspect id="triggerCacheUserService" ref="cacheManagementAspect">
            <aop:pointcut id="userServicePointcut" expression="execution(* org.hoteia.qalingo.core.service.UserService.get*(..))" />
            <aop:around method="around" pointcut-ref="userServicePointcut" />
        </aop:aspect>
        <aop:aspect id="triggerCachePropertiesUtil" ref="cacheManagementAspect">
            <aop:pointcut id="propertiesUtilPointcut" expression="execution(* org.hoteia.qalingo.core.web.util.PropertiesUtil.get*(..))" />
            <aop:around method="around" pointcut-ref="propertiesUtilPointcut" />
        </aop:aspect>
    </aop:config>

</beans>


text:
/*
 * The templates should be kept in sync with:
 *
 * - templates/reviews/changedesc_commit_list.html
 * - templates/reviews/commit_list_field.html
 *
 * so that they render items identically.
 */
(function() {

const itemTemplate = _.template(dedent`
    <tr<% if (rowClass) { %> class="<%- rowClass %>"<% } %>>
     <% if (showHistorySymbol) { %>

       <%- historyDiffEntry.getSymbol() %>

     <% } else if (showInterCommitDiffControls) { %>

       <input type="radio"
              class="base-commit-selector"
              name="base-commit-id"
              <% if (baseSelected) { %>checked<% } %>
              <% if (baseDisabled) { %>disabled<% } %>
              value="<%- commit.id %>">

       <input type="radio"
              class="tip-commit-selector"
              name="tip-commit-id"
              <% if (tipSelected) { %>checked<% } %>
              <% if (tipDisabled) { %>disabled<% } %>
              value="<%- commit.id %>">

     <% } %>
     <% if (showExpandCollapse) { %>

       <% if (commit && commit.hasSummary()) { %>
        <a href="#"
           class="expand-commit-message"
           data-commit-id="<%- commit.id %>"
           aria-role="button">
         <span class="fa fa-plus" title="<%- expandText %>">

       <% } %>

     <% } %>
     <td<% if (showHistorySymbol) { %> class="value"<% } %>>
      <% if (commit !== null) { %>

<%- commit.get('summary') %>

      <% } %>

     <td<% if (showHistorySymbol) { %> class="value"<% } %>>
      <% if (commit !== null) { %>
       <%- commit.get('authorName') %>
      <% } %>

`);

const headerTemplate = _.template(dedent`

      <% if (showHistorySymbol) { %>

      <% } else if (showInterCommitDiffControls) { %>
       <%- firstText %>
       <%- lastText %>
      <% } %>
      <th<% if (showExpandCollapse) { %> colspan="2"<% } %>>
       <%- summaryText %>

      <%- authorText %>

`);

const tableTemplate = _.template(dedent`
    <form>

      <colgroup>
       <% if (showHistorySymbol) { %>
        <col>
       <% } else if (showInterCommitDiffControls) { %>
         <col>
         <col>
       <% } %>
       <% if (showExpandCollapse) { %>
        <col class="expand-collapse-control">
       <% } %>
       <col>
       <col>
      </colgroup>

    </form>
`);

/**
 * A view for displaying a list of commits and their metadata.
 */
RB.DiffCommitListView = Backbone.View.extend({
    events: {
        'change .base-commit-selector': '_onBaseChanged',
        'change .tip-commit-selector': '_onTipChanged',
        'click .collapse-commit-message': '_collapseCommitMessage',
        'click .expand-commit-message': '_expandCommitMessage',
    },

    /**
     * Initialize the view.
     *
     * Args:
     *     options (object):
     *         Options that control how this view behaves.
     *
     * Option Args:
     *     showInterCommitDiffControls (boolean):
     *         Whether or not to show interdiff controls.
     */
    initialize(options) {
        this.listenTo(this.model.get('commits'), 'reset', this.render);

        this._showInterCommitDiffControls =
            !!options.showInterCommitDiffControls;

        this._$baseSelectors = $();
        this._$tipSelectors = $();
    },

    /**
     * Render the view.
     *
     * Returns:
     *     RB.DiffCommitListView:
     *     This view, for chaining.
     */
    render() {
        const commits = this.model.get('commits');
        const isInterdiff = this.model.isInterdiff();

        const commonContext = {
            showExpandCollapse: commits.some(commit => commit.hasSummary()),
            showHistorySymbol: isInterdiff,
            showInterCommitDiffControls:
                this._showInterCommitDiffControls,
        };

        const $content = $(tableTemplate(commonContext))
        const $table = $content
            .find('table')
            .toggleClass('changed', isInterdiff)
            .append(headerTemplate(_.extend(
                {
                    authorText: gettext('Author'),
                    firstText: gettext('First'),
                    lastText: gettext('Last'),
                    summaryText: gettext('Summary'),
                },
                commonContext
            )));

        const $tbody = $('
');

        commonContext.expandText = gettext('Expand commit message.');

        if (isInterdiff) {
            this.model.get('historyDiff').each(historyDiffEntry => {
                const entryType = historyDiffEntry.get('entryType');

                let key;
                let rowClass;

                switch (entryType) {
                    case RB.CommitHistoryDiffEntry.ADDED:
                        rowClass = 'new-value';
                        key = 'newCommitID';
                        break;

                    case RB.CommitHistoryDiffEntry.REMOVED:
                        rowClass = 'old-value';
                        key = 'oldCommitID';
                        break;

                    case RB.CommitHistoryDiffEntry.UNMODIFIED:
                    case RB.CommitHistoryDiffEntry.MODIFIED:
                        key = 'newCommitID';
                        break;

                    default:
                        console.error('Invalid history entry type: %s',
                                      entryType);
                        break;
                }

                const commit = commits.get(historyDiffEntry.get(key));

                $tbody.append(itemTemplate(_.extend(
                    {
                        commit: commit,
                        historyDiffEntry: historyDiffEntry,
                        rowClass: rowClass,
                    },
                    commonContext
                )));
            });
        } else {
            commonContext.rowClass = '';

            const baseCommitID = this.model.get('baseCommitID');
            const tipCommitID = this.model.get('tipCommitID');
            const lastIndex = commits.size() - 1;

            const baseIndex = (
                baseCommitID === null
                ? 0
                : commits.indexOf(commits.getChild(commits.get(baseCommitID)))
            );

            const tipIndex = (tipCommitID === null
                              ? lastIndex
                              : commits.indexOf(commits.get(tipCommitID)));

            commits.each((commit, i) => {
                $tbody.append(itemTemplate(_.extend(
                    {
                        commit: commit,
                        baseSelected: i === baseIndex,
                        tipSelected: i === tipIndex,
                        baseDisabled: i > tipIndex,
                        tipDisabled: i < baseIndex,
                    },
                    commonContext
                )));
            });
        }

        $table.append($tbody);

        this.$el
            .empty()
            .append($content);

        this._$baseSelectors = this.$('.base-commit-selector');
        this._$tipSelectors = this.$('.tip-commit-selector');

        return this;
    },

    /**
     * Handle the expand button being clicked.
     *
     * Args:
     *     e (jQuery.Event):
     *         The click event.
     */
    _expandCommitMessage(e) {
        e.preventDefault();
        e.stopPropagation();

        this._expandOrCollapse(
            $(e.target).closest('.expand-commit-message'),
            true);
    },

    /**
     * Handle the collapse button being clicked.
     *
     * Args:
     *     e (jQuery.Event):
     *         The click event.
     */
    _collapseCommitMessage(e) {
        e.preventDefault();
        e.stopPropagation();

        this._expandOrCollapse(
            $(e.target).closest('.collapse-commit-message'),
            false);
    },

    /**
     * Expand or collapse the commit message on the same row as the link.
     *
     * Args:
     *     $link (jQuery):
     *         The expand or collapse link that was clicked.
     *
     *     expand (boolean):
     *         Whether we are expanding (``true``) or collapsing (``false``).
     */
    _expandOrCollapse($link, expand) {
        const $icon = $link.find('.fa');
        const commitID = $link.data('commitId');

        const commit = this.model.get('commits').get(commitID);
        const newText = commit.get(expand ? 'commitMessage' : 'summary');

        $link.closest('tr')
            .find('pre')
            .text(newText);

        $link.attr(
            'class',
            expand ? 'collapse-commit-message' : 'expand-commit-message');

        $icon.attr({
            'class': expand ? 'fa fa-minus' : 'fa fa-plus',
            'title': expand ? gettext('Collapse commit message.')
                            : gettext('Expand commit message.'),
        });
    },

    /**
     * Handle the base commit selection changing.
     *
     * The view's model will be updated to reflect this change.
     *
     * Args:
     *     e (jQuery.Event):
     *         The change event.
     */
    _onBaseChanged(e) {
        const $target = $(e.target);
        const commits = this.model.get('commits');
        const commit = commits.get(parseInt($target.val(), 10));
        const index = commits.indexOf(commit);

        this.model.set('baseCommitID',
                       index === 0
                       ? null
                       : commits.getParent(commit).id);

        this._$tipSelectors
            .slice(0, index)
            .prop('disabled', true);

        this._$tipSelectors
            .slice(index)
            .prop('disabled', false);
    },

    /**
     * Handle the tip commit selection changing.
     *
     * The view's model will be updated to reflect this change.
     *
     * Args:
     *     e (jQuery.Event):
     *         The change event.
     */
    _onTipChanged(e) {
        const $target = $(e.target);
        const commits = this.model.get('commits');
        const commit = commits.get(parseInt($target.val(), 10));
        const index = commits.indexOf(commit);

        this.model.set('tipCommitID',
                       index === commits.size() - 1
                       ? null
                       : commit.id);

        this._$baseSelectors
            .slice(0, index + 1)
            .prop('disabled', false);

        this._$baseSelectors
            .slice(index + 1)
            .prop('disabled', true);
    },
});

})();


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

import org.gbif.api.model.common.paging.Pageable;
import org.gbif.api.model.common.paging.PagingResponse;
import org.gbif.api.model.registry.Dataset;
import org.gbif.api.model.registry.Installation;
import org.gbif.api.model.registry.search.KeyTitleResult;
import org.gbif.api.service.registry.InstallationService;
import org.gbif.api.vocabulary.InstallationType;

import java.util.List;
import java.util.UUID;

import javax.annotation.Nullable;
import javax.validation.constraints.NotNull;

/**
 * A simple implementation of a read-only DatasetService of the registry backed by a CSV file.
 */
public class InstallationServiceEmptyImpl extends EmptyNetworkEntityService<Installation> implements InstallationService {

  @Override
  public PagingResponse<Dataset> getHostedDatasets(@NotNull UUID installationKey, @Nullable Pageable page) {
    throw new UnsupportedOperationException();
  }

  @Override
  public PagingResponse<Installation> listDeleted(@Nullable Pageable page) {
    throw new UnsupportedOperationException();
  }

  @Override
  public PagingResponse<Installation> listNonPublishing(@Nullable Pageable page) {
    throw new UnsupportedOperationException();
  }

  @Override
  public List<KeyTitleResult> suggest(@Nullable String s) {
    throw new UnsupportedOperationException();
  }

  @Override
  public PagingResponse<Installation> listByType(
    InstallationType installationType, @Nullable Pageable pageable
  ) {
    {
      throw new UnsupportedOperationException();
    }
  }
}


text:
@implementation UIColor(BSKUtils)
-(BOOL)bsk_isSameColor:(UIColor*)color{
    if (!color||![color isKindOfClass:[UIColor class]]) {
        return NO;
    }
    return CGColorEqualToColor(self.CGColor, color.CGColor);
}

+(UIColor * _Nonnull)bsk_ColorWithHex:(int32_t)hex
{
    return [UIColor bsk_ColorWithHex:hex alpha:1.0];
}
+(UIColor * _Nonnull)bsk_ColorWithRGBAHex:(int32_t)hex{
    return [UIColor colorWithRed:(((hex & 0xFF0000) >> 16))/255.0 green:(((hex &0xFF00) >>8))/255.0 blue:((hex &0xFF))/255.0 alpha:(((hex & 0xFF000000) >> 24))/255.0];
}

+(UIColor * _Nonnull)bsk_ColorWithHex:(int32_t)hex alpha:(CGFloat)a{
    return [UIColor colorWithRed:(((hex & 0xFF0000) >> 16))/255.0 green:(((hex &0xFF00) >>8))/255.0 blue:((hex &0xFF))/255.0 alpha:a];
}
+(UIColor * _Nonnull)bsk_colorWithRed:(unsigned short)r green:(unsigned short)g blue:(unsigned short)b alpha:(unsigned short)a{
    return [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a];
}

@end


text:
package org.apache.ignite.internal.managers.checkpoint;

import java.io.Externalizable;
import java.nio.ByteBuffer;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.plugin.extensions.communication.MessageReader;
import org.apache.ignite.plugin.extensions.communication.MessageWriter;

/**
 * This class defines checkpoint request.
 */
public class GridCheckpointRequest implements Message {
    /** */
    private static final long serialVersionUID = 0L;

    /** */
    private IgniteUuid sesId;

    /** */
    @GridToStringInclude(sensitive = true)
    private String key;

    /** */
    private String cpSpi;

    /**
     * Empty constructor required by {@link Externalizable}.
     */
    public GridCheckpointRequest() {
        // No-op.
    }

    /**
     * @param sesId Task session ID.
     * @param key Checkpoint key.
     * @param cpSpi Checkpoint SPI.
     */
    public GridCheckpointRequest(IgniteUuid sesId, String key, String cpSpi) {
        assert sesId != null;
        assert key != null;

        this.sesId = sesId;
        this.key = key;

        this.cpSpi = cpSpi == null || cpSpi.isEmpty() ? null : cpSpi;
    }

    /**
     * @return Session ID.
     */
    public IgniteUuid getSessionId() {
        return sesId;
    }

    /**
     * @return Checkpoint key.
     */
    public String getKey() {
        return key;
    }

    /**
     * @return Checkpoint SPI.
     */
    public String getCheckpointSpi() {
        return cpSpi;
    }

    /** {@inheritDoc} */
    @Override public void onAckReceived() {
        // No-op.
    }

    /** {@inheritDoc} */
    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
        writer.setBuffer(buf);

        if (!writer.isHeaderWritten()) {
            if (!writer.writeHeader(directType(), fieldsCount()))
                return false;

            writer.onHeaderWritten();
        }

        switch (writer.state()) {
            case 0:
                if (!writer.writeString("cpSpi", cpSpi))
                    return false;

                writer.incrementState();

            case 1:
                if (!writer.writeString("key", key))
                    return false;

                writer.incrementState();

            case 2:
                if (!writer.writeIgniteUuid("sesId", sesId))
                    return false;

                writer.incrementState();

        }

        return true;
    }

    /** {@inheritDoc} */
    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
        reader.setBuffer(buf);

        if (!reader.beforeMessageRead())
            return false;

        switch (reader.state()) {
            case 0:
                cpSpi = reader.readString("cpSpi");

                if (!reader.isLastRead())
                    return false;

                reader.incrementState();

            case 1:
                key = reader.readString("key");

                if (!reader.isLastRead())
                    return false;

                reader.incrementState();

            case 2:
                sesId = reader.readIgniteUuid("sesId");

                if (!reader.isLastRead())
                    return false;

                reader.incrementState();

        }

        return reader.afterMessageRead(GridCheckpointRequest.class);
    }

    /** {@inheritDoc} */
    @Override public short directType() {
        return 7;
    }

    /** {@inheritDoc} */
    @Override public byte fieldsCount() {
        return 3;
    }

    /** {@inheritDoc} */
    @Override public String toString() {
        return S.toString(GridCheckpointRequest.class, this);
    }
}


text:
#include "shared-bindings/digitalio/DigitalInOut.h"
#include "py/runtime.h"
#include "supervisor/shared/translate/translate.h"

#include "nrf_gpio.h"

void common_hal_digitalio_digitalinout_never_reset(
    digitalio_digitalinout_obj_t *self) {
    never_reset_pin_number(self->pin->number);
}

digitalinout_result_t common_hal_digitalio_digitalinout_construct(
    digitalio_digitalinout_obj_t *self, const mcu_pin_obj_t *pin) {
    claim_pin(pin);
    self->pin = pin;

    nrf_gpio_cfg_input(pin->number, NRF_GPIO_PIN_NOPULL);

    return DIGITALINOUT_OK;
}

bool common_hal_digitalio_digitalinout_deinited(digitalio_digitalinout_obj_t *self) {
    return self->pin == NULL;
}

void common_hal_digitalio_digitalinout_deinit(digitalio_digitalinout_obj_t *self) {
    if (common_hal_digitalio_digitalinout_deinited(self)) {
        return;
    }
    nrf_gpio_cfg_default(self->pin->number);

    reset_pin_number(self->pin->number);
    self->pin = NULL;
}

digitalinout_result_t common_hal_digitalio_digitalinout_switch_to_input(
    digitalio_digitalinout_obj_t *self, digitalio_pull_t pull) {
    nrf_gpio_cfg_input(self->pin->number, NRF_GPIO_PIN_NOPULL);
    common_hal_digitalio_digitalinout_set_pull(self, pull);
    return DIGITALINOUT_OK;
}

digitalinout_result_t common_hal_digitalio_digitalinout_switch_to_output(
    digitalio_digitalinout_obj_t *self, bool value,
    digitalio_drive_mode_t drive_mode) {

    common_hal_digitalio_digitalinout_set_drive_mode(self, drive_mode);
    common_hal_digitalio_digitalinout_set_value(self, value);
    return DIGITALINOUT_OK;
}

digitalio_direction_t common_hal_digitalio_digitalinout_get_direction(
    digitalio_digitalinout_obj_t *self) {

    return (nrf_gpio_pin_dir_get(self->pin->number) == NRF_GPIO_PIN_DIR_INPUT)
        ? DIRECTION_INPUT : DIRECTION_OUTPUT;
}

void common_hal_digitalio_digitalinout_set_value(
    digitalio_digitalinout_obj_t *self, bool value) {
    nrf_gpio_pin_write(self->pin->number, value);
}

bool common_hal_digitalio_digitalinout_get_value(
    digitalio_digitalinout_obj_t *self) {
    return (nrf_gpio_pin_dir_get(self->pin->number) == NRF_GPIO_PIN_DIR_INPUT)
        ? nrf_gpio_pin_read(self->pin->number)
        : nrf_gpio_pin_out_read(self->pin->number);
}

digitalinout_result_t common_hal_digitalio_digitalinout_set_drive_mode(
    digitalio_digitalinout_obj_t *self,
    digitalio_drive_mode_t drive_mode) {
    nrf_gpio_cfg(self->pin->number,
        NRF_GPIO_PIN_DIR_OUTPUT,
        NRF_GPIO_PIN_INPUT_DISCONNECT,
        NRF_GPIO_PIN_NOPULL,
        drive_mode == DRIVE_MODE_OPEN_DRAIN ? NRF_GPIO_PIN_H0D1 : NRF_GPIO_PIN_H0H1,
        NRF_GPIO_PIN_NOSENSE);
    return DIGITALINOUT_OK;
}

digitalio_drive_mode_t common_hal_digitalio_digitalinout_get_drive_mode(
    digitalio_digitalinout_obj_t *self) {
    uint32_t pin = self->pin->number;
    // Changes pin to be a relative pin number in port.
    NRF_GPIO_Type *reg = nrf_gpio_pin_port_decode(&pin);

    switch ((reg->PIN_CNF[pin] & GPIO_PIN_CNF_DRIVE_Msk) >> GPIO_PIN_CNF_DRIVE_Pos) {
        case NRF_GPIO_PIN_S0D1:
        case NRF_GPIO_PIN_H0D1:
            return DRIVE_MODE_OPEN_DRAIN;
        default:
            return DRIVE_MODE_PUSH_PULL;
    }
}

digitalinout_result_t common_hal_digitalio_digitalinout_set_pull(
    digitalio_digitalinout_obj_t *self, digitalio_pull_t pull) {
    nrf_gpio_pin_pull_t hal_pull = NRF_GPIO_PIN_NOPULL;

    switch (pull) {
        case PULL_UP:
            hal_pull = NRF_GPIO_PIN_PULLUP;
            break;
        case PULL_DOWN:
            hal_pull = NRF_GPIO_PIN_PULLDOWN;
            break;
        case PULL_NONE:
        default:
            break;
    }

    nrf_gpio_cfg_input(self->pin->number, hal_pull);
    return DIGITALINOUT_OK;
}

digitalio_pull_t common_hal_digitalio_digitalinout_get_pull(
    digitalio_digitalinout_obj_t *self) {
    uint32_t pin = self->pin->number;
    // Changes pin to be a relative pin number in port.
    NRF_GPIO_Type *reg = nrf_gpio_pin_port_decode(&pin);

    if (nrf_gpio_pin_dir_get(self->pin->number) == NRF_GPIO_PIN_DIR_OUTPUT) {
        mp_raise_AttributeError(translate("Cannot get pull while in output mode"));
    }

    switch ((reg->PIN_CNF[pin] & GPIO_PIN_CNF_PULL_Msk) >> GPIO_PIN_CNF_PULL_Pos) {
        case NRF_GPIO_PIN_PULLUP:
            return PULL_UP;
        case NRF_GPIO_PIN_PULLDOWN:
            return PULL_DOWN;
        default:
            return PULL_NONE;
    }
}


text:
package com.intellij.openapi.roots.ui.configuration;

import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.openapi.roots.ModuleRootModel;
import com.intellij.openapi.util.UserDataHolder;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;

public interface ModuleConfigurationState extends UserDataHolder {
  ModulesProvider getModulesProvider();
  FacetsProvider getFacetsProvider();

  /**
   * Returns an instance which can be used to modify the module configuration
   */
  ModifiableRootModel getModifiableRootModel();

  /**
   * Returns the actual state of the module configuration
   */
  ModuleRootModel getCurrentRootModel();

  @NotNull
  Project getProject();

  /**
   * @deprecated use {@link #getModifiableRootModel()}} if you need to modify the model and use {@link #getCurrentRootModel()} if you just
   * need to read the current state
   */
  @ApiStatus.ScheduledForRemoval(inVersion = "2022.2")
  @Deprecated
  default ModifiableRootModel getRootModel() {
    return getModifiableRootModel();
  }
}


text:
title:  The Task
date:  27/06/2020
---

#### inTro

Read This Week's Passage: Matthew 28:16–20

The Task

Each generation has emphasized different aspects of Christianity. Some eras have emphasized doctrine, others piety. Some have seen true Christianity as organized institutions, while others reacted and sought decentralized systems of power. Still others have seen their faith manifested in bloodshed and martyrdom, while others see their faith online and spread by satellite technology. Some generations have wanted to be the hands of Christ, serving the poor and needy, while others were moved to become the feet of Christ, entering territories that the church dared not venture into aforetime.

Whether it's wearing a Christian T-shirt or identifying with religious images and slogans, each generation has seen new creative expressions of Christianity as well as restoring and reviving the virtues of the past. While this ebb and flow of trends and ideas is inevitable, it is also just as important a task for the Christian to find that which is core.

Regardless of trend or time period, whether institutionally loyal or individualistically minded, every Christian needs to follow Jesus personally, to become His disciple, and to discover what discipleship means on a daily basis. This is the most basic interaction between Christ and Christian, among Christians, and within Christianity. Handed down from one person to another starting from two millennia ago, the art of Christian discipleship has kept the movement of Jesus alive and the gospel spreading from person to person, and from age to age. It is in this discipleship context that the teachings of Jesus, the work of the church, lifestyle commitments and habits, and the evangelistic spread of the gospel all take place.

#### inScribe

Write out          Matthew 28:16–20 from the translation of your choice. You may also rewrite the passage in your own words, outline, or mind map the chapter.

``


text:
namespace ServMon {
	partial class SettingsForm {
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing) {
			if (disposing && (components != null)) {
				components.Dispose();
			}
			base.Dispose(disposing);
		}

		#region Windows Form Designer generated code

		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent() {
			this.LGroupBox = new System.Windows.Forms.GroupBox();
			this.LAutoStart = new System.Windows.Forms.CheckBox();
			this.LBtnRestart = new System.Windows.Forms.Button();
			this.LBtnStop = new System.Windows.Forms.Button();
			this.LBtnStart = new System.Windows.Forms.Button();
			this.LServiceLabel = new System.Windows.Forms.Label();
			this.LServiceSel = new System.Windows.Forms.ComboBox();
			this.RGroupBox = new System.Windows.Forms.GroupBox();
			this.RAutoStart = new System.Windows.Forms.CheckBox();
			this.RBtnRestart = new System.Windows.Forms.Button();
			this.RBtnStop = new System.Windows.Forms.Button();
			this.RServiceLabel = new System.Windows.Forms.Label();
			this.RBtnStart = new System.Windows.Forms.Button();
			this.RServiceSel = new System.Windows.Forms.ComboBox();
			this.BtnSave = new System.Windows.Forms.Button();
			this.Exit = new System.Windows.Forms.Button();
			this.LogOutput = new System.Windows.Forms.RichTextBox();
			this.MinimizedCheckbox = new System.Windows.Forms.CheckBox();
			this.TimeoutLabel = new System.Windows.Forms.Label();
			this.TimeoutInput = new System.Windows.Forms.NumericUpDown();
			this.LGroupBox.SuspendLayout();
			this.RGroupBox.SuspendLayout();
			((System.ComponentModel.ISupportInitialize)(this.TimeoutInput)).BeginInit();
			this.SuspendLayout();
			//
			// LGroupBox
			//
			this.LGroupBox.Controls.Add(this.LAutoStart);
			this.LGroupBox.Controls.Add(this.LBtnRestart);
			this.LGroupBox.Controls.Add(this.LBtnStop);
			this.LGroupBox.Controls.Add(this.LBtnStart);
			this.LGroupBox.Controls.Add(this.LServiceLabel);
			this.LGroupBox.Controls.Add(this.LServiceSel);
			this.LGroupBox.Location = new System.Drawing.Point(10, 10);
			this.LGroupBox.Margin = new System.Windows.Forms.Padding(1);
			this.LGroupBox.Name = "LGroupBox";
			this.LGroupBox.Padding = new System.Windows.Forms.Padding(5);
			this.LGroupBox.Size = new System.Drawing.Size(275, 98);
			this.LGroupBox.TabIndex = 0;
			this.LGroupBox.TabStop = false;
			this.LGroupBox.Text = "Left Side";
			//
			// LAutoStart
			//
			this.LAutoStart.BackColor = System.Drawing.Color.Transparent;
			this.LAutoStart.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.LAutoStart.Location = new System.Drawing.Point(209, 20);
			this.LAutoStart.Name = "LAutoStart";
			this.LAutoStart.Size = new System.Drawing.Size(60, 17);
			this.LAutoStart.TabIndex = 7;
			this.LAutoStart.Text = "Autostart";
			this.LAutoStart.UseVisualStyleBackColor = false;
			this.LAutoStart.CheckedChanged += new System.EventHandler(this.LAutoStart_CheckedChanged);
			//
			// LBtnRestart
			//
			this.LBtnRestart.BackColor = System.Drawing.Color.Transparent;
			this.LBtnRestart.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.LBtnRestart.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
			this.LBtnRestart.Location = new System.Drawing.Point(184, 65);
			this.LBtnRestart.Name = "LBtnRestart";
			this.LBtnRestart.Size = new System.Drawing.Size(83, 23);
			this.LBtnRestart.TabIndex = 4;
			this.LBtnRestart.Text = "Restart";
			this.LBtnRestart.UseVisualStyleBackColor = false;
			this.LBtnRestart.Click += new System.EventHandler(this.LBtnRestart_Click);
			//
			// LBtnStop
			//
			this.LBtnStop.BackColor = System.Drawing.Color.Transparent;
			this.LBtnStop.FlatAppearance.BorderColor = System.Drawing.Color.DarkRed;
			this.LBtnStop.FlatAppearance.BorderSize = 2;
			this.LBtnStop.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Brown;
			this.LBtnStop.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Firebrick;
			this.LBtnStop.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
			this.LBtnStop.ForeColor = System.Drawing.Color.DarkRed;
			this.LBtnStop.Location = new System.Drawing.Point(96, 65);
			this.LBtnStop.Name = "LBtnStop";
			this.LBtnStop.Size = new System.Drawing.Size(82, 23);
			this.LBtnStop.TabIndex = 3;
			this.LBtnStop.Text = "Stop";
			this.LBtnStop.UseVisualStyleBackColor = false;
			this.LBtnStop.Click += new System.EventHandler(this.LBtnStop_Click);
			//
			// LBtnStart
			//
			this.LBtnStart.BackColor = System.Drawing.Color.Transparent;
			this.LBtnStart.FlatAppearance.BorderColor = System.Drawing.Color.DarkGreen;
			this.LBtnStart.FlatAppearance.BorderSize = 2;
			this.LBtnStart.FlatAppearance.MouseDownBackColor = System.Drawing.Color.LimeGreen;
			this.LBtnStart.FlatAppearance.MouseOverBackColor = System.Drawing.Color.ForestGreen;
			this.LBtnStart.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
			this.LBtnStart.ForeColor = System.Drawing.Color.Green;
			this.LBtnStart.Location = new System.Drawing.Point(8, 65);
			this.LBtnStart.Name = "LBtnStart";
			this.LBtnStart.Size = new System.Drawing.Size(82, 23);
			this.LBtnStart.TabIndex = 2;
			this.LBtnStart.Text = "Start";
			this.LBtnStart.UseVisualStyleBackColor = false;
			this.LBtnStart.Click += new System.EventHandler(this.LBtnStart_Click);
			//
			// LServiceLabel
			//
			this.LServiceLabel.AutoSize = true;
			this.LServiceLabel.Location = new System.Drawing.Point(9, 22);
			this.LServiceLabel.Name = "LServiceLabel";
			this.LServiceLabel.Size = new System.Drawing.Size(141, 13);
			this.LServiceLabel.TabIndex = 1;
			this.LServiceLabel.Text = "Choose a service to monitor:";
			//
			// LServiceSel
			//
			this.LServiceSel.FormattingEnabled = true;
			this.LServiceSel.Location = new System.Drawing.Point(8, 38);
			this.LServiceSel.Name = "LServiceSel";
			this.LServiceSel.Size = new System.Drawing.Size(259, 21);
			this.LServiceSel.TabIndex = 0;
			this.LServiceSel.SelectedIndexChanged += new System.EventHandler(this.LServiceSel_SelectedIndexChanged);
			//
			// RGroupBox
			//
			this.RGroupBox.Controls.Add(this.RAutoStart);
			this.RGroupBox.Controls.Add(this.RBtnRestart);
			this.RGroupBox.Controls.Add(this.RBtnStop);
			this.RGroupBox.Controls.Add(this.RServiceLabel);
			this.RGroupBox.Controls.Add(this.RBtnStart);
			this.RGroupBox.Controls.Add(this.RServiceSel);
			this.RGroupBox.Location = new System.Drawing.Point(299, 10);
			this.RGroupBox.Margin = new System.Windows.Forms.Padding(1);
			this.RGroupBox.Name = "RGroupBox";
			this.RGroupBox.Padding = new System.Windows.Forms.Padding(5);
			this.RGroupBox.Size = new System.Drawing.Size(275, 98);
			this.RGroupBox.TabIndex = 1;
			this.RGroupBox.TabStop = false;
			this.RGroupBox.Text = "Right Side";
			//
			// RAutoStart
			//
			this.RAutoStart.BackColor = System.Drawing.Color.Transparent;
			this.RAutoStart.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.RAutoStart.Location = new System.Drawing.Point(209, 20);
			this.RAutoStart.Name = "RAutoStart";
			this.RAutoStart.Size = new System.Drawing.Size(60, 17);
			this.RAutoStart.TabIndex = 6;
			this.RAutoStart.Text = "Autostart";
			this.RAutoStart.UseVisualStyleBackColor = false;
			this.RAutoStart.CheckedChanged += new System.EventHandler(this.RAutoStart_CheckedChanged);
			//
			// RBtnRestart
			//
			this.RBtnRestart.BackColor = System.Drawing.Color.Transparent;
			this.RBtnRestart.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.RBtnRestart.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
			this.RBtnRestart.ForeColor = System.Drawing.SystemColors.ControlText;
			this.RBtnRestart.Location = new System.Drawing.Point(184, 65);
			this.RBtnRestart.Name = "RBtnRestart";
			this.RBtnRestart.Size = new System.Drawing.Size(83, 23);
			this.RBtnRestart.TabIndex = 5;
			this.RBtnRestart.Text = "Restart";
			this.RBtnRestart.UseVisualStyleBackColor = false;
			this.RBtnRestart.Click += new System.EventHandler(this.RBtnRestart_Click);
			//
			// RBtnStop
			//
			this.RBtnStop.BackColor = System.Drawing.Color.Transparent;
			this.RBtnStop.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
			this.RBtnStop.ForeColor = System.Drawing.Color.DarkRed;
			this.RBtnStop.Location = new System.Drawing.Point(96, 65);
			this.RBtnStop.Name = "RBtnStop";
			this.RBtnStop.Size = new System.Drawing.Size(82, 23);
			this.RBtnStop.TabIndex = 5;
			this.RBtnStop.Text = "Stop";
			this.RBtnStop.UseVisualStyleBackColor = false;
			this.RBtnStop.Click += new System.EventHandler(this.RBtnStop_Click);
			//
			// RServiceLabel
			//
			this.RServiceLabel.AutoSize = true;
			this.RServiceLabel.Location = new System.Drawing.Point(8, 22);
			this.RServiceLabel.Name = "RServiceLabel";
			this.RServiceLabel.Size = new System.Drawing.Size(141, 13);
			this.RServiceLabel.TabIndex = 3;
			this.RServiceLabel.Text = "Choose a service to monitor:";
			//
			// RBtnStart
			//
			this.RBtnStart.BackColor = System.Drawing.Color.Transparent;
			this.RBtnStart.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
			this.RBtnStart.ForeColor = System.Drawing.Color.Green;
			this.RBtnStart.Location = new System.Drawing.Point(8, 65);
			this.RBtnStart.Name = "RBtnStart";
			this.RBtnStart.Size = new System.Drawing.Size(82, 23);
			this.RBtnStart.TabIndex = 4;
			this.RBtnStart.Text = "Start";
			this.RBtnStart.UseVisualStyleBackColor = false;
			this.RBtnStart.Click += new System.EventHandler(this.RBtnStart_Click);
			//
			// RServiceSel
			//
			this.RServiceSel.FormattingEnabled = true;
			this.RServiceSel.Location = new System.Drawing.Point(8, 38);
			this.RServiceSel.Name = "RServiceSel";
			this.RServiceSel.Size = new System.Drawing.Size(259, 21);
			this.RServiceSel.TabIndex = 2;
			this.RServiceSel.SelectedIndexChanged += new System.EventHandler(this.RServiceSel_SelectedIndexChanged);
			//
			// BtnSave
			//
			this.BtnSave.Location = new System.Drawing.Point(334, 112);
			this.BtnSave.Name = "BtnSave";
			this.BtnSave.Size = new System.Drawing.Size(116, 28);
			this.BtnSave.TabIndex = 2;
			this.BtnSave.Text = "Save Settings";
			this.BtnSave.UseVisualStyleBackColor = true;
			this.BtnSave.Click += new System.EventHandler(this.BtnSave_Click);
			//
			// Exit
			//
			this.Exit.Location = new System.Drawing.Point(456, 112);
			this.Exit.Name = "Exit";
			this.Exit.Size = new System.Drawing.Size(116, 28);
			this.Exit.TabIndex = 3;
			this.Exit.Text = "Exit Application";
			this.Exit.UseVisualStyleBackColor = true;
			this.Exit.Click += new System.EventHandler(this.Exit_Click);
			//
			// LogOutput
			//
			this.LogOutput.BackColor = System.Drawing.Color.Black;
			this.LogOutput.BorderStyle = System.Windows.Forms.BorderStyle.None;
			this.LogOutput.Font = new System.Drawing.Font("Courier New", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
			this.LogOutput.Location = new System.Drawing.Point(12, 147);
			this.LogOutput.Name = "LogOutput";
			this.LogOutput.ReadOnly = true;
			this.LogOutput.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
			this.LogOutput.Size = new System.Drawing.Size(560, 142);
			this.LogOutput.TabIndex = 4;
			this.LogOutput.Text = "";
			//
			// MinimizedCheckbox
			//
			this.MinimizedCheckbox.AutoSize = true;
			this.MinimizedCheckbox.Location = new System.Drawing.Point(232, 119);
			this.MinimizedCheckbox.Name = "MinimizedCheckbox";
			this.MinimizedCheckbox.Size = new System.Drawing.Size(96, 17);
			this.MinimizedCheckbox.TabIndex = 5;
			this.MinimizedCheckbox.Text = "Start minimized";
			this.MinimizedCheckbox.UseVisualStyleBackColor = true;
			this.MinimizedCheckbox.CheckedChanged += new System.EventHandler(this.MinimizedCheckbox_CheckedChanged);
			//
			// TimeoutLabel
			//
			this.TimeoutLabel.AutoSize = true;
			this.TimeoutLabel.Cursor = System.Windows.Forms.Cursors.Help;
			this.TimeoutLabel.Location = new System.Drawing.Point(12, 120);
			this.TimeoutLabel.Name = "TimeoutLabel";
			this.TimeoutLabel.Size = new System.Drawing.Size(115, 13);
			this.TimeoutLabel.TabIndex = 6;
			this.TimeoutLabel.Text = "Service action timeout:";
			//
			// TimeoutInput
			//
			this.TimeoutInput.Location = new System.Drawing.Point(133, 118);
			this.TimeoutInput.Maximum = new decimal(new int[] {
            60,
            0,
            0,
            0});
			this.TimeoutInput.Name = "TimeoutInput";
			this.TimeoutInput.Size = new System.Drawing.Size(45, 20);
			this.TimeoutInput.TabIndex = 7;
			this.TimeoutInput.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
			this.TimeoutInput.ValueChanged += new System.EventHandler(this.TimeoutInput_ValueChanged);
			//
			// SettingsForm
			//
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.BackColor = System.Drawing.SystemColors.Control;
			this.ClientSize = new System.Drawing.Size(584, 301);
			this.Controls.Add(this.TimeoutInput);
			this.Controls.Add(this.TimeoutLabel);
			this.Controls.Add(this.MinimizedCheckbox);
			this.Controls.Add(this.LogOutput);
			this.Controls.Add(this.Exit);
			this.Controls.Add(this.BtnSave);
			this.Controls.Add(this.RGroupBox);
			this.Controls.Add(this.LGroupBox);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
			this.MaximizeBox = false;
			this.Name = "SettingsForm";
			this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "ServMon";
			this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.SettingsForm_FormClosing);
			this.Load += new System.EventHandler(this.SettingsForm_Load);
			this.LGroupBox.ResumeLayout(false);
			this.LGroupBox.PerformLayout();
			this.RGroupBox.ResumeLayout(false);
			this.RGroupBox.PerformLayout();
			((System.ComponentModel.ISupportInitialize)(this.TimeoutInput)).EndInit();
			this.ResumeLayout(false);
			this.PerformLayout();

		}

		#endregion

		private System.Windows.Forms.GroupBox LGroupBox;
		private System.Windows.Forms.Label LServiceLabel;
		private System.Windows.Forms.ComboBox LServiceSel;
		private System.Windows.Forms.GroupBox RGroupBox;
		private System.Windows.Forms.Label RServiceLabel;
		private System.Windows.Forms.ComboBox RServiceSel;
		private System.Windows.Forms.Button LBtnStop;
		private System.Windows.Forms.Button LBtnStart;
		private System.Windows.Forms.Button BtnSave;
		private System.Windows.Forms.Button RBtnStop;
		private System.Windows.Forms.Button RBtnStart;
		private System.Windows.Forms.Button LBtnRestart;
		private System.Windows.Forms.Button RBtnRestart;
		private System.Windows.Forms.Button Exit;
		private System.Windows.Forms.CheckBox LAutoStart;
		private System.Windows.Forms.CheckBox RAutoStart;
		private System.Windows.Forms.RichTextBox LogOutput;
		private System.Windows.Forms.CheckBox MinimizedCheckbox;
		private System.Windows.Forms.Label TimeoutLabel;
		private System.Windows.Forms.NumericUpDown TimeoutInput;
	}
}


text:
package com.emcaster.topics;

import java.util.Iterator;

public interface TopicSubscriber {

	void connect();
	Iterator<Message> readNext();

}


text:
Desarrollamos un Emulador de Sistemas de Post, que se puede correr online en
[http://otroyo.pythonanywhere.com/](http://otroyo.pythonanywhere.com/)

**Ello, para apoyar un cursillo orientado a alumnos de colegios, interesados en
comprender: lo que es la Computación.**

Si a alguien le interesa, por favor comuníquese conmigo:
Andreas Polymeris, andreaspolymeris@gmail.com

**Como crear un virtual environment y server local:**

Instalar virtualenv:
```
sudo apt-get install virtualenv
o
sudo apt-get install python-virtualenv
o
sudo apt-get install python-pip
sudo pip install virtualenv
```

crear directorios web (se deberán crear estos directorios, con por ejemplo: mkdir):
```
/var/www/uploads/
/var/www/temporal/
```
dar permisos necesarios a los directorios:
```
sudo chmod 777 www/
sudo chmod 777 uploads/
sudo chmod 777 temporal/

```
crear carpetda de proyecto Flask:

```
mkdir EmulaSIP-flask
cd EmulaSIP-flask
virtualenv flask
```
copiar este graaaan comando en la terminal!!(dentro de su carpeta de proyecto Flask):
```
flask/bin/pip install flask && flask/bin/pip install flask-login && flask/bin/pip install flask-openid && flask/bin/pip install flask-mail && flask/bin/pip install flask-sqlalchemy && flask/bin/pip install sqlalchemy-migrate && flask/bin/pip install flask-whooshalchemy && flask/bin/pip install flask-whooshalchemy && flask/bin/pip install flask-wtf && flask/bin/pip install flask-babel && flask/bin/pip install guess_language && flask/bin/pip install flipflop && flask/bin/pip install coverage
```
Clonar repositorio(Dentro de su carpeta de proyecto Flask):
```
//si no tiene git:

sudo apt-get install git

//después:

git clone https://github.com/otroyo/EmulaSIP
```
Correr en localhost:

_Dentro de su carpeta de proyecto Flask:_

```
flask/bin/python2.7 EmulaSIP/flask_app.py
```

### Attribution

[post logo](https://github.com/Otroyo/EmulaSIP/blob/master/static/post-line.png) from
[OpenLogicProject](https://github.com/OpenLogicProject/portraits) is licensed
under [CC-BY-4.0](https://creativecommons.org/licenses/by-nc/4.0/) / Desaturated
from original


text:
package zzb.srvbox

import akka.testkit.{ ImplicitSender, TestKit }
import akka.actor.{ Props, ActorSystem }
import org.scalatest.WordSpecLike
import org.scalatest.MustMatchers
import zzb.StopSystemAfterAll
import zzb.srvbox.SrvManageProtocol._
import zzb.srvbox.SrvManageProtocol.Services
import zzb.srvbox.SrvManageProtocol.Register
import scala.concurrent.Future
import scala.util.Success

class BoxActorTest extends TestKit(ActorSystem("testSystem"))
    with WordSpecLike
    with MustMatchers
    with ImplicitSender
    with StopSystemAfterAll {

  "A Box Actor" must {

    val boxActor = system.actorOf(Props[BoxActor], name = "boxActor")

    "create service actor" in {
      boxActor ! Register("S1", "zzb.srvbox.S1Service", sharedActorSystem = true)
      boxActor ! RequestList
      expectMsgPF() {
        case Services(services) ⇒
          ()
          services.contains(ServiceStatus("S1", running = false))
      }
    }
    "can start service " in {
      boxActor ! RequestStart("S1")
      expectMsgPF() {
        case ServiceStatus(name, running) ⇒
          name must be("S1")
          running mustBe true
      }
    }
    "can stop service " in {
      boxActor ! RequestStop("S1")
      expectMsgPF() {
        case ServiceStatus(name, running) ⇒
          name must be("S1")
          running mustBe false
      }
    }
    "ignore no exist service" in {
      boxActor ! RequestStop("Hello")
      expectMsg(ServiceNotExist)
    }
    "reg filter " in{
      boxActor ! FilterReg("testFilter",List("srv1","srv2"))
      expectMsgPF() {
        case FilterReg(name,serverNames) ⇒
          name must be("testFilter")
          serverNames must contain("srv1")
      }
    }
    "list filter " in{
      boxActor ! FilterList
      expectMsgPF() {
        case list:Map[_,_] ⇒
          list.keys must contain("srv1")
      }
    }
    "unreg filter " in{
      boxActor ! FilterUnReg("testFilter")
      expectMsgPF() {
        case FilterUnReg(name) ⇒
          name must be("testFilter")
          boxActor ! FilterList
          expectMsgPF() {
            case list:Map[_,_] ⇒
              list.keys.size must be(0)
          }
      }
    }
  }

}


text:
namespace content {
class NavigationHandle;
}  // namespace content

namespace apps {

// Allows canceling a navigation to instead be routed to an installed app.
class AppsNavigationThrottle : public content::NavigationThrottle {
 public:
  using ThrottleCheckResult = content::NavigationThrottle::ThrottleCheckResult;

  // Possibly creates a navigation throttle that checks if any installed apps
  // can handle the URL being navigated to.
  static std::unique_ptr<content::NavigationThrottle> MaybeCreate(
      content::NavigationHandle* handle);

  explicit AppsNavigationThrottle(content::NavigationHandle* navigation_handle);
  AppsNavigationThrottle(const AppsNavigationThrottle&) = delete;
  AppsNavigationThrottle& operator=(const AppsNavigationThrottle&) = delete;
  ~AppsNavigationThrottle() override;

  // content::NavigationHandle overrides
  const char* GetNameForLogging() override;
  ThrottleCheckResult WillStartRequest() override;
  ThrottleCheckResult WillRedirectRequest() override;

 protected:
  virtual bool ShouldCancelNavigation(content::NavigationHandle* handle);

  virtual bool ShouldShowDisablePage(content::NavigationHandle* handle);

  virtual ThrottleCheckResult MaybeShowCustomResult();

  bool navigate_from_link() const;

  GURL starting_url_;

 private:
  ThrottleCheckResult HandleRequest();

  // Keeps track of whether the navigation is coming from a link or not. If the
  // navigation is not from a link, we will not show the pop up for the intent
  // picker bubble.
  bool navigate_from_link_ = false;
};

}  // namespace apps

#endif  // CHROME_BROWSER_APPS_INTENT_HELPER_APPS_NAVIGATION_THROTTLE_H_


text:
.class Lcom/android/server/PowerManagerService$8;
.super Landroid/content/BroadcastReceiver;
.source "PowerManagerService.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/android/server/PowerManagerService;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation

# instance fields
.field final synthetic this$0:Lcom/android/server/PowerManagerService;

# direct methods
.method constructor <init>(Lcom/android/server/PowerManagerService;)V
    .locals 0
    .parameter

    .prologue
    .line 2129
    iput-object p1, p0, Lcom/android/server/PowerManagerService$8;->this$0:Lcom/android/server/PowerManagerService;

    invoke-direct {p0}, Landroid/content/BroadcastReceiver;-><init>()V

    return-void
.end method

# virtual methods
.method public onReceive(Landroid/content/Context;Landroid/content/Intent;)V
    .locals 8
    .parameter "context"
    .parameter "intent"

    .prologue
    .line 2131
    iget-object v0, p0, Lcom/android/server/PowerManagerService$8;->this$0:Lcom/android/server/PowerManagerService;

    #getter for: Lcom/android/server/PowerManagerService;->mLocks:Lcom/android/server/PowerManagerService$LockList;
    invoke-static {v0}, Lcom/android/server/PowerManagerService;->access$800(Lcom/android/server/PowerManagerService;)Lcom/android/server/PowerManagerService$LockList;

    move-result-object v1

    monitor-enter v1

    .line 2132
    const/16 v0, 0xaa6

    const/4 v2, 0x3

    :try_start_0
    new-array v2, v2, [Ljava/lang/Object;

    const/4 v3, 0x0

    const/4 v4, 0x0

    invoke-static {v4}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v4

    aput-object v4, v2, v3

    const/4 v3, 0x1

    invoke-static {}, Landroid/os/SystemClock;->uptimeMillis()J

    move-result-wide v4

    iget-object v6, p0, Lcom/android/server/PowerManagerService$8;->this$0:Lcom/android/server/PowerManagerService;

    iget-wide v6, v6, Lcom/android/server/PowerManagerService;->mScreenOffStart:J

    sub-long/2addr v4, v6

    invoke-static {v4, v5}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v4

    aput-object v4, v2, v3

    const/4 v3, 0x2

    iget-object v4, p0, Lcom/android/server/PowerManagerService$8;->this$0:Lcom/android/server/PowerManagerService;

    #getter for: Lcom/android/server/PowerManagerService;->mBroadcastWakeLock:Lcom/android/server/PowerManagerService$UnsynchronizedWakeLock;
    invoke-static {v4}, Lcom/android/server/PowerManagerService;->access$4400(Lcom/android/server/PowerManagerService;)Lcom/android/server/PowerManagerService$UnsynchronizedWakeLock;

    move-result-object v4

    iget v4, v4, Lcom/android/server/PowerManagerService$UnsynchronizedWakeLock;->mCount:I

    invoke-static {v4}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v4

    aput-object v4, v2, v3

    invoke-static {v0, v2}, Landroid/util/EventLog;->writeEvent(I[Ljava/lang/Object;)I

    .line 2134
    iget-object v0, p0, Lcom/android/server/PowerManagerService$8;->this$0:Lcom/android/server/PowerManagerService;

    #getter for: Lcom/android/server/PowerManagerService;->mBroadcastWakeLock:Lcom/android/server/PowerManagerService$UnsynchronizedWakeLock;
    invoke-static {v0}, Lcom/android/server/PowerManagerService;->access$4400(Lcom/android/server/PowerManagerService;)Lcom/android/server/PowerManagerService$UnsynchronizedWakeLock;

    move-result-object v0

    invoke-virtual {v0}, Lcom/android/server/PowerManagerService$UnsynchronizedWakeLock;->release()V

    .line 2135
    monitor-exit v1

    .line 2136
    return-void

    .line 2135
    :catchall_0
    move-exception v0

    monitor-exit v1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0
.end method


text:
package io.jgoerner.s3.adapter.out.s3;

import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.services.s3.model.*;
import com.amazonaws.services.s3.model.lifecycle.LifecycleFilter;
import com.amazonaws.waiters.WaiterParameters;
import io.jgoerner.s3.application.port.out.bucket.*;
import io.jgoerner.s3.application.port.out.object.*;
import io.jgoerner.s3.domain.Object;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Repository;

import java.io.InputStream;
import java.net.URL;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

@Repository
@Log4j2
public class S3Repository
    implements CreateBucket,
        DeleteBucket,
        ListObjects,
        SaveObject,
        MakeObjectPublic,
        MakeObjectPrivate,
        DeleteObject,
        CreatePresignedUrl,
        SetVisibilityInObjectLifecycle,
        RemoveVisibilityInObjectLifecycle {

  private final AmazonS3Client s3Client;

  public S3Repository(AmazonS3Client s3Client) {
    this.s3Client = s3Client;
  }

  @Override
  public void create(String bucket) {
    // send bucket creation request
    s3Client.createBucket(bucket);
    log.info("Request to create " + bucket + " sent");

    // assure that bucket is available
    s3Client.waiters().bucketExists().run(new WaiterParameters<>(new HeadBucketRequest(bucket)));
    log.info("Bucket " + bucket + " is ready");
  }

  @Override
  public void delete(String bucket) {
    // send deletion request
    s3Client.deleteBucket(bucket);
    log.info("Request to delete " + bucket + " sent");

    // assure bucket is deleted
    s3Client.waiters().bucketNotExists().run(new WaiterParameters(new HeadBucketRequest(bucket)));
    log.info("Bucket " + bucket + " is deleted");
  }

  @Override
  public List<Object> listObjectsInBucket(String bucket) {
    var items =
        s3Client.listObjectsV2(bucket).getObjectSummaries().stream()
            .parallel()
            .map(S3ObjectSummary::getKey)
            .map(key -> mapS3ToObject(bucket, key))
            .collect(Collectors.toList());

    log.info("Found " + items.size() + " objects in the bucket " + bucket);
    return items;
  }

  @Override
  public Object safe(String bucket, String key, String name, InputStream payload) {
    var metadata = new ObjectMetadata();
    metadata.addUserMetadata("name", name);
    s3Client.putObject(bucket, key, payload, metadata);
    log.info("Sent the request");
    return Object.builder().name(name).key(key).url(s3Client.getUrl(bucket, key)).build();
  }

  @Override
  public void makePublic(String bucket, String key) {
    s3Client.setObjectAcl(bucket, key, CannedAccessControlList.PublicRead);
    log.info("Sent request to make object in bucket " + bucket + " with key " + key + " public");
  }

  @Override
  public void makePrivate(String bucket, String key) {
    s3Client.setObjectAcl(bucket, key, CannedAccessControlList.BucketOwnerFullControl);
    log.info("Sent request to make object in bucket " + bucket + " with key " + key + " private");
  }

  @Override
  public void delete(String bucket, String key) {
    s3Client.deleteObject(bucket, key);
    log.info("Sent request to delete file with key " + key + " in bucket " + bucket);
  }

  @Override
  public URL createURL(String bucket, String key, Long duration) {
    var date = new Date(new Date().getTime() + duration * 1000); // 1 s * 1000 ms/s
    var url = s3Client.generatePresignedUrl(bucket, key, date);
    log.info("Generated the signature " + url);
    return url;
  }

  @Override
  public void setVisibility(String bucket, Integer ttlInDays) {
    s3Client.setBucketLifecycleConfiguration(
        bucket,
        new BucketLifecycleConfiguration()
            .withRules(
                new BucketLifecycleConfiguration.Rule()
                    .withId("custom-expiration-id")
                    .withFilter(new LifecycleFilter())
                    .withStatus(BucketLifecycleConfiguration.ENABLED)
                    .withExpirationInDays(ttlInDays)));
  }

  @Override
  public void removeVisibility(String bucket) {
    s3Client.deleteBucketLifecycleConfiguration(bucket);
  }

  private Object mapS3ToObject(String bucket, String key) {

    return Object.builder()
        .name(s3Client.getObjectMetadata(bucket, key).getUserMetaDataOf("name"))
        .key(key)
        .url(s3Client.getUrl(bucket, key))
        .isPublic(
            s3Client.getObjectAcl(bucket, key).getGrantsAsList().stream()
                .anyMatch(grant -> grant.equals(S3Repository.publicObjectReadGrant())))
        .build();
  }

  private static Grant publicObjectReadGrant() {
    return new Grant(
        GroupGrantee.parseGroupGrantee(GroupGrantee.AllUsers.getIdentifier()), Permission.Read);
  }
}


text:
angular.module('ccdb.authentication.user.authentication', ['ccdb.authentication.authentication'])
    .factory('UserAuthentication', function ($window, $location, $http, Authentication) {
        return {
            login: function (username, password) {
                return $http.post('/api/login', {
                    username: username,
                    password: password
                });
            },
            password: function (token, password) {
                return $http.post('/api/password', {
                    token: token,
                    password: password
                });
            },
            reset: function (username) {
                return $http.post('/api/reset', {
                    username: username
                });
            },
            logout: function () {
                if (Authentication.isLoggedIn) {
                    Authentication.isLoggedIn = false;
                    delete Authentication.user;
                    delete Authentication.userRole;

                    delete $window.sessionStorage.token;
                    delete $window.sessionStorage.user;
                    delete $window.sessionStorage.userRole;

                    $location.path('/login');
                }
            }
        };
    }
)
;