text:
#ifndef SCENE_LIGHT_H_INCLUDED
#define SCENE_LIGHT_H_INCLUDED

#include "math/types.h"
#include "scene/entity/entity.h"

namespace eps {
namespace scene {

class light : public entity
{
public:

    SNAPE_VISITABLE(light);

public:

    using entity::entity;

    void set_intensity(const math::vec3 & intensity) { intensity_ = intensity; }
    void set_enabled(bool enable) { enabled_ = enable; }

    const math::vec3 & get_intensity() const { return intensity_; }
    bool get_enabled() const { return enabled_; }

private:

    math::vec3 intensity_ = math::vec3(1.0f, 1.0f, 1.0f);
    bool enabled_ = true;
};

class light_point : public light
{
public:

    SNAPE_VISITABLE(light_point);

public:

    using light::light;

    void  set_range(float range) { range_ = range; }
    float get_range() const { return range_; }

private:

    float range_ = 1.0f;
};

} /* scene */
} /* eps */

#endif // SCENE_LIGHT_H_INCLUDED

redpajama_set_name: RedPajamaGithub


text:
package gnu.javax.sound.midi.alsa;

import javax.sound.midi.MidiUnavailableException;
import javax.sound.midi.Receiver;
import javax.sound.midi.Transmitter;
import gnu.javax.sound.midi.alsa.AlsaMidiDeviceProvider.AlsaPortInfo;

/**
 * ALSA MIDI In Port.
 *
 * @author Anthony Green (green@redhat.com)
 *
 */
public class AlsaInputPortDevice extends AlsaPortDevice
{

  AlsaInputPortDevice (AlsaPortInfo info)
  {
    super(info);
  }

  /* (non-Javadoc)
   * @see javax.sound.midi.MidiDevice#open()
   */
  public void open() throws MidiUnavailableException
  {
    // TODO Auto-generated method stub

  }

  /* (non-Javadoc)
   * @see javax.sound.midi.MidiDevice#close()
   */
  public void close()
  {
    // TODO Auto-generated method stub

  }

  /* (non-Javadoc)
   * @see javax.sound.midi.MidiDevice#isOpen()
   */
  public boolean isOpen()
  {
    // TODO Auto-generated method stub
    return false;
  }

  /* (non-Javadoc)
   * @see javax.sound.midi.MidiDevice#getMicrosecondPosition()
   */
  public long getMicrosecondPosition()
  {
    // TODO Auto-generated method stub
    return 0;
  }

  /* (non-Javadoc)
   * @see javax.sound.midi.MidiDevice#getMaxReceivers()
   */
  public int getMaxReceivers()
  {
    // TODO Auto-generated method stub
    return 0;
  }

  /* (non-Javadoc)
   * @see javax.sound.midi.MidiDevice#getMaxTransmitters()
   */
  public int getMaxTransmitters()
  {
    // TODO Auto-generated method stub
    return 1;
  }

  /* (non-Javadoc)
   * @see javax.sound.midi.MidiDevice#getReceiver()
   */
  public Receiver getReceiver() throws MidiUnavailableException
  {
    // TODO Auto-generated method stub
    return null;
  }

  /* (non-Javadoc)
   * @see javax.sound.midi.MidiDevice#getTransmitter()
   */
  public Transmitter getTransmitter() throws MidiUnavailableException
  {
    return new AlsaTransmitter();
  }
}


text:
    FFPhotos é uma ferramenta para facilitar a procura de suas fotos do flickr no Web.

    No fundo, nada mais é que a busca do google images, mas de uma maneira mais fácil.

Eu uso muito isto pois minhas fotos estão como Creative Commons e muitas pessoas usam para criar conteúdo em blogs ou sites de notícias.

Clique para entrar


text:
@interface SettingsViewController ()
@property (readwrite, nonatomic, strong) UIAlertView *alertView;
@end

@implementation SettingsViewController

- (id)initWithStyle:(UITableViewStyle)style
{
    self = [super initWithStyle:style];
    if (self) {
        self.title = @"更多";
        self.tabBarItem.image = [UIImage imageNamed:@"settings"];
        // Custom initialization
    }
    return self;
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Release any cached data, images, etc that aren't in use.
}

- (void)sendMail
{
    // Email Subject
    NSString *emailTitle = @"北大未名iOS客户端用户反馈";
    // Email Content
    NSString *messageBody = @"";
    // To address
    NSMutableArray *addressArray = [NSMutableArray array];
    [addressArray addObject:@"yingmingfan@gmail.com"];
    [addressArray addObject:@"shengbinmeng@gmail.com"];
    NSArray *toRecipents = addressArray;

    MFMailComposeViewController *mc = [[MFMailComposeViewController alloc] init];
    mc.mailComposeDelegate = self;
    [mc setSubject:emailTitle];
    [mc setMessageBody:messageBody isHTML:NO];
    [mc setToRecipients:toRecipents];

    // Present mail view controller on screen
    [self presentViewController:mc animated:YES completion:NULL];

}

- (void) mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
    switch (result)
    {
        case MFMailComposeResultCancelled:
            NSLog(@"Mail cancelled");
            break;
        case MFMailComposeResultSaved:
            NSLog(@"Mail saved");
            break;
        case MFMailComposeResultSent:
            NSLog(@"Mail sent");
            [BDWMAlertMessage alertMessage:@"感谢您的反馈。我们会尽快答复。"];
            break;
        case MFMailComposeResultFailed:
            NSLog(@"Mail sent failure: %@", [error localizedDescription]);
            break;
        default:
            break;
    }

    // Close the Mail Interface
    [self dismissViewControllerAnimated:YES completion:NULL];
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];

    // Uncomment the following line to preserve selection between presentations.
    // self.clearsSelectionOnViewWillAppear = NO;

    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
}

- (void)viewDidDisappear:(BOOL)animated
{
    [super viewDidDisappear:animated];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
    } else {
        return YES;
    }
}

#pragma mark - Table View delegate and data source

// Customize the number of sections in the table view.
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 5;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if (section == 0) {
        return 1;
    }else if (section == 1) {
        return 1;
    }else if (section == 2) {
        return 3;
    } else if (section == 3) {
        return 1;
    } else if (section == 4){
        return 2;
    }
    return 1;
}

- (void) boolUsePostSuffixStringSwitchChanged:(id)sender {
    UISwitch* switchControl = sender;
    NSLog( @"The switch is %@", switchControl.on ? @"ON" : @"OFF" );
    [BDWMSettings setBoolUsePostSuffixString:switchControl.on];

}

- (void) boolAutoLoginSwitchChanged:(id)sender {
    UISwitch* switchControl = sender;
    NSLog( @"The switch is %@", switchControl.on ? @"ON" : @"OFF" );
    [BDWMSettings setBoolAutoLogin:switchControl.on];

}

// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if ([indexPath section] == 0) {
        UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"DefaultStyleCell"];
        if(cell == nil) {
            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"DefaultStyleCell"];
        }
        if ([indexPath row] == 0) {
            [cell.textLabel setText:@"打开小尾巴"];
            //add a switch
            UISwitch *switchview = [[UISwitch alloc] initWithFrame:CGRectZero];
            [switchview addTarget:self action:@selector(boolUsePostSuffixStringSwitchChanged:) forControlEvents:UIControlEventValueChanged];
            [switchview setOn:[BDWMSettings boolUsePostSuffixString] animated:NO];
            cell.accessoryView = switchview;
        }
        return cell;
    }

    if ([indexPath section] == 1) {
        UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"DefaultStyleCell"];
        if(cell == nil) {
            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"DefaultStyleCell"];
        }
        if ([indexPath row] == 0) {
            [cell.textLabel setText:@"自动登录"];
            //add a switch
            UISwitch *switchview = [[UISwitch alloc] initWithFrame:CGRectZero];
            [switchview addTarget:self action:@selector(boolAutoLoginSwitchChanged:) forControlEvents:UIControlEventValueChanged];
            [switchview setOn:[BDWMSettings boolAutoLogin] animated:NO];
            cell.accessoryView = switchview;
        }
        return cell;
    }

    if ([indexPath section] == 2) {

        UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"Value1StyleCell"];
        if(cell == nil) {
            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"Value1StyleCell"];
        }

        if ([indexPath row] == 0) {
            [cell.textLabel setText:@"关于此应用"];
            cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        }
        if ([indexPath row] == 1) {
            [cell.textLabel setText:@"关于开发者"];
            cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        }
        if ([indexPath row] == 2) {
            [cell.textLabel setText:@"未名站点"];
            [cell.detailTextLabel setText:@"将打开浏览器访问"];
        }
        return cell;
    }

    if ([indexPath section] ==3) {
        UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"DefaultStyleCell"];
        if(cell == nil) {
            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"DefaultStyleCell"];
        }
        if ([indexPath row] == 0) {
            [cell.textLabel setText:@"给我们发邮件"];
        }
        return cell;
    }

    if ([indexPath section] == 4) {
        UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"DefaultStyleCell"];
        if(cell == nil) {
            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"DefaultStyleCell"];
        }
        if([indexPath row] == 0){
            [cell.textLabel setText:@"清空收藏夹"];
        }else if([indexPath row] == 1){
            [cell.textLabel setText:@"清空个人设置"];
        }
        return cell;
    }

    return nil;
}

- (NSString *)tableView:(UITableView*)tableView titleForHeaderInSection:(NSInteger)section {
    NSString *header = @"";
    if (section == 0) {
        header = @"设置";
    }
    if (section == 1) {
        header = @"";
    }
    if (section == 2) {
        header = @"关于";
    }
    if (section == 3) {
        header = @"反馈";
    }
    if (section == 4){
        header = @"高级设置";
    }
    return header;
}

- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section
{
    NSString *footerText = @"";
    if (section == 0) {
        footerText = [NSString stringWithFormat:@"打开小尾巴就是在您发布的消息结尾加上"发自我的北大未名iOS客户端"字样"];
    }
    if (section == 1) {
        footerText = [NSString stringWithFormat:@"开启自动登录后,应用会在启动时自动登录您的账号"];
    }
    if (section == 4) {
        footerText = [NSString stringWithFormat:@"高级设置,请谨慎使用"];
    }
    return footerText;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tableView deselectRowAtIndexPath:indexPath animated:YES];

    if ([indexPath section] == 2) {
        if ([indexPath row] == 0) {
            WebViewController *aboutViewController = [[WebViewController alloc] init];
            aboutViewController.webAddress = @"http://unibbs.sinaapp.com/bdwm";
            aboutViewController.barTitle = @"关于此应用";
            [self.navigationController pushViewController:aboutViewController animated:YES];
            return;
        }
        if ([indexPath row] == 1) {
            WebViewController *aboutViewController = [[WebViewController alloc] init];
            aboutViewController.webAddress = @"http://unibbs.sinaapp.com/authors";
            aboutViewController.barTitle = @"关于开发者";
            [self.navigationController pushViewController:aboutViewController animated:YES];
            return;
        }
        if ([indexPath row] == 2) {
            [[UIApplication sharedApplication] openURL:[[NSURL alloc] initWithString:@"https://bbs.pku.edu.cn"]];
            return;
        }
    }

    if ([indexPath section] == 3) {
        if ([indexPath row] ==0) {
            [self sendMail];
            return;
        }
    }

    if ([indexPath section] == 4){
        self.alertView = [[UIAlertView alloc] initWithTitle:@"警告"
                                             message:@"message"
                                            delegate:self
                                   cancelButtonTitle:@"取消"
                                   otherButtonTitles:@"确定",nil];
        if ([indexPath row] ==0 ) {
            self.alertView.tag = 0;
            self.alertView.message = @"确定清空收藏夹?";
            [self.alertView show];
            return;
        }else if([indexPath row] == 1){
            //delete user setting cache.
            self.alertView.tag = 1;
            self.alertView.message = @"确定清空个人设置?";
            [self.alertView show];
        }
    }
}

-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    switch (alertView.tag) {
        case 0:
            if (buttonIndex==1) {
                [DatabaseWrapper deleteDatabase];
                NSLog(@"db file deleted");
            }
            break;
        case 1:
            if (buttonIndex==1) {
                //todo: support multi-user
                //current version is the same as logout.
                [BDWMUserModel logout];
                NSLog(@"db user setting deleted");
            }
            break;
        default:
            break;
    }
}

@end


text:
package com.peth.towerdefense;

import org.andengine.entity.sprite.Sprite;
import org.andengine.opengl.texture.region.ITextureRegion;
import org.andengine.opengl.vbo.VertexBufferObjectManager;

public class WayPoint extends Sprite {

	// texture constants
	public static final ITextureRegion TEXTURE = TowerDefense.TEXTURE_WAYPOINT;

	// globals
	public float mCenterX;
	public float mCenterY;

	public WayPoint(float x, float y, VertexBufferObjectManager pVertexBufferObjectManager) {

		// superconstructor
		super(x - (TEXTURE.getWidth() / 2), y - (TEXTURE.getHeight() / 2), TEXTURE, pVertexBufferObjectManager);

		// set variables
		mCenterX = getX() + (TEXTURE.getWidth() / 2);
		mCenterY = getY() + (TEXTURE.getHeight() / 2);

		// set visibility
		setVisible(false);

		// attach
		TowerDefense.mSceneManager.getCurrentLevel().attachChild(this);

	}

}


text:
@interface MTRegionView : UIScrollView

@property (strong, nonatomic) NSArray *regions;

@end


text:
package net.uiqui.couchdb.api;

import com.google.gson.annotations.SerializedName;

public class TypedDocument extends Document {
    @SerializedName("type")
    private final String documentType;

    public TypedDocument() {
        super();
        this.documentType = documentType();
    }

    public TypedDocument(final String id) {
        super(id);
        this.documentType = documentType();
    }

    public TypedDocument(final String id, final String revision) {
        super(id, revision);
        this.documentType = documentType();
    }

    public String getDocumentType() {
        return documentType;
    }

    private String documentType() {
        return this.getClass().getSimpleName();
    }
}


text:
HOSTPROGNAME=	${_TOOL_PREFIX}asn1_compile
HOST_SRCDIR=	crypto/external/bsd/heimdal/lib/libasn1/asn1_compile

.include "${.CURDIR}/../Makefile.host"


text: Ansible role for creating servers at a cloud provider


text:
package com.facebook.rendercore;

import android.graphics.Rect;
import androidx.annotation.Nullable;
import com.facebook.proguard.annotations.DoNotStrip;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

@DoNotStrip
public class RenderTreeNode {

  private static final int DEFAULT_SIZE = 4;

  private final @Nullable RenderTreeNode mParent;
  private final RenderUnit mRenderUnit;
  private final @Nullable Object mLayoutData;
  private final Rect mBounds;
  private final int mAbsoluteX;
  private final int mAbsoluteY;
  private final @Nullable Rect mResolvedPadding;

  final int mPositionInParent;

  private List<RenderTreeNode> mChildren;

  public RenderTreeNode(
      final @Nullable RenderTreeNode parent,
      final RenderUnit renderUnit,
      final @Nullable Object layoutData,
      final Rect bounds,
      final @Nullable Rect resolvedPadding,
      final int positionInParent) {
    mParent = parent;
    mRenderUnit = renderUnit;
    mLayoutData = layoutData;
    mBounds = bounds;
    mAbsoluteX = parent != null ? parent.getAbsoluteX() + bounds.left : bounds.left;
    mAbsoluteY = parent != null ? parent.getAbsoluteY() + bounds.top : bounds.top;
    mResolvedPadding = resolvedPadding;
    mPositionInParent = positionInParent;
  }

  public void child(RenderTreeNode renderTreeNode) {
    if (mChildren == null) {
      mChildren = new ArrayList<>(DEFAULT_SIZE);
    }

    mChildren.add(renderTreeNode);
  }

  public Rect getBounds() {
    return mBounds;
  }

  public int getAbsoluteX() {
    return mAbsoluteX;
  }

  public int getAbsoluteY() {
    return mAbsoluteY;
  }

  /**
   * Sets the absolutes bounds of this render tree node in {@param outRect}; i.e. returns the bounds
   * of this render tree node within its {@link RootHost}.
   *
   * @param outRect the calculated absolute bounds.
   */
  public Rect getAbsoluteBounds(Rect outRect) {
    outRect.left = mAbsoluteX;
    outRect.top = mAbsoluteY;
    outRect.right = mAbsoluteX + mBounds.width();
    outRect.bottom = mAbsoluteY + mBounds.height();

    return outRect;
  }

  @Nullable
  public Rect getResolvedPadding() {
    return mResolvedPadding;
  }

  public RenderUnit getRenderUnit() {
    return mRenderUnit;
  }

  @Nullable
  public RenderTreeNode getParent() {
    return mParent;
  }

  public int getChildrenCount() {
    return mChildren != null ? mChildren.size() : 0;
  }

  public RenderTreeNode getChildAt(int idx) {
    return mChildren.get(idx);
  }

  public int getPositionInParent() {
    return mPositionInParent;
  }

  @Nullable
  public Object getLayoutData() {
    return mLayoutData;
  }

  public String generateDebugString(@Nullable RenderTree tree) {
    final long id = mRenderUnit.getId();
    final String contentType = mRenderUnit.getDescription();
    final int index = tree != null ? tree.getRenderTreeNodeIndex(mRenderUnit.getId()) : -1;
    final String bounds = mBounds.toShortString();
    final int childCount = getChildrenCount();
    final long parentId = mParent != null ? mParent.getRenderUnit().getId() : -1;

    return String.format(
        Locale.US,
        "Id=%d; renderUnit='%s'; indexInTree=%d; posInParent=%d; bounds=%s; absPosition=[%d, %d]; childCount=%d; parentId=%d;",
        id,
        contentType,
        index,
        mPositionInParent,
        bounds,
        mAbsoluteX,
        mAbsoluteY,
        childCount,
        parentId);
  }
}


text:
#ifndef AVCODEC_VDPAU_INTERNAL_H
#define AVCODEC_VDPAU_INTERNAL_H

#include "config.h"
#include <stdint.h>
#if CONFIG_VDPAU
#include <vdpau/vdpau.h>
#endif
#include "h264.h"

#include "libavutil/frame.h"

#include "avcodec.h"
#include "mpeg4video.h"

/** Extract VdpVideoSurface from an AVFrame */
static inline uintptr_t ff_vdpau_get_surface_id(AVFrame *pic)
{
    return (uintptr_t)pic->data[3];
}

struct vdpau_picture_context;
#if CONFIG_VDPAU
union VDPAUPictureInfo {
    VdpPictureInfoH264        h264;
    VdpPictureInfoMPEG1Or2    mpeg;
    VdpPictureInfoVC1          vc1;
    VdpPictureInfoMPEG4Part2 mpeg4;
#ifdef VDP_DECODER_PROFILE_H264_HIGH_444_PREDICTIVE
    VdpPictureInfoH264Predictive h264_predictive;
#endif
};

#include "vdpau.h"

typedef struct VDPAUHWContext {
    AVVDPAUContext context;
    VdpDevice device;
    VdpGetProcAddress *get_proc_address;
    char reset;
    unsigned char flags;
} VDPAUHWContext;

typedef struct VDPAUContext {
    /**
     * VDPAU device handle
     */
    VdpDevice device;

    /**
     * VDPAU decoder handle
     */
    VdpDecoder decoder;

    /**
     * VDPAU device driver
     */
    VdpGetProcAddress *get_proc_address;

    /**
     * VDPAU decoder render callback
     */
    VdpDecoderRender *render;

    uint32_t width;
    uint32_t height;
} VDPAUContext;

struct vdpau_picture_context {
    /**
     * VDPAU picture information.
     */
    union VDPAUPictureInfo info;

    /**
     * Allocated size of the bitstream_buffers table.
     */
    int bitstream_buffers_allocated;

    /**
     * Useful bitstream buffers in the bitstream buffers table.
     */
    int bitstream_buffers_used;

   /**
     * Table of bitstream buffers.
     */
    VdpBitstreamBuffer *bitstream_buffers;
};

int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile,
                         int level);
#endif //CONFIG_VDPAU

int ff_vdpau_common_uninit(AVCodecContext *avctx);

int ff_vdpau_common_start_frame(struct vdpau_picture_context *pic,
                                const uint8_t *buffer, uint32_t size);
int ff_vdpau_common_end_frame(AVCodecContext *avctx, AVFrame *frame,
                              struct vdpau_picture_context *pic);
int ff_vdpau_mpeg_end_frame(AVCodecContext *avctx);
int ff_vdpau_add_buffer(struct vdpau_picture_context *pic, const uint8_t *buf,
                        uint32_t buf_size);

void ff_vdpau_add_data_chunk(uint8_t *data, const uint8_t *buf,
                             int buf_size);

void ff_vdpau_mpeg_picture_complete(MpegEncContext *s, const uint8_t *buf,
                                    int buf_size, int slice_count);

void ff_vdpau_h264_picture_start(H264Context *h);
void ff_vdpau_h264_set_reference_frames(H264Context *h);
void ff_vdpau_h264_picture_complete(H264Context *h);

void ff_vdpau_vc1_decode_picture(MpegEncContext *s, const uint8_t *buf,
                                 int buf_size);

void ff_vdpau_mpeg4_decode_picture(Mpeg4DecContext *s, const uint8_t *buf,
                                   int buf_size);

#endif /* AVCODEC_VDPAU_INTERNAL_H */


text:
package com.example.g11f0364.graemesappfortestingstuff;

import android.app.Application;
import android.test.ApplicationTestCase;

/**
 * Testing Fundamentals
 */
public class ApplicationTest extends ApplicationTestCase<Application> {
    public ApplicationTest() {
        super(Application.class);
    }
}


text:
package socket_listener

import (
	"bytes"
	"crypto/tls"
	"io/ioutil"
	"log"
	"net"
	"os"
	"path/filepath"
	"testing"
	"time"

	"github.com/influxdata/telegraf/testutil"
	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
)

var pki = testutil.NewPKI("../../../testutil/pki")

// testEmptyLog is a helper function to ensure no data is written to log.
// Should be called at the start of the test, and returns a function which should run at the end.
func testEmptyLog(t *testing.T) func() {
	buf := bytes.NewBuffer(nil)
	log.SetOutput(buf)

	return func() {
		log.SetOutput(os.Stderr)
		assert.Empty(t, string(buf.Bytes()), "log not empty")
	}
}

func TestSocketListener_tcp_tls(t *testing.T) {
	defer testEmptyLog(t)()

	sl := newSocketListener()
	sl.ServiceAddress = "tcp://127.0.0.1:0"
	sl.ServerConfig = *pki.TLSServerConfig()

	acc := &testutil.Accumulator{}
	err := sl.Start(acc)
	require.NoError(t, err)
	defer sl.Stop()

	tlsCfg, err := pki.TLSClientConfig().TLSConfig()
	require.NoError(t, err)

	secureClient, err := tls.Dial("tcp", sl.Closer.(net.Listener).Addr().String(), tlsCfg)
	require.NoError(t, err)

	testSocketListener(t, sl, secureClient)
}

func TestSocketListener_unix_tls(t *testing.T) {
	tmpdir, err := ioutil.TempDir("", "telegraf")
	require.NoError(t, err)
	defer os.RemoveAll(tmpdir)
	sock := filepath.Join(tmpdir, "sl.TestSocketListener_unix_tls.sock")

	sl := newSocketListener()
	sl.ServiceAddress = "unix://" + sock
	sl.ServerConfig = *pki.TLSServerConfig()

	acc := &testutil.Accumulator{}
	err = sl.Start(acc)
	require.NoError(t, err)
	defer sl.Stop()

	tlsCfg, err := pki.TLSClientConfig().TLSConfig()
	tlsCfg.InsecureSkipVerify = true
	require.NoError(t, err)

	secureClient, err := tls.Dial("unix", sock, tlsCfg)
	require.NoError(t, err)

	testSocketListener(t, sl, secureClient)
}

func TestSocketListener_tcp(t *testing.T) {
	defer testEmptyLog(t)()

	sl := newSocketListener()
	sl.ServiceAddress = "tcp://127.0.0.1:0"
	sl.ReadBufferSize = 1024

	acc := &testutil.Accumulator{}
	err := sl.Start(acc)
	require.NoError(t, err)
	defer sl.Stop()

	client, err := net.Dial("tcp", sl.Closer.(net.Listener).Addr().String())
	require.NoError(t, err)

	testSocketListener(t, sl, client)
}

func TestSocketListener_udp(t *testing.T) {
	defer testEmptyLog(t)()

	sl := newSocketListener()
	sl.ServiceAddress = "udp://127.0.0.1:0"
	sl.ReadBufferSize = 1024

	acc := &testutil.Accumulator{}
	err := sl.Start(acc)
	require.NoError(t, err)
	defer sl.Stop()

	client, err := net.Dial("udp", sl.Closer.(net.PacketConn).LocalAddr().String())
	require.NoError(t, err)

	testSocketListener(t, sl, client)
}

func TestSocketListener_unix(t *testing.T) {
	tmpdir, err := ioutil.TempDir("", "telegraf")
	require.NoError(t, err)
	defer os.RemoveAll(tmpdir)
	sock := filepath.Join(tmpdir, "sl.TestSocketListener_unix.sock")

	defer testEmptyLog(t)()

	os.Create(sock)
	sl := newSocketListener()
	sl.ServiceAddress = "unix://" + sock
	sl.ReadBufferSize = 1024

	acc := &testutil.Accumulator{}
	err = sl.Start(acc)
	require.NoError(t, err)
	defer sl.Stop()

	client, err := net.Dial("unix", sock)
	require.NoError(t, err)

	testSocketListener(t, sl, client)
}

func TestSocketListener_unixgram(t *testing.T) {
	tmpdir, err := ioutil.TempDir("", "telegraf")
	require.NoError(t, err)
	defer os.RemoveAll(tmpdir)
	sock := filepath.Join(tmpdir, "sl.TestSocketListener_unixgram.sock")

	defer testEmptyLog(t)()

	os.Create(sock)
	sl := newSocketListener()
	sl.ServiceAddress = "unixgram://" + sock
	sl.ReadBufferSize = 1024

	acc := &testutil.Accumulator{}
	err = sl.Start(acc)
	require.NoError(t, err)
	defer sl.Stop()

	client, err := net.Dial("unixgram", sock)
	require.NoError(t, err)

	testSocketListener(t, sl, client)
}

func testSocketListener(t *testing.T, sl *SocketListener, client net.Conn) {
	mstr12 := "test,foo=bar v=1i 123456789\ntest,foo=baz v=2i 123456790\n"
	mstr3 := "test,foo=zab v=3i 123456791"
	client.Write([]byte(mstr12))
	client.Write([]byte(mstr3))
	if _, ok := client.(net.Conn); ok {
		// stream connection. needs trailing newline to terminate mstr3
		client.Write([]byte{'\n'})
	}

	acc := sl.Accumulator.(*testutil.Accumulator)

	acc.Wait(3)
	acc.Lock()
	m1 := acc.Metrics[0]
	m2 := acc.Metrics[1]
	m3 := acc.Metrics[2]
	acc.Unlock()

	assert.Equal(t, "test", m1.Measurement)
	assert.Equal(t, map[string]string{"foo": "bar"}, m1.Tags)
	assert.Equal(t, map[string]interface{}{"v": int64(1)}, m1.Fields)
	assert.True(t, time.Unix(0, 123456789).Equal(m1.Time))

	assert.Equal(t, "test", m2.Measurement)
	assert.Equal(t, map[string]string{"foo": "baz"}, m2.Tags)
	assert.Equal(t, map[string]interface{}{"v": int64(2)}, m2.Fields)
	assert.True(t, time.Unix(0, 123456790).Equal(m2.Time))

	assert.Equal(t, "test", m3.Measurement)
	assert.Equal(t, map[string]string{"foo": "zab"}, m3.Tags)
	assert.Equal(t, map[string]interface{}{"v": int64(3)}, m3.Fields)
	assert.True(t, time.Unix(0, 123456791).Equal(m3.Time))
}


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

// Copyright 2008 Google Inc. All Rights Reserved.

/**
 * @fileoverview Represents a line in 2D space.
 *
 */

goog.provide('goog.math.Line');

goog.require('goog.math');
goog.require('goog.math.Coordinate');

/**
 * Object representing a line.
 * @param {number} x0 X coordinate of the start point.
 * @param {number} y0 Y coordinate of the start point.
 * @param {number} x1 X coordinate of the end point.
 * @param {number} y1 Y coordinate of the end point.
 * @constructor
 */
goog.math.Line = function(x0, y0, x1, y1) {
  /**
   * X coordinate of the first point.
   * @type {number}
   */
  this.x0 = x0;

  /**
   * Y coordinate of the first point.
   * @type {number}
   */
  this.y0 = y0;

  /**
   * X coordinate of the first control point.
   * @type {number}
   */
  this.x1 = x1;

  /**
   * Y coordinate of the first control point.
   * @type {number}
   */
  this.y1 = y1;
};

/**
 * @return {goog.math.Line} A copy of this line.
 */
goog.math.Line.prototype.clone = function() {
  return new goog.math.Line(this.x0, this.y0, this.x1, this.y1);
};

/**
 * Tests whether the given line is exactly the same as this one.
 * @param {goog.math.Line} other The other line.
 * @return {boolean} Whether the given line is the same as this one.
 */
goog.math.Line.prototype.equals = function(other) {
  return this.x0 == other.x0 && this.y0 == other.y0 &&
         this.x1 == other.x1 && this.y1 == other.y1;
};

/**
 * @return {number} The squared length of the line segment used to define the
 *     line.
 */
goog.math.Line.prototype.getSegmentLengthSquared = function() {
  var xdist = this.x1 - this.x0;
  var ydist = this.y1 - this.y0;
  return xdist * xdist + ydist * ydist;
};

/**
 * @return {number} The length of the line segment used to define the line.
 */
goog.math.Line.prototype.getSegmentLength = function() {
  return Math.sqrt(this.getSegmentLengthSquared());
};

/**
 * Computes the point on the line closest to a given point.
 * @param {number|goog.math.Coordinate} x The x coordinate of the point, or
 *     a coordinate object.
 * @param {number} opt_y The y coordinate of the point - required if x is a
 *     number, ignored if x is a goog.math.Coordinate.
 * @return {goog.math.Coordinate} The point on the line closest to the given
 *     point.
 */
goog.math.Line.prototype.getClosestPoint = function(x, opt_y) {
  var y;
  if (x instanceof goog.math.Coordinate) {
    y = x.y;
    x = x.x;
  } else {
    y = opt_y;
  }

  var x0 = this.x0;
  var y0 = this.y0;

  var xChange = this.x1 - x0;
  var yChange = this.y1 - y0;

  var u = ((x - x0) * xChange + (y - y0) * yChange) /
              this.getSegmentLengthSquared();

  return new goog.math.Coordinate(x0 + u * xChange, y0 + u * yChange);
};


text:
package de.zazaz.iot.bosch.indego.srvmock.service;

public interface ContextHandlerService {

    IndegoContext createContextForUser (String userId) throws IndegoServiceException;

    void deleteContext (String contextId) throws IndegoServiceException;

}


text:
package org.apache.skywalking.oap.server.core.storage.profile;

import java.io.IOException;
import java.util.List;
import org.apache.skywalking.oap.server.core.query.type.ProfileTaskLog;
import org.apache.skywalking.oap.server.core.storage.DAO;

/**
 * process all profile task log query
 */
public interface IProfileTaskLogQueryDAO extends DAO {

    /**
     * search all task log list in appoint profile task id
     */
    List<ProfileTaskLog> getTaskLogList() throws IOException;

}


text:
extern crate iron;
#[macro_use] extern crate mime;

use iron::prelude::*;
use iron::status;

extern crate router;
use router::Router;

fn main() {
    let mut router = Router::new();

    router.get("/", get_form);
    router.post("/gcd", post_gcd);

    println!("Serving on http://0.0.0.0:3000...");
    Iron::new(router).http("0.0.0.0:3000").unwrap();
}

#[allow(unused_variables)]
fn get_form(request: &mut Request) -> IronResult<Response> {
    let mut response = Response::new();

    response.set_mut(status::Ok);
    response.set_mut(mime!(Text/Html; Charset=Utf8));
    response.set_mut(r#"
        <title>GCD Calculator</title>
        <form action="/gcd" method="post">
            <input type="text" name="n" />
            <input type="text" name="n" />
            <button type="submit">Compute GCD</button>
        </form>
    "#);

    Ok(response)
}

extern crate urlencoded;

use std::str::FromStr;
use urlencoded::UrlEncodedBody;

// get the numbers from the post and compute their gcd
fn post_gcd(request: &mut Request) -> IronResult<Response> {
    let mut response = Response::new();

    let hashmap;
    match request.get_ref::<UrlEncodedBody>() {
        Err(e) => {
            response.set_mut(status::BadRequest);
            response.set_mut(format!("Error parsing form data: {:?}\n", e));
            return Ok(response);
        }
        Ok(map) => {
            hashmap = map;
        }
    }

    let unparsed_numbers;
    match hashmap.get("n") {
        None => {
            response.set_mut(status::BadRequest);
            response.set_mut(format!("form data has no 'n' parameter\n"));
            return Ok(response);
        }
        Some(nums) => {
            unparsed_numbers = nums;
        }
    }

    let mut numbers = Vec::new();
    for unparsed in unparsed_numbers {
        match u64::from_str(&unparsed) {
            Err(_) => {
                response.set_mut(status::BadRequest);
                response.set_mut(format!("Value for 'n' parameter not a number: {:?}\n", unparsed));
                return Ok(response);
            }
            Ok(n) => {
                numbers.push(n);
            }
        }
    }

    let mut d = numbers[0];
    for m in &numbers[1..] {
        d = gcd(d, *m);
    }

    response.set_mut(status::Ok);
    response.set_mut(mime!(Text/Html; Charset=Utf8));
    response.set_mut(format!("The greatest common divisor of the numbers {:?} is <b>{}</b>\n", numbers, d));
    Ok(response)
}

// Euclid's gcd algorithm
fn gcd(mut n: u64, mut m: u64) -> u64 {
    assert!(n != 0 && m != 0);
    while m != 0 {
        if m < n {
            let t = m; m = n; n = t;
        }
        m = m % n;
    }
    n
}


text:
<?php

namespace ZendTest\Paginator\Adapter;

use Zend\Paginator\Adapter;

/**
 * @category   Zend
 * @package    Zend_Paginator
 * @subpackage UnitTests
 * @group      Zend_Paginator
 */
class DbTableSelectTest extends \ZendTest\Paginator\Adapter\DbSelectTest
{
    /**
     * @group ZF-3775
     */
    public function testSelectDoesReturnZendDbTableRowset()
    {
        $query   = $this->_table->select();
        $adapter = new Adapter\DbTableSelect($query);
        $items   = $adapter->getItems(0, 10);

        $this->assertInstanceOf('Zend\\Db\\Table\\Rowset', $items);
    }

    public function testToJsonWithRowset()
    {
        $query   = $this->_table->select();
        $paginator = new \Zend\Paginator\Paginator(new Adapter\DbTableSelect($query));
        $this->assertGreaterThan(2, strlen($paginator->toJson()));
    }
}


text:
/*
 * Written for: Bootstrap Wishlist v0.1.2
 * Author: Mahmoud Elmhadi
 * Author Url: elmahdim.com
 * Twitter   : @ElmahdiMahmoud
 * Licensed under http://opensource.org/licenses/MIT
 */

.preview-image {
   width:140px;
   height:140px;
   line-height:140px;
   border-radius:6px;
   overflow:hidden;
   background:#f0f0f0;
   position:relative;
   text-align:center
}
.preview-image img {
   margin:auto;
   max-width:100%;
   position:absolute;
   top:0;
   right:0;
   bottom:0;
   left:0
}
.preview-image:hover .upload-btn .upload-btn { display:block }
.preview-image .upload-btn {
   width:100px;
   height:40px;
   position:absolute;
   top:50%;
   left:50%;
   margin:-20px 0 0 -50px
}
.preview-image .upload-btn .upload-btn {
   display:none;
   width:100px;
   height:40px;
   position:absolute;
   top:50%;
   left:50%;
   margin:-20px 0 0 -50px
}
.preview-image .upload-btn .input-file {
   opacity:0;
   z-index:5;
   position:absolute;
   left:-95%;
   padding:7px;
   cursor:pointer
}
.alert.alert-outline { background-color:transparent }
.alert.alert-outline.alert-default { color:inherit }
.alert.alert-outline.alert-primary { color:#428bca }
.alert.alert-outline.alert-success { color:#5cb85c }
.alert.alert-outline.alert-info { color:#5bc0de }
.alert.alert-outline.alert-warning { color:#f0ad4e }
.alert.alert-outline.alert-danger { color:#d9534f }
.btn.btn-outline,
.btn.btn-outline:hover,
.btn.btn-outline:active,
.btn.btn-outline:focus { background-color:transparent }
.btn.btn-outline.btn-default { color:inherit }
.btn.btn-outline.btn-primary { color:#428bca }
.btn.btn-outline.btn-success { color:#5cb85c }
.btn.btn-outline.btn-info { color:#5bc0de }
.btn.btn-outline.btn-warning { color:#f0ad4e }
.btn.btn-outline.btn-danger { color:#d9534f }
.avatar.avatar-rounded {
   -webkit-border-radius:4px;
   -moz-border-radius:4px;
   -ms-border-radius:4px;
   -o-border-radius:4px;
   border-radius:4px
}
.avatar.avatar-circle {
   -webkit-border-radius:100%;
   -moz-border-radius:100%;
   -ms-border-radius:100%;
   -o-border-radius:100%;
   border-radius:100%
}
.avatar.avatar-xs {
   width:20px;
   height:20px
}
.avatar.avatar-sm {
   width:40px;
   height:40px
}
.avatar.avatar-md {
   width:160px;
   height:160px
}
.avatar.avatar-lg {
   width:200px;
   height:200px
}
.row.eq-cols [class*="col-xs"] {
   float:none;
   display:table-cell;
   vertical-align:top
}
.row.eq-cols { display:table }
.row.eq-cols [class*="col"].valign-mid { vertical-align:middle }
.text-uc { text-transform:uppercase }
.center-it {
   float:none !important;
   margin-right:auto !important;
   margin-left:auto !important
}
@media (min-width: 1200px) {
	.pull-right-lg { float:right }
	.pull-left-lg { float:left }
}
@media (min-width: 998px) {
	.pull-right-md { float:right }
	.pull-left-md { float:left }
}
@media (min-width: 768px) {
	.pull-right-sm { float:right }
	.pull-left-sm { float:left }
}
.input-group .btn,
.input-group .form-control {
   height:34px;
   -webkit-transition:none 1s;
   -moz-transition:none 1s;
   -o-transition:none 1s;
   transition:none 1s
}
.input-group.default-input-group .form-control { border-right:0 }
.input-group.default-input-group .form-control+.input-group-btn .btn { border-left:0 }
.input-group.default-input-group .form-control:focus {
   -webkit-box-shadow:none;
   -moz-box-shadow:none;
   box-shadow:none
}
.input-group.default-input-group .form-control:focus+.input-group-btn .btn {
   outline:0;
   border-color:#66afe9
}
.input-group.prev-input-group { width:100% }
.input-group.prev-input-group input.form-control {
   float:right;
   width:87%;
   border-top-left-radius:0;
   border-bottom-left-radius:0;
   border-top-right-radius:4px;
   border-bottom-right-radius:4px;
   border-left:0
}
.input-group.prev-input-group input.form-control+span .btn {
   border-top-left-radius:4px;
   border-width:1px 0 1px 1px;
   border-bottom-left-radius:4px
}
.input-group.prev-input-group input.form-control:focus {
   -webkit-box-shadow:none;
   -moz-box-shadow:none;
   box-shadow:none
}
.input-group.prev-input-group input.form-control:focus+.input-group-btn .btn {
   outline:0;
   border-color:#66afe9
}
.input-group.prev-input-group .input-group-btn {
   float:left;
   width:13%
}
.input-group.prev-input-group .input-group-btn .btn {
   margin:0;
   width:100%;
   border-left:1px solid #ccc;
   border-top-right-radius:0;
   border-bottom-right-radius:0
}
.input-group .input-group-btn .btn:hover {
   border-color:#ccc;
   background-color:inherit
}
@media (max-width: 992px) {
	.responsive-table .table-header { display:none }
	.responsive-table td {
	   display:block;
	   text-align:left;
	   line-height:100%;
	   border-width:0 !important
	}
	.responsive-table td+td { border-top:1px solid #ddd !important }
	.responsive-table td:nth-child(odd) { background-color:#f9f9f9 }
	.responsive-table td:before {
	   font-weight:bold;
	   display:inline-block;
	   content:attr(data-th) ": "
}
}


text:
'use strict';

var through = require('through2');
var gutil = require('gulp-util');
var exec = require('child_process').exec;
var escape = require('any-shell-escape');

module.exports = function (opt) {
  if (!opt) opt = {};
  if (!opt.args) opt.args = ' ';

  var paths = [];
  var files = [];
  var fileCwd = process.cwd;

  var write = function(file, enc, cb) {
    paths.push(file.path);
    files.push(file);
    fileCwd = file.cwd;
    cb();
  };

  var flush = function(cb) {
    var cwd = opt.cwd || fileCwd;

    var cmd = 'git add ' + escape(paths) + ' ' + opt.args;
    var that = this;
    exec(cmd, {cwd: cwd}, function(err, stdout, stderr){
      if (err) cb(err);
      if (!opt.quiet) gutil.log(stdout, stderr);
      files.forEach(that.push.bind(that));
	    that.emit('end');
      cb();
    });
  };

  return through.obj(write, flush);
};


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

<configuration scan="true" debug="false">

  <appender name="FILE" class="ch.qos.logback.core.FileAppender">
    <file>/Users/okrook/lz/logs/output.log</file>

    <encoder>
      <pattern>%date %level [%thread] %logger{10} [%file:%line] %msg%n</pattern>
    </encoder>
  </appender>

  <logger name="org.apache.camel.component.mongodb.converters.MongoDbBasicConverters" level="OFF" />

  <root level="info">
    <appender-ref ref="FILE" />
  </root>

</configuration>


text:
"""Auto-generated file, do not edit by hand. FO metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata

PHONE_METADATA_FO = PhoneMetadata(id='FO', country_code=298, international_prefix='00',
    general_desc=PhoneNumberDesc(national_number_pattern='[2-9]\\d{5}', possible_length=(6,)),
    fixed_line=PhoneNumberDesc(national_number_pattern='(?:20|[3-4]\\d|8[19])\\d{4}', example_number='201234', possible_length=(6,)),
    mobile=PhoneNumberDesc(national_number_pattern='(?:[27][1-9]|5\\d)\\d{4}', example_number='211234', possible_length=(6,)),
    toll_free=PhoneNumberDesc(national_number_pattern='80[257-9]\\d{3}', example_number='802123', possible_length=(6,)),
    premium_rate=PhoneNumberDesc(national_number_pattern='90(?:[1345][15-7]|2[125-7]|99)\\d{2}', example_number='901123', possible_length=(6,)),
    voip=PhoneNumberDesc(national_number_pattern='(?:6[0-36]|88)\\d{4}', example_number='601234', possible_length=(6,)),
    national_prefix_for_parsing='(10(?:01|[12]0|88))',
    number_format=[NumberFormat(pattern='(\\d{6})', format='\\1', domestic_carrier_code_formatting_rule='$CC \\1')])


text:
function annotation = includeGroundTruthEdgeLabels(annotation,edgeLabels,img)

CONTACT_EDGE = 1;
Nobjects = length(annotation.object);
largeObjects  = getListLargeObjects;
for i = 1:Nobjects
  if ismember(strtrim(lower(annotation.object(i).name)),largeObjects)
    Npoints = length(annotation.object(i).polygon.pt);
    edges = edgeLabels.object(i).edges;
    edgeType = edgeLabels.object(i).edgeType;
    n = find(edgeType==CONTACT_EDGE);
    c = edges(:,n);
    contactPoints = zeros(1,Npoints);
    contactPoints(unique(c(:))) = 1;
    for j = 1:Npoints
      annotation.object(i).polygon.pt(j).contact = contactPoints(j);
    end

% $$$     clf;
% $$$     imshow(img);
% $$$     hold on;
% $$$     [X,Y] = getLMpolygon(annotation.object(i).polygon);
% $$$     plot([X; X(1)],[Y; Y(1)],'b','LineWidth',4);
% $$$     for j = 1:length(X)
% $$$       if annotation.object(i).polygon.pt(j).contact
% $$$         plot(X(j),Y(j),'ro','LineWidth',4);
% $$$       end
% $$$     end
% $$$     pause;
  end
end


text:
require File.expand_path('helper', File.dirname(__FILE__))

class TestBirlingSupport < Test::Unit::TestCase
  def test_next_day_on_dst_flip
    in_time_zone('EST5EDT') do
      time = Time.new(2012, 11, 4)

      assert_equal 'EDT', time.zone

      assert_equal time.day, (time + 86400).day

      next_day = Birling::Support.next_day(time)

      assert_equal 2012, next_day.year
      assert_equal 11, next_day.month
      assert_equal 5, next_day.day
      assert_equal 0, next_day.hour
      assert_equal 0, next_day.min
      assert_equal 0, next_day.sec
    end
  end

  def test_hour_day_on_dst_flip
    in_time_zone('EST5EDT') do
      time = Time.new(2012, 11, 4, 0, 59, 59) + 1

      assert_equal 'EDT', time.zone

      assert_equal time.hour, (time + 3600).hour

      next_hour = Birling::Support.next_hour(time)

      assert_equal 2012, next_hour.year
      assert_equal 11, next_hour.month
      assert_equal 4, next_hour.day
      assert_equal 1, next_hour.hour
      assert_equal 0, next_hour.min
      assert_equal 0, next_hour.sec

      assert_equal 3600, next_hour - time
    end
  end

  def test_next_day_at_year_end
    in_time_zone('EST5EDT') do
      time = Time.new(2012, 12, 31)

      assert_equal 'EST', time.zone

      next_day = Birling::Support.next_day(time)

      assert_equal 2013, next_day.year
      assert_equal 1, next_day.month
      assert_equal 1, next_day.day
      assert_equal 0, next_day.hour
      assert_equal 0, next_day.min
      assert_equal 0, next_day.sec
    end
  end
end


text:
\begin{figure}[H]
\centering
\includegraphics[width=6in]{figs/run_41/run_41_turb_visc_by_vtheta_vs_r_meshscatter}
\caption{Scatter plot of total viscosity $\nu$ calculated by mean $\bar{v}_{\theta}$ equation with non-equilibrium pressure at $z/c$=9.00, $V_{free}$=14.88, station 5.}
\label{fig:run_41_turb_visc_by_vtheta_vs_r_meshscatter}
\end{figure}


text:
These settings apply only when `--ruby` is specified on the command line.

```yaml
package-name: azure_mgmt_digitaltwins
package-version: 2020-03-01-preview
azure-arm: true
```

### Tag: package-2020-03-01-preview and ruby

These settings apply only when `--tag=package-2020-03-01-preview --ruby` is specified on the command line.
Please also specify `--ruby-sdks-folder=<path to the root directory of your azure-sdk-for-ruby clone>`.

```yaml $(tag) == 'package-2020-03-01-preview' && $(ruby)
namespace: Microsoft.DigitalTwins
output-folder: $(ruby-sdks-folder)/digitaltwins
```


text:
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
        android:color="@color/main_gray">
    <item android:drawable="@color/main_bg"/>
</ripple>


text:
![image](images/DeleteJMSModule/Form.png)

### Output

After the job runs, you can view the results on the Job Details page in CloudBees CD. The JMS Module was deleted.

![image](images/DeleteJMSModule/Summary.png)

In the **DeleteJMSModule** step, click the Log button to see the diagnostic information:

    Using plugin EC-WebLogic-3.3.0.0
    Got parameter "configname" with value "demo"
    Got parameter "ecp_weblogic_jms_module_name" with value "TestModule"
    Processing template /myProject/jython/preamble.jython
    Processing template /myProject/jython/delete_jms_module.jython
    Script path: /opt/electriccloud/electriccommander/workspace/job_25644_20180607054757/exec_169758432417386.jython
    Running command: '/u01/oracle/oracle_common/common/bin/wlst.sh' '/opt/electriccloud/electriccommander/workspace/job_25644_20180607054757/exec_169758432417386.jython'
    Unlinking file /opt/electriccloud/electriccommander/workspace/job_25644_20180607054757/exec_169758432417386.jython
    EXIT_CODE: 0
    STDOUT:
    Initializing WebLogic Scripting Tool (WLST) ...

    Welcome to WebLogic Server Administration Scripting Shell

    Type help() for help on available commands

    WebLogic version is: WebLogic Server 12.2.1.3.0
    Connecting to t3://localhost:7001 with userid weblogic ...
    Successfully connected to Admin Server "AdminServer" that belongs to domain "base_domain".

    Warning: An insecure protocol was used to connect to the server.
    To ensure on-the-wire security, the SSL port or Admin port should be used instead.

    Location changed to edit tree.
    This is a writable tree with DomainMBean as the root.
    To make changes you will need to start an edit session via startEdit().
    For more help, use help('edit').

    Starting an edit session ...
    Started edit session, be sure to save and activate your changes once you are done.
    [WLST INFO] JMS Module TestModule has been deleted
    Saving all your changes ...
    Saved all your changes successfully.
    Activating all your changes, this may take a while ...
    The edit lock associated with this edit session is released once the activation is completed.
    Activation completed
    SUMMARY: Deleted JMS System Module TestModule
    STDERR:
    DONE


text:
using DarkSoulsII.DebugView.Core;

namespace DarkSoulsII.DebugView.Model.App.Graphics.Filters
{
    public class AppVolumeFogFilter : IReadable<AppVolumeFogFilter>
    {
        public AppVolumeFogFilter Read(IPointerFactory pointerFactory, IReader reader, int address, bool relative = false)
        {
            return this;
        }
    }
}


text:
package version

import (
	"fmt"
	"runtime"

	apimachineryversion "k8s.io/apimachinery/pkg/version"
)

// Get returns the overall codebase version. It's for detecting
// what code a binary was built from.
func Get() apimachineryversion.Info {
	// These variables typically come from -ldflags settings and in
	// their absence fallback to the settings in pkg/version/base.go
	return apimachineryversion.Info{
		Major: "", // deprecated
		Minor: "", // deprecated
		// TODO: we need to update these values when building a release.
		// GitVersion:   "",
		// GitCommit:    "",
		// GitTreeState: "",
		// BuildDate:    "1970-01-01T00:00:00Z",
		GoVersion: runtime.Version(),
		Compiler:  runtime.Compiler,
		Platform:  fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH),
	}
}


text:
require 'event_bus'
require 'listen'
require 'fileutils'

require 'oblako/resource'
require 'rdoba'

rdoba mixin: [ :to_h ]

class Oblako::Local::Resource < Oblako::Resource
   rdoba log: { functions: [ :basic, :enter, :leave, :extended ],
                prefix: :function  }

   public

   def match_uri? uri
      if !uri.is_a?( Oblako::Local::URI )
         raise "Invalid URI Type, must be of Oblako::Local::URI class" ; end
      size = self.uri.path.size
      super && self.uri.path == uri.path[ 0...size ] ; end

   def extract_path path
      path[ self.uri.path.size..-1 ] ; end

   def scan_chain base
      log + { base: base }
      files = {}
      Dir.glob( File.join( self.uri.path, "**/*" ) ).each do |f|
         if File.file?( f )
            uri = URI( 'file:' + f )
            # TODO move to cloud logic
            path = extract_path( f )
            mtime = uri.updated_at
            selected = {}
            base.each do |list|
               found = list.select { |file| file[ 0 ] == path }.first
               if found && !found[ 1 ].keys.include?( mtime )
                  selected.merge!( found ); end ; end
            selected.merge!( mtime => uri.digest )
            files[ path ] = selected ; end ; end
      log - files ; end

   protected

   def cloud= cloud
      if !cloud.is_a?( Oblako::Local::Cloud )
         raise( "Cloud must of Oblako::Local::Cloud class" ) ; end
      super
      Listen.to( self.uri.path ) { |*args| listen( *args ) }.start ; end

   def uri= uri
      if !uri.is_a?( Oblako::Local::URI )
         raise "Invalid URI type, must be of Oblako::Local::URI class" ; end
      super ; end

   private

   def crop_moved( added, removed )
      log + { added: added, removed: removed }
      a_hash = added.map { |uri| [ uri.digest, uri ] }.to_h
      r_hash = removed.map { |uri| [ uri.digest, uri ] }.to_h
      log >> { 'Added hash' => a_hash, 'Removed hash' => r_hash  }
      log > { 'Reloc intersection' => a_hash.keys & r_hash.keys }
      ( a_hash.keys & r_hash.keys ).each do |digest|
         ( add_uri, rm_uri ) = [ a_hash[ digest ], r_hash[ digest ] ]
         if !@unlinked.keys.include?( rm_uri )
            log > { 'Digest to relocate' => digest }
            yield( rm_uri, add_uri )
         else
            log > { 'Digest to unlinked assign' => digest }
            @unlinked[ add_uri ] = @unlinked.delete( rm_uri ) ; end
         added.delete( add_uri )
         removed.delete( rm_uri ) ; end ; end

   def urify *args
      args.each do |a|
         a.map! do |path|
            s =
            ( @uris.keys | @unlinked.keys ).select { |uri| uri.path == path }
            s.first || URI( "file:" + path ) ; end ; end ; end

   def reloc uri, to_uri
      log + { 'To URI' => to_uri, 'URI' => uri }
      @uris.delete( uri )
      @uris[ to_uri ] = to_uri.digest
      EventBus.announce( :reloc, uri: uri, to_uri: to_uri ) ; end

   def create uri
      log + { URI: uri }
      @uris[ uri ] = uri.digest
      EventBus.announce( :create, uri: uri ) ; end

   def update uri
      log + { URI: uri }
      @uris[ uri ] = uri.digest
      EventBus.announce( :update, uri: uri ) ; end

   def delete uri
      log + { URI: uri }
      @uris.delete( uri )
      EventBus.announce( :delete, uri: uri ) ; end

   def listen modified, added, removed
      log + { modified: modified, added: added, removed: removed }
      urify( modified, added, removed )

      crop_moved( added, removed ) { |uri, to_uri| reloc( uri, to_uri ) }
      added.each { |uri| create( uri ) }
      modified.each { |uri| update( uri ) }
      removed.each { |uri| delete( uri ) } ; end ; end


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

/*!
Pin configuration.

Some pins that could be configured here may be missing from actual MCU depending
on the package.
*/

use core::intrinsics::abort;
use core::option::{Option};

#[path="../../lib/ioreg.rs"] mod ioreg;

/// Available port names.
#[allow(missing_doc)]
pub enum Port {
  Port0,
  Port1,
  Port2,
  Port3,
  Port4,
}

/// Pin functions (GPIO or up to three additional functions).
#[deriving(PartialEq)]
#[allow(missing_doc)]
pub enum Function {
  GPIO         = 0,
  AltFunction1 = 1,
  AltFunction2 = 2,
  AltFunction3 = 3,
}

/// Structure to describe the location of a pin
pub struct Pin {
  /// Port the pin is attached to
  port: Port,
  /// Pin number in the port
  pin: u8
}

impl Pin {
  /// Create and setup a Pin
  pub fn new(port: Port, pin_index: u8, function: Function,
      gpiodir: Option<::hal::pin::GPIODirection>) -> Pin {
    let pin = Pin {
      port: port,
      pin: pin_index,
    };
    pin.setup_regs(function, gpiodir);

    pin
  }

  fn setup_regs(&self, function: Function,
      gpiodir: Option<::hal::pin::GPIODirection>) {
    let (offset, reg) = self.get_pinsel_reg_and_offset();

    let fun_bits: u32  = function as u32 << (offset as uint * 2);
    let mask_bits: u32 = !(3u32 << (offset as uint * 2));

    let val: u32 = reg.value();
    let new_val = (val & mask_bits) | fun_bits;
    reg.set_value(new_val);

    if function == GPIO {
      (self as &::hal::pin::GPIO).set_direction(gpiodir.unwrap());
    }
  }

  fn gpioreg(&self) -> &reg::GPIO {
    match self.port {
      Port0 => &reg::GPIO0,
      Port1 => &reg::GPIO1,
      Port2 => &reg::GPIO2,
      Port3 => &reg::GPIO3,
      Port4 => &reg::GPIO4,
    }
  }

  fn get_pinsel_reg_and_offset(&self) -> (u8, &reg::PINSEL) {
    match self.port {
      Port0 => match self.pin {
        0..15  => (self.pin,    &reg::PINSEL0),
        16..30 => (self.pin-16, &reg::PINSEL1),
        _      => unsafe { abort() },
      },
      Port1 => match self.pin {
        0..15  => (self.pin,    &reg::PINSEL2),
        16..31 => (self.pin-16, &reg::PINSEL3),
        _      => unsafe { abort() },
      },
      Port2 => match self.pin {
        0..13  => (self.pin,    &reg::PINSEL4),
        _      => unsafe { abort() },
      },
      Port3 => match self.pin {
        25|26 => (self.pin-16,  &reg::PINSEL7),
        _     => unsafe { abort() },
      },
      Port4 => match self.pin {
        28|29 => (self.pin-16,  &reg::PINSEL9),
        _     => unsafe { abort() },
      },
    }
  }
}

impl ::hal::pin::GPIO for Pin {
  /// Sets output GPIO value to high.
  fn set_high(&self) {
    self.gpioreg().set_FIOSET(1 << (self.pin as uint));
  }

  /// Sets output GPIO value to low.
  fn set_low(&self) {
    self.gpioreg().set_FIOCLR(1 << (self.pin as uint));
  }

  /// Returns input GPIO level.
  fn level(&self) -> ::hal::pin::GPIOLevel {
    let bit: u32 = 1 << (self.pin as uint);
    let reg = self.gpioreg();

    match reg.FIOPIN() & bit {
      0 => ::hal::pin::Low,
      _ => ::hal::pin::High,
    }
  }

  /// Sets output GPIO direction.
  fn set_direction(&self, new_mode: ::hal::pin::GPIODirection) {
    let bit: u32 = 1 << (self.pin as uint);
    let mask: u32 = !bit;
    let reg = self.gpioreg();
    let val: u32 = reg.FIODIR();
    let new_val: u32 = match new_mode {
      ::hal::pin::In  => val & mask,
      ::hal::pin::Out => (val & mask) | bit,
    };

    reg.set_FIODIR(new_val);
  }
}

/// Sets the state of trace port interface.
pub fn set_trace_port_interface_enabled(enabled: bool) {
  let value: u32 = if enabled { 0b1000 } else { 0 };
  reg::PINSEL10.set_value(value);
}

mod reg {
  use lib::volatile_cell::VolatileCell;

  ioreg_old!(PINSEL: u32, value)
  reg_rw!(PINSEL, u32, value, set_value, value)

  extern {
    #[link_name="lpc17xx_iomem_PINSEL0"]  pub static PINSEL0:  PINSEL;
    #[link_name="lpc17xx_iomem_PINSEL1"]  pub static PINSEL1:  PINSEL;
    #[link_name="lpc17xx_iomem_PINSEL2"]  pub static PINSEL2:  PINSEL;
    #[link_name="lpc17xx_iomem_PINSEL3"]  pub static PINSEL3:  PINSEL;
    #[link_name="lpc17xx_iomem_PINSEL4"]  pub static PINSEL4:  PINSEL;
    #[link_name="lpc17xx_iomem_PINSEL7"]  pub static PINSEL7:  PINSEL;
    #[link_name="lpc17xx_iomem_PINSEL9"]  pub static PINSEL9:  PINSEL;
    #[link_name="lpc17xx_iomem_PINSEL10"] pub static PINSEL10: PINSEL;
  }

  ioreg_old!(GPIO: u32, FIODIR, _r0, _r1, _r2, FIOMASK, FIOPIN, FIOSET, FIOCLR)
  reg_rw!(GPIO, u32, FIODIR,  set_FIODIR,  FIODIR)
  reg_rw!(GPIO, u32, FIOMASK, set_FIOMASK, FIOMASK)
  reg_rw!(GPIO, u32, FIOPIN,  set_FIOPIN,  FIOPIN)
  reg_rw!(GPIO, u32, FIOSET,  set_FIOSET,  FIOSET)
  reg_rw!(GPIO, u32, FIOCLR,  set_FIOCLR,  FIOCLR)

  extern {
    #[link_name="lpc17xx_iomem_GPIO0"] pub static GPIO0: GPIO;
    #[link_name="lpc17xx_iomem_GPIO1"] pub static GPIO1: GPIO;
    #[link_name="lpc17xx_iomem_GPIO2"] pub static GPIO2: GPIO;
    #[link_name="lpc17xx_iomem_GPIO3"] pub static GPIO3: GPIO;
    #[link_name="lpc17xx_iomem_GPIO4"] pub static GPIO4: GPIO;
  }
}


text:
module Azure::DataMigration::Mgmt::V2018_04_19
  module Models
    #
    # Defines values for DataMigrationResultCode
    #
    module DataMigrationResultCode
      Initial = "Initial"
      Completed = "Completed"
      ObjectNotExistsInSource = "ObjectNotExistsInSource"
      ObjectNotExistsInTarget = "ObjectNotExistsInTarget"
      TargetObjectIsInaccessible = "TargetObjectIsInaccessible"
      FatalError = "FatalError"
    end
  end
end


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">

   <!-- ================================= -->
   <!-- Preserve messages in a local file -->
   <!-- ================================= -->

   <!-- A time/date based rolling appender
   <appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
      <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
      <param name="File" value="${jboss.server.home.dir}/log/server.log"/>
      <param name="Append" value="false"/>
      <param name="DatePattern" value="'.'yyyy-MM-dd"/>
      <layout class="org.apache.log4j.PatternLayout">
         <param name="ConversionPattern" value="%d{ISO8601} %-5p [%c{1}] %m%n"/>
     </layout>
   </appender>
   -->

   <!-- ============================== -->
   <!-- Append messages to the console -->
   <!-- ============================== -->

   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
      <param name="Target" value="System.out"/>
      <param name="Threshold" value="INFO"/>
      <layout class="org.apache.log4j.PatternLayout">
         <!-- The default pattern: Date Priority [Category] Message\n -->
         <param name="ConversionPattern" value="%d{ISO8601} %-5p [%c{1}] %m%n"/>
      </layout>
   </appender>

   <appender name="KONSOLE" class="org.apache.log4j.ConsoleAppender">
      <layout class="org.apache.log4j.PatternLayout">
         <param name="ConversionPattern" value="%d{ISO8601} %-5p [%c{1}] %m%n"/>
      </layout>
   </appender>

   <!-- ================ -->
   <!-- Limit categories -->
   <!-- ================ -->

   <!-- Limit JBoss categories to INFO -->
   <category name="org.jboss">
     <priority value="INFO"/>
   </category>

   <!-- com.vh logger -->
   <logger name="com.vh" additivity="true">
	   <level value="DEBUG" />
	   <appender-ref ref="KONSOLE" />
   </logger>

   <!-- ======================= -->
   <!-- Setup the Root category -->
   <!-- ======================= -->

   <root>
      <appender-ref ref="CONSOLE"/>
   </root>

</log4j:configuration>


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  This configuration file was written by the eclipse-cs plugin configuration editor
-->
<!--
Checkstyle-Configuration: GWT Checks
Description:

-->
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<module name="Checker">
    <property name="severity" value="warning"/>
    <module name="RegexpHeader">
       <property name="fileExtensions" value="java"/>
       <property name="severity" value="error"/>
       <property name="header" value="^/\*[ ]*$\n^ \* Copyright 20(0[6789]|[12][0-9]), The gwtquery team\.$\n^ \*[ ]*$\n^ \* Licensed under the Apache License, Version 2\.0 \(the "License"\); you may not( use this file except)?$\n^ \* (use this file except )?in compliance with the License\. You may obtain a copy of( the License at)?$\n^ \* the License at$\n^ \*[ ]*$\n^ \* http://www\.apache\.org/licenses/LICENSE-2\.0$\n^ \*[ ]*\n \* Unless required by applicable law or agreed to in writing, software( distributed under the License)?$\n^ \* (distributed under the License )?is distributed on an "AS IS" BASIS, WITHOUT( WARRANTIES OR CONDITIONS OF ANY KIND, either express)?$\n^ \* (WARRANTIES OR CONDITIONS OF ANY KIND, either express )?or implied\. See the( License for the specific language governing permissions and limitations under)?$\n^ \* License for the specific language governing permissions and limitations under$\n^ \* the License\.$\n^ \*/$"/>
       <property name="multiLines" value="6,13"/>
    </module>
    <module name="FileTabCharacter">
        <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="no tabs"/>
        <property name="fileExtensions" value="java"/>
        <property name="severity" value="error"/>
    </module>
    <module name="TreeWalker">
       <property name="fileExtensions" value="java"/>
       <module name="FileContentsHolder" />
       <module name="InterfaceIsType">
            <property name="severity" value="ignore"/>
        </module>
        <module name="RedundantImport">
            <property name="severity" value="error"/>
        </module>
        <module name="UnusedImports">
            <property name="severity" value="error"/>
        </module>
        <module name="JavadocType">
            <property name="severity" value="error"/>
            <property name="scope" value="protected"/>
        </module>
        <module name="PackageName">
            <property name="severity" value="error"/>
            <property name="format" value="^[a-z]+(\.[a-z][a-z0-9]{1,})*$"/>
        </module>
        <module name="ParameterName">
            <property name="severity" value="error"/>
        </module>
        <module name="LocalFinalVariableName">
            <property name="severity" value="error"/>
        </module>
        <module name="LocalVariableName">
            <property name="severity" value="error"/>
            <property name="tokens" value="PARAMETER_DEF,VARIABLE_DEF"/>
        </module>
        <module name="LeftCurly"/>
        <module name="RightCurly"/>
        <module name="CovariantEquals">
            <property name="severity" value="error"/>
        </module>
        <module name="HiddenField">
            <property name="severity" value="error"/>
            <property name="tokens" value="VARIABLE_DEF"/>
            <property name="ignoreConstructorParameter" value="true"/>
            <property name="ignoreSetter" value="true"/>
        </module>
        <module name="IllegalInstantiation">
            <property name="severity" value="error"/>
            <property name="classes" value="java.lang.Boolean"/>
        </module>
        <module name="UpperEll">
            <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="checking for 4l rather than 4L"/>
            <property name="severity" value="error"/>
        </module>
        <module name="JavadocStyle">
            <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Well formed java docs"/>
            <property name="severity" value="info"/>
            <property name="checkHtml" value="false"/>
            <property name="tokens" value="CLASS_DEF,CTOR_DEF,INTERFACE_DEF,METHOD_DEF,VARIABLE_DEF"/>
        </module>
        <module name="JavadocMethod">
            <metadata name="com.atlassw.tools.eclipse.checkstyle.lastEnabledSeverity" value="info"/>
            <property name="severity" value="info"/>
            <property name="scope" value="protected"/>
            <property name="allowUndeclaredRTE" value="true"/>
            <property name="allowMissingParamTags" value="true"/>
            <property name="allowMissingThrowsTags" value="true"/>
            <property name="allowMissingReturnTag" value="true"/>
            <property name="allowMissingJavadoc" value="true"/>
            <property name="allowMissingPropertyJavadoc" value="true"/>
            <property name="logLoadErrors" value="true"/>
            <property name="tokens" value="METHOD_DEF"/>
        </module>
        <module name="ImportOrder">
            <property name="severity" value="error"/>
            <property name="groups" value="com.google, com,  junit, net,org, java,javax"/>
            <property name="ordered" value="true"/>
            <property name="separated" value="true"/>
            <property name="option" value="top"/>
        </module>
        <module name="DefaultComesLast">
            <property name="severity" value="error"/>
        </module>
        <module name="MultipleStringLiterals">
            <property name="severity" value="info"/>
            <property name="ignoreStringsRegexp" value=".{0,3}"/>
        </module>
        <module name="FallThrough">
            <property name="severity" value="error"/>
        </module>
        <module name="IllegalInstantiation">
            <property name="severity" value="error"/>
            <property name="classes" value="Boolean"/>
        </module>
        <module name="Regexp">
            <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="check that a space is left after a colon with an assembled error message"/>
            <property name="severity" value="info"/>
            <property name="format" value="[^:^"]:" .*+"/>
            <property name="message" value="check that a space is left after a colon on an assembled error message"/>
            <property name="illegalPattern" value="true"/>
        </module>
        <module name="Regexp">
            <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="more than one blank line"/>
            <property name="severity" value="info"/>
            <property name="format" value="[\r]?[\n][ \t]*[\r]?[\n][ \t]*[\r]?[\n][ \t]*"/>
            <property name="message" value="more than one blank line"/>
            <property name="illegalPattern" value="true"/>
        </module>
        <module name="WhitespaceAround">
            <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Must have spaces"/>
            <property name="severity" value="error"/>
            <property name="tokens" value="COLON,NOT_EQUAL,QUESTION,DIV,DIV_ASSIGN,BXOR,BXOR_ASSIGN,MINUS,LCURLY,STAR,STAR_ASSIGN,TYPE_EXTENSION_AND,BAND,LAND,BAND_ASSIGN,MOD,MOD_ASSIGN,PLUS,PLUS_ASSIGN,LT,SL,SL_ASSIGN,LE,ASSIGN,MINUS_ASSIGN,EQUAL,GT,GE,SR,SR_ASSIGN,BSR,BSR_ASSIGN,BOR,BOR_ASSIGN,LOR,LITERAL_ASSERT,LITERAL_ASSERT,LITERAL_CATCH,LITERAL_DO,LITERAL_ELSE,LITERAL_FINALLY,LITERAL_FOR,LITERAL_IF,LITERAL_RETURN,SLIST,LITERAL_SYNCHRONIZED,LITERAL_TRY,LITERAL_WHILE"/>
        </module>
        <module name="Regexp">
            <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="newline before }"/>
            <property name="severity" value="error"/>
            <property name="format" value="[\r]?[\n][ \t]*[\r]?[\n][ \t]+[}][ ]*[\n]"/>
            <property name="message" value="newline before }"/>
            <property name="illegalPattern" value="true"/>
        </module>
        <module name="ModifierOrder">
            <property name="severity" value="error"/>
        </module>
        <module name="AvoidStarImport">
            <property name="severity" value="error"/>
        </module>
        <module name="RegexpSinglelineJava">
            <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="bad // comment"/>
            <property name="severity" value="error"/>
            <property name="format" value="  [/][/][A-z]"/>
            <property name="message" value="// comments must be followed by a space and be on their own line"/>
        </module>
        <module name="EmptyStatement">
            <property name="severity" value="error"/>
        </module>
        <module name="MethodName">
            <property name="severity" value="error"/>
            <property name="format" value="^[a-z$XJD:][a-zA-Z0-9$]*$"/>
        </module>
        <module name="MemberName">
            <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Field names must start with [a-z], may not start with f[A-Z], and should not contain '_''s."/>
            <property name="severity" value="error"/>
            <property name="format" value="^([a-eg-z]|(f[a-z0-9]))[a-zA-Z0-9]*$"/>
        </module>
        <module name="TodoComment">
            <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Author tags"/>
            <property name="severity" value="error"/>
            <property name="format" value="@author"/>
        </module>
        <module name="Regexp">
            <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="No one line javadoc comments"/>
            <property name="severity" value="error"/>
            <property name="format" value="[/][*][*][^\n]*[*][/]"/>
            <property name="message" value="No one line javadoc comments"/>
            <property name="illegalPattern" value="true"/>
        </module>
        <module name="NoWhitespaceAfter">
            <property name="severity" value="error"/>
            <property name="allowLineBreaks" value="false"/>
            <property name="tokens" value="BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS"/>
        </module>
        <module name="WhitespaceAfter">
            <property name="tokens" value="TYPECAST"/>
        </module>
        <module name="TypecastParenPad">
            <property name="severity" value="error"/>
            <property name="tokens" value="RPAREN,TYPECAST"/>
        </module>
        <module name="ParenPad"/>
        <module name="MethodParamPad"/>
        <module name="NoWhitespaceBefore">
            <property name="severity" value="error"/>
            <property name="tokens" value="SEMI,POST_DEC,POST_INC"/>
        </module>
        <module name="NoWhitespaceBefore">
            <property name="severity" value="error"/>
            <property name="allowLineBreaks" value="true"/>
            <property name="tokens" value="DOT"/>
        </module>
        <module name="RedundantModifier"/>
        <module name="EqualsHashCode"/>
    </module>
    <module name="JavadocPackage">
        <property name="severity" value="ignore"/>
    </module>
        <module name="SuppressionCommentFilter">
       <property name="offCommentFormat" value="CHECKSTYLE_OFF"/>
       <property name="onCommentFormat" value="CHECKSTYLE_ON"/>
    </module>
    <module name="SuppressionCommentFilter">
       <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Avoid name checking"/>
      <property name="offCommentFormat" value="CHECKSTYLE_NAMING_OFF"/>
      <property name="onCommentFormat" value="CHECKSTYLE_NAMING_ON"/>
      <property name="checkFormat" value="MethodName"/>
    </module>
    <module name="SuppressionCommentFilter">
       <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Avoid name checking"/>
      <property name="offCommentFormat" value="CHECKSTYLE_NAMING_OFF"/>
      <property name="onCommentFormat" value="CHECKSTYLE_NAMING_ON"/>
      <property name="checkFormat" value="MemberName"/>
    </module>
    <module name="SuppressionCommentFilter">
       <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Avoid name checking"/>
      <property name="offCommentFormat" value="CHECKSTYLE_NAMING_OFF"/>
      <property name="onCommentFormat" value="CHECKSTYLE_NAMING_ON"/>
      <property name="checkFormat" value="ParameterName"/>
    </module>
</module>


text:
module Network.Email.Read where

import Data.Maybe
import Control.Monad
import qualified Data.Map as M
import qualified Data.ByteString.Lazy.Char8 as BL
import qualified Data.ByteString.Builder as BL
import qualified Data.Attoparsec.ByteString.Lazy as BL
import qualified Data.Attoparsec.Text as T
import qualified Data.Text as T
import qualified Data.Text.Lazy as TL
import qualified Data.ByteString.Base64.Lazy as B64
import Control.Monad.Catch

import Network.Email.Header.Types
import qualified Network.Email.Header.Read as R
import qualified Network.Email.Charset as C

import Network.Email.Parser
import Network.Email.Types

-- | Decode binary body from 'Mail' using headers.
decodeBinary :: forall m. MonadThrow m => Mail -> m BL.ByteString
decodeBinary mail = do
  enc <- encoder
  case enc $ mailBody mail of
   Left e -> throwM $ DecodingError e
   Right r -> return $ BL.toLazyByteString r

  where encoding = fromMaybe "8bit" $ R.contentTransferEncoding $ mailHeaders mail
        encoder :: m (BL.ByteString -> Either String BL.Builder)
        encoder = case encoding of
          "quoted-printable" -> return $ BL.eitherResult . BL.parse (quotedPrintable <* BL.endOfInput)
          "base64" -> return $ fmap BL.lazyByteString . B64.decode
          "8bit" -> return $ Right . BL.lazyByteString
          "7bit" -> return $ Right . BL.lazyByteString
          _ -> throwM $ UnknownEncoding encoding

-- | Decode text body from 'Mail' using headers.
decodeText :: MonadThrow m => Mail -> m TL.Text
decodeText mail = do
  dat <- decodeBinary mail
  unless (typ == "text") $ throwM NotAText
  cs <- maybe (throwM $ UnknownCharset charset) return $ C.lookupCharset charset
  let txt = C.toUnicode cs $ BL.toStrict dat
  case T.parseOnly (crlfText <* T.endOfInput) txt of
   Left e -> throwM $ DecodingError e
   Right r -> return r

  where (MimeType typ _, pars) = fromMaybe (MimeType "text" "plain", M.empty) $ R.contentType $ mailHeaders mail
        charset = maybe "us-ascii" T.unpack $ M.lookup "charset" pars

-- | Find all parts with given mime type in 'Mail'.
findMime :: MimeType -> Mail -> [Path]
findMime typ ml = (if typ == typ' then [[]] else []) ++ parts
  where typ' = case R.contentType $ mailHeaders ml of
                Nothing -> MimeType "text" "plain"
                Just (t, _) -> t
        parts = concatMap (\(i, x) -> map (i:) $ findMime typ x) $ zip [0..] $ mailParts ml


text:
_engine = None

def set_engine(engine):
    global _engine
    _engine = engine

def get_engine():
    return _engine


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>me.footlights</groupId>
		<artifactId>footlights-demos</artifactId>
		<version>HEAD</version>
	</parent>

	<artifactId>library</artifactId>
	<name>A Demo Library</name>

	<packaging>jar</packaging>
</project>


text:
<?php

/*
 * This file is part of php-cache organization.
 *
 * (c) 2015 Aaron Scherer <aequasi@gmail.com>, Tobias Nyholm <tobias.nyholm@gmail.com>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace Cache\Adapter\Apc;

use Cache\Adapter\Common\AbstractCachePool;
use Cache\Adapter\Common\PhpCacheItem;
use Cache\Adapter\Common\TagSupportWithArray;

/**
 * @author Tobias Nyholm <tobias.nyholm@gmail.com>
 */
class ApcCachePool extends AbstractCachePool
{
    use TagSupportWithArray;

    /**
     * @type bool
     */
    private $skipOnCli;

    /**
     * @param bool $skipOnCli
     */
    public function __construct($skipOnCli = false)
    {
        $this->skipOnCli = $skipOnCli;
    }

    /**
     * {@inheritdoc}
     */
    protected function fetchObjectFromCache($key)
    {
        if ($this->skipIfCli()) {
            return [false, null, [], null];
        }

        $success   = false;
        $cacheData = apc_fetch($key, $success);
        if (!$success) {
            return [false, null, [], null];
        }
        list($data, $tags, $timestamp) = unserialize($cacheData);

        return [$success, $data, $tags, $timestamp];
    }

    /**
     * {@inheritdoc}
     */
    protected function clearAllObjectsFromCache()
    {
        return apc_clear_cache('user');
    }

    /**
     * {@inheritdoc}
     */
    protected function clearOneObjectFromCache($key)
    {
        apc_delete($key);

        return true;
    }

    /**
     * {@inheritdoc}
     */
    protected function storeItemInCache(PhpCacheItem $item, $ttl)
    {
        if ($this->skipIfCli()) {
            return false;
        }

        if ($ttl < 0) {
            return false;
        }

        return apc_store($item->getKey(), serialize([$item->get(), $item->getTags(), $item->getExpirationTimestamp()]), $ttl);
    }

    /**
     * Returns true if CLI and if it should skip on cli.
     *
     * @return bool
     */
    private function skipIfCli()
    {
        return $this->skipOnCli && php_sapi_name() === 'cli';
    }

    /**
     * {@inheritdoc}
     */
    public function getDirectValue($name)
    {
        return apc_fetch($name);
    }

    /**
     * {@inheritdoc}
     */
    public function setDirectValue($name, $value)
    {
        apc_store($name, $value);
    }
}


text:
/********************************************************************
 * Standalone interface to Andy Liaw et al.'s C code (used in R package randomForest)
 * Added by Abhishek Jaiantilal ( abhishek.jaiantilal@colorado.edu )
 * License: GPLv2
 * Version: 0.02
 *
 * What this barely has: link to Random forest code, setting parameters for
 * number of tree, nvar/mtry. No support for almost everything else.
 *
 * Uses the twonorm dataset, creating the RF models and
 * testing on the dataset. This is just a simple code to show the interface
 * with the code from Andy Liaw et al. Modify as needed for custom datasets
 *
 * In this default form it will output the predictions out.
 * use DEBUG_ON to control verbosity
 *
 * to compile on linux: use the Makefile command 'make twonorm'
 *
 * to compile on windows: use either cygwin or VC++ (<CC> represents the compiler)
 *  to compile these 5 files "cokus.cpp classRF.cpp twonorm_C_wrapper.cpp rfutils.cpp classTree.cpp"
 *  and also either compile or link with rfsub.f (need a fortran compiler)  or rfsub.o (precompiled)
 *
 * Errata: the file reading part will be needed to tweaked per requirement
 *
 * Generating the ascii files:
 *  the data files can be generated from matlab as
 *  save('filename.mat','variable','-ascii')
 *******************************************************************/

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>

#define DEBUG_ON 1

void classRF(double *x, int *dimx, int *cl, int *ncl, int *cat, int *maxcat,
	     int *sampsize, int *strata, int *Options, int *ntree, int *nvar,
	     int *ipi, double *classwt, double *cut, int *nodesize,
	     int *outcl, int *counttr, double *prox,
	     double *imprt, double *impsd, double *impmat, int *nrnodes,
	     int *ndbigtree, int *nodestatus, int *bestvar, int *treemap,
	     int *nodeclass, double *xbestsplit, double *errtr,
	     int *testdat, double *xts, int *clts, int *nts, double *countts,
	     int *outclts, int labelts, double *proxts, double *errts,
             int *inbag, int print_verbose_tree_progression);

void classForest(int *mdim, int *ntest, int *nclass, int *maxcat,
        int *nrnodes, int *ntree, double *x, double *xbestsplit,
        double *pid, double *cutoff, double *countts, int *treemap,
        int *nodestatus, int *cat, int *nodeclass, int *jts,
        int *jet, int *bestvar, int *node, int *treeSize,
        int *keepPred, int *prox, double *proxMat, int *nodes);

int main(){
    char X_filename[100], Y_filename[100];
    FILE *fp_X, *fp_Y, *fp;

    //set the number of examples in rows and number of dimensions in cols
    int cols=20,rows=300,i,j;

    /***START: NO NEED TO CHANGE ANYTHING FROM HERE TO THERE***************/
    int p_size=cols,n_size=rows;
    int nsample=n_size;

    //need the below for some string ops
    char dum_str[100];

    //allocate some memory for the data
    double* X=(double*)calloc(rows*cols,sizeof(double));
    int* Y=(int*)calloc(rows,sizeof(int));

    //the classifcation version requires {D,N}, where D=(num) dimensions, N=(num) examples
    int dimx[2];
    dimx[0]=p_size;
    dimx[1]=n_size;

    int* cat = (int*)calloc(p_size,sizeof(int));

    /***END: NO NEED TO CHANGE ANYTHING FROM HERE TO THERE*****************/

    //save the file to open in some string variables
    strcpy(X_filename,"data/X_twonorm.txt");
    strcpy(Y_filename,"data/Y_twonorm.txt");

    //write prediction OUTPUT into Y_hat.txt
//    fp = fopen("Y_hat.txt","w");

    /**read and save to the X and Y variable**
    **this file grabbing is different in the regression version as it seemed to work there
     *but not here :( */
    fp_X = fopen(X_filename,"r");
    fp_Y = fopen(Y_filename,"r");

    if (fp_X !=NULL)
    {
      if(DEBUG_ON) printf("file opened: %s\n",X_filename);
    }else{
      printf("cannot find files for data\n");exit(0);
    }

    if (fp_Y !=NULL)
    {
      if(DEBUG_ON) printf("file opened: %s\n",Y_filename);
    }else{
      printf("cannot find files for data\n");exit(0);
    }

    fflush(stdout);

    for(i=0;i<rows;i++)
      for(j=0;j<cols;j++){
         //fscanf(fp_X, "%f ", &X[i*cols+j]);
         fscanf(fp_X,"%s ",dum_str);
         X[i*cols+j]=atof(dum_str);
         if ((i*cols+j <10) & DEBUG_ON)
            printf("%s (%f)", dum_str,X[i*cols+j]);
         fflush(stdout);
      }

    /* optionally print something if you think there was an error in reading*/
    /*for(i=0;i<10;i++)
        printf("%f, ",X[i]);

    for(i=rows*cols-10;i<rows*cols;i++)
        printf("%f, ",X[i]);*/

    for(i=0;i<rows;i++){
       fscanf(fp_Y,"%s ",dum_str);
       Y[i] = (int)atof(dum_str);
       if (DEBUG_ON) printf("%d,",Y[i]);
    }
    /********************DONE with DATA reading***************************/

    //number of classes - <change appropriately>
    int nclass=2;

    //need to do set this else everything blows up, represents the number of categories for
    //every dimension - <change appropriately>
    for(i=0;i<p_size;i++) cat[i]=1;

	fflush(stdout);//flush out any printf that we might have done till now

    //basically set the below to max(cat)
    int maxcat=1;//=max(cat)  - <change appropriately>

    int sampsize=n_size; //if replace then sampsize=n_size or sampsize=0.632*n_size

    //no need to change this
    int nsum = sampsize;

    int strata = 1;
    //other options
    int addclass = 0;
    int importance=0;
    int localImp=0;
    int proximity=0;
    int oob_prox=0;
    int do_trace; //this variable prints verbosely each step
    if(DEBUG_ON)
       do_trace=1;
    else
       do_trace=0;
    int keep_forest=1;
    int replace=1;
    int stratify=0;
    int keep_inbag=0;
    int Options[]={addclass,importance,localImp,proximity,oob_prox
     ,do_trace,keep_forest,replace,stratify,keep_inbag};

    //ntree= number of tree. mtry=mtry :)
    int ntree=500; int nt=ntree;
    int mtry=(int)floor(sqrt(p_size)); //  - <change appropriately>
    if(DEBUG_ON) printf("ntree %d, mtry %d\n",ntree,mtry);

    int ipi=0;
    double* classwt=(double*)calloc(nclass,sizeof(double));
    double* cutoff=(double*)calloc(nclass,sizeof(double));
    for(i=0;i<nclass;i++){
        classwt[i]=1;
        cutoff[i]=1.0/((double)nclass);
    }
    int nodesize=1;
    int* outcl=(int*) calloc(nsample,sizeof(int));
    int* counttr=(int*) calloc(nclass*nsample,sizeof(int));
    double prox=1;
    double* impout=(double*)calloc(p_size,sizeof(double));
    double impSD=1;
    double impmat=1;
    int nrnodes = 2 * (int)floor(nsum / nodesize) + 1;
    int* ndbigtree = (int*) calloc(ntree,sizeof(int));
    int* nodestatus = (int*) calloc(nt*nrnodes,sizeof(int));
    int* bestvar = (int*) calloc(nt*nrnodes,sizeof(int));
    int* treemap = (int*) calloc(nt * 2 * nrnodes,sizeof(int));
    int* nodepred = (int*) calloc(nt * nrnodes,sizeof(int));
    double* xbestsplit = (double*) calloc(nt * nrnodes,sizeof(double));
    double* errtr = (double*) calloc((nclass+1) * ntree,sizeof(double));
    int testdat=0;
    double xts=1;
    int clts = 1;
    int nts=0;
    double* countts = (double*) calloc(nclass * nts,sizeof(double));
    int outclts = 0;
    int labelts=0;
    double proxts=1;
    double errts=1;
    int* inbag = (int*) calloc(n_size,sizeof(int));

    //printf("1");
    fflush(stdout);
    //printf("2");

    //train the model
    classRF(X, dimx, Y, &nclass, cat, &maxcat,
	     &sampsize, &strata, Options, &ntree, &mtry,&ipi,
         classwt, cutoff, &nodesize,outcl, counttr, &prox,
	     impout, &impSD, &impmat, &nrnodes,ndbigtree, nodestatus,
         bestvar, treemap,nodepred, xbestsplit, errtr,&testdat,
         &xts, &clts, &nts, countts,&outclts, labelts,
         &proxts, &errts,inbag,0);

    //test the model
    //classwt=pid
    //printf("3");
    int ntest = n_size;
    double *pid = classwt;
    free(countts);
    countts = (double*) calloc(nclass * ntest,sizeof(double));
    //nodeclass=nodepred
    int* nodeclass = nodepred;
    int* jts = (int*) calloc(ntest,sizeof(int));
    int* jet = (int*) calloc(ntest,sizeof(int));
    int* treeSize = ndbigtree;
    int keepPred=0;
    int intProximity=0;
    int nodes=0;
    int* nodexts;
    if (nodes)
        nodexts = (int*)calloc(ntest*ntree,sizeof(int));
    else
        nodexts = (int*)calloc(ntest,sizeof(int));
    int* node = nodexts;
    double *proxMat;
    if(proximity)
        proxMat = (double*)calloc(ntest*ntest,sizeof(double));
    else
        proxMat = (double*)calloc(1,sizeof(double));
    //printf("4");

    classForest(&p_size, &ntest, &nclass, &maxcat,
        &nrnodes, &ntree, X, xbestsplit,
        pid, cutoff, countts, treemap,
        nodestatus, cat, nodeclass, jts,
	jet, bestvar, node, treeSize,
        &keepPred, &intProximity, proxMat, &nodes);
    //printf("5");

    if(DEBUG_ON) printf("Predicted class Labels\n");
    for(i=0;i<n_size;i++){
//        fprintf(fp,"%d\n",jts[i]);
        printf("%d\n",jts[i]);
    }
    int total_error=0;

    for(i=0;i<n_size;i++)
        if(jts[i]!=Y[i])
            total_error+=1;

    if (DEBUG_ON)
        printf("\nTotal misclassified %d out of %d\n",total_error,n_size);

    if (DEBUG_ON){
        printf("Press any key to end");
        getchar();
    }
    free(X);
    free(Y);

    free(jet);
    free(jts);
    free(nodexts);
    free(proxMat);
    free(cat);
    free(classwt);
    free(cutoff);
    free(outcl);
    free(counttr);
    free(ndbigtree);
    free(nodestatus);
    free(bestvar);
    free(treemap);
    free(nodepred);
    free(xbestsplit);
    free(errtr);
    free(countts);
    free(inbag);
    free(impout);

    fflush(stdout);
    fclose(fp_Y);
    fclose(fp_X);
//    fclose(fp);
}


text:
/* Timer.js
KC3改 Timer Object

Contains a single timer which contains number of seconds left
Has functions for TimerManager to use
*/
(function(){
	"use strict";

	window.KC3Timer = function(element, type, num){
		this.alerted = false;
		this.type = type;
		this.num = num;
		this.element = element;
		this.deactivate();
	};

	KC3Timer.prototype.show = function(element){ this.element.show(); };
	KC3Timer.prototype.hide = function(element){ this.element.hide(); };

	KC3Timer.prototype.activate = function(completion, faceId, expedNum, rosterId){
		this.active = true;
		this.completion = completion;
		if(faceId > 0){ this.faceId = faceId; }
		if(expedNum > 0){ this.expedNum = expedNum; }
		if(rosterId > 0){ this.rosterId = rosterId; }

		var remaining = this.completion - Date.now();
		remaining = Math.ceil((remaining - (ConfigManager.alert_diff*1000))/1000);
		if(remaining <= 0){
			this.alerted = true;
			$(".timer-time", this.element).attr("title", "");
		} else {
			$(".timer-time", this.element).attr("title",
				String(remaining).plusCurrentTime(true) );
		}
	};

	KC3Timer.prototype.deactivate = function(){
		this.active = false;
		this.completion = 0;
		this.faceId = 0;
		this.expedNum = 0;
		this.rosterId = 0;
		$(".timer-img img", this.element).hide();
		$(".timer-expnum", this.element).text("");
		$(".timer-time", this.element).text("").attr("title", "");
	};

	KC3Timer.prototype.time = function(){
		$(".timer-time", this.element).text( this.text() );
	};

	KC3Timer.prototype.expnum = function(){
		if(this.expedNum > 0){
			$(".timer-expnum", this.element).text( KC3Master.missionDispNo(this.expedNum) );
		}
	};

	KC3Timer.prototype.face = function(faceId = this.faceId, isLocked = false){
		if(this.faceId > 0){
			$(".timer-img img", this.element).attr("src", this.rosterId > 0 ?
				KC3ShipManager.get(this.rosterId).shipIcon() :
				KC3Meta.shipIcon(this.faceId, "/assets/img/ui/empty.png"));
			$(".timer-img", this.element).attr("title",
				KC3Meta.shipName( KC3Master.ship(this.faceId).api_name )
			);
			$(".timer-img", this.element).data("masterId", this.faceId).off("dblclick")
				.on("dblclick", function(e){
					(new RMsg("service", "strategyRoomPage", {
						tabPath: "mstship-{0}".format($(this).data("masterId"))
					})).execute();
				});
			$(".timer-img", this.element).toggleClass("lsc", !!this.lsc)
				.toggleClass("new_ship", !!this.newShip);
			$(".timer-img", this.element).removeClass("locked");
			$(".timer-img img", this.element).show();
		}else{
			$(".timer-img", this.element).attr("title", "")
				.removeData("masterId").off("dblclick");
			$(".timer-img img", this.element).hide();
			$(".timer-img", this.element).toggleClass("locked", isLocked);
			$(".timer-img", this.element).removeClass("lsc new_ship");
		}
		return $(".timer-img", this.element);
	};

	KC3Timer.prototype.updateElement = function(element){
		this.element = element;
	};

	KC3Timer.prototype.remainingTime = function(){
		return this.active ? (this.completion - Date.now()) : 0;
	};

	KC3Timer.prototype.text = function(){
		if(this.active){
			var remaining = this.remainingTime();
			var timerAllowance = (this.type == 2)?0:ConfigManager.alert_diff;
			remaining = Math.ceil((remaining - (timerAllowance*1000))/1000);
			if(remaining > 0){
				this.alerted = false;
				return String(remaining).toHHMMSS();
			}else{
				this.completionAlert();
				return KC3Meta.term("TimerComplete");
			}
		}else{
			return "";
		}
	};

	KC3Timer.prototype.completionAlert = function(){
		if(this.alerted){ return false; }
		this.alerted = true;

		// Sound Alerts
		if(KC3TimerManager.notifSound){
			KC3TimerManager.notifSound.pause();
		}
		switch(ConfigManager.alert_type){
			case 1: KC3TimerManager.notifSound = new Audio("../../../../assets/snd/pop.mp3"); break;
			case 2: KC3TimerManager.notifSound = new Audio(ConfigManager.alert_custom); break;
			case 3: KC3TimerManager.notifSound = new Audio("../../../../assets/snd/ding.mp3"); break;
			default: KC3TimerManager.notifSound = false; break;
		}
		if(KC3TimerManager.notifSound){
			KC3TimerManager.notifSound.volume = ConfigManager.alert_volume / 100;
			KC3TimerManager.notifSound.play();
		}

		// Desktop notification
		var notifData = { type: "basic" };
		var shipName;

		// Notification types show varying messages
		switch(this.type){
			case 0:
				var thisFleet = PlayerManager.fleets[this.num+1];
				notifData.title = KC3Meta.term("DesktopNotifyExpedCompleteTitle");
				notifData.message = KC3Meta.term("DesktopNotifyExpedCompleteMessage")
					.format(this.num + 2, KC3Master.missionDispNo(thisFleet.mission[1]));
				notifData.iconUrl = "../../assets/img/quests/expedition.jpg";
				break;
			case 1:
				var shipRef = KC3ShipManager.get(PlayerManager.repairShips[this.num+1]);
				shipName = shipRef.name();
				notifData.title = KC3Meta.term("DesktopNotifyRepairCompleteTitle");
				notifData.message = KC3Meta.term("DesktopNotifyRepairCompleteMessage").format(shipName);
				notifData.iconUrl = "../../assets/img/quests/supply.jpg";
				shipRef.applyRepair();
				break;
			case 2:
				shipName = KC3Meta.shipName( KC3Master.ship( this.faceId ).api_name );
				notifData.title = KC3Meta.term("DesktopNotifyConstrCompleteTitle");
				if(ConfigManager.info_face){
					notifData.message = KC3Meta.term("DesktopNotifyConstrCompleteMessageFaced").format(shipName);
				}else{
					notifData.message = KC3Meta.term("DesktopNotifyConstrCompleteMessageUnknown");
				}
				notifData.iconUrl = "../../assets/img/quests/build.jpg";
				break;
			default:break;
		}

		// Tell background page to show the notification, cant do it here
		if(ConfigManager.alert_desktop){
			(new RMsg("service", "notify_desktop", {
				notifId: [this.type, this.num].join('_'),
				data: notifData,
				tabId: chrome.devtools.inspectedWindow.tabId
			})).execute();
		}

	};

})();


text:
<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCommentsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('comments', function (Blueprint $table) {
            $table->increments('id');
            $table->string('content');

            $table->nullableTimestamps();
            $table->integer('user_id')->unsigned();
            $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade');

            $table->integer('post_id')->unsigned();
            $table->foreign('post_id')->references('id')->on('posts')->onDelete('cascade')->onUpdate('cascade');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('comments');
    }
}