text:
#import "CDVSplashScreen.h"
#import <Cordova/CDVViewController.h>
#import <Cordova/CDVScreenOrientationDelegate.h>
#import "CDVViewController+SplashScreen.h"

#define kSplashScreenDurationDefault 0.25f

@implementation CDVSplashScreen

- (void)pluginInitialize
{
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pageDidLoad) name:CDVPageDidLoadNotification object:self.webView];

    [self setVisible:YES];
}

- (void)show:(CDVInvokedUrlCommand*)command
{
    [self setVisible:YES];
}

- (void)hide:(CDVInvokedUrlCommand*)command
{
    [self setVisible:NO];
}

- (void)pageDidLoad
{
    id autoHideSplashScreenValue = [self.commandDelegate.settings objectForKey:[@"AutoHideSplashScreen" lowercaseString]];

    // if value is missing, default to yes
    if ((autoHideSplashScreenValue == nil) || [autoHideSplashScreenValue boolValue]) {
        [self performSelector:@selector(ChangeImage:) withObject:[NSNumber numberWithBool:false] afterDelay:_temdata];
    }
}

- (void)observeValueForKeyPath:(NSString*)keyPath ofObject:(id)object change:(NSDictionary*)change context:(void*)context
{
    [self updateImage];
}

- (void)createViews
{
    /*
     * The Activity View is the top spinning throbber in the status/battery bar. We init it with the default Grey Style.
     *
     *     whiteLarge = UIActivityIndicatorViewStyleWhiteLarge
     *     white      = UIActivityIndicatorViewStyleWhite
     *     gray       = UIActivityIndicatorViewStyleGray
     *
     */

    // Determine whether rotation should be enabled for this device
    // Per iOS HIG, landscape is only supported on iPad and iPhone 6+
    CDV_iOSDevice device = [self getCurrentDevice];
    BOOL autorotateValue = (device.iPad || device.iPhone6Plus) ?
    [(CDVViewController *)self.viewController shouldAutorotateDefaultValue] :
    NO;

    [(CDVViewController *)self.viewController setEnabledAutorotation:autorotateValue];

    NSString* topActivityIndicator = [self.commandDelegate.settings objectForKey:[@"TopActivityIndicator" lowercaseString]];
    UIActivityIndicatorViewStyle topActivityIndicatorStyle = UIActivityIndicatorViewStyleGray;

    if ([topActivityIndicator isEqualToString:@"whiteLarge"]) {
        topActivityIndicatorStyle = UIActivityIndicatorViewStyleWhiteLarge;
    } else if ([topActivityIndicator isEqualToString:@"white"]) {
        topActivityIndicatorStyle = UIActivityIndicatorViewStyleWhite;
    } else if ([topActivityIndicator isEqualToString:@"gray"]) {
        topActivityIndicatorStyle = UIActivityIndicatorViewStyleGray;
    }

    UIView* parentView = self.viewController.view;
    parentView.userInteractionEnabled = NO;  // disable user interaction while splashscreen is shown
    _activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:topActivityIndicatorStyle];
    _activityView.center = CGPointMake(parentView.bounds.size.width / 2, parentView.bounds.size.height / 1.2);
    _activityView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin
    | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin;
    [_activityView startAnimating];

    // Set the frame & image later.
    _imageView = [[UIImageView alloc] init];
    _bgImgView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
    _labelView = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 30)];

    [parentView addSubview:_bgImgView];
    [parentView addSubview:_imageView];
    [parentView addSubview:_labelView];
    // Frame is required when launching in portrait mode.
    // Bounds for landscape since it captures the rotation.
    [parentView addObserver:self forKeyPath:@"frame" options:0 context:nil];
    [parentView addObserver:self forKeyPath:@"bounds" options:0 context:nil];

    [self updateImage];
}

- (void)destroyViews
{
    [(CDVViewController *)self.viewController setEnabledAutorotation:[(CDVViewController *)self.viewController shouldAutorotateDefaultValue]];

    [_imageView removeFromSuperview];
    [_bgImgView removeFromSuperview];
    [_activityView removeFromSuperview];
    [_labelView removeFromSuperview];

    _imageView = nil;
    _activityView = nil;
    _curImageName = nil;

    self.viewController.view.userInteractionEnabled = YES;  // re-enable user interaction upon completion
    //[self.viewController.view removeObserver:self forKeyPath:@"frame"];
    //[self.viewController.view removeObserver:self forKeyPath:@"bounds"];
}

- (CDV_iOSDevice) getCurrentDevice
{
    CDV_iOSDevice device;

    UIScreen* mainScreen = [UIScreen mainScreen];
    CGFloat mainScreenHeight = mainScreen.bounds.size.height;
    CGFloat mainScreenWidth = mainScreen.bounds.size.width;

    int limit = MAX(mainScreenHeight,mainScreenWidth);

    device.iPad = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad);
    device.iPhone = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone);
    device.retina = ([mainScreen scale] == 2.0);
    device.iPhone5 = (device.iPhone && limit == 568.0);
    // note these below is not a true device detect, for example if you are on an
    // iPhone 6/6+ but the app is scaled it will prob set iPhone5 as true, but
    // this is appropriate for detecting the runtime screen environment
    device.iPhone6 = (device.iPhone && limit == 667.0);
    device.iPhone6Plus = (device.iPhone && limit == 736.0);

    return device;
}

- (NSString*)getImageName:(UIInterfaceOrientation)currentOrientation delegate:(id<CDVScreenOrientationDelegate>)orientationDelegate device:(CDV_iOSDevice)device
{
    // Use UILaunchImageFile if specified in plist.  Otherwise, use Default.
    NSString* imageName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UILaunchImageFile"];

    NSUInteger supportedOrientations = [orientationDelegate supportedInterfaceOrientations];

    // Checks to see if the developer has locked the orientation to use only one of Portrait or Landscape
    BOOL supportsLandscape = (supportedOrientations & UIInterfaceOrientationMaskLandscape);
    BOOL supportsPortrait = (supportedOrientations & UIInterfaceOrientationMaskPortrait || supportedOrientations & UIInterfaceOrientationMaskPortraitUpsideDown);
    // this means there are no mixed orientations in there
    BOOL isOrientationLocked = !(supportsPortrait && supportsLandscape);

    if (imageName) {
        imageName = [imageName stringByDeletingPathExtension];
    } else {
        imageName = @"Default";
    }

    if (device.iPhone5) { // does not support landscape
        imageName = [imageName stringByAppendingString:@"-568h"];
    } else if (device.iPhone6) { // does not support landscape
        imageName = [imageName stringByAppendingString:@"-667h"];
    } else if (device.iPhone6Plus) { // supports landscape
        if (isOrientationLocked) {
            imageName = [imageName stringByAppendingString:(supportsLandscape ? @"-Landscape" : @"")];
        } else {
            switch (currentOrientation) {
                case UIInterfaceOrientationLandscapeLeft:
                case UIInterfaceOrientationLandscapeRight:
                    imageName = [imageName stringByAppendingString:@"-Landscape"];
                    break;
                default:
                    break;
            }
        }
        imageName = [imageName stringByAppendingString:@"-736h"];

    } else if (device.iPad) { // supports landscape
        if (isOrientationLocked) {
            imageName = [imageName stringByAppendingString:(supportsLandscape ? @"-Landscape" : @"-Portrait")];
        } else {
            switch (currentOrientation) {
                case UIInterfaceOrientationLandscapeLeft:
                case UIInterfaceOrientationLandscapeRight:
                    imageName = [imageName stringByAppendingString:@"-Landscape"];
                    break;

                case UIInterfaceOrientationPortrait:
                case UIInterfaceOrientationPortraitUpsideDown:
                default:
                    imageName = [imageName stringByAppendingString:@"-Portrait"];
                    break;
            }
        }
    }

    return imageName;
}

// Sets the view's frame and image.
- (void)updateImage
{

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    documentsDirectory = [documentsDirectory stringByAppendingPathComponent:@""];
    NSLog(@"do ==%@",documentsDirectory);

    NSString *URLImg = [documentsDirectory stringByAppendingPathComponent:@"organization_splash.png"];

    NSLog(@"==%@",URLImg);

    // Fallback to Default Splashscreen
    if (![URLImg isEqualToString:_curImageName]) {
        UIImage* img = [UIImage imageNamed:URLImg];
        _imageView.image = img;
        _curImageName = URLImg;
        fallbackToDefaultSplash = TRUE;
    } else {
        fallbackToDefaultSplash = FALSE;
    }

    id showSplashScreenSpinnerValue = [self.commandDelegate.settings objectForKey:[@"ShowSplashScreenSpinner" lowercaseString]];
    // backwards compatibility - if key is missing, default to true
    if ((showSplashScreenSpinnerValue == nil) || [showSplashScreenSpinnerValue boolValue]) {
        [self.viewController.view addSubview:_activityView];
    }

    // Check that splash screen's image exists before updating bounds
    if (_imageView.image) {
        [self updateBounds];
    } else {

        NSString* imageName = [self getImageName:[[UIApplication sharedApplication] statusBarOrientation] delegate:(id<CDVScreenOrientationDelegate>)self.viewController device:[self getCurrentDevice]];
        if (![imageName isEqualToString:_curImageName]) {
            UIImage* img = [UIImage imageNamed:imageName];
            _imageView.image = img;
            _curImageName = imageName;
        }

        if (_imageView.image) {
            [self updateBounds];
        }
        else
        {
            NSLog(@"WARNING: The splashscreen image named %@ was not found", imageName);
        }
    }

}

- (void)updateBounds
{
    UIImage* img = _imageView.image;
    CGRect imgBounds = (img) ? CGRectMake(0, 0, img.size.width, img.size.height) : CGRectZero;

    CGSize screenSize = [self.viewController.view convertRect:[UIScreen mainScreen].bounds fromView:nil].size;
    UIInterfaceOrientation orientation = self.viewController.interfaceOrientation;
    CGAffineTransform imgTransform = CGAffineTransformIdentity;

    /* If and only if an iPhone application is landscape-only as per
     * UISupportedInterfaceOrientations, the view controller's orientation is
     * landscape. In this case the image must be rotated in order to appear
     * correctly.
     */
    BOOL isIPad = [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad;
    if (UIInterfaceOrientationIsLandscape(orientation) && !isIPad) {
        imgTransform = CGAffineTransformMakeRotation(M_PI / 2);
        imgBounds.size = CGSizeMake(imgBounds.size.height, imgBounds.size.width);
    }

    // There's a special case when the image is the size of the screen.
    if (CGSizeEqualToSize(screenSize, imgBounds.size)) {
        CGRect statusFrame = [self.viewController.view convertRect:[UIApplication sharedApplication].statusBarFrame fromView:nil];
        if (!(IsAtLeastiOSVersion(@"7.0"))) {
            imgBounds.origin.y -= statusFrame.size.height;
        }
    } else if (imgBounds.size.width > 0) {
        CGRect viewBounds = self.viewController.view.bounds;
        CGFloat imgAspect = imgBounds.size.width / imgBounds.size.height;
        CGFloat viewAspect = viewBounds.size.width / viewBounds.size.height;
        // This matches the behaviour of the native splash screen.
        CGFloat ratio;
        if (viewAspect > imgAspect) {
            ratio = viewBounds.size.width / imgBounds.size.width;
        } else {
            ratio = viewBounds.size.height / imgBounds.size.height;
        }
        imgBounds.size.height *= ratio;
        imgBounds.size.width *= ratio;
    }

    _labelView.text = @"Updates powered by";
    _labelView.textAlignment = NSTextAlignmentCenter;
    _labelView.textColor = [UIColor colorWithRed:0.42 green:0.42 blue:0.42 alpha:1.0];
    _labelView.font = [UIFont systemFontOfSize:17];

    if(fallbackToDefaultSplash == FALSE) {
        if(screenSize.width > screenSize.height) {
            _labelView.frame = CGRectMake(0, screenSize.height/2 - 40 - (screenSize.width/(6*(img.size.width/img.size.height))), screenSize.width, 30);
            _imageView.frame=CGRectMake(screenSize.width/6, 0, screenSize.width/3, screenSize.height);
        } else {
            if(screenSize.width >= 1024) {
                _labelView.frame = CGRectMake(0, screenSize.height/2 - 40 - (screenSize.width/(4*(img.size.width/img.size.height))), screenSize.width, 30);
                _imageView.frame=CGRectMake(screenSize.width/4, 0, screenSize.width/2, screenSize.height);

            } else {
                if(screenSize.width >= 768) {
                    // iPad
                    _imageView.frame=CGRectMake(screenSize.width/5, 0, screenSize.width/2.5, screenSize.height);
                    _labelView.frame = CGRectMake(0, screenSize.height/2 - 40 - (screenSize.width/(5*(img.size.width/img.size.height))), screenSize.width, 30);
                } else {
                    // iPhone
                    _imageView.frame=CGRectMake(screenSize.width/2.5, 0, screenSize.width/1.25, screenSize.height);
                    _labelView.frame = CGRectMake(0, screenSize.height/2 - 40 - (screenSize.width/(2.5*(img.size.width/img.size.height))), screenSize.width, 30);

                }
            }
        }
    } else {
        _labelView.frame = CGRectMake(0, 0, 0, 0);
        _imageView.frame=CGRectMake(0, 0, screenSize.width, screenSize.height);
    }
    _imageView.center=self.viewController.view.center;
    _imageView.transform = imgTransform;
    [_imageView setContentMode:UIViewContentModeScaleAspectFit
     ];
    NSLog(@"%@",NSStringFromCGRect(self.viewController.view.frame));
    [_bgImgView setBackgroundColor:[UIColor colorWithRed:223.0/255.0 green:231.0/255.0 blue:235.0/255.0 alpha:1.0]];
}

- (void)setVisible:(BOOL)visible
{
    if (visible == _visible) {
        return;
    }
    _visible = visible;

    id fadeSplashScreenValue = [self.commandDelegate.settings objectForKey:[@"FadeSplashScreen" lowercaseString]];
    id fadeSplashScreenDuration = [self.commandDelegate.settings objectForKey:[@"FadeSplashScreenDuration" lowercaseString]];

    float fadeDuration = fadeSplashScreenDuration == nil ? kSplashScreenDurationDefault : [fadeSplashScreenDuration floatValue];
    _temdata=fadeDuration;
    if ((fadeSplashScreenValue == nil) || ![fadeSplashScreenValue boolValue]) {
        fadeDuration = 0;
    }

    // Never animate the showing of the splash screen.
    if (visible) {
        if (_imageView == nil) {
            [self createViews];
        }
    } else if (fadeDuration == 0) {
        [self performSelector:@selector(ChangeImage:) withObject:[NSNumber numberWithBool:false] afterDelay:_temdata];
    } else {
        __weak __typeof(self) weakSelf = self;

        [UIView transitionWithView:self.viewController.view
                          duration:fadeDuration
                           options:UIViewAnimationOptionTransitionNone
                        animations:^(void) {
                            __typeof(self) strongSelf = weakSelf;
                            if (strongSelf != nil) {
                                dispatch_async(dispatch_get_main_queue(), ^{
                                    [strongSelf->_activityView setAlpha:0];
                                    [strongSelf->_imageView setAlpha:0];
                                });
                            }
                        }
                        completion:^(BOOL finished) {
                            if (finished) {
                                dispatch_async(dispatch_get_main_queue(), ^{
                                    [weakSelf destroyViews];
                                });
                            }
                        }
         ];
    }
}
-(void)ChangeImage:(id)sender{
    [self destroyViews];
}

@end


text:
package org.spongepowered.common.block;

import com.google.common.base.MoreObjects;
import net.minecraft.block.Block;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import org.spongepowered.api.block.BlockSnapshot;
import org.spongepowered.api.block.BlockState;
import org.spongepowered.api.block.tileentity.TileEntityArchetype;
import org.spongepowered.api.block.tileentity.TileEntityType;
import org.spongepowered.api.data.DataContainer;
import org.spongepowered.api.event.cause.Cause;
import org.spongepowered.api.world.BlockChangeFlag;
import org.spongepowered.api.world.Location;
import org.spongepowered.api.world.World;
import org.spongepowered.common.data.AbstractArchetype;
import org.spongepowered.common.data.nbt.NbtDataType;
import org.spongepowered.common.data.nbt.NbtDataTypes;
import org.spongepowered.common.data.nbt.validation.ValidationType;
import org.spongepowered.common.data.nbt.validation.Validations;
import org.spongepowered.common.data.persistence.NbtTranslator;
import org.spongepowered.common.data.util.DataQueries;
import org.spongepowered.common.data.util.DataVersions;
import org.spongepowered.common.util.VecHelper;

import java.util.Optional;

public class SpongeTileEntityArchetype extends AbstractArchetype<TileEntityType, BlockSnapshot, org.spongepowered.api.block.tileentity.TileEntity> implements TileEntityArchetype {

    final BlockState blockState;

    SpongeTileEntityArchetype(SpongeTileEntityArchetypeBuilder builder) {
        super(builder.tileEntityType, NbtTranslator.getInstance().translateData(builder.tileData));
        this.blockState = builder.blockState;
    }

    @Override
    public BlockState getState() {
        return this.blockState;
    }

    @Override
    public TileEntityType getTileEntityType() {
        return this.type;
    }

    @Override
    public DataContainer getTileData() {
        return NbtTranslator.getInstance().translateFrom(this.data);
    }

    @Override
    public Optional<org.spongepowered.api.block.tileentity.TileEntity> apply(Location<World> location, Cause cause) {
        final BlockState currentState = location.getBlock();
        final Block currentBlock = BlockUtil.toBlock(currentState);
        final Block newBlock = BlockUtil.toBlock(this.blockState);
        final net.minecraft.world.World minecraftWorld = (net.minecraft.world.World) location.getExtent();

        BlockPos blockpos = VecHelper.toBlockPos(location);
        if (currentBlock != newBlock) {
            ((World) minecraftWorld).setBlock(blockpos.getX(), blockpos.getY(), blockpos.getZ(), this.blockState, BlockChangeFlag.ALL, cause);
        }
        final NBTTagCompound compound = this.data.copy();

        TileEntity tileEntity = minecraftWorld.getTileEntity(blockpos);
        if (tileEntity == null) {
            return Optional.empty();
        }
        compound.setInteger("x", blockpos.getX());
        compound.setInteger("y", blockpos.getY());
        compound.setInteger("z", blockpos.getZ());
        tileEntity.readFromNBT(compound);
        tileEntity.markDirty();
        return Optional.of((org.spongepowered.api.block.tileentity.TileEntity) tileEntity);
    }

    @Override
    public BlockSnapshot toSnapshot(Location<World> location) {
        final SpongeBlockSnapshotBuilder builder = new SpongeBlockSnapshotBuilder();
        builder.blockState = this.blockState;
        builder.compound = this.data.copy();
        builder.worldUuid = location.getExtent().getUniqueId();
        builder.coords = location.getBlockPosition();
        return builder.build();
    }

    @Override
    public int getContentVersion() {
        return DataVersions.TileEntitArchetype.BASE_VERSION;
    }

    @Override
    public DataContainer toContainer() {
        return DataContainer.createNew()
                .set(DataQueries.TileEntityArchetype.TILE_TYPE, this.type)
                .set(DataQueries.TileEntityArchetype.BLOCK_STATE, this.blockState)
                .set(DataQueries.TileEntityArchetype.TILE_DATA, getTileData())
                ;
    }

    @Override
    protected NbtDataType getDataType() {
        return NbtDataTypes.TILE_ENTITY;
    }

    @Override
    protected ValidationType getValidationType() {
        return Validations.TILE_ENTITY;
    }

    @Override
    public TileEntityArchetype copy() {
        final SpongeTileEntityArchetypeBuilder builder = new SpongeTileEntityArchetypeBuilder();
        builder.tileEntityType = this.type;
        builder.tileData = NbtTranslator.getInstance().translate(this.data);
        builder.blockState = this.blockState;
        return builder.build();
    }

    @Override
    public String toString() {
        return MoreObjects.toStringHelper(this).add("type", this.type).add("state", this.blockState).add("data", this.data).toString();
    }
}

redpajama_set_name: RedPajamaGithub


text:
from tkinter import *
from ConnectFour import ConnectFour

class GUI:
    elementSize = 50
    gridBorder = 3
    gridColor = "#AAA"
    p1Color = "#4096EE"
    p2Color = "#FF1A00"
    backgroundColor = "#FFFFFF"
    gameOn = False

    def __init__(self, master):
        self.master = master

        master.title('Connect Four')

        label = Label(master, text="Connect Four")
        label.grid(row=0)

        button = Button(master, text="New Game!", command=self._newGameButton)
        button.grid(row=1)

        self.canvas = Canvas(master, width=200, height=50, background=self.backgroundColor, highlightthickness=0)
        self.canvas.grid(row=2)

        self.currentPlayerVar = StringVar(self.master, value="")
        self.currentPlayerLabel = Label(self.master, textvariable=self.currentPlayerVar, anchor=W)
        self.currentPlayerLabel.grid(row=3)

        self.canvas.bind('<Button-1>', self._canvasClick)
        self.newGame()

    def draw(self):
        for c in range(self.game.size['c']):
            for r in range(self.game.size['r']):
                if r >= len(self.game.grid[c]): continue

                x0 = c*self.elementSize
                y0 = r*self.elementSize
                x1 = (c+1)*self.elementSize
                y1 = (r+1)*self.elementSize
                fill = self.p1Color if self.game.grid[c][r] == self.game.players[True] else self.p2Color
                self.canvas.create_oval(x0 + 2,
                                        self.canvas.winfo_height() - (y0 + 2),
                                        x1 - 2,
                                        self.canvas.winfo_height() - (y1 - 2),
                                        fill = fill, outline=self.gridColor)

    def drawGrid(self):
        x0, x1 = 0, self.canvas.winfo_width()
        for r in range(1, self.game.size['r']):
            y = r*self.elementSize
            self.canvas.create_line(x0, y, x1, y, fill=self.gridColor)

        y0, y1 = 0, self.canvas.winfo_height()
        for c in range(1, self.game.size['c']):
            x = c*self.elementSize
            self.canvas.create_line(x, y0, x, y1, fill=self.gridColor)

    def drop(self, column):
        return self.game.drop(column)

    def newGame(self):
        # Ask for players' names
        self.p1 = 'Blue'
        self.p2 = 'Red'

        # Ask for grid size
        columns = 7
        rows = 6

        self.game = ConnectFour(columns=columns, rows=rows)

        self.canvas.delete(ALL)
        self.canvas.config(width=(self.elementSize)*self.game.size['c'],
                           height=(self.elementSize)*self.game.size['r'])
        self.master.update() # Rerender window
        self.drawGrid()
        self.draw()

        self._updateCurrentPlayer()

        self.gameOn = True

    def _updateCurrentPlayer(self):
        p = self.p1 if self.game.first_player else self.p2
        self.currentPlayerVar.set('Current player: ' + p)

    def _canvasClick(self, event):
        if not self.gameOn: return
        if self.game.game_over: return

        c = event.x // self.elementSize

        if (0 <= c < self.game.size['c']):
            self.drop(c)
            self.draw()
            self._updateCurrentPlayer()

        if self.game.game_over:
            x = self.canvas.winfo_width() // 2
            y = self.canvas.winfo_height() // 2
            if self.game.game_over == 'draw':
                t = 'DRAW!'
            else:
                winner = self.p1 if self.game.first_player else self.p2
                t = winner + ' won!'
            self.canvas.create_text(x, y, text=t, font=("Helvetica", 32), fill="#333")

    def _newGameButton(self):
        self.newGame()

root = Tk()
app = GUI(root)

root.mainloop()


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

class Student extends CI_Controller {
	public function __construct()
	{
		parent::__construct();
		//Do your magic here

		$this->load->model('export_student_model','student');
	}

	public function index()
	{
		//	echo dirname(__FILE__);
		echo "start
";
		$check  = $this->student->student_export();
		var_dump($check);
		/*echo "
";
		var_dump($_SERVER);
		echo "
";*/

	}

	public function file(){

		echo "file";

		$check = $this->student->Export_student_csv();
		var_dump($check);

		echo '<form method="get" action="'.base_url($check).'">
   <button type="submit">Download!</button>
</form>';

	}

}

/* End of file Student.php */
/* Location: ./application/controllers/Student.php */


text:
oa-data
=======

An experimental single-page app using Python Flask that integrates the Oracle OpenAir OData BI feed and some 3rd-party JavaScript libraries to showcase what type of reporting can be done outside of the OpenAir application.


text:
package botservice.service;

import botservice.model.bot.BotEntity;
import botservice.model.system.UserKeyEntity;
import botservice.queueprocessing.BotManager;
import botservice.queueprocessing.IQueueConsumer;
import botservice.rest.model.MsgObject;
import botservice.rest.model.UserObject;
import botservice.service.common.BaseService;
import botservice.util.BotMsgDirectionType;
import com.bftcom.devcomp.api.BotCommand;
import com.bftcom.devcomp.api.IBotConst;
import com.bftcom.devcomp.api.Message;
import org.jboss.resteasy.client.jaxrs.ResteasyClient;
import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget;

import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.inject.Inject;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

/**
 * Методы для работы с внутренними сущностями сервиса
 */

@Stateless
public class SystemService extends BaseService {

    @Inject
    BotManager botManager;

    @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
    public MsgObject sendMsgToClntApp(String userName, String bodyText, BotEntity botEntity){
        UserObject userObject = new UserObject();
        userObject.setBotName(botEntity.getName());
        userObject.setUserName(userName);
        MsgObject requestMsgObject = new MsgObject();
        requestMsgObject.setUserObject(userObject);
        requestMsgObject.setDirectionType(BotMsgDirectionType.TO_CLIENT_APP.name());
        requestMsgObject.setMsgBody(bodyText);
        ResteasyClient client = new ResteasyClientBuilder().build();
        ResteasyWebTarget target = client.target(botEntity.getClientAppEntity().getPath());
        Response response = target.request().post(Entity.entity(requestMsgObject, MediaType.APPLICATION_JSON));
        return response.readEntity(MsgObject.class);
    }

    @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
    public void sendMessageToBotQueue(String bodyText, UserKeyEntity userKeyEntity) throws IOException {
        Message message = new Message();
        message.setCommand(BotCommand.SERVICE_PROCESS_BOT_MESSAGE);
        message.setServiceProperties(userKeyEntity.getProps());
        message.getUserProperties().put(IBotConst.PROP_BODY_TEXT, bodyText);
        String queueName = IBotConst.QUEUE_TO_BOT_PREFIX + userKeyEntity.getBotEntity().getName();
        botManager.getChannel().queueDeclare(queueName, false, false, false, null);
        botManager.getChannel().basicPublish("", queueName, null, IQueueConsumer.mapper.writeValueAsString(message).getBytes(StandardCharsets.UTF_8));
    }

}


text:
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

"use strict";

var headers = null, vault = null;

$(document).ready(function() {
	chrome.runtime.getBackgroundPage(function(bg) {
		vault = bg.vault;
		if (setup()) {
			chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
				chrome.tabs.sendMessage(tabs[0].id, { tabId: tabs[0].id, cmd: 'get-headers' }, getHeaders);
			});
		}
	});
});

function getHeaders(val) {
	headers = val;
	setup2();
}

function onOptionsClick(evt) {
	var optionsUrl = chrome.extension.getURL('@options.html');
	chrome.tabs.query({url: optionsUrl}, function(tabs) {
		if (tabs.length) chrome.tabs.update(tabs[0].id, {active: true});
		else  chrome.tabs.create({url: optionsUrl});
    });
}

function onRegisterClick(headers) {
	headers.uid = $('#register_list option:selected').val();
	if (vault.size() === 1) headers.uid = vault.getFirst();
	chrome.extension.sendMessage({cmd: 'register', payload: headers});
	hidePopup();
}

function onLoginClick(headers) {
	headers.uid = $('#login_list option:selected').val();
	if (vault.size() === 1) headers.uid = vault.getFirst();
	chrome.extension.sendMessage({cmd: 'login', payload: headers});
	hidePopup();
}

function onUpdateClick(headers) {
	headers.ouid = $('#update_list1 option:selected').val();
	headers.nuid = $('#update_list2 option:selected').val();
	if (headers.ouid === headers.nuid) {
		$('#update_list2').css({ 'border': '2px solid red' });
	} else {
		chrome.extension.sendMessage({cmd: 'update', payload: headers});
		hidePopup();
	}
}

function onUpdatePwClick(headers) {
	headers.uid = $('#updatepw_list option:selected').val();
	if (vault.size() === 1) headers.uid = vault.getFirst();
	headers.password = $('#updatepw_password').val();
	if (headers.password.length == 0) {
		$('#updatepw_password').css({ 'border': '2px solid red' });
	} else {
		chrome.extension.sendMessage({cmd: 'updatepw', payload: headers});
		hidePopup();
	}
}

function hidePopup() {
	window.close();
}


text:
'use strict';

goog.provide('Blockly.Blocks.lists');

goog.require('Blockly.Blocks');

Blockly.Blocks.lists.HUE = 260//'#70b234'//260;

Blockly.Blocks.lists_get_index = {
    init: function () {
        this.setHelpUrl(Blockly.Msg.LISTS_GET_INDEX_HELPURL);
        this.setColour(Blockly.Blocks.lists.HUE);
        this.appendValueInput("LIST")
        this.appendValueInput("AT")
            .setCheck(Number)
            .appendField(Blockly.MIXLY_MICROBIT_PY_STORAGE_GET + " " + Blockly.Msg.LISTS_GET_INDEX_FROM_START)
        this.appendDummyInput()
            .appendField(Blockly.Msg.TEXT_CHARAT_TAIL);
        this.setInputsInline(true);
        this.setOutput(true);
        this.setTooltip(Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FROM);
    }
}

Blockly.Blocks['lists_get_sublist'] = {
    /**
     * Block for getting sublist.
     * @this Blockly.Block
     */
    init: function () {
        this.setHelpUrl(Blockly.Msg.LISTS_GET_SUBLIST_HELPURL);
        this.setColour(Blockly.Blocks.lists.HUE);
        this.appendValueInput('LIST')
        this.appendDummyInput('')
        this.appendValueInput('AT1')
            .appendField(Blockly.MIXLY_MICROBIT_PY_STORAGE_GET + " " + Blockly.Msg.LISTS_GET_INDEX_FROM_START);
        this.appendValueInput('AT2')
            .appendField(Blockly.Msg.TEXT_CHARAT_TAIL + " " + Blockly.Msg.LISTS_GET_SUBLIST_END_FROM_START);
        this.appendDummyInput()
            .appendField(Blockly.Msg.TEXT_CHARAT_TAIL);
        this.setInputsInline(true);
        this.setOutput(true, 'List');
        this.setTooltip(Blockly.Msg.PYTHON_LISTS_GET_SUBLIST_TOOLTIP);
    }
}

Blockly.Blocks.lists_2d_get_data_with_col_row= {
  init: function() {
  this.appendValueInput("LIST")
      .setCheck(null);
  this.appendValueInput("row")
      .setCheck(null)
      .appendField(Blockly.MIXLY_MICROBIT_PY_STORAGE_GET+" "+Blockly.Msg.DATAFRAME_RAW);
  this.appendValueInput("col")
      .setCheck(null)
      .appendField(Blockly.Msg.DATAFRAME_COLUMN);
  this.setInputsInline(true);
  this.setOutput(true, null);
  this.setColour(Blockly.Blocks.lists.HUE);
  this.setTooltip("");
  this.setHelpUrl("");
  }
};

Blockly.Blocks.lists_2d_get_col_row_data= {
  init: function() {
  this.appendValueInput("LIST")
      .setCheck(null);
  this.appendValueInput("row_start")
      .setCheck(null)
      .appendField(Blockly.MIXLY_GET+" "+Blockly.Msg.DATAFRAME_RAW+" [");
  this.appendValueInput("row_end")
      .setCheck(null)
      .appendField(",");
  this.appendValueInput("col_start")
      .setCheck(null)
      .appendField(")  "+Blockly.Msg.DATAFRAME_COLUMN+" [");
  this.appendValueInput("col_end")
      .setCheck(null)
      .appendField(",");
  this.appendDummyInput()
      .appendField(") "+Blockly.Msg.DICTS_ADD_VALUE);
  this.setInputsInline(true);
  this.setOutput(true, 'List');
  this.setColour(Blockly.Blocks.lists.HUE);
  this.setTooltip("");
  this.setHelpUrl("");
  }
};

Blockly.Blocks['lists_create_with'] = {
  /**
   * Block for creating a list with any number of elements of any type.
   * @this Blockly.Block
   */
  init: function() {
    this.setColour(Blockly.Blocks.lists.HUE);
	this.appendDummyInput("")
  //don't need to specify the data type in Python
        // .appendField(new Blockly.FieldDropdown([[Blockly.MIXLY_NUMBER, 'Array<number>'], [Blockly.LANG_MATH_STRING, 'Array<string>'], [Blockly.LANG_MATH_BOOLEAN, 'Array<boolean>']]), 'TYPE')
        // .appendField(' ')
        .appendField(new Blockly.FieldTextInput('mylist'), 'VAR')
        .appendField('[')
        //.appendField(new Blockly.FieldTextInput('3',Blockly.FieldTextInput.math_number_validator), 'SIZE')
        .appendField(']');
    this.itemCount_ = 3;
    this.updateShape_();
    this.setPreviousStatement(true);
    this.setNextStatement(true);
    this.setMutator(new Blockly.Mutator(['lists_create_with_item']));
    this.setTooltip(Blockly.Msg.LISTS_CREATE_WITH_PYTHON_TOOLTIP);
  },
  /**
   * Create XML to represent list inputs.
   * @return {Element} XML storage element.
   * @this Blockly.Block
   */
  mutationToDom: function() {
    var container = document.createElement('mutation');
    container.setAttribute('items', this.itemCount_);
    return container;
  },
  /**
   * Parse XML to restore the list inputs.
   * @param {!Element} xmlElement XML storage element.
   * @this Blockly.Block
   */
  domToMutation: function(xmlElement) {
    this.itemCount_ = parseInt(xmlElement.getAttribute('items'), 10);
    this.updateShape_();
  },
  /**
   * Populate the mutator's dialog with this block's components.
   * @param {!Blockly.Workspace} workspace Mutator's workspace.
   * @return {!Blockly.Block} Root block in mutator.
   * @this Blockly.Block
   */
  decompose: function(workspace) {
    var containerBlock =
        Blockly.Block.obtain(workspace, 'lists_create_with_container');
    containerBlock.initSvg();
    var connection = containerBlock.getInput('STACK').connection;
    for (var i = 0; i < this.itemCount_; i++) {
      var itemBlock = Blockly.Block.obtain(workspace, 'lists_create_with_item');
      itemBlock.initSvg();
      connection.connect(itemBlock.previousConnection);
      connection = itemBlock.nextConnection;
    }
    return containerBlock;
  },
  /**
   * Reconfigure this block based on the mutator dialog's components.
   * @param {!Blockly.Block} containerBlock Root block in mutator.
   * @this Blockly.Block
   */
  compose: function(containerBlock) {
    var itemBlock = containerBlock.getInputTargetBlock('STACK');
    // Count number of inputs.
    var connections = [];
    var i = 0;
    while (itemBlock) {
      connections[i] = itemBlock.valueConnection_;
      itemBlock = itemBlock.nextConnection &&
          itemBlock.nextConnection.targetBlock();
      i++;
    }
    this.itemCount_ = i;
    this.updateShape_();
    // Reconnect any child blocks.
    for (var i = 0; i < this.itemCount_; i++) {
      if (connections[i]) {
        this.getInput('ADD' + i).connection.connect(connections[i]);
      }
    }
  },
  /**
   * Store pointers to any connected child blocks.
   * @param {!Blockly.Block} containerBlock Root block in mutator.
   * @this Blockly.Block
   */
  saveConnections: function(containerBlock) {
    var itemBlock = containerBlock.getInputTargetBlock('STACK');
    var i = 0;
    while (itemBlock) {
      var input = this.getInput('ADD' + i);
      itemBlock.valueConnection_ = input && input.connection.targetConnection;
      i++;
      itemBlock = itemBlock.nextConnection &&
          itemBlock.nextConnection.targetBlock();
    }
  },
  /**
   * Modify this block to have the correct number of inputs.
   * @private
   * @this Blockly.Block
   */
  updateShape_: function() {
    // Delete everything.
    if (this.getInput('EMPTY')) {
      this.removeInput('EMPTY');
    } else {
      var i = 0;
      while (this.getInput('ADD' + i)) {
        this.removeInput('ADD' + i);
        i++;
      }
    }
    // Rebuild block.
    if (this.itemCount_ == 0) {
      this.appendDummyInput('EMPTY')
          .appendField(Blockly.Msg.LISTS_CREATE_PYTHON_EMPTY_TITLE);
    } else {
      for (var i = 0; i < this.itemCount_; i++) {
        var input = this.appendValueInput('ADD' + i);
        if (i == 0) {
          input.appendField(Blockly.Msg.blockpy_LISTS_CREATE_WITH_INPUT_WITH);
        }
      }
    }
  },
  getVars: function() {
    return [this.getFieldValue('VAR')];
  },
  renameVar: function(oldName, newName) {
    if (Blockly.Names.equals(oldName, this.getFieldValue('VAR'))) {
      this.setTitleValue(newName, 'VAR');
    }
  }
};

Blockly.Blocks['lists_create_with_text'] = {
  init: function() {
    this.setColour(Blockly.Blocks.lists.HUE);
  this.appendDummyInput("")
  //don't need to specify the data type in Python
        // .appendField(new Blockly.FieldDropdown([[Blockly.MIXLY_NUMBER, 'Array<number>']]), 'TYPE')
        // .appendField(' ')
    // .appendField(Blockly.blockpy_MIXLY_SPLITBYDOU)
        .appendField(new Blockly.FieldTextInput('mylist'), 'VAR')
        //.appendField(new Blockly.FieldTextInput('3',Blockly.FieldTextInput.math_number_validator), 'SIZE')
      // .appendField(Blockly.MIXLY_MAKELISTFROM)
    // .appendField(this.newQuote_(true))
        .appendField(' = [')
        .appendField(new Blockly.FieldTextInput('0,0,0'), 'TEXT')
        .appendField(']');
        // .appendField(this.newQuote_(false))
    this.setPreviousStatement(true);
    this.setNextStatement(true);
  this.setTooltip(Blockly.MIXLY_TOOLTIP_LISTS_CREATE_WITH_TEXT2);
  },
  getVars: function() {
    return [this.getFieldValue('VAR')];
  },
  renameVar: function(oldName, newName) {
    if (Blockly.Names.equals(oldName, this.getFieldValue('VAR'))) {
      this.setTitleValue(newName, 'VAR');
    }
  }
}

Blockly.Blocks['lists_create_with_container'] = {
  /**
   * Mutator block for list container.
   * @this Blockly.Block
   */
  init: function() {
    this.setColour(Blockly.Blocks.lists.HUE);
    this.appendDummyInput()
        .appendField(Blockly.MIXLY_MICROBIT_TYPE_LIST);
    this.appendStatementInput('STACK');
    this.setTooltip(Blockly.Msg.LISTS_CREATE_WITH_CONTAINER_TOOLTIP);
    this.contextMenu = false;
  }
};

Blockly.Blocks['lists_create_with_item'] = {
  /**
   * Mutator bolck for adding items.
   * @this Blockly.Block
   */
  init: function() {
    this.setColour(Blockly.Blocks.lists.HUE);
    this.appendDummyInput()
        .appendField(Blockly.Msg.LISTS_CREATE_WITH_ITEM_TITLE);
    this.setPreviousStatement(true);
    this.setNextStatement(true);
    this.setTooltip(Blockly.Msg.LISTS_CREATE_WITH_ITEM_TOOLTIP);
    this.contextMenu = false;
  }
};

Blockly.Blocks.lists_set_index = {
    init: function() {
        this.setColour(Blockly.Blocks.lists.HUE);
        this.appendValueInput('LIST');
        this.appendValueInput('AT')
            .setCheck(Number)
            .appendField(Blockly.MIXLY_MICROBIT_LIST_ASSIGN_AT);
        this.appendValueInput('TO')
            .appendField(Blockly.MIXLY_MICROBIT_JS_LIST_VALUE);
        this.setInputsInline(true);
        this.setPreviousStatement(true);
        this.setNextStatement(true);
        this.setTooltip(Blockly.LANG_LISTS_SET_INDEX_TOOLTIP);
    }
};

Blockly.Blocks['lists_append_extend'] = {
  init: function() {
    this.setColour(Blockly.Blocks.lists.HUE);
    this['TYPE'] =
        [[Blockly.MIXLY_blockpy_set_add, 'append'],
         [Blockly.MIXLY_MICROBIT_LIST_EXTEND, 'extend']];

    this.appendValueInput('LIST')
        .setCheck('List')
    this.appendValueInput('DATA')
        .appendField(new Blockly.FieldDropdown(this['TYPE']), 'OP')
        .appendField(Blockly.MIXLY_MICROBIT_LIST_A_ITEM)
    this.appendDummyInput("")
        .appendField(Blockly.MIXLY_MICROBIT_JS_LIST_TO_END);
    this.setInputsInline(true);
    this.setPreviousStatement(true);
    this.setNextStatement(true);
    var thisBlock = this;
    this.setTooltip(function() {
      var mode = thisBlock.getFieldValue('OP');
      var TOOLTIPS = {
        'append': Blockly.MIXLY_TOOLTIP_LIST_APPEND,
        'extend': Blockly.Msg.LISTS_EXTEND_TOOLTIP

      };
      return TOOLTIPS[mode];
    });
  }

};

Blockly.Blocks['lists_get_random_item'] = {
  /**
   * Block for get a random item from list.
   * @this Blockly.Block
   */
  init: function() {
    this.setColour(Blockly.Blocks.lists.HUE);
  this.appendValueInput("LIST");
  this.appendDummyInput()
        .appendField(Blockly.MIXLY_MICROBIT_PY_STORAGE_GET + " " + Blockly.Msg.LISTS_GET_INDEX_RANDOM)
  this.setTooltip(Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM);
  this.setOutput(true);
  }
};

Blockly.Blocks['lists_get_random_sublist'] = {
  /**
   * Block for get a random item from list.
   * @this Blockly.Block
   */
  init: function() {
    this.setColour(Blockly.Blocks.lists.HUE);
  this.appendValueInput("LIST");
  this.appendValueInput('VAR')
      .appendField(Blockly.MIXLY_MICROBIT_PY_STORAGE_GET + Blockly.MIXLY_MICROBIT_RANDOM)
  this.appendDummyInput()
      .appendField(Blockly.LANG_LISTS_GET_INDEX2 + Blockly.Msg.LISTS_GET_RANDOM_SUBLIST)
  this.setTooltip(Blockly.Msg.LISTS_GET_RANDOM_SUBLIST_TOOLTIP);
  this.setOutput(true,'List');
  }
};

Blockly.Blocks.lists_insert_value = {
  init: function() {
    this.setColour(Blockly.Blocks.lists.HUE);
    this.appendValueInput('LIST');
    this.appendValueInput('AT')
        .setCheck(Number)
        .appendField(Blockly.MIXLY_MICROBIT_JS_LIST_INSERT_AT);
    this.appendValueInput('VALUE')
        .appendField(Blockly.MIXLY_MICROBIT_JS_LIST_VALUE);
    this.setInputsInline(true);
    this.setPreviousStatement(true);
    this.setNextStatement(true);
    this.setTooltip(Blockly.LANG_LISTS_SET_INDEX_TOOLTIP);
    this.setTooltip(Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT);
  }
};

Blockly.Blocks['lists_reverse'] = {
  init: function() {
    this.setColour(Blockly.Blocks.lists.HUE);
    this.appendValueInput('VAR')
        .setCheck('List') //this.appendDummyInput("")
    this.appendDummyInput()
        .appendField(Blockly.MIXLY_MICROBIT_JS_LIST_REVERSE)
        //.appendField(new Blockly.FieldTextInput('mylist'), 'VAR');
    this.setTooltip(Blockly.LANG_LISTS_CLEAR_TOOLTIP);
    this.setInputsInline(true);
    this.setPreviousStatement(true);
    this.setNextStatement(true);
  }
};
Blockly.Blocks['lists_clear'] = {
  init: function() {
    this.setColour(Blockly.Blocks.lists.HUE);
    this.appendValueInput('VAR')
    this.appendDummyInput()
        .appendField(Blockly.MIXLY_MICROPYTHON_CLEAR)
        //.appendField(new Blockly.FieldTextInput('mylist'), 'VAR');
    this.setTooltip(Blockly.LANG_LISTS_REVERSE_TOOLTIP);
    this.setInputsInline(true);
    this.setPreviousStatement(true);
    this.setNextStatement(true);
  }
};

Blockly.Blocks.lists_remove_at = {
    init: function() {
        this.setColour(Blockly.Blocks.lists.HUE);
        this['TYPE'] =
            [[Blockly.Msg.SERIES_INDEX, 'del'],
                [Blockly.MIXLY_MICROBIT_JS_I2C_VALUE, 'remove']];
        this.appendValueInput('LIST')
            .setCheck('List')
        this.appendValueInput('DATA')
            .appendField(Blockly.MIXLY_MIXPY_LISTS_REMOVE)
            .appendField(new Blockly.FieldDropdown(this['TYPE']), 'OP')
        this.setInputsInline(true);
        this.setPreviousStatement(true);
        this.setNextStatement(true);
        var thisBlock = this;
        this.setTooltip(function () {
            var mode = thisBlock.getFieldValue('OP');
            var TOOLTIPS = {
                'del': Blockly.Msg.LISTS_SET_INDEX_TOOLTIP_DELETE,
                'remove': Blockly.MIXLY_TOOLTIP_LIST_REMOVE
            };
            return TOOLTIPS[mode];
        });
    }
};
Blockly.Blocks.lists_pop = {
  init: function() {
    this.setColour(Blockly.Blocks.lists.HUE);
    this.appendValueInput('LIST');
    this.appendValueInput('VALUE')
        .appendField(Blockly.MIXLY_MICROBIT_LIST_POP);
    this.appendDummyInput()
        .appendField(Blockly.Msg.TEXT_CHARAT_TAIL);
    this.setInputsInline(true);
    this.setOutput(true);
    this.setTooltip(Blockly.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM);
  }
};

Blockly.Blocks['lists_find'] = {
  init: function() {
    var OPERATORS =
        [[Blockly.Msg.MIXLY_LIST_INDEX, 'INDEX'],
         [Blockly.Msg.MIXLY_LIST_COUNT, 'COUNT']
        ];
    this.setColour(Blockly.Blocks.lists.HUE);
    this.appendValueInput('VAR')
        .setCheck('List')
    this.appendValueInput('data')
        .appendField(Blockly.MIXLY_MICROBIT_PY_STORAGE_GET)
        .appendField(Blockly.Msg.HTML_VALUE)
    this.appendDummyInput()
        .appendField(Blockly.MIXLY_DE)
        .appendField(new Blockly.FieldDropdown(OPERATORS), 'OP');
        //.appendField(new Blockly.FieldTextInput('mylist'), 'VAR')
    this.setInputsInline(true);
    this.setOutput(true, Number);
     var thisBlock = this;
    this.setTooltip(function() {
      var mode = thisBlock.getFieldValue('OP');
      var TOOLTIPS = {
        'INDEX': Blockly.MIXLY_TOOLTIP_LIST_FIND_INDEX,
        'COUNT': Blockly.MIXLY_TOOLTIP_LIST_FIND_COUNT

      };
      return TOOLTIPS[mode];
    });
  }
};
Blockly.Blocks['list_trig'] = {
  init: function() {
    var OPERATORS =
        [[Blockly.Msg.MIXLY_LIST_LEN, 'LEN'],
         [Blockly.Msg.MATH_ONLIST_OPERATOR_SUM, 'SUM'],
         [Blockly.Msg.MATH_ONLIST_OPERATOR_MAX, 'MAX'],
         [Blockly.Msg.MATH_ONLIST_OPERATOR_MIN, 'MIN'],
         [Blockly.Msg.MATH_ONLIST_OPERATOR_AVERAGE, 'AVERAGE'],
         [Blockly.Msg.MATH_ONLIST_OPERATOR_MEDIAN, 'MEDIAN'],
         [Blockly.Msg.MATH_ONLIST_OPERATOR_MODE, 'MODE'],
         [Blockly.Msg.MATH_ONLIST_OPERATOR_STD_DEV, 'STD_DEV'],
        ];
    //this.setHelpUrl(Blockly.Msg.MATH_TRIG_HELPURL);
    this.setColour(Blockly.Blocks.lists.HUE);
    this.setOutput(true, Number);
    this.appendValueInput('data')
    this.appendDummyInput()
    .appendField(Blockly.MIXLY_MICROBIT_PY_STORAGE_GET)
        .appendField(new Blockly.FieldDropdown(OPERATORS), 'OP');
    this.setInputsInline(true);
    // Assign 'this' to a variable for use in the tooltip closure below.
    var thisBlock = this;
    this.setTooltip(function() {
      var mode = thisBlock.getFieldValue('OP');
      var TOOLTIPS = {
        'LEN': Blockly.Msg.LISTS_LENGTH_TOOLTIP,
        'SUM': Blockly.Msg.MATH_ONLIST_TOOLTIP_SUM,
        'MAX': Blockly.Msg.MATH_ONLIST_TOOLTIP_MAX,
        'MIN': Blockly.Msg.MATH_ONLIST_TOOLTIP_MIN,
        'AVERAGE': Blockly.Msg.MATH_ONLIST_TOOLTIP_AVERAGE,
        'MEDIAN': Blockly.Msg.MATH_ONLIST_TOOLTIP_MEDIAN,
        'MODE': Blockly.Msg.MATH_ONLIST_TOOLTIP_MODE,
        'STD_DEV': Blockly.Msg.MATH_ONLIST_TOOLTIP_STD_DEV

      };
      return TOOLTIPS[mode];
    });
  }
};

Blockly.Blocks['lists_sort'] = {
  /**
   * Block for sorting a list.
   * @this Blockly.Block
   */
  init: function() {
    this.jsonInit({
      "args0": [
        {
          "type": "input_value",
          "name": "LIST",
          "check": "List"
        },
        {
          "type": "field_dropdown",
          "name": "TYPE",
          "options": [
            [Blockly.Msg.LISTS_SORT_TYPE_NUMERIC, "NUMERIC"],
            [Blockly.Msg.LISTS_SORT_TYPE_TEXT, "TEXT"],
            [Blockly.Msg.LISTS_SORT_TYPE_IGNORECASE, "IGNORE_CASE"]
          ]
        },
        {
          "type": "field_dropdown",
          "name": "DIRECTION",
          "options": [
            [Blockly.Msg.LISTS_SORT_ORDER_ASCENDING, "1"],
            [Blockly.Msg.LISTS_SORT_ORDER_DESCENDING, "-1"]
          ]
        },
      ],
      "message0": Blockly.Msg.LISTS_SORT_TITLE,
      "inputsInline": true,
      "output": "List",
      "colour": Blockly.Blocks.lists.HUE,
      "tooltip": Blockly.Msg.LISTS_SORT_TOOLTIP,
      "helpUrl": Blockly.Msg.LISTS_SORT_HELPURL
    });
  }
};

Blockly.Blocks['lists_change_to'] = {
  init: function() {
    var OPERATORS =
        [[Blockly.MIXLY_MICROBIT_TYPE_TUPLE, 'tuple'],
         [Blockly.Msg.blockpy_SET_CREATE_WITH_CONTAINER_TITLE_ADD, 'set'],
         [Blockly.Msg.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD, 'array']
        ];
    this.setColour(Blockly.Blocks.lists.HUE);
    this.appendValueInput('VAR')
        .setCheck("List")
        // .appendField(Blockly.blockpy_USE_LIST);
    this.appendDummyInput("")
        .appendField(Blockly.Msg.A_TO_B)
        .appendField(new Blockly.FieldDropdown(OPERATORS), 'OP');
    var thisBlock = this;
    this.setTooltip(function() {
      var mode = thisBlock.getFieldValue('OP');
      var TOOLTIPS = {
        'tuple': Blockly.MIXLY_TOOLTIP_CONVERT_LIST_TO_TUPLE,
        'set': Blockly.MIXLY_TOOLTIP_CONVERT_LIST_TO_SET,
        'array': Blockly.MIXLY_TOOLTIP_CONVERT_LIST_TO_ARRAY
      };
      return TOOLTIPS[mode];
    });

    this.setInputsInline(true);
    this.setOutput(true);
  }
};

Blockly.Blocks['list_many_input']= {
  init: function() {
    this.setColour(Blockly.Blocks.lists.HUE);
    this.appendDummyInput("")
        .appendField('[')
        .appendField(new Blockly.FieldTextInput('0,0,0'),"CONTENT")
        .appendField(']');
    this.setInputsInline(true);
    this.setOutput(true);
  }
};

Blockly.Blocks['lists_create_with_noreturn'] = {
    /**
     * Block for creating a list with any number of elements of any type.
     * @this Blockly.Block
     */
    init: function () {
        this.setColour(Blockly.Blocks.lists.HUE);
        this.itemCount_ = 3;
        this.updateShape_();
        this.setPreviousStatement(false);
        this.setNextStatement(false);
        this.setOutput(true, "List")
        this.setMutator(new Blockly.Mutator(['lists_create_with_item']));
        this.setTooltip(Blockly.Msg.LISTS_CREATE_WITH_PYTHON_TOOLTIP);
    },
    /**
     * Create XML to represent list inputs.
     * @return {Element} XML storage element.
     * @this Blockly.Block
     */
    mutationToDom: function () {
        var container = document.createElement('mutation');
        container.setAttribute('items', this.itemCount_);
        return container;
    },
    /**
     * Parse XML to restore the list inputs.
     * @param {!Element} xmlElement XML storage element.
     * @this Blockly.Block
     */
    domToMutation: function (xmlElement) {
        this.itemCount_ = parseInt(xmlElement.getAttribute('items'), 10);
        this.updateShape_();
    },
    /**
     * Populate the mutator's dialog with this block's components.
     * @param {!Blockly.Workspace} workspace Mutator's workspace.
     * @return {!Blockly.Block} Root block in mutator.
     * @this Blockly.Block
     */
    decompose: function (workspace) {
        var containerBlock =
            Blockly.Block.obtain(workspace, 'lists_create_with_container');
        containerBlock.initSvg();
        var connection = containerBlock.getInput('STACK').connection;
        for (var i = 0; i < this.itemCount_; i++) {
            var itemBlock = Blockly.Block.obtain(workspace, 'lists_create_with_item');
            itemBlock.initSvg();
            connection.connect(itemBlock.previousConnection);
            connection = itemBlock.nextConnection;
        }
        return containerBlock;
    },
    /**
     * Reconfigure this block based on the mutator dialog's components.
     * @param {!Blockly.Block} containerBlock Root block in mutator.
     * @this Blockly.Block
     */
    compose: function (containerBlock) {
        var itemBlock = containerBlock.getInputTargetBlock('STACK');
        // Count number of inputs.
        var connections = [];
        var i = 0;
        while (itemBlock) {
            connections[i] = itemBlock.valueConnection_;
            itemBlock = itemBlock.nextConnection &&
                itemBlock.nextConnection.targetBlock();
            i++;
        }
        this.itemCount_ = i;
        this.updateShape_();
        // Reconnect any child blocks.
        for (var i = 0; i < this.itemCount_; i++) {
            if (connections[i]) {
                this.getInput('ADD' + i).connection.connect(connections[i]);
            }
        }
    },
    /**
     * Store pointers to any connected child blocks.
     * @param {!Blockly.Block} containerBlock Root block in mutator.
     * @this Blockly.Block
     */
    saveConnections: function (containerBlock) {
        var itemBlock = containerBlock.getInputTargetBlock('STACK');
        var i = 0;
        while (itemBlock) {
            var input = this.getInput('ADD' + i);
            itemBlock.valueConnection_ = input && input.connection.targetConnection;
            i++;
            itemBlock = itemBlock.nextConnection &&
                itemBlock.nextConnection.targetBlock();
        }
    },
    /**
     * Modify this block to have the correct number of inputs.
     * @private
     * @this Blockly.Block
     */
    updateShape_: function () {
        // Delete everything.
        if (this.getInput('EMPTY')) {
            this.removeInput('EMPTY');
        } else {
            var i = 0;
            while (this.getInput('ADD' + i)) {
                this.removeInput('ADD' + i);
                i++;
            }
        }
        // Rebuild block.
        if (this.itemCount_ == 0) {
            this.appendDummyInput('EMPTY')
                .appendField(Blockly.Msg.LISTS_CREATE_PYTHON_EMPTY_TITLE);
        } else {
            for (var i = 0; i < this.itemCount_; i++) {
                var input = this.appendValueInput('ADD' + i);
                if (i == 0) {
                    input.appendField(Blockly.Msg.blockpy_LISTS_CREATE_WITH_INPUT_WITH);
                }
            }
        }
    },
    getVars: function () {
        return [this.getFieldValue('VAR')];
    },
    renameVar: function (oldName, newName) {
        if (Blockly.Names.equals(oldName, this.getFieldValue('VAR'))) {
            this.setTitleValue(newName, 'VAR');
        }
    }
}

Blockly.Blocks['lists_change_to_general'] = {
  init: function() {
    var OPERATORS =
        [
         [Blockly.MIXLY_MICROBIT_TYPE_LIST, 'list'],
         [Blockly.MIXLY_MICROBIT_TYPE_TUPLE, 'tuple'],
         [Blockly.Msg.blockpy_SET_CREATE_WITH_CONTAINER_TITLE_ADD, 'set']
        ];
    this.setColour(Blockly.Blocks.lists.HUE);
    this.appendValueInput('VAR');
    this.appendDummyInput("")
        .appendField(Blockly.Msg.A_TO_B)
        .appendField(new Blockly.FieldDropdown(OPERATORS), 'OP');
    var thisBlock = this;

    this.setInputsInline(true);
    this.setOutput(true);
  }
};

Blockly.Blocks['lists_del_general'] = {
  /**
   * Block for list length.
   * @this Blockly.Block
   */
  init: function() {
    this.setColour(Blockly.Blocks.lists.HUE);
    this.appendValueInput('TUP')
    this.appendDummyInput("")
        .appendField(Blockly.Msg.OBJECT_DELETE);
    this.setPreviousStatement(true);
    this.setNextStatement(true);
  }
};

Blockly.Blocks['lists_zip'] = {
    init: function() {
    this.setColour(Blockly.Blocks.lists.HUE);

    this.itemCount_ = 2;
    this.updateShape_();
    this.setInputsInline(true);
    this.setPreviousStatement(false);
    this.setNextStatement(false);
    this.setOutput(true, "List")
    this.setMutator(new Blockly.Mutator(['lists_zip_item']));
    this.setTooltip(Blockly.MIXLY_PYTHON_LISTS_ZIP_TOOLTIP);
  },

  mutationToDom: function() {
    var container = document.createElement('mutation');
    container.setAttribute('items', this.itemCount_);
    return container;
  },

  domToMutation: function(xmlElement) {
    this.itemCount_ = parseInt(xmlElement.getAttribute('items'), 10);
    this.updateShape_();
  },

  decompose: function(workspace) {
    var containerBlock =
        Blockly.Block.obtain(workspace, 'lists_zip_container');
    containerBlock.initSvg();
    var connection = containerBlock.getInput('STACK').connection;
    for (var i = 0; i < this.itemCount_; i++) {
      var itemBlock = Blockly.Block.obtain(workspace, 'lists_zip_item');
      itemBlock.initSvg();
      connection.connect(itemBlock.previousConnection);
      connection = itemBlock.nextConnection;
    }
    return containerBlock;
  },

  compose: function(containerBlock) {
    var itemBlock = containerBlock.getInputTargetBlock('STACK');
    // Count number of inputs.
    var connections = [];
    var i = 0;
    while (itemBlock) {
      connections[i] = itemBlock.valueConnection_;
      itemBlock = itemBlock.nextConnection &&
          itemBlock.nextConnection.targetBlock();
      i++;
    }
    this.itemCount_ = i;
    this.updateShape_();
    // Reconnect any child blocks.
    for (var i = 0; i < this.itemCount_; i++) {
      if (connections[i]) {
        this.getInput('ADD' + i).connection.connect(connections[i]);
      }
    }
  },

  saveConnections: function(containerBlock) {
    var itemBlock = containerBlock.getInputTargetBlock('STACK');
    var i = 0;
    while (itemBlock) {
      var input = this.getInput('ADD' + i);
      itemBlock.valueConnection_ = input && input.connection.targetConnection;
      i++;
      itemBlock = itemBlock.nextConnection &&
          itemBlock.nextConnection.targetBlock();
    }
  },

  updateShape_: function() {
    // Delete everything.
    if (this.getInput('EMPTY')) {
      this.removeInput('EMPTY');
    } else {
      var i = 0;
      while (this.getInput('ADD' + i)) {
        this.removeInput('ADD' + i);
        i++;
      }
    }
    // Rebuild block.
    if (this.itemCount_ == 0) {
      this.appendDummyInput('EMPTY')
          .appendField(Blockly.MIXLY_PYTHON_LISTS_ZIP);
    } else {
      for (var i = 0; i < this.itemCount_; i++) {
        var input = this.appendValueInput('ADD' + i);
        if (i == 0) {
          input.appendField(Blockly.MIXLY_PYTHON_LISTS_ZIP);
        }
      }
    }
  }
};
Blockly.Blocks['lists_zip_container'] = {
  init: function() {
    this.setColour(Blockly.Blocks.lists.HUE);
    this.appendDummyInput()
        .appendField(Blockly.MIXLY_PYTHON_LISTS_ZIP)
        .appendField('[]');
    this.appendStatementInput('STACK');
    this.setTooltip(Blockly.MIXLY_MIXPY_INOUT_PRINT_MANY_CONTAINER_TOOLTIP);
    this.contextMenu = false;
  }
};

Blockly.Blocks['lists_zip_item'] = {
  init: function() {
    this.setColour(Blockly.Blocks.lists.HUE);
    this.appendDummyInput()
        .appendField(Blockly.MIXLY_PYTHON_LISTS_ZIP_ITEM);
    this.setPreviousStatement(true);
    this.setNextStatement(true);
    this.setTooltip(Blockly.MIXLY_PYTHON_LISTS_ZIP_ITEM_TOOLTIP);
    this.contextMenu = false;
  }
};

Blockly.Blocks['list_tolist'] = {
  init: function () {
    this.setColour(Blockly.Blocks.lists.HUE);
    this.appendValueInput('VAR')
    .appendField(Blockly.MIXLY_TOLIST);
    this.setOutput(true, 'List');
    this.setTooltip(Blockly.MIXLY_PYTHON_TOOLTIP_TOLIST);
  }
};

Blockly.Blocks['lists_create_with2'] = Blockly.Blocks['lists_create_with']
Blockly.Blocks['lists_create_with_text2'] = Blockly.Blocks['lists_create_with_text']
Blockly.Blocks['lists_getIndex3'] = Blockly.Blocks['lists_get_index']
Blockly.Blocks['lists_getSublist3'] = Blockly.Blocks['lists_get_sublist']
Blockly.Blocks['lists_setIndex3'] = Blockly.Blocks['lists_set_index']
Blockly.Blocks['lists_insert_value2'] = Blockly.Blocks['lists_insert_value']
Blockly.Blocks['lists_remove_at2'] = Blockly.Blocks['lists_remove_at']


text:
docker-image:
	docker build -t srclib/srclib-csharp .

release: docker-image
	docker push srclib/srclib-csharp

dep:
	dnu restore Srclib.Nuget/project.json


text:
import * as Scrivito from 'scrivito';

Scrivito.provideEditingConfig('SnipcartFullWidget', {
  title: 'Snipcart Full Width Product',
  attributes: {
    productId: {
      title: 'Product ID',
      description: "ID of the product.",
    },
    name: {
      title: 'Name',
      description: "Name of product.",
    },
    image: {
      title: "Product Image"
    },
    price: {
      title: 'Price',
      description: "Price of product.",
    },
    url: {
      title: 'URL',
      description: "URL of product for Snipcart to validate. Enter '/' followed by the page id.",
    },
    description: {
      title: 'Description',
      description: "Description of product.",
    },
    buttonText: {
      title: 'Button Text',
      description: "Text for the buy button.",
    },
  },
  properties: [
    'productId',
    'name',
    'price',
    'url',
    'description',
    'buttonText',
    'image'
  ],
  initialContent: {
    name: 'Enter name of product',
    description: 'Enter a description',
    buttonText: 'Add to cart',
  },
});


text:
package org.growingstems.scouting.data;

import java.util.Locale;

import org.growingstems.scouting.R;

import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TableLayout;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;

public abstract class DataFragment extends Fragment {
    public static final int PT_EVENTS = 0;
    public static final int PT_TEAMS = 1;
    public static final int PT_MATCHES = 2;
    public static final int PT_PITS = 3;
    public static final int PT_MATCHLINEGRAPH = 4;
    public static final int PT_FUTUREMATCHES = 5;
    public static final int PT_MATCHINFOCURRENTEVENT = 6;
    public static final int PT_MATCHINFOALLEVENTS = 7;

    protected static final int defaultListResource = android.R.layout.simple_list_item_1;

    protected ListView dataList;
    protected TableLayout dataTable;
    protected AutoCompleteTextView autoText;
    protected Button loadB;
    protected boolean displayed = false;

    protected View rootView;

    protected int mSectionType;

    protected DataActivity mParent;

    protected int default_layout_resource = R.layout.fragment_data;

    public static DataFragment newInstance(int section_title, DataActivity parent) {
        return newInstance(section_title, parent, -1, null, -1);
    }

    public static DataFragment newInstance(int section_title,
                                           DataActivity parent, int teamNumber) {
        return newInstance(section_title, parent, teamNumber, null, -1);
    }

    public static DataFragment newInstance(int section_title,
                                           DataActivity parent, String event_name) {
        return newInstance(section_title, parent, -1, event_name, -1);
    }

    public static DataFragment newInstance(int section_title,
                                           DataActivity parent, String event_name, int matchNumber) {
        return newInstance(section_title, parent, -1, event_name, matchNumber);
    }

    public static DataFragment newInstance(int section_title,
                                           DataActivity parent, int teamNumber, String event_name)
    {
        return newInstance(section_title, parent, teamNumber, event_name, -1);
    }

    public static DataFragment newInstance(int section_title,
                                           DataActivity parent, int teamNumber, String event_name, int matchNumber) {
        DataFragment fragment;
        switch (section_title) {
            case PT_EVENTS:
                fragment = new EventListFragment();
                break;
            case PT_TEAMS:
                fragment = TeamListFragment.getInstance(event_name);
                break;
            case PT_MATCHES:
                fragment = MatchListFragment.getInstance(event_name, teamNumber);
                break;
            case PT_PITS:
                fragment = PitsDataFragment.getInstance(teamNumber);
                break;
            case PT_MATCHLINEGRAPH:
                fragment = MatchLineGraphFragment.getInstance(teamNumber, event_name);
                break;
            case PT_FUTUREMATCHES:
                fragment = MatchListFragment.getInstance(event_name, teamNumber, true);
                break;
            case PT_MATCHINFOCURRENTEVENT:
                fragment = MatchInfoFragment.getInstance(event_name, matchNumber);
                break;
            case PT_MATCHINFOALLEVENTS:
                fragment = MatchInfoFragment.getInstance(event_name, matchNumber, true);
                break;
            default:
                return null;
        }
        fragment.mParent = parent;
        fragment.mSectionType = section_title;
        return fragment;
    }

    public static String getPageTitle(int section_title, Context context) {
        Locale l = Locale.getDefault();
        switch (section_title) {
            case PT_EVENTS:
                return context.getString(R.string.title_event_section).toUpperCase(
                        l);
            case PT_TEAMS:
                return context.getString(R.string.title_team_section)
                        .toUpperCase(l);
            case PT_MATCHES:
                return context.getString(R.string.title_match_section).toUpperCase(
                        l);
            case PT_PITS:
                return context.getString(R.string.title_pits_section)
                        .toUpperCase(l);
            case PT_MATCHLINEGRAPH:
                return context.getString(R.string.title_match_graphs_section).toUpperCase(l);
            case PT_FUTUREMATCHES:
                return context.getString(R.string.title_future_match_section).toUpperCase(l);
            case PT_MATCHINFOCURRENTEVENT:
                return context.getString(R.string.title_match_current_event_section).toUpperCase(l);
            case PT_MATCHINFOALLEVENTS:
                return context.getString(R.string.title_match_all_events_section).toUpperCase(l);
        }
        return null;
    }

    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
							 Bundle savedInstanceState) {
        super.onCreateView(inflater, container, savedInstanceState);
        rootView = inflater.inflate(default_layout_resource, container, false);
        if (default_layout_resource == R.layout.fragment_data) {
            dataList = (ListView) rootView.findViewById(R.id.dataList);
            dataTable = (TableLayout) rootView.findViewById(R.id.dataTable);
            autoText = (AutoCompleteTextView) rootView
                    .findViewById(R.id.data_team_id);
            loadB = (Button) rootView.findViewById(R.id.data_teamB);
        }

        displayed = true;
        return rootView;
    }

    protected boolean isDisplayed() {
        return mParent != null && displayed && mParent.isDisplayed();
    }

    public void onResume() {
        super.onResume();
        if (isDisplayed())
            refreshData();
    }

    protected abstract void refreshData();

}


text:
A semi-glossy button created via various mixins. By default, no classes
are added to the style sheet unless told to do so.

[<~Example](markup/button_semigloss.html.haml)

The semigloss-button class can be applied to `<a>`, `<button>` and `<input>` elements.

```~haml
%section.semigloss-btn-demo
  %a.btn(href="#") Link
  %button.btn(type="submit") Button
  %input.btn(type="button" value="Input")
  %input.btn(type="submit" value="Submit")
```

```sass
@import utensils/button_semigloss
```

## Options
Semigloss button contains 3 mixins.

### Mixin: `semigloss-button`

Generates the base class for modifiers to extend.

Parameter          | Default          | Description
------------------ | ---------------- | -------------------------------------------
`$bg`              | _none_           | This is a required parameter
`$color`           | `#fff`           | The text `color`
`$hover-percent`   | `10%`            | The percentage to darken the `background-color` on hover
`$active-percent`  | `15%`            | The percentage to darken the `background-color` on press and `.active`
`$border-percent`  | `30%`            | The percentage to darken the `border-color` against `$bg`
`$padding`         | `$base-padding`  | The `padding` within the button
`$radii`           | `$radii`         | The button's `border-radius`

```sass
.btn
  +semigloss-button($body-bgc, $link-color)
```

### Mixin: `semigloss-button-modifier`

Generates the modifier classes from the base class. This limits the
amount of output for a given button.

Parameter          | Default          | Description
------------------ | ---------------- | -------------------------------------------
`$bg`              | _none_           | This is a required parameter
`$color`           | `#fff`           | The text `color` to override from the base button
`$hover-percent`   | `10%`            | The percentage to darken the `background-color` on hover
`$active-percent`  | `12.5%`          | The percentage to darken the `background-color` on press and `.active`
`$border-percent`  | `15%`            | The percentage to darken the `border-color` against `$bg`

```sass
.btn
  &.important
    +semigloss-button-modifier($important, $white)
  &.success
    +semigloss-button-modifier($success, $white)
  &.warning
    +semigloss-button-modifier($warning, $white)
```

### Mixin: `generate-semigloss-buttons`

Generates the base class and modifier classes from the list directly to
the style sheet.

Parameter          | Default          | Description
------------------ | ---------------- | -------------------------------------------
`$name`            | _none_           | The base class name to call it (`btn`, `action`, ...), required parameter
`$list`            | _none_           | A `list` of named status classes, passing an empty list does not generate any modifiers

```sass
+generate-semigloss-buttons(btn, $base-level-list)

// results in styles for..
.btn
  // styles...

.btn.important
  // modified styles...

.btn.success
  // modified styles...

.btn.warning
  // modified styles...

.btn.danger
  // modified styles...
```

The base class (in these cases `.btn`) adds all of the necessary
properties to render a button. The modifiers (`.success`, `.important`)
mainly override the color values for various states. To keep the output
as small as possible, just mixin or generate the states needed within the
project or application.

#### Auto Generation
To auto generate buttons into the style sheet, within `config.sass` add
the following:

```sass
$auto-generate-semigloss: btn, $base-status-list
```

This will create a base button with the class of `.btn` and
modifiers for each of the elements within the `$base-status-list`. By
default this is set to `false` so no buttons are created.


text:
<?php
class Order_model extends CI_Model {
	function __construct()
    {
        parent::__construct();
        $this->load->database();
    }

	function selOrderSelect($docid){
				$query = $this->db->query("SELECT doc_working FROM coh_doctor WHERE doc_id = '".$docid."'");
				return $query;
	}

	function insertOrder($username,$telnum,$age,$sex,$orderDate,$userid,$docid){
		$insertData = array('name'=>$username,
				    			'telnum'=>$telnum,
				    			'age'=>$age,
				    			'sex'=>$sex,
				    			'orderDate'=>$orderDate,
				    			'userid'=>$userid,
				    			'docid'=>$docid,
				    			'viewflg'=>'0',
							'posttime'=>date('Y年m月d日 H:i:s'),
								);

				$insertSQL = $this->db->insert_string('coh_userinfor', $insertData);
				$query = $this->db->query($insertSQL);
				return $query;
	}

	function selOrderDetailByID($id){
				$query = $this->db->query("SELECT ui.id, ui.docid,ui.name, ui.confirmflg, ui.telnum,ui.orderDate,dep.dep_name FROM coh_userinfor AS ui LEFT JOIN coh_doctor AS di ON ui.docid = di.doc_id LEFT JOIN coh_dep AS dep ON di.doc_id = dep.dep_id WHERE ui.id = '".$id."'");
				return $query;
	}
}


text:
<?php session_start(); include("../../dbaccess/index.php"); include("../../dbaccess/modules.php");

	if(isset($_SESSION["username"]) == false)
	{

		header("Location: ../");

	}

	$statement = $conn->prepare("SELECT * FROM settings LIMIT 1");
	$statement->execute();
	$sslstate = $statement->fetch();

	$username = $userDetails->getUsername();
?>
<!DOCTYPE html>

		<link rel="stylesheet" type="text/css" href="../../css/css.css" />
		<title>KoanSystems Admin Area</title>
		<link href="../../../css/favicon.ico" rel="shortcut icon" type="image/x-icon" />

		<?php echo ( $userDetails->getType() == 0 ? "" : ""); ?>

<h9>Welcome, <?php echo $username; ?>.</h9>
Logout...

		<?php
			if($userDetails->getType() == 0)
			{
				echo "
CMS Options

Force SSL Encryption:

										Styling

										Page Editor

										Menu Editor

";
				echo "
Administration

										Gallery

										Clients

										Administrators

";
				echo "
Work

										Queries

";
				echo "
Blog

										Posts

";
			}
			else
			{
				echo "
Client Area

										My Galleries

";
			}
		?>

Copyright © KoanSystems

		<?php echo ( $userDetails->getType() == 0 ? "" : ""); ?>


text:
@interface TextImageView : UIView

@end


text:
package javax.print;

import javax.print.attribute.AttributeSet;
import javax.print.attribute.PrintJobAttributeSet;
import javax.print.attribute.PrintRequestAttributeSet;
import javax.print.event.PrintJobAttributeListener;
import javax.print.event.PrintJobListener;
import javax.print.PrintException;

/**
 *
 * This interface represents a print job that can print a specified
 * document with a set of job attributes.  An object implementing
 * this interface is obtained from a print service.
 *
 */

public interface DocPrintJob {

    /**
     * Determines the {@link PrintService} object to which this print job
     * object is bound.
     *
     * @return  PrintService object.
     *
     */
    public PrintService getPrintService();

    /**
     * Obtains this Print Job's set of printing attributes.
     * The returned attribute set object is unmodifiable.
     * The returned attribute set object is a "snapshot" of this Print Job's
     * attribute set at the time of the {@link #getAttributes()} method
     * call; that is, the returned attribute set's object's contents will
     * not be updated if this Print Job's attribute set's contents change
     * in the future. To detect changes in attribute values, call
     * getAttributes() again and compare the new attribute
     * set to the previous attribute set; alternatively, register a
     * listener for print job events.
     * The returned value may be an empty set but should not be null.
     * @return the print job attributes
     */
     public PrintJobAttributeSet getAttributes();

    /**
     * Registers a listener for event occurring during this print job.
     * If listener is null, no exception is thrown and no action is
     * performed.
     * If listener is already registered, it will be registered again.
     * @see #removePrintJobListener
     *
     * @param listener  The object implementing the listener interface
     *
     */
    public void addPrintJobListener(PrintJobListener listener);

    /**
     * Removes a listener from this print job.
     * This method performs no function, nor does it throw an exception,
     * if the listener specified by the argument was not previously added
     * to this component. If listener is null, no exception is thrown and
     * no action is performed. If a listener was registered more than once
     * only one of the registrations will be removed.
     * @see #addPrintJobListener
     *
     * @param listener  The object implementing the listener interface
     */
    public void removePrintJobListener(PrintJobListener listener);

    /**
     * Registers a listener for changes in the specified attributes.
     * If listener is null, no exception is thrown and no action is
     * performed.
     * To determine the attribute updates that may be reported by this job,
     * a client can call getAttributes() and identify the
     * subset that are interesting and likely to be reported to the
     * listener. Clients expecting to be updated about changes in a
     * specific job attribute should verify it is in that set, but
     * updates about an attribute will be made only if it changes and this
     * is detected by the job. Also updates may be subject to batching
     * by the job. To minimise overhead in print job processing it is
     * recommended to listen on only that subset of attributes which
     * are likely to change.
     * If the specified set is empty no attribute updates will be reported
     * to the listener.
     * If the attribute set is null, then this means to listen on all
     * dynamic attributes that the job supports. This may result in no
     * update notifications if a job can not report any attribute updates.
     *
     * If listener is already registered, it will be registered again.
     * @see #removePrintJobAttributeListener
     *
     * @param listener  The object implementing the listener interface
     * @param attributes The attributes to listen on, or null to mean
     * all attributes that can change, as determined by the job.
     */
    public void addPrintJobAttributeListener(
                                  PrintJobAttributeListener listener,
                                  PrintJobAttributeSet attributes);

    /**
     * Removes an attribute listener from this print job.
     * This method performs no function, nor does it throw an exception,
     * if the listener specified by the argument was not previously added
     * to this component. If the listener is null, no exception is thrown
     * and no action is performed.
     * If a listener is registered more than once, even for a different
     * set of attributes, no guarantee is made which listener is removed.
     * @see #addPrintJobAttributeListener
     *
     * @param listener  The object implementing the listener interface
     *
     */
    public void removePrintJobAttributeListener(
                                      PrintJobAttributeListener listener);

    /**
     * Prints a document with the specified job attributes.
     * This method should only be called once for a given print job.
     * Calling it again will not result in a new job being spooled to
     * the printer. The service implementation will define policy
     * for service interruption and recovery.
     * When the print method returns, printing may not yet have completed as
     * printing may happen asynchronously, perhaps in a different thread.
     * Application clients which  want to monitor the success or failure
     * should register a PrintJobListener.
     *

     * Print service implementors should close any print data streams (ie
     * Reader or InputStream implementations) that they obtain
     * from the client doc. Robust clients may still wish to verify this.
     * An exception is always generated if a DocFlavor cannot
     * be printed.
     *
     * @param doc       The document to be printed. If must be a flavor
     *                                  supported by this PrintJob.
     *
     * @param attributes The job attributes to be applied to this print job.
     *        If this parameter is null then the default attributes are used.
     * @throws PrintException The exception additionally may implement
     * an interface that more precisely describes the cause of the
     * exception
     *

     *
FlavorException.
     *  If the document has a flavor not supported by this print job.
     *
AttributeException.
     *  If one or more of the attributes are not valid for this print job.
     *

     */
    public void print(Doc doc, PrintRequestAttributeSet attributes)
          throws PrintException;

}


text:
namespace BookShop.AcceptanceTests.Support
{
    public class CatalogContext
    {
        public CatalogContext()
        {
            ReferenceBooks = new ReferenceBookList();
        }

        public ReferenceBookList ReferenceBooks { get; set; }
    }
}


text:
package org.apache.cassandra.io.util;

import java.io.Closeable;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.SeekableByteChannel;

import com.google.common.base.Preconditions;

/**
 * Rough equivalent of BufferedInputStream and DataInputStream wrapping the input stream of a File or Socket
 * Created to work around the fact that when BIS + DIS delegate to NIO for socket IO they will allocate large
 * thread local direct byte buffers when a large array is used to read.
 *
 * There may also be some performance improvement due to using a DBB as the underlying buffer for IO and the removal
 * of some indirection and delegation when it comes to reading out individual values, but that is not the goal.
 *
 * Closing NIODataInputStream will invoke close on the ReadableByteChannel provided at construction.
 *
 * NIODataInputStream is not thread safe.
 */
public class NIODataInputStream extends InputStream implements DataInput, Closeable
{
    private final ReadableByteChannel rbc;
    private ByteBuffer buf;

    public NIODataInputStream(ReadableByteChannel rbc, int bufferSize)
    {
        Preconditions.checkNotNull(rbc);
        Preconditions.checkArgument(bufferSize >= 8, "Buffer size must be large enough to accomadate a long/double");
        this.rbc = rbc;
        buf = ByteBuffer.allocateDirect(bufferSize);
        buf.position(0);
        buf.limit(0);
    }

    @Override
    public void readFully(byte[] b) throws IOException
    {
        readFully(b, 0, b.length);
    }

    @Override
    public void readFully(byte[] b, int off, int len) throws IOException
    {
        int copied = 0;
        while (copied < len)
        {
            int read = read(b, off + copied, len - copied);
            if (read < 0)
                throw new EOFException();
            copied += read;
        }
    }

    @Override
    public int read(byte b[], int off, int len) throws IOException {
        if (b == null)
            throw new NullPointerException();

        // avoid int overflow
        if (off < 0 || off > b.length || len < 0
                || len > b.length - off)
            throw new IndexOutOfBoundsException();

        if (len == 0)
            return 0;

        int copied = 0;
        while (copied < len)
        {
            if (buf.hasRemaining())
            {
                int toCopy = Math.min(len - copied, buf.remaining());
                buf.get(b, off + copied, toCopy);
                copied += toCopy;
            }
            else
            {
                int read = readNext();
                if (read < 0 && copied == 0) return -1;
                if (read <= 0) return copied;
            }
        }

        return copied;
    }

    /*
     * Refill the buffer, preserving any unread bytes remaining in the buffer
     */
    private int readNext() throws IOException
    {
        Preconditions.checkState(buf.remaining() != buf.capacity());
        assert(buf.remaining() < 8);

        /*
         * If there is data already at the start of the buffer, move the position to the end
         * If there is data but not at the start, move it to the start
         * Otherwise move the position to 0 so writes start at the beginning of the buffer
         *
         * We go to the trouble of shuffling the bytes remaining for cases where the buffer isn't fully drained
         * while retrieving a multi-byte value while the position is in the middle.
         */
        if (buf.position() == 0 && buf.hasRemaining())
        {
            buf.position(buf.limit());
        }
        else if (buf.hasRemaining())
        {
            ByteBuffer dup = buf.duplicate();
            buf.clear();
            buf.put(dup);
        }
        else
        {
            buf.position(0);
        }

        buf.limit(buf.capacity());

        int read = 0;
        while ((read = rbc.read(buf)) == 0) {}

        buf.flip();

        return read;
    }

    /*
     * Read at least minimum bytes and throw EOF if that fails
     */
    private void readMinimum(int minimum) throws IOException
    {
        assert(buf.remaining() < 8);
        while (buf.remaining() < minimum)
        {
            int read = readNext();
            if (read == -1)
            {
                //DataInputStream consumes the bytes even if it doesn't get the entire value, match the behavior here
                buf.position(0);
                buf.limit(0);
                throw new EOFException();
            }
        }
    }

    /*
     * Ensure the buffer contains the minimum number of readable bytes
     */
    private void prepareReadPrimitive(int minimum) throws IOException
    {
        if (buf.remaining() < minimum) readMinimum(minimum);
    }

    @Override
    public int skipBytes(int n) throws IOException
    {
        int skipped = 0;

        while (skipped < n)
        {
            int skippedThisTime = (int)skip(n - skipped);
            if (skippedThisTime <= 0) break;
            skipped += skippedThisTime;
        }

        return skipped;
    }

    @Override
    public boolean readBoolean() throws IOException
    {
        prepareReadPrimitive(1);
        return buf.get() != 0;
    }

    @Override
    public byte readByte() throws IOException
    {
        prepareReadPrimitive(1);
        return buf.get();
    }

    @Override
    public int readUnsignedByte() throws IOException
    {
        prepareReadPrimitive(1);
        return buf.get() & 0xff;
    }

    @Override
    public short readShort() throws IOException
    {
        prepareReadPrimitive(2);
        return buf.getShort();
    }

    @Override
    public int readUnsignedShort() throws IOException
    {
        return readShort() & 0xFFFF;
    }

    @Override
    public char readChar() throws IOException
    {
        prepareReadPrimitive(2);
        return buf.getChar();
    }

    @Override
    public int readInt() throws IOException
    {
        prepareReadPrimitive(4);
        return buf.getInt();
    }

    @Override
    public long readLong() throws IOException
    {
        prepareReadPrimitive(8);
        return buf.getLong();
    }

    @Override
    public float readFloat() throws IOException
    {
        prepareReadPrimitive(4);
        return buf.getFloat();
    }

    @Override
    public double readDouble() throws IOException
    {
        prepareReadPrimitive(8);
        return buf.getDouble();
    }

    @Override
    public String readLine() throws IOException
    {
        throw new UnsupportedOperationException();
    }

    @Override
    public String readUTF() throws IOException
    {
        return DataInputStream.readUTF(this);
    }

    @Override
    public void close() throws IOException
    {
        rbc.close();
        FileUtils.clean(buf);
        buf = null;
    }

    @Override
    public int read() throws IOException
    {
        return readUnsignedByte();
    }

    @Override
    public int available() throws IOException
    {
        if (rbc instanceof SeekableByteChannel)
        {
            SeekableByteChannel sbc = (SeekableByteChannel)rbc;
            long remainder = Math.max(0, sbc.size() - sbc.position());
            return (remainder > Integer.MAX_VALUE) ? Integer.MAX_VALUE : (int)(remainder + buf.remaining());
        }
        return buf.remaining();
    }

    @Override
    public void reset() throws IOException
    {
        throw new IOException("mark/reset not supported");
    }

    @Override
    public boolean markSupported()
    {
        return false;
    }
}


text:
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24"
    android:viewportHeight="24"
    android:tint="?attr/colorControlNormal">
  <path
      android:fillColor="@android:color/white"
      android:pathData="M1.075,18.975V5.025H22.925V18.975ZM6.15,16.825H17.85V7.175H6.15Z"/>
</vector>


text:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
	xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
						http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">

	<persistence-unit name="PersistenceUnitFinance"
		transaction-type="JTA">
		<class>com.m4gik.business.model.Finance</class>
		<properties>
			<property name="hibernate.transaction.manager_lookup_class"
				value="com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup" />
			<property name="hibernate.transaction.factory_class"
				value="org.hibernate.transaction.CMTTransactionFactory" />
		</properties>
	</persistence-unit>

	<persistence-unit name="PersistenceUnitWarehouseFinland"
		transaction-type="JTA">
		<class>com.m4gik.business.model.WarehouseFinland</class>
		<properties>
			<property name="hibernate.transaction.manager_lookup_class"
				value="com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup" />
			<property name="hibernate.transaction.factory_class"
				value="org.hibernate.transaction.CMTTransactionFactory" />
		</properties>
	</persistence-unit>

	<persistence-unit name="PersistenceUnitWarehousePoland"
		transaction-type="JTA">
		<class>com.m4gik.business.model.WarehousePoland</class>
		<properties>
			<property name="hibernate.transaction.manager_lookup_class"
				value="com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup" />
			<property name="hibernate.transaction.factory_class"
				value="org.hibernate.transaction.CMTTransactionFactory" />
		</properties>
	</persistence-unit>

</persistence>


text:
[![Build Status](http://jenkins.sonata-nfv.eu/buildStatus/icon?job=son-sp-infrabstract-vim)](http://jenkins.sonata-nfv.eu/job/son-sp-infrabstract-vim)

# VIM Adaptor
The VIM Adaptor is the component of the Infrastructure Abstraction Layer responsible to offer the functionalities of the underlying Virtual Infrastructure Managers to the SONATA Service Platform (SP) modules in a vendor-independent way.
The adaptor can be used to attach virtual infrastructure points of presence (PoP), managed by a VIM. Once the VIM is attached to the SP, it can be used to deploy network services.
VIM from different vendors are connected to the VIM Adaptor using specific VIM Wrapper entities, which are in charge of executing VIM specific tasks that map to the generic functionalities exported to the SP. The integration between southbound interface of the adaptor and the VIM is therefore a responsibility of the Wrapper developer, when it comes to specify the medium and technologies used by adaptor and the VIM to interact, and of the SP operator, when it comes to configure credentials and endpoints to establish the connection. A repository is used to store the registered VIMs configuration and the VIM-dependant information on the deployed and running network services.

### Building
* You can run 'docker build -t vim-adaptor .' in this folder to build the self-contained docker image of the VIM-adaptor

If you prefer to manually build the source code, please consider the following:

* This software is mainly organised as a maven project, so you can run 'mvn build assembly:single' in ./adaptor.
* The OpenStack VIM wrapper makes use of python clients: you can see ./Dockerfile or "Dependencies" section of this README for the needed dependencies.
* This software needs a PostgreSQL database to work. This can be easily provided using the PostgreSQL docker image.  Please check ./docker-compose-test.yml for the needed configuration.

### Dependencies

* Java dependencies:
  * [Java JDK] = 1.8.0
  * [Apache Maven](https://maven.apache.org/) >=3.3.9, "Apache 2.0"
  * [amqp-client](https://www.rabbitmq.com/java-client.html) >=3.6.1, "Apache 2.0"
  * [commons-io](https://commons.apache.org/proper/commons-io/) >= 1.3.2, "Apache 2.0"
  * [jackson-annotations](https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations) >=  2.7.0, "Apache 2.0"
  * [jackson-core](https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core) >= 2.7.5	, "Apache 2.0"
  * [jackson-databind](https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind) >= 2.7.5, "Apache 2.0"
  * [jackson-dataformat-yaml](https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-yaml) >= 2.7.5, "Apache 2.0"
  * [json](http://www.json.org/), 20160212, "The JSON License"
  * [junit](https://mvnrepository.com/artifact/junit/junit/3.8.1) = 4.12 "Eclipse Public License Version 1.0"
  * [mockito-all](https://mvnrepository.com/artifact/org.mockito/mockito-all) >=1.9.5, "MIT"
  * [powermock-api-mockito](https://mvnrepository.com/artifact/org.powermock/powermock-api-mockito) >=1.6.5, "Apache 2.0"
  * [powermock-core](https://mvnrepository.com/artifact/org.powermock/powermock-core) >=1.6.5, "Apache 2.0"
  * [powermock-module-junit4](https://mvnrepository.com/artifact/org.powermock/powermock-module-junit4) >=1.6.5, "Apache 2.0"
  * [postgresql](https://mvnrepository.com/artifact/org.postgresql/postgresql), 9.4.1208.jre7, "The PostgreSQL License"

* Python dependencies
  * [python-pip](https://pypi.python.org/pypi/pip)>=8.1.2, "MIT"
  * [python-dev](http://packages.ubuntu.com/search?keywords=python-dev)
  * [pyaml](https://pypi.python.org/pypi/pyaml) >=15.8.2 (WTFPL)
  * [python-heatclient](https://pypi.python.org/pypi/python-heatclient) >=1.2.0, "Apache 2.0"
  * [python-novaclient](https://pypi.python.org/pypi/python-novaclient) >=4.2.0, "Apache 2.0"
  * [python-keystoneclient](https://pypi.python.org/pypi/python-keystoneclient) >=3.2.0, "Apache 2.0"
  * [python-httplib2](https://pypi.python.org/pypi/httplib2) >=0.9.2, "MIT"
  * [python-setuptools](https://pypi.python.org/pypi/setuptools) >=24.0.3

* General Ubuntu dependencies
  * [librtmp-dev](http://packages.ubuntu.com/precise/librtmp-dev)
  * [libcurl4-gnutls-dev](http://packages.ubuntu.com/trusty/libcurl4-gnutls-dev)
  * [build-essential](http://packages.ubuntu.com/precise/build-essential)

### Contributing

You can contribute to this repository extending the set VIM supported by the adaptor.
The VIM Adaptor architecture is based on VIM wrappers that implement technology dependant processes for deploying and managing VNFs.
You can extend the set of available VIM wrappers creating a subpackage of sonata.kernel.VimAdaptor.wrapper and extending the interfaces therein.

## Usage

This sofware exposes its API through an AMPQ interface implemented with Rabbitmq. In order to use it, the VIM adaptor must be connected to a message broker. Configuration for the connection can be set in ./Dockerfile for docker use, and in broker.config for direct use.

### Test

You can run Unit and Module tests using docker compose. Just run in `son-sp-infrabstract/vim-adaptor/`:

`docker-compose -f docker-compose-test.yml build`
`docker-compose -f docker-compose-test.yml up`

After the test, remember to tear down the compose running:

`docker-compose -f docker-compose-test.yml down`

## License

This Software is published under Apache 2.0 license. Please see the LICENSE file for more details.

## Useful Links

* https://www.openstack.org/ the OpenStack project homepage
* https://pypi.python.org/pypi/pip Python Package Index
* https://maven.apache.org/ Java Maven
* https://www.docker.com/ The Docker project
* https://docs.docker.com/compose/ Docker-compose documentation

---
#### Lead Developers

The following lead developers are responsible for this repository and have admin rights. They can, for example, merge pull requests.

* [Dario Valocchi](https://github.com/DarioValocchi)

#### Feedback-Channel

* You may use the mailing list [sonata-dev@lists.atosresearch.eu](mailto:sonata-dev@lists.atosresearch.eu)
* [GitHub issues](https://github.com/sonata-nfv/son-mano-framework/issues)