text:
//
//  NSString+Extend.m
//  CoreCategory
//
//  Created by 成林 on 15/4/6.
//  Copyright (c) 2015年 沐汐. All rights reserved.
//

#import "NSString+Extend.h"

@implementation NSString (Extend)
+ (NSString*)dictionaryToJsonString:(NSDictionary*)dict
{

    NSData* data = [NSJSONSerialization dataWithJSONObject:dict options:NSJSONWritingPrettyPrinted error:nil];
    NSString* str = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
    //    str = [[str stringByReplacingOccurrencesOfString:@"\n" withString:@""] stringByReplacingOccurrencesOfString:@" " withString:@""];
    //    str = (__bridge NSString*)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,
    //                                                                      (CFStringRef)str,
    //                                                                      (CFStringRef) @"!$&'()*+,-./:;=?@_~%#[]",
    //                                                                      NULL,
    //                                                                      kCFStringEncodingUTF8);
    return str;
}

+ (BOOL)isValide:(NSString*)value
{
    if (value == nil || [value isEqualToString:@""]) {
        return YES;
    }
    return NO;
}

//+ (NSString*)snWithString:(NSString*)userid
//{
//    NSString* sign = [NSString stringWithFormat:@"%@%@%@", kAPPKEY, kTOKEN, userid];
//    return [sign md5String];
//}

//验证身份证
//必须满足以下规则
//1. 长度必须是18位,前17位必须是数字,第十八位可以是数字或X
//2. 前两位必须是以下情形中的一种:11,12,13,14,15,21,22,23,31,32,33,34,35,36,37,41,42,43,44,45,46,50,51,52,53,54,61,62,63,64,65,71,81,82,91
//3. 第7到第14位出生年月日。第7到第10位为出生年份;11到12位表示月份,范围为01-12;13到14位为合法的日期
//4. 第17位表示性别,双数表示女,单数表示男
//5. 第18位为前17位的校验位
//算法如下:
//(1)校验和 = (n1 + n11) * 7 + (n2 + n12) * 9 + (n3 + n13) * 10 + (n4 + n14) * 5 + (n5 + n15) * 8 + (n6 + n16) * 4 + (n7 + n17) * 2 + n8 + n9 * 6 + n10 * 3,其中n数值,表示第几位的数字
//(2)余数 = 校验和 % 11
//(3)如果余数为0,校验位应为1,余数为1到10校验位应为字符串"0X98765432"(不包括分号)的第余数位的值(比如余数等于3,校验位应为9)
//6. 出生年份的前两位必须是19或20
+ (BOOL)verifyIDCardNumber:(NSString*)value
{
    value = [value stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
    if ([value length] != 18) {
        return NO;
    }
    NSString* mmdd = @"(((0[13578]|1[02])(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)(0[1-9]|[12][0-9]|30))|(02(0[1-9]|[1][0-9]|2[0-8])))";
    NSString* leapMmdd = @"0229";
    NSString* year = @"(19|20)[0-9]{2}";
    NSString* leapYear = @"(19|20)(0[48]|[2468][048]|[13579][26])";
    NSString* yearMmdd = [NSString stringWithFormat:@"%@%@", year, mmdd];
    NSString* leapyearMmdd = [NSString stringWithFormat:@"%@%@", leapYear, leapMmdd];
    NSString* yyyyMmdd = [NSString stringWithFormat:@"((%@)|(%@)|(%@))", yearMmdd, leapyearMmdd, @"20000229"];
    NSString* area = @"(1[1-5]|2[1-3]|3[1-7]|4[1-6]|5[0-4]|6[1-5]|82|[7-9]1)[0-9]{4}";
    NSString* regex = [NSString stringWithFormat:@"%@%@%@", area, yyyyMmdd, @"[0-9]{3}[0-9Xx]"];

    NSPredicate* regexTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex];
    if (![regexTest evaluateWithObject:value]) {
        return NO;
    }
    int summary = ([value substringWithRange:NSMakeRange(0, 1)].intValue + [value substringWithRange:NSMakeRange(10, 1)].intValue) * 7
    + ([value substringWithRange:NSMakeRange(1, 1)].intValue + [value substringWithRange:NSMakeRange(11, 1)].intValue) * 9
    + ([value substringWithRange:NSMakeRange(2, 1)].intValue + [value substringWithRange:NSMakeRange(12, 1)].intValue) * 10
    + ([value substringWithRange:NSMakeRange(3, 1)].intValue + [value substringWithRange:NSMakeRange(13, 1)].intValue) * 5
    + ([value substringWithRange:NSMakeRange(4, 1)].intValue + [value substringWithRange:NSMakeRange(14, 1)].intValue) * 8
    + ([value substringWithRange:NSMakeRange(5, 1)].intValue + [value substringWithRange:NSMakeRange(15, 1)].intValue) * 4
    + ([value substringWithRange:NSMakeRange(6, 1)].intValue + [value substringWithRange:NSMakeRange(16, 1)].intValue) * 2
    + [value substringWithRange:NSMakeRange(7, 1)].intValue * 1 + [value substringWithRange:NSMakeRange(8, 1)].intValue * 6
    + [value substringWithRange:NSMakeRange(9, 1)].intValue * 3;
    NSInteger remainder = summary % 11;
    NSString* checkBit = @"";
    NSString* checkString = @"10X98765432";
    checkBit = [checkString substringWithRange:NSMakeRange(remainder, 1)]; // 判断校验位
    return [checkBit isEqualToString:[[value substringWithRange:NSMakeRange(17, 1)] uppercaseString]];
}

//银行卡
+ (BOOL)validateBankCardNumber:(NSString*)bankCardNumber
{
    BOOL flag;
    if (bankCardNumber.length <= 0) {
        flag = NO;
        return flag;
    }
    NSString* regex2 = @"^(\\d{15,18})";
    NSPredicate* bankCardPredicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex2];
    return [bankCardPredicate evaluateWithObject:bankCardNumber];
}

//用户名
+ (BOOL)validateUserName:(NSString*)name
{
    NSString* userNameRegex = @"^[A-Za-z0-9]{4,20}+$";
    NSPredicate* userNamePredicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", userNameRegex];
    BOOL B = [userNamePredicate evaluateWithObject:name];
    return B;
}
//密码
+ (BOOL)validatePassword:(NSString*)passWord
{
    NSString* passWordRegex = @"^[a-zA-Z0-9]{6,20}+$";
    NSPredicate* passWordPredicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", passWordRegex];
    return [passWordPredicate evaluateWithObject:passWord];
}
//昵称
+ (BOOL)validateNickname:(NSString*)nickname
{
    NSString* nicknameRegex = @"^[a-zA-Z\u4e00-\u9fa5]+$";
    NSPredicate* passWordPredicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", nicknameRegex];
    return [passWordPredicate evaluateWithObject:nickname];
}

+ (NSString*)getCurrentDate
{
    NSDateFormatter* dateFormtter = [[NSDateFormatter alloc] init];
    [dateFormtter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString* dateString = [dateFormtter stringFromDate:[NSDate date]];

    return dateString;
}

+ (NSString*)stringWithCurrenDate
{

    NSDate* date = [NSDate date];
    NSCalendar* calendar = [NSCalendar currentCalendar];
    NSDateComponents* comps = [calendar components:(NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit)fromDate:date];
    NSInteger year = [comps year];
    NSInteger month = [comps month];
    NSInteger day = [comps day];
    NSInteger hour = [comps hour];
    NSInteger minute = [comps minute];
    NSInteger second = [comps second];
    NSString* str = [NSString stringWithFormat:@"%ld-%ld-%ld %ld:%ld:%ld", (long)year, (long)month, (long)day, (long)hour, (long)minute, (long)second];
    return str;
}

//手机号码验证
+ (BOOL)validateMobile:(NSString*)mobile
{
    //手机号以13, 15,18开头,八个 \d 数字字符
    NSString* phoneRegex = @"^((13[0-9])|(15[^4,\\D])|(18[0,0-9]))\\d{8}$";
    NSPredicate* phoneTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", phoneRegex];
    return [phoneTest evaluateWithObject:mobile];
}

+ (NSString*)UTF8StringWithString:(NSString*)string
{

    NSString* UTF8String = (NSString*)CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)string, NULL, NULL, kCFStringEncodingUTF8));

    return UTF8String;
}

+ (NSString*)imageWithBase64:(UIImage*)image
{

    NSData* imageData = UIImageJPEGRepresentation(image, 1.0);
    if (imageData.length / 1024 > 50) {

        imageData = UIImageJPEGRepresentation(image, 1024 * 50 / imageData.length);
    }
    NSString* imageStr = [GTMBase64 stringByEncodingData:imageData];

    return imageStr;
}

//车牌号验证
+ (BOOL)validateCarNo:(NSString*)carNo
{
    NSString* carRegex = @"^([a-z]|[A-Z]|[0-9]|[\u4e00-\u9fa5])$";
    NSPredicate* carTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", carRegex];
    return [carTest evaluateWithObject:carNo];
}

//发动机验证
+ (BOOL)validateEnginno:(NSString*)enginno
{
    NSString* userNameRegex = @"^([a-z]|[A-Z]|[0-9]){4,20}$";
    NSPredicate* userNamePredicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", userNameRegex];
    BOOL B = [userNamePredicate evaluateWithObject:enginno];
    return B;
}

//验证中文汉字字母
+ (BOOL)validateString:(NSString*)regStr
{
    NSString* userNameRegex = @"^[a-zA-Z\u4e00-\u9fa5]+$";
    NSPredicate* userNamePredicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", userNameRegex];
    BOOL B = [userNamePredicate evaluateWithObject:regStr];
    return B;
}
//图片名称
+ (NSString*)imageNameWithCurrentDate
{

    NSDate* date = [NSDate date];
    NSCalendar* calendar = [NSCalendar currentCalendar];
    NSDateComponents* comps = [calendar components:(NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit)fromDate:date];
    NSInteger year = [comps year];
    NSInteger month = [comps month];
    NSInteger day = [comps day];
    NSInteger hour = [comps hour];
    NSInteger minute = [comps minute];
    NSInteger second = [comps second];
    NSString* str = [NSString stringWithFormat:@"%ld%ld%ld%ld%ld%ld.jpg", (long)year, (long)month, (long)day, (long)hour, (long)minute, (long)second];
    return str;
}
+ (BOOL)isMobileNumber:(NSString*)mobileNum
{

    /**
     * 手机号码
     * 移动:134[0-8],135,136,137,138,139,150,151,157,158,159,182,187,188
     * 联通:130,131,132,152,155,156,185,186
     * 电信:133,1349,153,180,189
     */
    NSString* MOBILE = @"^1(3[0-9]|5[0-35-9]|8[025-9])\\d{8}$";
    /**
     10 * 中国移动:China Mobile
     11 * 134[0-8],135,136,137,138,139,150,151,157,158,159,182,187,188
     12 */
    NSString* CM = @"^1(34[0-8]|(3[5-9]|5[017-9]|8[278])\\d)\\d{7}$";
    /**
     15 * 中国联通:China Unicom
     16 * 130,131,132,152,155,156,185,186
     17 */
    NSString* CU = @"^1(3[0-2]|5[256]|8[56])\\d{8}$";
    /**
     20 * 中国电信:China Telecom
     21 * 133,1349,153,180,189
     22 */
    NSString* CT = @"^1((33|53|8[09])[0-9]|349)\\d{7}$";
    /**
     25 * 大陆地区固话及小灵通
     26 * 区号:010,020,021,022,023,024,025,027,028,029
     27 * 号码:七位或八位
     28 */
    // NSString * PHS = @"^0(10|2[0-5789]|\\d{3})\\d{7,8}$";
    NSString* phoneRegex = @"^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$";

    NSPredicate* regextestmobile = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", MOBILE];
    NSPredicate* regextestcm = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", CM];
    NSPredicate* regextestcu = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", CU];
    NSPredicate* regextestct = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", CT];
    //兼容14开头
    NSPredicate* regextestPhoneRegex = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", phoneRegex];
    if (([regextestmobile evaluateWithObject:mobileNum] == YES)
        || ([regextestcm evaluateWithObject:mobileNum] == YES)
        || ([regextestct evaluateWithObject:mobileNum] == YES)
        || ([regextestcu evaluateWithObject:mobileNum] == YES)
        || ([regextestPhoneRegex evaluateWithObject:mobileNum])) {
        return YES;
    }
    else {
        return NO;
    }
}
+ (BOOL)CheckInput:(NSString*)text
{
    if (text.length < 6) {
        return NO;
    }else{

        return YES;
    }
}

+ (NSData *)decodeWithBase64String:(NSString *)str{

    NSData *data = [GTMBase64 decodeString:str];

    return data;
}

+ (BOOL)judgeOnlyIncludeCEN:(NSString *)str
{
    NSString * regex = @"[a-zA-Z0-9\u3400-\u9fff]+";
    NSPredicate *pred = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex];
    return [pred evaluateWithObject:str];
}

+ (BOOL)isEnglishWordOrNumber:(NSString *)str{

    NSString* userNameRegex = @"^[A-Za-z0-9]+$";
    NSPredicate* userNamePredicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", userNameRegex];
    BOOL B = [userNamePredicate evaluateWithObject:str];
    return B;
}

+ (BOOL)isOnlyNumber:(NSString *)str{

    NSString* userNameRegex = @"^[0-9]+$";
    NSPredicate* userNamePredicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", userNameRegex];
    BOOL B = [userNamePredicate evaluateWithObject:str];
    return B;
}

+ (BOOL)stringContainsEmoji:(NSString *)string
{
    __block BOOL returnValue = NO;

    [string enumerateSubstringsInRange:NSMakeRange(0, [string length])
                               options:NSStringEnumerationByComposedCharacterSequences
                            usingBlock:^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) {
                                const unichar hs = [substring characterAtIndex:0];
                                if (0xd800 <= hs && hs <= 0xdbff) {
                                    if (substring.length > 1) {
                                        const unichar ls = [substring characterAtIndex:1];
                                        const int uc = ((hs - 0xd800) * 0x400) + (ls - 0xdc00) + 0x10000;
                                        if (0x1d000 <= uc && uc <= 0x1f77f) {
                                            returnValue = YES;
                                        }
                                    }
                                } else if (substring.length > 1) {
                                    const unichar ls = [substring characterAtIndex:1];
                                    if (ls == 0x20e3) {
                                        returnValue = YES;
                                    }
                                } else {
                                    if (0x2100 <= hs && hs <= 0x27ff) {
                                        returnValue = YES;
                                    } else if (0x2B05 <= hs && hs <= 0x2b07) {
                                        returnValue = YES;
                                    } else if (0x2934 <= hs && hs <= 0x2935) {
                                        returnValue = YES;
                                    } else if (0x3297 <= hs && hs <= 0x3299) {
                                        returnValue = YES;
                                    } else if (hs == 0xa9 || hs == 0xae || hs == 0x303d || hs == 0x3030 || hs == 0x2b55 || hs == 0x2b1c || hs == 0x2b1b || hs == 0x2b50) {
                                        returnValue = YES;
                                    }
                                }
                            }];

    return returnValue;
}

/** 删除所有的空格 */
-(NSString *)deleteSpace{

    NSMutableString *strM = [NSMutableString stringWithString:self];

    [strM replaceOccurrencesOfString:@" " withString:@"" options:NSLiteralSearch range:NSMakeRange(0, strM.length)];

    return [strM copy];
}

/*
 *  时间戳对应的NSDate
 */
-(NSDate *)date{

    NSTimeInterval timeInterval=self.floatValue;

    return [NSDate dateWithTimeIntervalSince1970:timeInterval];
}

/**
 *  时间戳转格式化的时间字符串
 */
-(NSString *)timestampToTimeStringWithFormatString:(NSString *)formatString{
    //时间戳转date
    NSDate *date=[NSDate dateWithTimeIntervalSince1970:[self integerValue]];

    return [self timeStringFromDate:date formatString:formatString];
}

-(NSString *)timeStringFromDate:(NSDate *)date formatString:(NSString *)formatString{
    //实例化时间格式化工具
    NSDateFormatter *formatter=[[NSDateFormatter alloc] init];

    //定义格式
    formatter.dateFormat=formatString;

    //时间转化为字符串
    NSString *dateString = [formatter stringFromDate:date];

    return dateString;
}

@end


text:
import mongoose from 'mongoose';
import mockgoose from 'mockgoose';

export const connectDb = () =>
  mockgoose(mongoose).then(() =>
    mongoose.connect('mongodb://mockhost:1/mern-test')
  );

export const dropDb = () => mockgoose.reset();

redpajama_set_name: RedPajamaGithub


text:
// Copyright 2017 Google Inc. All rights reserved.
//
// 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.

namespace GoogleVR.Demos {
  using UnityEngine;

  // Ensures correct app and scene setup.
  public class DemoSceneManager : MonoBehaviour {
    void Start() {
      Input.backButtonLeavesApp = true;
    }

    void Update() {
      // Exit when (X) is tapped.
      if (Input.GetKeyDown(KeyCode.Escape)) {
        Application.Quit();
      }
    }
  }
}


text:
<?php

namespace Tests;

use App\Models\User;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;

abstract class TestCase extends BaseTestCase
{
    use CreatesApplication;

    /**
     * @param null $user
     * @return $this
     */
    protected function signIn($user = null)
    {
        $user = $user ?: create(User::class);

        $this->actingAs($user);

        return $this;
    }
}


text:
require('stratum/stratum')

class 'SomeException' extends 'Exception' is { }
class 'AnotherException' extends 'Exception' is { }
class 'SomeOtherException' extends 'Exception' is { }

try(function()
	throw ('SomeException', 'This is a message')
end)
local caught1 = catch({
	['SomeException'] = function(exception)
		return('Caught SomeException: ' .. exception.message)
	end
})

try(function()
	throw ('AnotherException', 'This is another message')
end)
local caught2 = catch('AnotherException', function(exception)
	return('Caught AnotherException: ' .. exception.message)
end)

try(function()
	return something[nothing]
end)
local caught3 = catch('ErrorException', function(exception)
	return('Caught ErrorException: ' .. exception.message)
end)

try(function()
	throw ('SomeOtherException', 'This is some other message')
end)
local ret, uncaught = pcall(function()
	catch({
		['SomeException'] = function(exception)
			return('Caught SomeException: ' .. exception.message)
		end
	})
end)

assert(caught1 == 'Caught SomeException: This is a message', 'SomeException should be caught')
assert(caught2 == 'Caught AnotherException: This is another message', 'AnotherException should be caught')
assert(caught3:find('Caught ErrorException', 1, true), 'ErrorException should be caught')
assert(uncaught:find('Uncaught SomeOtherException', 1, true), 'SomeOtherException should not be caught')

print('👍  All try/catch tests okay!')


text:
package LeetcodeTemplate;

public class _0693BinaryNumberWithAlternatingBits {

	public static void main(String[] args) {
		System.out.println(hasAlternatingBits(5));
		System.out.println(hasAlternatingBits(7));
		System.out.println(hasAlternatingBits(11));
		System.out.println(hasAlternatingBits(10));
		System.out.println(hasAlternatingBits(3));
	}

	public static boolean hasAlternatingBits(int n) {

	}

}


text:
(function($) {
$.fn.lifestream.feeds.delicious = function( config, callback ) {

  var template = $.extend({},
    {
      bookmarked: 'bookmarked ${d}'
    },
    config.template);

  $.ajax({
    url: "http://feeds.delicious.com/v2/json/" + config.user,
    dataType: "jsonp",
    success: function( data ) {
      var output = [], i = 0, j;
      if (data && data.length && data.length > 0) {
        j = data.length;
        for( ; i < j; i++) {
          var item = data[i];
          output.push({
            date: new Date(item.dt),
            config: config,
            html: $.tmpl( template.bookmarked, item )
          });
        }
      }
      callback(output);
    }
  });

  // Expose the template.
  // We use this to check which templates are available
  return {
    "template" : template
  };

};
})(jQuery);


text:
// // tslint:disable:typedef

// export interface ExpiryData {
//   expires?: Date|string;
//   data: any;
// }

// // Convenience
// export const encode = encodeURIComponent;
// export const decode = decodeURIComponent;

// export const COOKIE_SEP = '; ';
// export const isAfterToday = (date: Date) => date > new Date();
// export const isString = (str: string|Date): boolean => typeof str === 'string';
// export const toString = (obj: any): string => typeof obj.toUTCString === 'function' ? obj.toUTCString() : obj.toString();
export const isNil = (item: any) => item === undefined || item === null;

// export const setDataWithExpiry = (data, expires?: Date|string): ExpiryData => {
//   return expires ? {data, expires: toString(expires)} : data;
// };

// export const isExpired = (data: ExpiryData): boolean => {
//   if (!data.expires)
//     return false;

//   const {expires} = data;

//   return isAfterToday(expires instanceof Date ? expires : new Date(expires));
// };

// export const getDataWithExpiry = (expData) => isExpired(expData) ? undefined : expData.data;

// export const convertFromJSON = function(data: any) {
//   if (typeof data !== 'string')
//     return data;
//   else {
//     try {
//       return JSON.parse(data);
//     } catch (e) {
//       return data;
//     }
//   }
// };

// export const isLocalStorageValid = () => {
//   try {
//     return typeof localStorage !== 'undefined' &&
//            ('setItem' in localStorage) &&
//            typeof localStorage.setItem === 'function';
//   } catch (e) {
//     return false;
//   }
// };

// declare var window: any;

// export const idb = () => {
//   /* global indexedDB,webkitIndexedDB,mozIndexedDB,OIndexedDB,msIndexedDB */
//   try {
//     if (typeof window.indexedDB !== 'undefined') {
//       return window.indexedDB;
//     }
//     if (typeof window.webkitIndexedDB !== 'undefined') {
//       return window.webkitIndexedDB;
//     }
//     if (typeof window.mozIndexedDB !== 'undefined') {
//       return window.mozIndexedDB;
//     }
//     if (typeof window.OIndexedDB !== 'undefined') {
//       return window.OIndexedDB;
//     }
//     if (typeof window.msIndexedDB !== 'undefined') {
//       return window.msIndexedDB;
//     }
//   } catch (e) {
//     return;
//   }
// };

// export const isIndexedDBValid = () => {
//   try {
//     // Initialize IndexedDB; fall back to vendor-prefixed versions
//     // if needed.
//     if (!idb()) {
//       return false;
//     }
//     // We mimic PouchDB here; just UA test for Safari (which, as of
//     // iOS 8/Yosemite, doesn't properly support IndexedDB).
//     // IndexedDB support is broken and different from Blink's.
//     // This is faster than the test case (and it's sync), so we just
//     // do this. *SIGH*
//     // http://bl.ocks.org/nolanlawson/raw/c83e9039edf2278047e9/
//     //
//     // We test for openDatabase because IE Mobile identifies itself
//     // as Safari. Oh the lulz...
//     if (typeof window.openDatabase !== 'undefined' && typeof navigator !== 'undefined' &&
//       navigator.userAgent &&
//       /Safari/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent)) {
//       return false;
//     }

//     return idb &&
//       typeof idb().open === 'function' &&
//       // Some Samsung/HTC Android 4.0-4.3 devices
//       // have older IndexedDB specs; if this isn't available
//       // their IndexedDB is too old for us to use.
//       // (Replaces the onupgradeneeded test.)
//       typeof IDBKeyRange !== 'undefined';
//   } catch (e) {
//     return false;
//   }
// };

// export const isWebSQLValid = () => {
//   return typeof window.openDatabase === 'function';
// };


text:
<?php get_template_part('templates/head'); ?>
  <body <?php body_class(); ?>>

  <?php
    // Use Bootstrap's navbar if enabled in config.php
    if (current_theme_supports('bootstrap-top-navbar')) {
      get_template_part('templates/header-top-navbar');
    } else {
      get_template_part('templates/header');
    }
  ?>

                           <?php get_template_part('templates/page', 'carousel'); ?>
                          <?php get_template_part('templates/page', 'submenu'); ?>
                  <?php if (function_exists('dimox_breadcrumbs')) dimox_breadcrumbs(); ?>

                <div id="main" class="<?php echo roots_main_class(); ?>" role="main">

                  <?php get_template_part('templates/oblaci'); ?>
                  <?php include roots_template_path(); ?>

            <?php get_template_part('templates/footer'); ?>


text:
default['motd']['path'] = '/etc/motd'
default['motd']['content'] = "Property of Awesome Appliance, Inc\n"


text:
define([
    'react/addons',
    'lodash',
    './CodeMirrorEditor'
], function (React, _, CodeEditor) {
    'use strict';
    function onChange1(e) {
        this.setState({ templateHTML: e.target.value });
    }
    function onChange2(e) {
        this.setState({ templateProps: e.target.value });
    }
    function onSubmit3(e) {
        e.preventDefault();
    }
    return function () {
        return React.createElement('div', { 'className': 'playground' }, React.createElement('div', { 'className': 'fiddle-row' }, React.createElement('div', {
            'className': 'code-area',
            'id': 'area-rt'
        }, React.createElement(CodeEditor, {
            'ref': 'editorRT',
            'id': 'editor-rt',
            'className': 'large-text-area',
            'value': this.state.templateHTML,
            'mode': 'html',
            'onChange': onChange1.bind(this)
        })), React.createElement('div', {
            'className': 'code-area',
            'id': 'area-code'
        }, React.createElement(CodeEditor, {
            'ref': 'editorCode',
            'id': 'editor-code',
            'className': 'large-text-area',
            'value': this.state.templateProps,
            'mode': 'javascript',
            'onChange': onChange2.bind(this)
        }))), React.createElement('div', { 'className': 'fiddle-row' }, React.createElement('div', {
            'className': 'code-area',
            'id': 'area-generated'
        }, React.createElement(CodeEditor, {
            'id': 'editor-generated',
            'className': 'large-text-area',
            'ref': 'editorGenerated',
            'value': this.templateSource,
            'mode': 'javascript',
            'readOnly': true
        })), React.createElement('div', {
            'className': 'code-area',
            'id': 'area-result'
        }    /* <div id="result-container" class="result-area"> */, React.createElement('div', {
            'id': 'result-area',
            'key': 'result-area',
            'className': 'sample-view'
        }, React.createElement('form', {
            'className': 'result-area-form',
            'ref': 'mount',
            'onSubmit': onSubmit3.bind(this)
        }    /* <this.sample key="sample"> */
             /* </this.sample> */)))));
    };
});


text:
layout: post
title: Dopplr, le carnet de voyage 2.0
categories:
- Internet
tags:
- Dopplr
- Vacances
- Voyage
- Web
- Web2.0
status: publish
type: post
published: true
meta:
  aktt_notify_twitter: 'no'
  _edit_last: '1'
  tmac_last_id: '256453945738792960'
---

Ça fait un petit moment que Dopplr existe. Mais je n'avais jamais testé ce site. Voilà qui est chose faite.

Dopplr c'est quoi ?
Ce site vous permet de saisir les voyages que vous avez et surtout ceux que vous allez faire. Jusque-là, rien de très impressionnant.

Là où ça devient sympa, c'est que vous pouvez bénéficier des astuces et bons plans des utilisateurs qui ont déjà visité les endroits de vos futures vacances. C'est comme ça que j'ai pu récolter quelques adresses de restaurant à San Francisco qui ont l'air bien sympa.

Dopplr vous permet également de voir les voyages de vos amis et de voir si vous allez aux mêmes endroits en même temps.

Je pense que vous allez me dire que ce n'est pas grand-chose. Oui, peut-être. Mais Dopplr le fait très bien. L'interface est vraiment sympa, l'humour est présent et la communauté active.

Si vous êtes un grand voyageur, je vous conseille d'aller y jeter un coup d'oeil.

Maintenant, je sais que j'ai la rapidité d'une tortue :|


text:
using System;
using BEPUphysics.Constraints.SingleEntity;
using BEPUphysics.Constraints.TwoEntity.Motors;
using BEPUphysics.Entities;
using BEPUphysics.UpdateableSystems;
using BEPUutilities;

namespace BEPUphysics.Paths.PathFollowing
{
    /// <summary>
    /// Pushes an entity around according to goal positions and orientations.
    /// </summary>
    public class EntityMover : Updateable, IDuringForcesUpdateable
    {
        private Entity entity;

        /// <summary>
        /// Constructs a new EntityMover.
        /// </summary>
        /// <param name="e">Entity to move.</param>
        public EntityMover(Entity e)
        {
            IsUpdatedSequentially = false;
            LinearMotor = new SingleEntityLinearMotor(e, e.Position);
            Entity = e;

            LinearMotor.Settings.Mode = MotorMode.Servomechanism;
            TargetPosition = e.Position;
        }

        /// <summary>
        /// Constructs a new EntityMover.
        /// </summary>
        /// <param name="e">Entity to move.</param>
        /// <param name="linearMotor">Motor to use for linear motion if the entity is dynamic.</param>
        public EntityMover(Entity e, SingleEntityLinearMotor linearMotor)
        {
            IsUpdatedSequentially = false;
            LinearMotor = linearMotor;
            Entity = e;

            linearMotor.Entity = Entity;
            linearMotor.Settings.Mode = MotorMode.Servomechanism;
            TargetPosition = e.Position;
        }

        /// <summary>
        /// Gets or sets the entity being pushed by the entity mover.
        /// </summary>
        public Entity Entity
        {
            get { return entity; }
            set
            {
                entity = value;
                LinearMotor.Entity = value;
            }
        }

        /// <summary>
        /// Gets the linear motor used by the entity mover.
        /// When the affected entity is dynamic, it is pushed by motors.
        /// This ensures that its interactions and collisions with
        /// other entities remain stable.
        /// </summary>
        public SingleEntityLinearMotor LinearMotor { get; private set; }

        /// <summary>
        /// Gets or sets the point in the entity's local space that will be moved towards the target position.
        /// </summary>
        public Vector3 LocalOffset
        {
            get { return LinearMotor.LocalPoint; }
            set { LinearMotor.LocalPoint = value; }
        }

        /// <summary>
        /// Gets or sets the point attached to the entity in world space that will be moved towards the target position.
        /// </summary>
        public Vector3 Offset
        {
            get { return LinearMotor.Point; }
            set { LinearMotor.Point = value; }
        }

        /// <summary>
        /// Gets or sets the target location of the entity mover.
        /// </summary>
        public Vector3 TargetPosition { get; set; }

        /// <summary>
        /// Gets the angular velocity necessary to change an entity's orientation from
        /// the starting quaternion to the ending quaternion over time dt.
        /// </summary>
        /// <param name="start">Initial position.</param>
        /// <param name="end">Final position.</param>
        /// <param name="dt">Time over which the angular velocity is to be applied.</param>
        /// <returns>Angular velocity to reach the goal in time.</returns>
        public static Vector3 GetLinearVelocity(Vector3 start, Vector3 end, float dt)
        {
            Vector3 offset;
            Vector3.Subtract(ref end, ref start, out offset);
            Vector3.Divide(ref offset, dt, out offset);
            return offset;
        }

        /// <summary>
        /// Adds the motors to the space.  Called automatically.
        /// </summary>
        public override void OnAdditionToSpace(Space newSpace)
        {
            newSpace.Add(LinearMotor);
        }

        /// <summary>
        /// Removes the motors from the space.  Called automatically.
        /// </summary>
        public override void OnRemovalFromSpace(Space oldSpace)
        {
            oldSpace.Remove(LinearMotor);
        }

        /// <summary>
        /// Called automatically by the space.
        /// </summary>
        /// <param name="dt">Simulation timestep.</param>
        void IDuringForcesUpdateable.Update(float dt)
        {
            if (Entity != LinearMotor.Entity)
                throw new InvalidOperationException(
                    "EntityMover's entity differs from EntityMover's motors' entities.  Ensure that the moved entity is only changed by setting the EntityMover's entity property.");

            if (Entity.IsDynamic)
            {
                LinearMotor.IsActive = true;
                LinearMotor.Settings.Servo.Goal = TargetPosition;
            }
            else
            {
                LinearMotor.IsActive = false;
                Vector3 worldMovedPoint = Matrix3x3.Transform(LocalOffset, entity.orientationMatrix);
                Vector3.Add(ref worldMovedPoint, ref entity.position, out worldMovedPoint);
                Entity.LinearVelocity = GetLinearVelocity(worldMovedPoint, TargetPosition, dt);
            }
        }
    }
}


text:
/**
 */
package gluemodel.substationStandard.LNNodes.LNGroupY;

import gluemodel.substationStandard.Dataclasses.APC;
import gluemodel.substationStandard.Dataclasses.INS;
import gluemodel.substationStandard.Dataclasses.ISC;
import gluemodel.substationStandard.Dataclasses.MV;
import gluemodel.substationStandard.Dataclasses.SPS;

/**
 *
 * A representation of the model object 'YEFN'.
 *
 *
 *

 * The following features are supported:
 *

 *

 *
{@link gluemodel.substationStandard.LNNodes.LNGroupY.YEFN#getLoc Loc}

 *
{@link gluemodel.substationStandard.LNNodes.LNGroupY.YEFN#getOpTmh Op Tmh}

 *
{@link gluemodel.substationStandard.LNNodes.LNGroupY.YEFN#getECA ECA}

 *
{@link gluemodel.substationStandard.LNNodes.LNGroupY.YEFN#getColTapPos Col Tap Pos}

 *
{@link gluemodel.substationStandard.LNNodes.LNGroupY.YEFN#getColPos Col Pos}

 *

 *
 * @see gluemodel.substationStandard.LNNodes.LNGroupY.LNGroupYPackage#getYEFN()
 * @model
 * @generated
 */
public interface YEFN extends GroupY {
	/**
	 * Returns the value of the 'Loc' reference.
	 *
	 *

	 * If the meaning of the 'Loc' reference isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @return the value of the 'Loc' reference.
	 * @see #setLoc(SPS)
	 * @see gluemodel.substationStandard.LNNodes.LNGroupY.LNGroupYPackage#getYEFN_Loc()
	 * @model required="true"
	 * @generated
	 */
	SPS getLoc();

	/**
	 * Sets the value of the '{@link gluemodel.substationStandard.LNNodes.LNGroupY.YEFN#getLoc Loc}' reference.
	 *
	 *
	 * @param value the new value of the 'Loc' reference.
	 * @see #getLoc()
	 * @generated
	 */
	void setLoc(SPS value);

	/**
	 * Returns the value of the 'Op Tmh' reference.
	 *
	 *

	 * If the meaning of the 'Op Tmh' reference isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @return the value of the 'Op Tmh' reference.
	 * @see #setOpTmh(INS)
	 * @see gluemodel.substationStandard.LNNodes.LNGroupY.LNGroupYPackage#getYEFN_OpTmh()
	 * @model required="true"
	 * @generated
	 */
	INS getOpTmh();

	/**
	 * Sets the value of the '{@link gluemodel.substationStandard.LNNodes.LNGroupY.YEFN#getOpTmh Op Tmh}' reference.
	 *
	 *
	 * @param value the new value of the 'Op Tmh' reference.
	 * @see #getOpTmh()
	 * @generated
	 */
	void setOpTmh(INS value);

	/**
	 * Returns the value of the 'ECA' reference.
	 *
	 *

	 * If the meaning of the 'ECA' reference isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @return the value of the 'ECA' reference.
	 * @see #setECA(MV)
	 * @see gluemodel.substationStandard.LNNodes.LNGroupY.LNGroupYPackage#getYEFN_ECA()
	 * @model required="true"
	 * @generated
	 */
	MV getECA();

	/**
	 * Sets the value of the '{@link gluemodel.substationStandard.LNNodes.LNGroupY.YEFN#getECA ECA}' reference.
	 *
	 *
	 * @param value the new value of the 'ECA' reference.
	 * @see #getECA()
	 * @generated
	 */
	void setECA(MV value);

	/**
	 * Returns the value of the 'Col Tap Pos' reference.
	 *
	 *

	 * If the meaning of the 'Col Tap Pos' reference isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @return the value of the 'Col Tap Pos' reference.
	 * @see #setColTapPos(ISC)
	 * @see gluemodel.substationStandard.LNNodes.LNGroupY.LNGroupYPackage#getYEFN_ColTapPos()
	 * @model required="true"
	 * @generated
	 */
	ISC getColTapPos();

	/**
	 * Sets the value of the '{@link gluemodel.substationStandard.LNNodes.LNGroupY.YEFN#getColTapPos Col Tap Pos}' reference.
	 *
	 *
	 * @param value the new value of the 'Col Tap Pos' reference.
	 * @see #getColTapPos()
	 * @generated
	 */
	void setColTapPos(ISC value);

	/**
	 * Returns the value of the 'Col Pos' reference.
	 *
	 *

	 * If the meaning of the 'Col Pos' reference isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @return the value of the 'Col Pos' reference.
	 * @see #setColPos(APC)
	 * @see gluemodel.substationStandard.LNNodes.LNGroupY.LNGroupYPackage#getYEFN_ColPos()
	 * @model required="true"
	 * @generated
	 */
	APC getColPos();

	/**
	 * Sets the value of the '{@link gluemodel.substationStandard.LNNodes.LNGroupY.YEFN#getColPos Col Pos}' reference.
	 *
	 *
	 * @param value the new value of the 'Col Pos' reference.
	 * @see #getColPos()
	 * @generated
	 */
	void setColPos(APC value);

} // YEFN


text:
module Providers
  module Ovirt
    class OvirtLaunchable < Launchable
      attr_accessor :memory, :os, :cluster

      # List all of the launchable items.
      # The list may be reduced by the information in the current context.
      def self.all(filter=nil)
        launchables = []
        connect! do |client|
          client.templates.map do |template|
            state = template.status.strip
            wm_state = (state == "ok") ? Launchable::WM_STATE_ACTIVE : Launchable::WM_STATE_INACTIVE

            OvirtLaunchable.new(:id          => template.id,
                                :name        => template.name,
                                :description => template.description,
                                :wm_state    => wm_state,
                                :memory      => template.memory.strip,
                                # :cluster   => template.cluster,
                                :os          => template.os)
          end
        end
      end

      def self.find(id)
        self.all.find{|launchable| launchable.id.to_s == id.to_s}
      end
    end
  end
end


text:
namespace blink {

class StyleSelfAlignmentData {
  DISALLOW_NEW();

 public:
  // Style data for Self-Aligment and Default-Alignment properties: align-{self,
  // items}, justify-{self, items}.
  // [ <self-position> && <overflow-position>? ] | [ legacy && [ left | right |
  // center ] ]
  StyleSelfAlignmentData(
      ItemPosition position,
      OverflowAlignment overflow,
      ItemPositionType position_type = ItemPositionType::kNonLegacy)
      : position_(static_cast<unsigned>(position)),
        position_type_(static_cast<unsigned>(position_type)),
        overflow_(static_cast<unsigned>(overflow)) {}

  void SetPosition(ItemPosition position) {
    position_ = static_cast<unsigned>(position);
  }
  void SetPositionType(ItemPositionType position_type) {
    position_type_ = static_cast<unsigned>(position_type);
  }
  void SetOverflow(OverflowAlignment overflow) {
    overflow_ = static_cast<unsigned>(overflow);
  }

  ItemPosition GetPosition() const {
    return static_cast<ItemPosition>(position_);
  }
  ItemPositionType PositionType() const {
    return static_cast<ItemPositionType>(position_type_);
  }
  OverflowAlignment Overflow() const {
    return static_cast<OverflowAlignment>(overflow_);
  }

  bool operator==(const StyleSelfAlignmentData& o) const {
    return position_ == o.position_ && position_type_ == o.position_type_ &&
           overflow_ == o.overflow_;
  }

  bool operator!=(const StyleSelfAlignmentData& o) const {
    return !(*this == o);
  }

 private:
  unsigned position_ : 4;       // ItemPosition
  unsigned position_type_ : 1;  // Whether or not alignment uses the 'legacy'
                                // keyword.
  unsigned overflow_ : 2;       // OverflowAlignment
};

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_CORE_STYLE_STYLE_SELF_ALIGNMENT_DATA_H_


text:
verifyAndSignTransactionBytes = function(transactionBytes, signature, requestType, data) {

	var transaction = {};

	var byteArray = converters.hexStringToByteArray(transactionBytes);

	transaction.type = byteArray[0];

	transaction.version = (byteArray[1] & 0xF0) >> 4;
	transaction.subtype = byteArray[1] & 0x0F;

	transaction.timestamp = String(converters.byteArrayToSignedInt32(byteArray, 2));
	transaction.deadline = String(converters.byteArrayToSignedShort(byteArray, 6));
	transaction.publicKey = converters.byteArrayToHexString(byteArray.slice(8, 40));
	transaction.recipient = String(converters.byteArrayToBigInteger(byteArray, 40));
	transaction.amountNQT = String(converters.byteArrayToBigInteger(byteArray, 48));
	transaction.feeNQT = String(converters.byteArrayToBigInteger(byteArray, 56));

	var refHash = byteArray.slice(64, 96);
	transaction.referencedTransactionFullHash = converters.byteArrayToHexString(refHash);
	if (transaction.referencedTransactionFullHash == "0000000000000000000000000000000000000000000000000000000000000000") {
		transaction.referencedTransactionFullHash = "";
	}
	//transaction.referencedTransactionId = converters.byteArrayToBigInteger([refHash[7], refHash[6], refHash[5], refHash[4], refHash[3], refHash[2], refHash[1], refHash[0]], 0);

	transaction.flags = 0;

	if (transaction.version > 0) {
		transaction.flags = converters.byteArrayToSignedInt32(byteArray, 160);
		transaction.ecBlockHeight = String(converters.byteArrayToSignedInt32(byteArray, 164));
		transaction.ecBlockId = String(converters.byteArrayToBigInteger(byteArray, 168));
	}

	if (!("amountNQT" in data)) {
		data.amountNQT = "0";
	}

	if (!("recipient" in data)) {
		data.recipient = "13675701959091502344"; //nhz mainnet
		data.recipientRS = "NHZ-8HAA-H88W-UVT5-DUGLV"; //nhz mainnet
	}

	if (transaction.amountNQT !== data.amountNQT || transaction.feeNQT !== data.feeNQT) {
		return false;
	}

	if ("referencedTransactionFullHash" in data) {
		if (transaction.referencedTransactionFullHash !== data.referencedTransactionFullHash) {
			return false;
		}
	} else if (transaction.referencedTransactionFullHash !== "") {
		return false;
	}

	if (transaction.version > 0) {
		//has empty attachment, so no attachmentVersion byte...
		if (requestType == "sendMoney" || requestType == "sendMessage") {
			var pos = 176;
		} else {
			var pos = 177;
		}
	} else {
		var pos = 160;
	}

	switch (requestType) {
		case "sendMoney":
			if (transaction.type !== 0 || transaction.subtype !== 0) {
				return false;
			}
			break;
		case "sendMessage":
			if (transaction.type !== 1 || transaction.subtype !== 0) {
				return false;
			}

			break;
		case "setAlias":
			if (transaction.type !== 1 || transaction.subtype !== 1) {
				return false;
			}

			var aliasLength = parseInt(byteArray[pos], 10);

			pos++;

			transaction.aliasName = converters.byteArrayToString(byteArray, pos, aliasLength);

			pos += aliasLength;

			var uriLength = converters.byteArrayToSignedShort(byteArray, pos);

			pos += 2;

			transaction.aliasURI = converters.byteArrayToString(byteArray, pos, uriLength);

			pos += uriLength;

			if (transaction.aliasName !== data.aliasName || transaction.aliasURI !== data.aliasURI) {
				return false;
			}
			break;
		case "createPoll":
			if (transaction.type !== 1 || transaction.subtype !== 2) {
				return false;
			}

			var nameLength = converters.byteArrayToSignedShort(byteArray, pos);

			pos += 2;

			transaction.name = converters.byteArrayToString(byteArray, pos, nameLength);

			pos += nameLength;

			var descriptionLength = converters.byteArrayToSignedShort(byteArray, pos);

			pos += 2;

			transaction.description = converters.byteArrayToString(byteArray, pos, descriptionLength);

			pos += descriptionLength;

			var nr_options = byteArray[pos];

			pos++;

			for (var i = 0; i < nr_options; i++) {
				var optionLength = converters.byteArrayToSignedShort(byteArray, pos);

				pos += 2;

				transaction["option" + i] = converters.byteArrayToString(byteArray, pos, optionLength);

				pos += optionLength;
			}

			transaction.minNumberOfOptions = String(byteArray[pos]);

			pos++;

			transaction.maxNumberOfOptions = String(byteArray[pos]);

			pos++;

			transaction.optionsAreBinary = String(byteArray[pos]);

			pos++;

			if (transaction.name !== data.name || transaction.description !== data.description || transaction.minNumberOfOptions !== data.minNumberOfOptions || transaction.maxNumberOfOptions !== data.maxNumberOfOptions || transaction.optionsAreBinary !== data.optionsAreBinary) {
				return false;
			}

			for (var i = 0; i < nr_options; i++) {
				if (transaction["option" + i] !== data["option" + i]) {
					return false;
				}
			}

			if (("option" + i) in data) {
				return false;
			}

			break;
		case "castVote":
			if (transaction.type !== 1 || transaction.subtype !== 3) {
				return false;
			}

			transaction.poll = String(converters.byteArrayToBigInteger(byteArray, pos));

			pos += 8;

			var voteLength = byteArray[pos];

			pos++;

			transaction.votes = [];

			for (var i = 0; i < voteLength; i++) {
				transaction.votes.push(byteArray[pos]);

				pos++;
			}

			return false;

			break;
		case "hubAnnouncement":
			if (transaction.type !== 1 || transaction.subtype != 4) {
				return false;
			}

			var minFeePerByte = String(converters.byteArrayToBigInteger(byteArray, pos));

			pos += 8;

			var numberOfUris = parseInt(byteArray[pos], 10);

			pos++;

			var uris = [];

			for (var i = 0; i < numberOfUris; i++) {
				var uriLength = parseInt(byteArray[pos], 10);

				pos++;

				uris[i] = converters.byteArrayToString(byteArray, pos, uriLength);

				pos += uriLength;
			}

			//do validation

			return false;

			break;
		case "setAccountInfo":
			if (transaction.type !== 1 || transaction.subtype != 5) {
				return false;
			}

			var nameLength = parseInt(byteArray[pos], 10);

			pos++;

			transaction.name = converters.byteArrayToString(byteArray, pos, nameLength);

			pos += nameLength;

			var descriptionLength = converters.byteArrayToSignedShort(byteArray, pos);

			pos += 2;

			transaction.description = converters.byteArrayToString(byteArray, pos, descriptionLength);

			pos += descriptionLength;

			if (transaction.name !== data.name || transaction.description !== data.description) {
				return false;
			}

			break;
		case "sellAlias":
			if (transaction.type !== 1 || transaction.subtype !== 6) {
				return false;
			}

			var aliasLength = parseInt(byteArray[pos], 10);

			pos++;

			transaction.alias = converters.byteArrayToString(byteArray, pos, aliasLength);

			pos += aliasLength;

			transaction.priceNQT = String(converters.byteArrayToBigInteger(byteArray, pos));

			pos += 8;

			if (transaction.alias !== data.aliasName || transaction.priceNQT !== data.priceNQT) {
				return false;
			}

			break;
		case "buyAlias":
			if (transaction.type !== 1 && transaction.subtype !== 7) {
				return false;
			}

			var aliasLength = parseInt(byteArray[pos], 10);

			pos++;

			transaction.alias = converters.byteArrayToString(byteArray, pos, aliasLength);

			pos += aliasLength;

			if (transaction.alias !== data.aliasName) {
				return false;
			}

			break;
		case "issueAsset":
			if (transaction.type !== 2 || transaction.subtype !== 0) {
				return false;
			}

			var nameLength = byteArray[pos];

			pos++;

			transaction.name = converters.byteArrayToString(byteArray, pos, nameLength);

			pos += nameLength;

			var descriptionLength = converters.byteArrayToSignedShort(byteArray, pos);

			pos += 2;

			transaction.description = converters.byteArrayToString(byteArray, pos, descriptionLength);

			pos += descriptionLength;

			transaction.quantityQNT = String(converters.byteArrayToBigInteger(byteArray, pos));

			pos += 8;

			transaction.decimals = String(byteArray[pos]);

			pos++;

			if (transaction.name !== data.name || transaction.description !== data.description || transaction.quantityQNT !== data.quantityQNT || transaction.decimals !== data.decimals) {
				return false;
			}

			break;
		case "transferAsset":
			if (transaction.type !== 2 || transaction.subtype !== 1) {
				return false;
			}

			transaction.asset = String(converters.byteArrayToBigInteger(byteArray, pos));

			pos += 8;

			transaction.quantityQNT = String(converters.byteArrayToBigInteger(byteArray, pos));

			pos += 8;
			break;
		case "placeAskOrder":
		case "placeBidOrder":
			if (transaction.type !== 2) {
				return false;
			} else if (requestType == "placeAskOrder" && transaction.subtype !== 2) {
				return false;
			} else if (requestType == "placeBidOrder" && transaction.subtype !== 3) {
				return false;
			}

			transaction.asset = String(converters.byteArrayToBigInteger(byteArray, pos));

			pos += 8;

			transaction.quantityQNT = String(converters.byteArrayToBigInteger(byteArray, pos));

			pos += 8;

			transaction.priceNQT = String(converters.byteArrayToBigInteger(byteArray, pos));

			pos += 8;

			break;
		case "cancelAskOrder":
		case "cancelBidOrder":
			if (transaction.type !== 2) {
				return false;
			} else if (requestType == "cancelAskOrder" && transaction.subtype !== 4) {
				return false;
			} else if (requestType == "cancelBidOrder" && transaction.subtype !== 5) {
				return false;
			}

			transaction.order = String(converters.byteArrayToBigInteger(byteArray, pos));

			pos += 8;

			break;
		case "dgsListing":
			if (transaction.type !== 3 && transaction.subtype != 0) {
				return false;
			}

			var nameLength = converters.byteArrayToSignedShort(byteArray, pos);

			pos += 2;

			transaction.name = converters.byteArrayToString(byteArray, pos, nameLength);

			pos += nameLength;

			var descriptionLength = converters.byteArrayToSignedShort(byteArray, pos);

			pos += 2;

			transaction.description = converters.byteArrayToString(byteArray, pos, descriptionLength);

			pos += descriptionLength;

			var tagsLength = converters.byteArrayToSignedShort(byteArray, pos);

			pos += 2;

			transaction.tags = converters.byteArrayToString(byteArray, pos, tagsLength);

			pos += tagsLength;

			transaction.quantity = String(converters.byteArrayToSignedInt32(byteArray, pos));

			pos += 4;

			transaction.priceNQT = String(converters.byteArrayToBigInteger(byteArray, pos));

			pos += 8;

			if (transaction.name !== data.name || transaction.description !== data.description || transaction.tags !== data.tags || transaction.quantity !== data.quantity || transaction.priceNQT !== data.priceNQT) {
				return false;
			}

			break;
		case "dgsDelisting":
			if (transaction.type !== 3 && transaction.subtype !== 1) {
				return false;
			}

			transaction.goods = String(converters.byteArrayToBigInteger(byteArray, pos));

			pos += 8;

			if (transaction.goods !== data.goods) {
				return false;
			}

			break;
		case "dgsPriceChange":
			if (transaction.type !== 3 && transaction.subtype !== 2) {
				return false;
			}

			transaction.goods = String(converters.byteArrayToBigInteger(byteArray, pos));

			pos += 8;

			transaction.priceNQT = String(converters.byteArrayToBigInteger(byteArray, pos));

			pos += 8;

			if (transaction.goods !== data.goods || transaction.priceNQT !== data.priceNQT) {
				return false;
			}

			break;
		case "dgsQuantityChange":
			if (transaction.type !== 3 && transaction.subtype !== 3) {
				return false;
			}

			transaction.goods = String(converters.byteArrayToBigInteger(byteArray, pos));

			pos += 8;

			transaction.deltaQuantity = String(converters.byteArrayToSignedInt32(byteArray, pos));

			pos += 4;

			if (transaction.goods !== data.goods || transaction.deltaQuantity !== data.deltaQuantity) {
				return false;
			}

			break;
		case "dgsPurchase":
			if (transaction.type !== 3 && transaction.subtype !== 4) {
				return false;
			}

			transaction.goods = String(converters.byteArrayToBigInteger(byteArray, pos));

			pos += 8;

			transaction.quantity = String(converters.byteArrayToSignedInt32(byteArray, pos));

			pos += 4;

			transaction.priceNQT = String(converters.byteArrayToBigInteger(byteArray, pos));

			pos += 8;

			transaction.deliveryDeadlineTimestamp = String(converters.byteArrayToSignedInt32(byteArray, pos));

			pos += 4;

			if (transaction.goods !== data.goods || transaction.quantity !== data.quantity || transaction.priceNQT !== data.priceNQT || transaction.deliveryDeadlineTimestamp !== data.deliveryDeadlineTimestamp) {
				return false;
			}

			break;
		case "dgsDelivery":
			if (transaction.type !== 3 && transaction.subtype !== 5) {
				return false;
			}

			transaction.purchase = String(converters.byteArrayToBigInteger(byteArray, pos));

			pos += 8;

			var encryptedGoodsLength = converters.byteArrayToSignedShort(byteArray, pos);

			var goodsLength = converters.byteArrayToSignedInt32(byteArray, pos);

			transaction.goodsIsText = goodsLength < 0; // ugly hack??

			if (goodsLength < 0) {
				goodsLength &= 2147483647;
			}

			pos += 4;

			transaction.goodsData = converters.byteArrayToHexString(byteArray.slice(pos, pos + encryptedGoodsLength));

			pos += encryptedGoodsLength;

			transaction.goodsNonce = converters.byteArrayToHexString(byteArray.slice(pos, pos + 32));

			pos += 32;

			transaction.discountNQT = String(converters.byteArrayToBigInteger(byteArray, pos));

			pos += 8;

			var goodsIsText = (transaction.goodsIsText ? "true" : "false");

			if (goodsIsText != data.goodsIsText) {
				return false;
			}

			if (transaction.purchase !== data.purchase || transaction.goodsData !== data.goodsData || transaction.goodsNonce !== data.goodsNonce || transaction.discountNQT !== data.discountNQT) {
				return false;
			}

			break;
		case "dgsFeedback":
			if (transaction.type !== 3 && transaction.subtype !== 6) {
				return false;
			}

			transaction.purchase = String(converters.byteArrayToBigInteger(byteArray, pos));

			pos += 8;

			if (transaction.purchase !== data.purchase) {
				return false;
			}

			break;
		case "dgsRefund":
			if (transaction.type !== 3 && transaction.subtype !== 7) {
				return false;
			}

			transaction.purchase = String(converters.byteArrayToBigInteger(byteArray, pos));

			pos += 8;

			transaction.refundNQT = String(converters.byteArrayToBigInteger(byteArray, pos));

			pos += 8;

			if (transaction.purchase !== data.purchase || transaction.refundNQT !== data.refundNQT) {
				return false;
			}

			break;
		case "leaseBalance":
			if (transaction.type !== 4 && transaction.subtype !== 0) {
				return false;
			}

			transaction.period = String(converters.byteArrayToSignedShort(byteArray, pos));

			pos += 2;

			if (transaction.period !== data.period) {
				return false;
			}

			break;
		default:
			//invalid requestType..
			return false;
	}

	if (1) {
		var position = 1;

	position <<= 1;

	//encrypted note
	if ((transaction.flags & position) != 0) {
		var attachmentVersion = byteArray[pos];

		pos++;

		var encryptedMessageLength = converters.byteArrayToSignedInt32(byteArray, pos);

		transaction.messageToEncryptIsText = encryptedMessageLength < 0;

		if (encryptedMessageLength < 0) {
			encryptedMessageLength &= 2147483647;
		}

		pos += 4;

		transaction.encryptedMessageData = converters.byteArrayToHexString(byteArray.slice(pos, pos + encryptedMessageLength));

		pos += encryptedMessageLength;

		transaction.encryptedMessageNonce = converters.byteArrayToHexString(byteArray.slice(pos, pos + 32));

		pos += 32;

		var messageToEncryptIsText = (transaction.messageToEncryptIsText ? "true" : "false");

		if (messageToEncryptIsText != data.messageToEncryptIsText) {
			return false;
		}

		if (transaction.encryptedMessageData !== data.encryptedMessageData || transaction.encryptedMessageNonce !== data.encryptedMessageNonce) {
			return false;
		}
	} else if (data.encryptedMessageData) {
		return false;
	}

	position <<= 1;

	if ((transaction.flags & position) != 0) {
		var attachmentVersion = byteArray[pos];

		pos++;

		var recipientPublicKey = converters.byteArrayToHexString(byteArray.slice(pos, pos + 32));

		if (recipientPublicKey != data.recipientPublicKey) {
			return false;
		}
		pos += 32;
	} else if (data.recipientPublicKey) {
		return false;
	}

	position <<= 1;

	if ((transaction.flags & position) != 0) {
		var attachmentVersion = byteArray[pos];

		pos++;

		var encryptedToSelfMessageLength = converters.byteArrayToSignedInt32(byteArray, pos);

		transaction.messageToEncryptToSelfIsText = encryptedToSelfMessageLength < 0;

		if (encryptedToSelfMessageLength < 0) {
			encryptedToSelfMessageLength &= 2147483647;
		}

		pos += 4;

		transaction.encryptToSelfMessageData = converters.byteArrayToHexString(byteArray.slice(pos, pos + encryptedToSelfMessageLength));

		pos += encryptedToSelfMessageLength;

		transaction.encryptToSelfMessageNonce = converters.byteArrayToHexString(byteArray.slice(pos, pos + 32));

		pos += 32;

		var messageToEncryptToSelfIsText = (transaction.messageToEncryptToSelfIsText ? "true" : "false");

		if (messageToEncryptToSelfIsText != data.messageToEncryptToSelfIsText) {
			return false;
		}

			if (transaction.encryptToSelfMessageData !== data.encryptToSelfMessageData || transaction.encryptToSelfMessageNonce !== data.encryptToSelfMessageNonce) {
				return false;
			}
		} else if (data.encryptToSelfMessageData) {
			return false;
		}
	}

	return transactionBytes.substr(0, 192) + signature + transactionBytes.substr(320);
}

signBytes = function(message, secretPhrase) {
	var messageBytes = converters.hexStringToByteArray(message);
	var secretPhraseBytes = converters.hexStringToByteArray(secretPhrase);

	var digest = simpleHash(secretPhraseBytes);
	var s = curve25519.keygen(digest).s;

	var m = simpleHash(messageBytes);

	_hash.init();
	_hash.update(m);
	_hash.update(s);
	var x = _hash.getBytes();

	var y = curve25519.keygen(x).p;

	_hash.init();
	_hash.update(m);
	_hash.update(y);
	var h = _hash.getBytes();

	var v = curve25519.sign(h, x, s);

	return converters.byteArrayToHexString(v.concat(h));
}

var _hash = {
	init: SHA256_init,
	update: SHA256_write,
	getBytes: SHA256_finalize
};

simpleHash = function(message) {
	_hash.init();
	_hash.update(message);
	return _hash.getBytes();
}


text:
exports.repr = function (object) {
    return "SomeRepresentation"
};

exports.isArray = Array.isArray;

exports.isBoolean = function (arg) {
    return typeof arg === "boolean";
};

exports.isNull = function (arg) {
    return (arg) === null;
};

exports.isNullOrUndefined = function (arg) {
    return arg === null || arg === undefined;
};

exports.isNumber = function (arg) {
    return typeof arg === "number";
};

exports.isString = function (arg) {
    return typeof arg === "string";
};

exports.isUndefined = function (arg) {
    return arg === void 0;
};

exports.isRegExp = function (arg) {
    return isObject(arg) && objectToString(arg) === "[object RegExp]";
};

function isObject(arg) {
    return typeof arg === "object" && arg !== null;
};
exports.isObject = isObject;

exports.isDate = function (arg) {
    return isObject(arg) && objectToString(arg) === "[object Date]";
};

exports.isError = function (arg) {
    return isObject(arg) && (objectToString(arg) === "[object Error]" || arg instanceof Error);
};

exports.isFunction = function (arg) {
    return typeof arg === "function";
};

exports.isSymbol = function (arg) {
    return typeof arg === "symbol";
};

exports.isPrimitive = function (arg) {
    return arg === null || (typeof arg !== "object" && typeof arg !== "function")
};

exports.inherits = function (constructor, superConstructor) {
    if (constructor === undefined || constructor === null) {
        throw new TypeError("The constructor to 'inherits' must not be null or undefined");
    }

    if (superConstructor === undefined || superConstructor === null) {
        throw new TypeError("The super constructor to 'inherits' must not be null or undefined");
    }

    if (superConstructor.prototype === undefined) {
        throw new TypeError("The super constructor to 'inherits' must have a prototype");
    }

    constructor.super_ = superConstructor;
    constructor.prototype = Object.create(superConstructor.prototype, {
        constructor: {
            value: constructor,
            enumerable: false,
            writable: true,
            configurable: true
        }
    });
};


text:
default_target: all

.PHONY : default_target

# Allow only one "make -f Makefile2" at a time, but pass parallelism.
.NOTPARALLEL:

#=============================================================================
# Special targets provided by cmake.

# Disable implicit rules so canonical targets will work.
.SUFFIXES:

# Remove some rules from gmake that .SUFFIXES does not remove.
SUFFIXES =

.SUFFIXES: .hpux_make_needs_suffix_list

# Suppress display of executed commands.
$(VERBOSE).SILENT:

# A target that is always out of date.
cmake_force:

.PHONY : cmake_force

#=============================================================================
# Set environment variables for the build.

# The shell in which to execute make rules.
SHELL = /bin/sh

# The CMake executable.
CMAKE_COMMAND = /Applications/CLion.app/Contents/bin/cmake/bin/cmake

# The command to remove a file.
RM = /Applications/CLion.app/Contents/bin/cmake/bin/cmake -E remove -f

# Escaping for special characters.
EQUALS = =

# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code

# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug

#=============================================================================
# Targets provided globally by CMake.

# Special rule for the target edit_cache
edit_cache:
	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "No interactive CMake dialog available..."
	/Applications/CLion.app/Contents/bin/cmake/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available.
.PHONY : edit_cache

# Special rule for the target edit_cache
edit_cache/fast: edit_cache

.PHONY : edit_cache/fast

# Special rule for the target rebuild_cache
rebuild_cache:
	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
	/Applications/CLion.app/Contents/bin/cmake/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : rebuild_cache

# Special rule for the target rebuild_cache
rebuild_cache/fast: rebuild_cache

.PHONY : rebuild_cache/fast

# Special rule for the target list_install_components
list_install_components:
	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Available install components are: \"Unspecified\""
.PHONY : list_install_components

# Special rule for the target list_install_components
list_install_components/fast: list_install_components

.PHONY : list_install_components/fast

# Special rule for the target install
install: preinstall
	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
	/Applications/CLion.app/Contents/bin/cmake/bin/cmake -P cmake_install.cmake
.PHONY : install

# Special rule for the target install
install/fast: preinstall/fast
	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
	/Applications/CLion.app/Contents/bin/cmake/bin/cmake -P cmake_install.cmake
.PHONY : install/fast

# Special rule for the target install/strip
install/strip: preinstall
	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing the project stripped..."
	/Applications/CLion.app/Contents/bin/cmake/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake
.PHONY : install/strip

# Special rule for the target install/strip
install/strip/fast: install/strip

.PHONY : install/strip/fast

# Special rule for the target install/local
install/local: preinstall
	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..."
	/Applications/CLion.app/Contents/bin/cmake/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake
.PHONY : install/local

# Special rule for the target install/local
install/local/fast: install/local

.PHONY : install/local/fast

# The main all target
all: cmake_check_build_system
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(CMAKE_COMMAND) -E cmake_progress_start /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug/CMakeFiles /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug/CGL/src/CMakeFiles/progress.marks
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CMakeFiles/Makefile2 CGL/src/all
	$(CMAKE_COMMAND) -E cmake_progress_start /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug/CMakeFiles 0
.PHONY : all

# The main clean target
clean:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CMakeFiles/Makefile2 CGL/src/clean
.PHONY : clean

# The main clean target
clean/fast: clean

.PHONY : clean/fast

# Prepare targets for installation.
preinstall: all
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CMakeFiles/Makefile2 CGL/src/preinstall
.PHONY : preinstall

# Prepare targets for installation.
preinstall/fast:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CMakeFiles/Makefile2 CGL/src/preinstall
.PHONY : preinstall/fast

# clear depends
depend:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
.PHONY : depend

# Convenience name for target.
CGL/src/CMakeFiles/CGL.dir/rule:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CMakeFiles/Makefile2 CGL/src/CMakeFiles/CGL.dir/rule
.PHONY : CGL/src/CMakeFiles/CGL.dir/rule

# Convenience name for target.
CGL: CGL/src/CMakeFiles/CGL.dir/rule

.PHONY : CGL

# fast build rule for target.
CGL/fast:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/build
.PHONY : CGL/fast

base64.o: base64.cpp.o

.PHONY : base64.o

# target to build an object file
base64.cpp.o:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/base64.cpp.o
.PHONY : base64.cpp.o

base64.i: base64.cpp.i

.PHONY : base64.i

# target to preprocess a source file
base64.cpp.i:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/base64.cpp.i
.PHONY : base64.cpp.i

base64.s: base64.cpp.s

.PHONY : base64.s

# target to generate assembly for a file
base64.cpp.s:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/base64.cpp.s
.PHONY : base64.cpp.s

color.o: color.cpp.o

.PHONY : color.o

# target to build an object file
color.cpp.o:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/color.cpp.o
.PHONY : color.cpp.o

color.i: color.cpp.i

.PHONY : color.i

# target to preprocess a source file
color.cpp.i:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/color.cpp.i
.PHONY : color.cpp.i

color.s: color.cpp.s

.PHONY : color.s

# target to generate assembly for a file
color.cpp.s:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/color.cpp.s
.PHONY : color.cpp.s

complex.o: complex.cpp.o

.PHONY : complex.o

# target to build an object file
complex.cpp.o:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/complex.cpp.o
.PHONY : complex.cpp.o

complex.i: complex.cpp.i

.PHONY : complex.i

# target to preprocess a source file
complex.cpp.i:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/complex.cpp.i
.PHONY : complex.cpp.i

complex.s: complex.cpp.s

.PHONY : complex.s

# target to generate assembly for a file
complex.cpp.s:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/complex.cpp.s
.PHONY : complex.cpp.s

lodepng.o: lodepng.cpp.o

.PHONY : lodepng.o

# target to build an object file
lodepng.cpp.o:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/lodepng.cpp.o
.PHONY : lodepng.cpp.o

lodepng.i: lodepng.cpp.i

.PHONY : lodepng.i

# target to preprocess a source file
lodepng.cpp.i:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/lodepng.cpp.i
.PHONY : lodepng.cpp.i

lodepng.s: lodepng.cpp.s

.PHONY : lodepng.s

# target to generate assembly for a file
lodepng.cpp.s:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/lodepng.cpp.s
.PHONY : lodepng.cpp.s

matrix3x3.o: matrix3x3.cpp.o

.PHONY : matrix3x3.o

# target to build an object file
matrix3x3.cpp.o:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/matrix3x3.cpp.o
.PHONY : matrix3x3.cpp.o

matrix3x3.i: matrix3x3.cpp.i

.PHONY : matrix3x3.i

# target to preprocess a source file
matrix3x3.cpp.i:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/matrix3x3.cpp.i
.PHONY : matrix3x3.cpp.i

matrix3x3.s: matrix3x3.cpp.s

.PHONY : matrix3x3.s

# target to generate assembly for a file
matrix3x3.cpp.s:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/matrix3x3.cpp.s
.PHONY : matrix3x3.cpp.s

matrix4x4.o: matrix4x4.cpp.o

.PHONY : matrix4x4.o

# target to build an object file
matrix4x4.cpp.o:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/matrix4x4.cpp.o
.PHONY : matrix4x4.cpp.o

matrix4x4.i: matrix4x4.cpp.i

.PHONY : matrix4x4.i

# target to preprocess a source file
matrix4x4.cpp.i:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/matrix4x4.cpp.i
.PHONY : matrix4x4.cpp.i

matrix4x4.s: matrix4x4.cpp.s

.PHONY : matrix4x4.s

# target to generate assembly for a file
matrix4x4.cpp.s:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/matrix4x4.cpp.s
.PHONY : matrix4x4.cpp.s

osdfont.o: osdfont.c.o

.PHONY : osdfont.o

# target to build an object file
osdfont.c.o:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/osdfont.c.o
.PHONY : osdfont.c.o

osdfont.i: osdfont.c.i

.PHONY : osdfont.i

# target to preprocess a source file
osdfont.c.i:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/osdfont.c.i
.PHONY : osdfont.c.i

osdfont.s: osdfont.c.s

.PHONY : osdfont.s

# target to generate assembly for a file
osdfont.c.s:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/osdfont.c.s
.PHONY : osdfont.c.s

osdtext.o: osdtext.cpp.o

.PHONY : osdtext.o

# target to build an object file
osdtext.cpp.o:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/osdtext.cpp.o
.PHONY : osdtext.cpp.o

osdtext.i: osdtext.cpp.i

.PHONY : osdtext.i

# target to preprocess a source file
osdtext.cpp.i:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/osdtext.cpp.i
.PHONY : osdtext.cpp.i

osdtext.s: osdtext.cpp.s

.PHONY : osdtext.s

# target to generate assembly for a file
osdtext.cpp.s:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/osdtext.cpp.s
.PHONY : osdtext.cpp.s

quaternion.o: quaternion.cpp.o

.PHONY : quaternion.o

# target to build an object file
quaternion.cpp.o:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/quaternion.cpp.o
.PHONY : quaternion.cpp.o

quaternion.i: quaternion.cpp.i

.PHONY : quaternion.i

# target to preprocess a source file
quaternion.cpp.i:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/quaternion.cpp.i
.PHONY : quaternion.cpp.i

quaternion.s: quaternion.cpp.s

.PHONY : quaternion.s

# target to generate assembly for a file
quaternion.cpp.s:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/quaternion.cpp.s
.PHONY : quaternion.cpp.s

spectrum.o: spectrum.cpp.o

.PHONY : spectrum.o

# target to build an object file
spectrum.cpp.o:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/spectrum.cpp.o
.PHONY : spectrum.cpp.o

spectrum.i: spectrum.cpp.i

.PHONY : spectrum.i

# target to preprocess a source file
spectrum.cpp.i:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/spectrum.cpp.i
.PHONY : spectrum.cpp.i

spectrum.s: spectrum.cpp.s

.PHONY : spectrum.s

# target to generate assembly for a file
spectrum.cpp.s:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/spectrum.cpp.s
.PHONY : spectrum.cpp.s

tinyxml2.o: tinyxml2.cpp.o

.PHONY : tinyxml2.o

# target to build an object file
tinyxml2.cpp.o:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/tinyxml2.cpp.o
.PHONY : tinyxml2.cpp.o

tinyxml2.i: tinyxml2.cpp.i

.PHONY : tinyxml2.i

# target to preprocess a source file
tinyxml2.cpp.i:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/tinyxml2.cpp.i
.PHONY : tinyxml2.cpp.i

tinyxml2.s: tinyxml2.cpp.s

.PHONY : tinyxml2.s

# target to generate assembly for a file
tinyxml2.cpp.s:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/tinyxml2.cpp.s
.PHONY : tinyxml2.cpp.s

vector2D.o: vector2D.cpp.o

.PHONY : vector2D.o

# target to build an object file
vector2D.cpp.o:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/vector2D.cpp.o
.PHONY : vector2D.cpp.o

vector2D.i: vector2D.cpp.i

.PHONY : vector2D.i

# target to preprocess a source file
vector2D.cpp.i:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/vector2D.cpp.i
.PHONY : vector2D.cpp.i

vector2D.s: vector2D.cpp.s

.PHONY : vector2D.s

# target to generate assembly for a file
vector2D.cpp.s:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/vector2D.cpp.s
.PHONY : vector2D.cpp.s

vector3D.o: vector3D.cpp.o

.PHONY : vector3D.o

# target to build an object file
vector3D.cpp.o:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/vector3D.cpp.o
.PHONY : vector3D.cpp.o

vector3D.i: vector3D.cpp.i

.PHONY : vector3D.i

# target to preprocess a source file
vector3D.cpp.i:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/vector3D.cpp.i
.PHONY : vector3D.cpp.i

vector3D.s: vector3D.cpp.s

.PHONY : vector3D.s

# target to generate assembly for a file
vector3D.cpp.s:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/vector3D.cpp.s
.PHONY : vector3D.cpp.s

vector4D.o: vector4D.cpp.o

.PHONY : vector4D.o

# target to build an object file
vector4D.cpp.o:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/vector4D.cpp.o
.PHONY : vector4D.cpp.o

vector4D.i: vector4D.cpp.i

.PHONY : vector4D.i

# target to preprocess a source file
vector4D.cpp.i:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/vector4D.cpp.i
.PHONY : vector4D.cpp.i

vector4D.s: vector4D.cpp.s

.PHONY : vector4D.s

# target to generate assembly for a file
vector4D.cpp.s:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/vector4D.cpp.s
.PHONY : vector4D.cpp.s

viewer.o: viewer.cpp.o

.PHONY : viewer.o

# target to build an object file
viewer.cpp.o:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/viewer.cpp.o
.PHONY : viewer.cpp.o

viewer.i: viewer.cpp.i

.PHONY : viewer.i

# target to preprocess a source file
viewer.cpp.i:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/viewer.cpp.i
.PHONY : viewer.cpp.i

viewer.s: viewer.cpp.s

.PHONY : viewer.s

# target to generate assembly for a file
viewer.cpp.s:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(MAKE) -f CGL/src/CMakeFiles/CGL.dir/build.make CGL/src/CMakeFiles/CGL.dir/viewer.cpp.s
.PHONY : viewer.cpp.s

# Help Target
help:
	@echo "The following are some of the valid targets for this Makefile:"
	@echo "... all (the default if no target is provided)"
	@echo "... clean"
	@echo "... depend"
	@echo "... edit_cache"
	@echo "... rebuild_cache"
	@echo "... list_install_components"
	@echo "... install"
	@echo "... install/strip"
	@echo "... install/local"
	@echo "... CGL"
	@echo "... base64.o"
	@echo "... base64.i"
	@echo "... base64.s"
	@echo "... color.o"
	@echo "... color.i"
	@echo "... color.s"
	@echo "... complex.o"
	@echo "... complex.i"
	@echo "... complex.s"
	@echo "... lodepng.o"
	@echo "... lodepng.i"
	@echo "... lodepng.s"
	@echo "... matrix3x3.o"
	@echo "... matrix3x3.i"
	@echo "... matrix3x3.s"
	@echo "... matrix4x4.o"
	@echo "... matrix4x4.i"
	@echo "... matrix4x4.s"
	@echo "... osdfont.o"
	@echo "... osdfont.i"
	@echo "... osdfont.s"
	@echo "... osdtext.o"
	@echo "... osdtext.i"
	@echo "... osdtext.s"
	@echo "... quaternion.o"
	@echo "... quaternion.i"
	@echo "... quaternion.s"
	@echo "... spectrum.o"
	@echo "... spectrum.i"
	@echo "... spectrum.s"
	@echo "... tinyxml2.o"
	@echo "... tinyxml2.i"
	@echo "... tinyxml2.s"
	@echo "... vector2D.o"
	@echo "... vector2D.i"
	@echo "... vector2D.s"
	@echo "... vector3D.o"
	@echo "... vector3D.i"
	@echo "... vector3D.s"
	@echo "... vector4D.o"
	@echo "... vector4D.i"
	@echo "... vector4D.s"
	@echo "... viewer.o"
	@echo "... viewer.i"
	@echo "... viewer.s"
.PHONY : help

#=============================================================================
# Special targets to cleanup operation of make.

# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
	cd /Users/Yimin/Dropbox/2017spring/cs184/final_proj/fluid-simulation/code/cmake-build-debug && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system


text:
from hqlib.sql import Base
from sqlalchemy import Column, Integer, String, ForeignKey, PickleType, Text, DateTime
from sqlalchemy.orm import relationship
from datetime import datetime
from sqlalchemy.ext.orderinglist import ordering_list
from hqlib.sql.customtypes.enumtype import DBEnum
from hqlib.sql.customtypes.textpickle import TextPickleType
import json

class TaskStatus(DBEnum):
    PENDING = 'PENDING'
    STARTING = 'STARTING'
    RUNNING = 'RUNNING'
    LOST = 'LOST'
    KILLED = 'KILLED'
    FAILED = 'FAILED'
    FINISHED = 'FINISHED'

class Task(Base):

    __tablename__ = 'tasks'

    id = Column(Integer, primary_key=True)
    name = Column(String, nullable=False)
    status = Column(TaskStatus.as_type('ck_task_status'), default=TaskStatus.PENDING, nullable=False)
    error_message = Column(String)
    order = Column(Integer, nullable=False)
    created_at = Column(DateTime(timezone=True), default=datetime.now, nullable=False)
    updated_at = Column(DateTime(timezone=True), default=datetime.now, onupdate=datetime.now, nullable=False)
    stopped_at = Column(DateTime(timezone=True))
    job_target_id = Column(Integer, ForeignKey('job_targets.id'))
    job_target = relationship('JobTarget', uselist=False)
    actions = relationship('Action', order_by='Action.order', collection_class=ordering_list('order'))

class Action(Base):

    __tablename__ = 'actions'

    id = Column(Integer, primary_key=True)
    processor = Column(String, nullable=False)
    arguments = Column(TextPickleType(pickler=json))
    order = Column(Integer, nullable=False)
    created_at = Column(DateTime(timezone=True), default=datetime.now, nullable=False)
    task_id = Column(Integer, ForeignKey('tasks.id'), nullable=False)
    task = relationship('Task', uselist=False)


text:
export PATH=$PATH:/usr/bin
exec java -jar /etc/riemann-jmx/riemann-jmx.jar {{riemann_jmx_config_file}}


text:
GameScene::GameScene(GameData& gameData, sf::RenderWindow& window) :
		m_gameData(gameData),
		m_window(window),
		m_sceneView(sf::Vector2f(VIEWWIDTH / 2, VIEWHEIGHT / 2), sf::Vector2f(VIEWWIDTH, VIEWHEIGHT)),
		m_scenery(WINDOWWIDTH, WINDOWHEIGHT, VIEWWIDTH, VIEWHEIGHT),
		m_level(),
		m_cube(0.f, 0.f, CUBESIZE),
		m_attemptCount(1),
		m_godMode(false),
		m_floor(sf::Vector2f(0.f, 0.f)),
		m_attemptsText(""),
		m_godModeText(""),
		m_quit(false)
{
	// Create scene view
	m_sceneView.setViewport(sf::FloatRect((1 - VIEWWIDTH / WINDOWWIDTH) / 2, (1 - VIEWHEIGHT / WINDOWHEIGHT) / 2, VIEWWIDTH / WINDOWWIDTH, VIEWHEIGHT / WINDOWHEIGHT));

	// Create and init level
	loadLevel();
	m_level.start();

	m_floor.setSize(sf::Vector2f(m_level.getSize().x, FLOORSIZE));

	// Create Floor
	m_floor.setPosition(0.f, m_level.getSize().y);
	m_floor.setFillColor(sf::Color::White);

	// UI
	std::stringstream ss;
	ss << "Attempts : " << m_attemptCount;
	m_attemptsText.setString(ss.str());
	m_attemptsText.setPosition(floor(window.getSize().x / 2.f - m_attemptsText.getGlobalBounds().width / 2.f), 30.f);
	m_attemptsText.setColor(sf::Color::White);

	m_godModeText.setString(m_godMode ? "Hypercube Mode !" : "");
	m_godModeText.setPosition(window.getSize().x / 2.f - m_godModeText.getGlobalBounds().width / 2.f, 80.f);
	m_godModeText.setColor(sf::Color::White);
}

GameScene::~GameScene()
{

}

void GameScene::onEvent(const sf::Event& event)
{
	if (event.type == sf::Event::KeyPressed)
	{
		if(event.key.code == sf::Keyboard::Return)
		{
			m_godMode = !m_godMode;
			m_godModeText.setString(m_godMode ? "Hypercube Mode !" : "");
			m_godModeText.setPosition(floor(m_window.getSize().x / 2.f - m_godModeText.getGlobalBounds().width / 2.f), 80.f);
		}
		if (event.key.code == sf::Keyboard::Escape || event.key.code == sf::Keyboard::Back)
		{
			m_quit = true;
		}
	}
	if(event.type == sf::Event::JoystickButtonPressed)
	{
		if(event.joystickButton.button == 6)
		{
			m_quit = true;
		}
		else if(event.joystickButton.button == 7)
		{
			m_godMode = !m_godMode;
			m_godModeText.setString(m_godMode ? "Hypercube Mode !" : "");
			m_godModeText.setPosition(floor(m_window.getSize().x / 2.f - m_godModeText.getGlobalBounds().width / 2.f), 80.f);
		}
	}
}

Scene::Type GameScene::update(float time)
{
	// Cube
	float cubeDistToGround = m_level.getSize().y - (m_cube.getBoundingRect().top + m_cube.getBoundingRect().height);
	for (std::list<Block>::iterator it = m_level.getBlocks().begin(); it != m_level.getBlocks().end(); ++it)
	{
		sf::FloatRect rect = it->getRect();
		sf::Vector2f cubePosition = m_cube.getHitSphere().getPosition();

		if(rect.left <= cubePosition.x+PADOFFSET && rect.left+rect.width >= cubePosition.x-PADOFFSET && rect.top >= cubePosition.y && it->isPracticable())
		{
			float newCubeDistToGround = rect.top - (cubePosition.y+CUBESIZE/2);
			if(newCubeDistToGround < cubeDistToGround)
				 cubeDistToGround = newCubeDistToGround;
		}
	}
	m_cube.update(time, cubeDistToGround);

	// Update view according to cube's position
	m_sceneView.setCenter(m_cube.getPosition()+sf::Vector2f(250.f,-150.f));

	// Events
	std::list<Level::Event>::iterator it = m_level.getEvents().begin();
	if(it != m_level.getEvents().end() && it->position <= m_cube.getPosition().x)
	{
		switch(it->type)
		{
		case Level::Event::ROTATE :
			m_sceneView.rotate(it->parameter.f);
			break;

		case Level::Event::COLOR :
			{
				unsigned int r = it->parameter.ui << 8 >> 24;
				unsigned int g = it->parameter.ui << 16 >> 24;
				unsigned int b = it->parameter.ui << 24 >> 24;
				m_scenery.setColor(sf::Color(r,g,b));
			}
			break;

		default :
			break;
		}
		it = m_level.getEvents().erase(it);
	}

	// Blocks
	for (std::list<Block>::iterator it = m_level.getBlocks().begin(); it != m_level.getBlocks().end(); ++it)
	{
		if (it->getHitSphere().intersects(m_cube.getHitSphere()) && !m_godMode && m_cube.getState() == Cube::ALIVE)
			m_cube.setState(Cube::DESTROYING);
	}

	// Start next level or restart
	if (m_cube.getPosition().x >= m_level.getSize().x)
	{
		loadLevel();
		m_level.start();
	}
	if(m_cube.getState() == Cube::DESTROYED)
	{
		m_cube = Cube(0.f, 0.f, CUBESIZE);
		loadLevel();
		m_level.start();
		++m_attemptCount;
		std::stringstream ss;
		ss << "Attempts : " << m_attemptCount;
		m_attemptsText.setString(ss.str());
	}

	return m_quit ? Scene::MENUSCENE : Scene::NONE;
}

void GameScene::draw(sf::RenderTarget& target)
{
	target.setView(target.getDefaultView());
	m_scenery.drawBackground(target);

	target.setView(m_sceneView);
	target.draw(m_floor);

	for (std::list<Block>::iterator it = m_level.getBlocks().begin(); it != m_level.getBlocks().end(); ++it)
		(*it).draw(target);
	m_cube.draw(target);

	target.setView(target.getDefaultView());
	m_scenery.drawForeground(target);
	target.draw(m_attemptsText);
	target.draw(m_godModeText);
}

void GameScene::loadLevel()
{
	m_level.load(m_gameData.levelFileName);

	m_window.setTitle("Imblockible - "+m_level.getName());
	m_scenery.setColor(m_level.getColor());

	m_sceneView = 	sf::View(sf::Vector2f(VIEWWIDTH / 2, VIEWHEIGHT / 2), sf::Vector2f(VIEWWIDTH, VIEWHEIGHT));
	m_sceneView.setViewport(sf::FloatRect((1 - VIEWWIDTH / WINDOWWIDTH) / 2, (1 - VIEWHEIGHT / WINDOWHEIGHT) / 2, VIEWWIDTH / WINDOWWIDTH, VIEWHEIGHT / WINDOWHEIGHT));
}


text:
    #ifdef min
        #undef min
    #endif
    #ifdef max
        #undef max
    #endif
#endif

namespace Imath {

//-----------------------------------------------------------------
//
// Template class limits<T> returns information about the limits
// of numerical data type T:
//
//	min()		largest possible negative value of type T
//
//	max()		largest possible positive value of type T
//
//	smallest()	smallest possible positive value of type T
//			(for float and double: smallest normalized
//			positive value)
//
//	epsilon()	smallest possible e of type T, for which
//			1 + e != 1
//
//	isIntegral()	returns true if T is an integral type
//
//	isSigned()	returns true if T is signed
//
// Class limits<T> is useful to implement template classes or
// functions which depend on the limits of a numerical type
// which is not known in advance; for example:
//
//	template <class T> max (T x[], int n)
//	{
//	    T m = limits<T>::min();
//
//	    for (int i = 0; i < n; i++)
//		if (m < x[i])
//		    m = x[i];
//
//	    return m;
//	}
//
// Class limits<T> has been implemented for the following types:
//
//	char, signed char, unsigned char
//	short, unsigned short
//	int, unsigned int
//	long, unsigned long
//	float
//	double
//	long double
//
// Class limits<T> has only static member functions, all of which
// are implemented as inlines.  No objects of type limits<T> are
// ever created.
//
//-----------------------------------------------------------------

template <class T> struct limits
{
    static T	min();
    static T	max();
    static T	smallest();
    static T	epsilon();
    static bool	isIntegral();
    static bool	isSigned();
};

//---------------
// Implementation
//---------------

template <>
struct limits <char>
{
    static char			min()		{return CHAR_MIN;}
    static char			max()		{return CHAR_MAX;}
    static char			smallest()	{return 1;}
    static char			epsilon()	{return 1;}
    static bool			isIntegral()	{return true;}
    static bool			isSigned()	{return (char) ~0 < 0;}
};

template <>
struct limits <signed char>
{
    static signed char		min()		{return SCHAR_MIN;}
    static signed char		max()		{return SCHAR_MAX;}
    static signed char		smallest()	{return 1;}
    static signed char		epsilon()	{return 1;}
    static bool			isIntegral()	{return true;}
    static bool			isSigned()	{return true;}
};

template <>
struct limits <unsigned char>
{
    static unsigned char	min()		{return 0;}
    static unsigned char	max()		{return UCHAR_MAX;}
    static unsigned char	smallest()	{return 1;}
    static unsigned char	epsilon()	{return 1;}
    static bool			isIntegral()	{return true;}
    static bool			isSigned()	{return false;}
};

template <>
struct limits <short>
{
    static short		min()		{return SHRT_MIN;}
    static short		max()		{return SHRT_MAX;}
    static short		smallest()	{return 1;}
    static short		epsilon()	{return 1;}
    static bool			isIntegral()	{return true;}
    static bool			isSigned()	{return true;}
};

template <>
struct limits <unsigned short>
{
    static unsigned short	min()		{return 0;}
    static unsigned short	max()		{return USHRT_MAX;}
    static unsigned short	smallest()	{return 1;}
    static unsigned short	epsilon()	{return 1;}
    static bool			isIntegral()	{return true;}
    static bool			isSigned()	{return false;}
};

template <>
struct limits <int>
{
    static int			min()		{return INT_MIN;}
    static int			max()		{return INT_MAX;}
    static int			smallest()	{return 1;}
    static int			epsilon()	{return 1;}
    static bool			isIntegral()	{return true;}
    static bool			isSigned()	{return true;}
};

template <>
struct limits <unsigned int>
{
    static unsigned int		min()		{return 0;}
    static unsigned int		max()		{return UINT_MAX;}
    static unsigned int		smallest()	{return 1;}
    static unsigned int		epsilon()	{return 1;}
    static bool			isIntegral()	{return true;}
    static bool			isSigned()	{return false;}
};

template <>
struct limits <long>
{
    static long			min()		{return LONG_MIN;}
    static long			max()		{return LONG_MAX;}
    static long			smallest()	{return 1;}
    static long			epsilon()	{return 1;}
    static bool			isIntegral()	{return true;}
    static bool			isSigned()	{return true;}
};

template <>
struct limits <unsigned long>
{
    static unsigned long	min()		{return 0;}
    static unsigned long	max()		{return ULONG_MAX;}
    static unsigned long	smallest()	{return 1;}
    static unsigned long	epsilon()	{return 1;}
    static bool			isIntegral()	{return true;}
    static bool			isSigned()	{return false;}
};

template <>
struct limits <float>
{
    static float		min()		{return -FLT_MAX;}
    static float		max()		{return FLT_MAX;}
    static float		smallest()	{return FLT_MIN;}
    static float		epsilon()	{return FLT_EPSILON;}
    static bool			isIntegral()	{return false;}
    static bool			isSigned()	{return true;}
};

template <>
struct limits <double>
{
    static double		min()		{return -DBL_MAX;}
    static double		max()		{return DBL_MAX;}
    static double		smallest()	{return DBL_MIN;}
    static double		epsilon()	{return DBL_EPSILON;}
    static bool			isIntegral()	{return false;}
    static bool			isSigned()	{return true;}
};

template <>
struct limits <long double>
{
    static long double		min()		{return -LDBL_MAX;}
    static long double		max()		{return LDBL_MAX;}
    static long double		smallest()	{return LDBL_MIN;}
    static long double		epsilon()	{return LDBL_EPSILON;}
    static bool			isIntegral()	{return false;}
    static bool			isSigned()	{return true;}
};

} // namespace Imath

#endif


text:
<?php

declare(strict_types=1);

namespace BrianFaust\Exceptions\Runtime\Http;

use BrianFaust\Exceptions\Standards\RuntimeException;

class UnauthorizedException extends RuntimeException
{
    public function __construct(?string $message, ?string $errorCode = 'ERR-UNAUTHORIZED')
    {
        parent::__construct($message, $errorCode, 401);
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval" >
    <solid android:color="#c8ed7141" />
</shape>


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Revis. gen. pl. (Leipzig) 3: 459 (1898)

#### Original name
Phoma petersii Syd.

### Remarks
null