text:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>Debugging with GDB: Retrieving Descriptions</title>

<meta name="description" content="Debugging with GDB: Retrieving Descriptions">
<meta name="keywords" content="Debugging with GDB: Retrieving Descriptions">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Target-Descriptions.html#Target-Descriptions" rel="up" title="Target Descriptions">
<link href="Target-Description-Format.html#Target-Description-Format" rel="next" title="Target Description Format">
<link href="Target-Descriptions.html#Target-Descriptions" rel="prev" title="Target Descriptions">

Next: Target Description Format, Up: Target Descriptions   [Contents][Index]

G.1 Retrieving Descriptions

Target descriptions can be read from the target automatically, or
specified by the user manually.  The default behavior is to read the
description from the target.  GDB retrieves it via the remote
protocol using ‘<samp>qXfer</samp>’ requests (see qXfer).  The <var>annex</var> in the ‘<samp>qXfer</samp>’ packet will be
‘<samp>target.xml</samp>’.  The contents of the ‘<samp>target.xml</samp>’ annex are an
XML document, of the form described in Target Description Format.

Alternatively, you can specify a file to read for the target description.
If a file is set, the target will not be queried.  The commands to
specify a file are:

set tdesc filename <var>path</var>

Read the target description from <var>path</var>.

unset tdesc filename

Do not read the XML target description from a file.  GDB
will use the description supplied by the current target.

show tdesc filename

Show the filename to read for a target description, if any.


text:
// Copyright (c) 2013 TopCoder. 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.
//
//
//  DataUpdateServiceTests.m
//  ISSFoodIntakeTracker
//
//  Created by LokiYang on 8/5/13.
//

#import "DataUpdateServiceTests.h"

#import "DataUpdateServiceImpl.h"

#import "DataHelper.h"

#import "UserServiceImpl.h"

@implementation DataUpdateServiceTests
/*!
 @discussuion Private utility method for copying local file to samba server.
 */
- (BOOL)copyLocalFile:(NSString *)localFile toSMBPath:(NSString *)smbPath error:(NSError **)error {
    NSData *data = [NSData dataWithContentsOfFile:localFile];
    NSError *e = nil;
    id<SMBClient> client = [[[BaseCommunicationDataService alloc] initWithManagedObjectContext:self.managedObjectContext
                                                                                configuration:self.configurations]
                            createSMBClient:&e];
    if(e) {
        return NO;
    }
    [client writeFile:smbPath data:data error:&e];
    if(e) {
        return NO;
    }
    else {
        return YES;
    }
}

/*!
 @discussion Set up testing environment. It creates service and some testing data.
 */
- (void)setUp {
    [super setUp];
    self.service = [[DataUpdateServiceImpl alloc] initWithManagedObjectContext:self.managedObjectContext
                                                                 configuration:self.configurations];
    NSError *error = nil;
    id<SMBClient> client = [(DataUpdateServiceImpl*)self.service createSMBClient:&error];

    [client createDirectory:@"control_files" error:&error];
    [client createDirectory:@"control_files/food_product_inventory" error:&error];
    [client createDirectory:@"control_files/food_product_inventory/ack" error:&error];
    [client createDirectory:@"control_files/food_product_inventory/data" error:&error];

    NSBundle *bundle = [NSBundle bundleForClass:[self class]];
    NSString *localFolder = [bundle pathForResource:@"test_data/samba" ofType:@""];

    [self copyLocalFile:[localFolder
                         stringByAppendingPathComponent:@"control_files/food_product_inventory/data/bc1.png"]
              toSMBPath:@"control_files/food_product_inventory/data/bc1.png" error:&error];
    [self copyLocalFile:[localFolder
                         stringByAppendingPathComponent:@"control_files/food_product_inventory/data/bc2.png"]
              toSMBPath:@"control_files/food_product_inventory/data/bc2.png" error:&error];
    [self copyLocalFile:[localFolder
                         stringByAppendingPathComponent:@"control_files/food_product_inventory/data/black_coffee.png"]
              toSMBPath:@"control_files/food_product_inventory/data/black_coffee.png" error:&error];
    [self copyLocalFile:[localFolder
                         stringByAppendingPathComponent:@"control_files/food_product_inventory/data/data.csv"]
              toSMBPath:@"control_files/food_product_inventory/data/data.csv" error:&error];

    [client createDirectory:@"control_files/user_management" error:&error];
    [client createDirectory:@"control_files/user_management/ack" error:&error];
    [client createDirectory:@"control_files/user_management/data" error:&error];

    [self copyLocalFile:[localFolder
                         stringByAppendingPathComponent:@"control_files/user_management/data/joe.png"]
              toSMBPath:@"control_files/user_management/data/joe.png" error:&error];
    [self copyLocalFile:[localFolder
                         stringByAppendingPathComponent:@"control_files/user_management/data/joe1.png"]
              toSMBPath:@"control_files/user_management/data/joe1.png" error:&error];
    [self copyLocalFile:[localFolder
                         stringByAppendingPathComponent:@"control_files/user_management/data/joe2.png"]
              toSMBPath:@"control_files/user_management/data/joe2.png" error:&error];
    [self copyLocalFile:[localFolder
                         stringByAppendingPathComponent:@"control_files/user_management/data/data.csv"]
              toSMBPath:@"control_files/user_management/data/data.csv" error:&error];

    NSString* deviceID = [DataHelper getDeviceIdentifier];
    [client createDirectory:@"device_registry" error:&error];
    [client writeFile:[NSString stringWithFormat:@"device_registry/%@", deviceID] data:[NSData data] error:&error];
}

/*!
 @discussion Tear down testing environment. It deletes the testing data.
 */
-(void)tearDown {
    NSError *error = nil;
    id<SMBClient> client = [(DataUpdateServiceImpl*)self.service createSMBClient:&error];
    [client deleteDirectory:@"control_files" error:&error];
    [client deleteDirectory:@"device_registry" error:&error];
    [[NSFileManager defaultManager]
                removeItemAtPath:[DataHelper getAbsoulteLocalDirectory:self.configurations[@"LocalFileSystemDirectory"]]
                        error:&error];
    [super tearDown];
}

/*!
 @discussuion Test initialization method
 */
- (void)testInit {
    //assert service is not nil
    STAssertNotNil(self.service, @"service should not be nil");

}

/*!
 @discussuion Test Update method
 */
- (void)testUpdate {
    NSError *error = nil;
    BOOL result = [self.service update:&error];
    STAssertTrue(result, @"result should be YES.");
    STAssertNil(error, @"error should be nil.");

    // check fetched user
    id<UserService> userService = [[UserServiceImpl alloc] initWithManagedObjectContext:self.managedObjectContext
                                                                          configuration:self.configurations
                                                                            lockService:nil];

    NSArray *users = [userService filterUsers:@"Joe Norton" error:&error];
    STAssertNotNil(users, @"users should not be nil.");
    STAssertTrue(users.count == 1, @"users should only contain 1 user.");
    STAssertNil(error, @"error should be nil.");
    User *user = users[0];
    STAssertEquals(user.admin.boolValue, YES, @"returned user should have proper value set");
    STAssertTrue([user.fullName isEqualToString:@"Joe Norton"], @"returned user should have proper value set");
    STAssertEquals(user.dailyTargetFluid.intValue, 20, @"returned user should have proper value set");
    STAssertEquals(user.dailyTargetEnergy.intValue, 20, @"returned user should have proper value set");
    STAssertEquals(user.dailyTargetSodium.intValue, 20, @"returned user should have proper value set");

    STAssertTrue(user.faceImages.count == 2, @"returned user should have proper value set.");
    NSArray *components = [@"joe1.png;joe2.png" componentsSeparatedByString:@";"];
    for (StringWrapper *c in user.faceImages) {
        STAssertTrue([components containsObject:c.value], @"The string array should contain the object.");
    }

    // check fetched food product
    NSFetchRequest *request = [[NSFetchRequest alloc] init];
    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(name == %@)", @"Black Coffee"];
    NSEntityDescription *description = [NSEntityDescription  entityForName:@"FoodProduct"
                                                    inManagedObjectContext:self.managedObjectContext];
    [request setEntity:description];
    [request setPredicate:predicate];
    NSArray *products = [self.managedObjectContext executeFetchRequest:request error:&error];
    STAssertNotNil(products, @"products should not be nil.");
    STAssertTrue(products.count == 1, @"products should only contain 1 food product.");
    STAssertNil(error, @"error should be nil.");
    FoodProduct *product = products[0];
    STAssertTrue([product.name isEqualToString:@"Black Coffee"], @"returned product should have proper value set");
    STAssertTrue([product.category isEqualToString: @"Beverage"], @"returned product should have proper value set");
    STAssertTrue([product.origin isEqualToString:@"USA" ], @"returned product should have proper value set");
    STAssertTrue([product.barcode isEqualToString: @"11456588"], @"returned product should have proper value set");
    STAssertEquals(product.fluid.intValue, 20, @"returned product should have proper value set");
    STAssertEquals(product.energy.intValue, 20, @"returned product should have proper value set");
    STAssertEquals(product.sodium.intValue, 20, @"returned product should have proper value set");

    STAssertTrue(product.images.count == 2, @"returned product should have proper value set.");
    NSArray *productImagecomponents = [@"bc1.png;bc2.png" componentsSeparatedByString:@";"];
    for (StringWrapper *c in product.images) {
        STAssertTrue([productImagecomponents containsObject:c.value], @"The string array should contain the object.");
    }

    // check data_update directory hierachy
    id<SMBClient> client = [(DataUpdateServiceImpl*)self.service createSMBClient:&error];
    NSArray *folders = [client listDirectories:@"control_files/user_management" error:&error];
    STAssertNotNil(folders, @"result should not be nil.");
    STAssertNil(error, @"error should be nil.");
    STAssertTrue(folders.count == 2, @"should just contains 2 folders");
    for (NSString  *folder in folders) {
        STAssertTrue([(@[@"ack",@"data"]) containsObject:folder], @"The folder name does not match.");
        NSArray *subfolders = [client listDirectories:[NSString stringWithFormat:@"control_files/user_management/%@",
                                                       folder] error:&error];
        STAssertNotNil(subfolders, @"result should not be nil.");
        STAssertNil(error, @"error should be nil.");
        STAssertTrue(subfolders.count == 0, @"should just contains 0 folders");

        NSArray *subFiles = [client listFiles:[NSString stringWithFormat:@"control_files/user_management/%@",
                                                       folder] error:&error];
        STAssertNotNil(subFiles, @"result should not be nil.");
        STAssertNil(error, @"error should be nil.");
        STAssertTrue(subFiles.count == 0, @"should just contains 0 files");
    }

    folders = [client listDirectories:@"control_files/food_product_inventory" error:&error];
    STAssertNotNil(folders, @"result should not be nil.");
    STAssertNil(error, @"error should be nil.");
    STAssertTrue(folders.count == 2, @"should just contains 2 folders");
    for (NSString  *folder in folders) {
        STAssertTrue([(@[@"ack",@"data"]) containsObject:folder], @"The folder name does not match.");
        NSArray *subfolders = [client listDirectories:[NSString
                                                       stringWithFormat:@"control_files/food_product_inventory/%@",
                                                       folder] error:&error];
        STAssertNotNil(subfolders, @"result should not be nil.");
        STAssertNil(error, @"error should be nil.");
        STAssertTrue(subfolders.count == 0, @"should just contains 0 folders");

        NSArray *subFiles = [client listFiles:[NSString stringWithFormat:@"control_files/food_product_inventory/%@",
                                               folder] error:&error];
        STAssertNotNil(subFiles, @"result should not be nil.");
        STAssertNil(error, @"error should be nil.");
        STAssertTrue(subFiles.count == 0, @"should just contains 0 files");
    }

    // check local file system
    NSArray *localFiles = @[@"bc1.png", @"bc2.png", @"black_coffee.png", @"joe.png", @"joe1.png", @"joe2.png"];
    for (NSString *localFileName in localFiles) {
        NSString *localDataFile = [[DataHelper
                                    getAbsoulteLocalDirectory:self.configurations[@"LocalFileSystemDirectory"]]
                                   stringByAppendingPathComponent:localFileName];
        STAssertTrue([[NSFileManager defaultManager] fileExistsAtPath:localDataFile], @"local file should exist.");

    }

}

/*!
 @discussuion Test Update method on failure cases
 */
- (void)testUpdate_Failure_MissingControlFolder {
    NSError *error = nil;
    id<SMBClient> client = [(DataUpdateServiceImpl*)self.service createSMBClient:&error];
    [client deleteDirectory:@"control_files" error:&error];
    BOOL result = [self.service update:&error];
    STAssertFalse(result, @"result should be NO.");
    STAssertNotNil(error, @"error should not be nil.");
}

/*!
 @discussuion Test Update method on failure cases
 */
- (void)testUpdate_Failure_MissingFoodFolder{
    NSError *error = nil;
    id<SMBClient> client = [(DataUpdateServiceImpl*)self.service createSMBClient:&error];
    [client deleteDirectory:@"control_files/food_product_inventory" error:&error];
    BOOL result = [self.service update:&error];
    STAssertFalse(result, @"result should be NO.");
    STAssertNotNil(error, @"error should not be nil.");
}

/*!
 @discussuion Test Update method on failure cases
 */
- (void)testUpdate_Failure_MissingUserFolder{
    NSError *error = nil;
    id<SMBClient> client = [(DataUpdateServiceImpl*)self.service createSMBClient:&error];
    [client deleteDirectory:@"control_files/user_management" error:&error];
    BOOL result = [self.service update:&error];
    STAssertFalse(result, @"result should be NO.");
    STAssertNotNil(error, @"error should not be nil.");
}

/*!
 @discussuion Test Update method on failure cases
 */
- (void)testUpdate_Failure_MissingDataFolder{
    NSError *error = nil;
    id<SMBClient> client = [(DataUpdateServiceImpl*)self.service createSMBClient:&error];
    [client deleteDirectory:@"control_files/food_product_inventory/data" error:&error];
    BOOL result = [self.service update:&error];
    STAssertFalse(result, @"result should be NO.");
    STAssertNotNil(error, @"error should not be nil.");
}

/*!
 @discussuion Test Update method on failure cases
 */
- (void)testUpdate_Failure_MissingAckFolder {
    NSError *error = nil;
    id<SMBClient> client = [(DataUpdateServiceImpl*)self.service createSMBClient:&error];
    [client deleteDirectory:@"control_files/user_management/ack" error:&error];
    BOOL result = [self.service update:&error];
    STAssertFalse(result, @"result should be NO.");
    STAssertNotNil(error, @"error should not be nil.");
}

/*!
 @discussuion Test Update method on failure cases
 */
- (void)testUpdate_Failure_MissingDataCSVFile {
    NSError *error = nil;
    id<SMBClient> client = [(DataUpdateServiceImpl*)self.service createSMBClient:&error];
    [client deleteFile:@"control_files/food_product_inventory/data/data.csv" error:&error];
    BOOL result = [self.service update:&error];
    STAssertFalse(result, @"result should be NO.");
    STAssertNotNil(error, @"error should not be nil.");
}
@end

redpajama_set_name: RedPajamaGithub


text:
//------------------------------------------------------------------------------
// <auto-generated>
//     Этот код создан программой.
//     Исполняемая версия:4.0.30319.42000
//
//     Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
//     повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------

namespace Aion_Launcher.Properties {
    using System;

    /// <summary>
    ///   Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
    /// </summary>
    // Этот класс создан автоматически классом StronglyTypedResourceBuilder
    // с помощью такого средства, как ResGen или Visual Studio.
    // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
    // с параметром /str или перестройте свой проект VS.
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    internal class Resources {

        private static global::System.Resources.ResourceManager resourceMan;

        private static global::System.Globalization.CultureInfo resourceCulture;

        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        internal Resources() {
        }

        /// <summary>
        ///   Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Resources.ResourceManager ResourceManager {
            get {
                if (object.ReferenceEquals(resourceMan, null)) {
                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Aion_Launcher.Properties.Resources", typeof(Resources).Assembly);
                    resourceMan = temp;
                }
                return resourceMan;
            }
        }

        /// <summary>
        ///   Перезаписывает свойство CurrentUICulture текущего потока для всех
        ///   обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Globalization.CultureInfo Culture {
            get {
                return resourceCulture;
            }
            set {
                resourceCulture = value;
            }
        }

        /// <summary>
        ///   Поиск локализованного ресурса типа System.Drawing.Bitmap.
        /// </summary>
        internal static System.Drawing.Bitmap ai_eye2 {
            get {
                object obj = ResourceManager.GetObject("ai_eye2", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }

        /// <summary>
        ///   Поиск локализованного ресурса типа System.Drawing.Bitmap.
        /// </summary>
        internal static System.Drawing.Bitmap ai_main2 {
            get {
                object obj = ResourceManager.GetObject("ai_main2", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }

        /// <summary>
        ///   Поиск локализованного ресурса типа System.Drawing.Bitmap.
        /// </summary>
        internal static System.Drawing.Bitmap application_view_icons {
            get {
                object obj = ResourceManager.GetObject("application_view_icons", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }

        /// <summary>
        ///   Поиск локализованного ресурса типа System.Drawing.Bitmap.
        /// </summary>
        internal static System.Drawing.Bitmap bullet_black {
            get {
                object obj = ResourceManager.GetObject("bullet_black", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }

        /// <summary>
        ///   Поиск локализованного ресурса типа System.Drawing.Bitmap.
        /// </summary>
        internal static System.Drawing.Bitmap bullet_green {
            get {
                object obj = ResourceManager.GetObject("bullet_green", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }

        /// <summary>
        ///   Поиск локализованного ресурса типа System.Drawing.Bitmap.
        /// </summary>
        internal static System.Drawing.Bitmap bullet_red {
            get {
                object obj = ResourceManager.GetObject("bullet_red", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }

        /// <summary>
        ///   Поиск локализованного ресурса типа System.Drawing.Bitmap.
        /// </summary>
        internal static System.Drawing.Bitmap construction {
            get {
                object obj = ResourceManager.GetObject("construction", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }

        /// <summary>
        ///   Поиск локализованного ресурса типа System.Drawing.Bitmap.
        /// </summary>
        internal static System.Drawing.Bitmap controller {
            get {
                object obj = ResourceManager.GetObject("controller", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }

        /// <summary>
        ///   Поиск локализованного ресурса типа System.Drawing.Bitmap.
        /// </summary>
        internal static System.Drawing.Bitmap document_image_ver {
            get {
                object obj = ResourceManager.GetObject("document_image_ver", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }

        /// <summary>
        ///   Поиск локализованного ресурса типа System.Drawing.Bitmap.
        /// </summary>
        internal static System.Drawing.Bitmap door_out {
            get {
                object obj = ResourceManager.GetObject("door_out", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }

        /// <summary>
        ///   Поиск локализованного ресурса типа System.Drawing.Bitmap.
        /// </summary>
        internal static System.Drawing.Bitmap draw_points {
            get {
                object obj = ResourceManager.GetObject("draw_points", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }

        /// <summary>
        ///   Поиск локализованного ресурса типа System.Drawing.Bitmap.
        /// </summary>
        internal static System.Drawing.Bitmap eo {
            get {
                object obj = ResourceManager.GetObject("eo", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }

        /// <summary>
        ///   Поиск локализованного ресурса типа System.Drawing.Bitmap.
        /// </summary>
        internal static System.Drawing.Bitmap help {
            get {
                object obj = ResourceManager.GetObject("help", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }

        /// <summary>
        ///   Ищет локализованную строку, похожую на <!DOCTYPE html>
        ///<html>
        ///
        ///<head>
        ///    <title></title>
        ///    <meta charset="UTF-8">
        ///    <style>
        ///        html {
        ///            -ms-overflow-style: scrollbar;
        ///        }
        ///
        ///        body {
        ///            width: 93%;
        ///            font-size: 12px;
        ///            font-family: Tahoma;
        ///            cursor: default;
        ///        }
        ///
        ///        h3 {
        ///            font-size: 14px;
        ///        }
        ///
        ///        h2 {
        ///            font-size: 18px;
        ///        }
        ///
        ///        a,
        ///        a:active,
        ///        a:visited {
        ///            color: #25519A;
        /// [остаток строки не уместился]";.
        /// </summary>
        internal static string history {
            get {
                return ResourceManager.GetString("history", resourceCulture);
            }
        }

        /// <summary>
        ///   Ищет локализованную строку, похожую на <!DOCTYPE html>
        ///<html>
        ///
        ///<head>
        ///    <title></title>
        ///    <meta charset="UTF-8">
        ///
        ///    <style>
        ///        html {
        ///            -ms-overflow-style: scrollbar;
        ///        }
        ///
        ///        body {
        ///            width: 93%;
        ///            font-size: 12px;
        ///            font-family: Tahoma;
        ///            cursor: default;
        ///        }
        ///
        ///        h3 {
        ///            font-size: 14px;
        ///        }
        ///
        ///        h2 {
        ///            font-size: 18px;
        ///        }
        ///
        ///        a,
        ///        a:active,
        ///        a:visited {
        ///            color: #25519A [остаток строки не уместился]";.
        /// </summary>
        internal static string historyen {
            get {
                return ResourceManager.GetString("historyen", resourceCulture);
            }
        }

        /// <summary>
        ///   Поиск локализованного ресурса типа System.Drawing.Bitmap.
        /// </summary>
        internal static System.Drawing.Bitmap inbox_download {
            get {
                object obj = ResourceManager.GetObject("inbox_download", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }

        /// <summary>
        ///   Поиск локализованного ресурса типа System.Drawing.Bitmap.
        /// </summary>
        internal static System.Drawing.Bitmap info_rhombus {
            get {
                object obj = ResourceManager.GetObject("info_rhombus", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }

        /// <summary>
        ///   Поиск локализованного ресурса типа System.Drawing.Bitmap.
        /// </summary>
        internal static System.Drawing.Bitmap load_anim {
            get {
                object obj = ResourceManager.GetObject("load_anim", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }

        /// <summary>
        ///   Поиск локализованного ресурса типа System.Drawing.Bitmap.
        /// </summary>
        internal static System.Drawing.Bitmap loader {
            get {
                object obj = ResourceManager.GetObject("loader", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }

        /// <summary>
        ///   Поиск локализованного ресурса типа System.Drawing.Bitmap.
        /// </summary>
        internal static System.Drawing.Bitmap loadgif {
            get {
                object obj = ResourceManager.GetObject("loadgif", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }

        /// <summary>
        ///   Поиск локализованного ресурса типа System.Drawing.Bitmap.
        /// </summary>
        internal static System.Drawing.Bitmap noupd {
            get {
                object obj = ResourceManager.GetObject("noupd", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }

        /// <summary>
        ///   Поиск локализованного ресурса типа System.Drawing.Bitmap.
        /// </summary>
        internal static System.Drawing.Bitmap panels {
            get {
                object obj = ResourceManager.GetObject("panels", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }

        /// <summary>
        ///   Поиск локализованного ресурса типа System.Drawing.Bitmap.
        /// </summary>
        internal static System.Drawing.Bitmap plaync {
            get {
                object obj = ResourceManager.GetObject("plaync", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }

        /// <summary>
        ///   Поиск локализованного ресурса типа System.Drawing.Bitmap.
        /// </summary>
        internal static System.Drawing.Bitmap save {
            get {
                object obj = ResourceManager.GetObject("save", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }

        /// <summary>
        ///   Поиск локализованного ресурса типа System.Drawing.Bitmap.
        /// </summary>
        internal static System.Drawing.Bitmap setting_tools {
            get {
                object obj = ResourceManager.GetObject("setting_tools", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }

        /// <summary>
        ///   Поиск локализованного ресурса типа System.Drawing.Bitmap.
        /// </summary>
        internal static System.Drawing.Bitmap timerplay {
            get {
                object obj = ResourceManager.GetObject("timerplay", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }

        /// <summary>
        ///   Поиск локализованного ресурса типа System.Drawing.Bitmap.
        /// </summary>
        internal static System.Drawing.Bitmap timerstop {
            get {
                object obj = ResourceManager.GetObject("timerstop", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }

        /// <summary>
        ///   Поиск локализованного ресурса типа System.Drawing.Bitmap.
        /// </summary>
        internal static System.Drawing.Bitmap upd {
            get {
                object obj = ResourceManager.GetObject("upd", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }

        /// <summary>
        ///   Поиск локализованного ресурса типа System.Byte[].
        /// </summary>
        internal static byte[] Updater {
            get {
                object obj = ResourceManager.GetObject("Updater", resourceCulture);
                return ((byte[])(obj));
            }
        }

        /// <summary>
        ///   Поиск локализованного ресурса типа System.Drawing.Bitmap.
        /// </summary>
        internal static System.Drawing.Bitmap updfail {
            get {
                object obj = ResourceManager.GetObject("updfail", resourceCulture);
                return ((System.Drawing.Bitmap)(obj));
            }
        }
    }
}


text:
package com.google.errorprone.bugpatterns.testdata;

import static com.google.common.truth.Truth.assertThat;

/**
 * Negative test cases for TruthConstantAsserts check.
 *
 * @author bhagwani@google.com (Sumit Bhagwani)
 */
public class TruthConstantAssertsNegativeCases {

  public void testNegativeCases() {
    assertThat(new TruthConstantAssertsNegativeCases()).isEqualTo(Boolean.TRUE);
    assertThat(getObject()).isEqualTo(Boolean.TRUE);

    // assertion called on constant with constant expectation is ignored.
    assertThat(Boolean.FALSE).isEqualTo(4.2);
  }

  private static TruthConstantAssertsNegativeCases getObject() {
    return new TruthConstantAssertsNegativeCases();
  }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="JavaScriptLibraryMappings">
    <file url="file://$PROJECT_DIR$" libraries="{VinnyStoryPage node_modules}" />
    <includedPredefinedLibrary name="ECMAScript 6" />
  </component>
</project>


text:
{{-- Display a single member --}}
@extends('layouts.template-ng')

@section('ng-app', 'flaresApp')
@section('ng-controller', 'memberController')
@section('title', 'Member View')

@section('heading')

Mass Actions

@endsection

@section('content')
	@yield('memberDisplay')
@endsection

@section('ng-script')

@endsection


text:
import getOffsetRectRelativeToArbitraryNode from './getOffsetRectRelativeToArbitraryNode';
import getScroll from './getScroll';
import getClientRect from './getClientRect';

export default function getViewportOffsetRectRelativeToArtbitraryNode(element, excludeScroll = false) {
  const html = element.ownerDocument.documentElement;
  const relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  const width = Math.max(html.clientWidth, window.innerWidth || 0);
  const height = Math.max(html.clientHeight, window.innerHeight || 0);

  const scrollTop = !excludeScroll ? getScroll(html) : 0;
  const scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;

  const offset = {
    top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
    left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
    width,
    height,
  };

  return getClientRect(offset);
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Farringia Stafleu

### Remarks
null


text:
using System;

namespace Serenity.Reporting
{
    public class ReportAttribute : Attribute
    {
        public ReportAttribute(string reportKey = null)
        {
            this.ReportKey = reportKey;
        }

        public string ReportKey { get; private set; }
    }
}


text:
//C++

#include "DShared.h"
#include "DSys.h"
#include "DAudio_Main.h"

//#include <FMod_errors.h>

namespace DAudio {

	DSys::Var_bool	sv_bSoundEnable				("s_soundEnable",	"1");
	DSys::Var_int	sv_iSound_MaxChannels		("s_maxChannels",	"32");
	DSys::Var_int	sv_iSound_Frequency			("s_frequency",		"44100");
	DSys::Var_float	sv_fSound_Volume			("s_volume",		"0.5");

	void Init()
	{
#if 0
		if( ! sv_bSoundEnable )
		{
			DSys::Logger::Print("Skipping FMod initialization...");
			return;
		}
		DSys::Logger::Print("---- FMod Initializing ----");
		Logger_EnterLevel();

		int error = FSOUND_Init(sv_iSound_Frequency, sv_iSound_MaxChannels, 0);
		if(error)
		{
			DSys::Logger::Error(FMOD_ErrorString(error));
		}
		else
		{
			DSys::Logger::Print("FMod Initialized Successfully...");
		}

		DSys::Logger::Print("Setting audio frequency to %d Hz...", sv_iSound_Frequency.intval());
		DSys::Logger::Print("Setting max software channels to %d channels...", sv_iSound_MaxChannels.intval());

		if (FSOUND_GetVersion() < FMOD_VERSION)
		{
			DSys::Logger::Error("You are using the wrong DLL version!  You should be using FMOD %.02f\n", FMOD_VERSION);
			return;
		}

		DSys::Logger::Print("Using Direct Sound output device...");
		FSOUND_SetOutput(FSOUND_OUTPUT_DSOUND);

		unsigned int caps = 0;

        FSOUND_GetDriverCaps(FSOUND_GetDriver(), &caps);
        DSys::Logger::Print("--------------------");
		DSys::Logger::Print("Driver capabilities:");
		DSys::Logger::Print("--------------------");
        if (!caps)
            DSys::Logger::Print("This driver will support software mode only.\n  It does not properly support 3D sound hardware.");
        if (caps & FSOUND_CAPS_HARDWARE)
            DSys::Logger::Print("Driver supports hardware 3D sound!");
        if (caps & FSOUND_CAPS_EAX2)
            DSys::Logger::Print("Driver supports EAX 2 reverb!");
        if (caps & FSOUND_CAPS_EAX3)
            DSys::Logger::Print("Driver supports EAX 3 reverb!");

		DSys::Logger::Print("\n");

		switch (FSOUND_GetOutput())
		{
			case FSOUND_OUTPUT_NOSOUND: DSys::Logger::Print("FSOUND Output Method : FSOUND_OUTPUT_NOSOUND"); break;
			case FSOUND_OUTPUT_WINMM:   DSys::Logger::Print("FSOUND Output Method : FSOUND_OUTPUT_WINMM"); break;
			case FSOUND_OUTPUT_DSOUND:  DSys::Logger::Print("FSOUND Output Method : FSOUND_OUTPUT_DSOUND"); break;
			case FSOUND_OUTPUT_ASIO:    DSys::Logger::Print("FSOUND Output Method : FSOUND_OUTPUT_ASIO"); break;
			case FSOUND_OUTPUT_OSS:     DSys::Logger::Print("FSOUND Output Method : FSOUND_OUTPUT_OSS"); break;
			case FSOUND_OUTPUT_ESD:     DSys::Logger::Print("FSOUND Output Method : FSOUND_OUTPUT_ESD"); break;
			case FSOUND_OUTPUT_ALSA:    DSys::Logger::Print("FSOUND Output Method : FSOUND_OUTPUT_ALSA"); break;
		};

		DSys::Logger::Print("Autodetecting mixxer...");
		FSOUND_SetMixer(FSOUND_MIXER_AUTODETECT);
		switch (FSOUND_GetMixer())
		{
			case FSOUND_MIXER_BLENDMODE:     DSys::Logger::Print("FSOUND Mixer         : FSOUND_MIXER_BLENDMODE"); break;
			case FSOUND_MIXER_MMXP5:         DSys::Logger::Print("FSOUND Mixer         : FSOUND_MIXER_MMXP5"); break;
			case FSOUND_MIXER_MMXP6:         DSys::Logger::Print("FSOUND Mixer         : FSOUND_MIXER_MMXP6"); break;
			case FSOUND_MIXER_QUALITY_FPU:   DSys::Logger::Print("FSOUND Mixer         : FSOUND_MIXER_QUALITY_FPU"); break;
			case FSOUND_MIXER_QUALITY_MMXP5: DSys::Logger::Print("FSOUND Mixer         : FSOUND_MIXER_QUALITY_MMXP5"); break;
			case FSOUND_MIXER_QUALITY_MMXP6: DSys::Logger::Print("FSOUND Mixer         : FSOUND_MIXER_QUALITY_MMXP6"); break;
		};

		DSys::Logger::Print("FSOUND Driver        : %s", FSOUND_GetDriverName(FSOUND_GetDriver()));
		DSys::Logger::Print("Hardware 3D channels : %d", FSOUND_GetNumHardwareChannels());

		if(sv_fSound_Volume.floatval() > 1 || sv_fSound_Volume.floatval() < 0)
		{
			sv_fSound_Volume.setval("0.5");
			sv_fSound_Volume.update();
			DSys::Logger::Warning("sv_fSound_Volume is out of range resetting to default...");
		}
		DSys::Logger::Print("Setting volume to %f%%...", sv_fSound_Volume.floatval()*100.0f);
		FSOUND_SetVolume(FSOUND_ALL, (int)(255 * sv_fSound_Volume.floatval()));
#endif
	}

	void Update()
	{
#if 0
		FSOUND_Update();
#endif
	}

	void Shutdown()
	{
#if 0
		DSys::Logger::Print("FMod Shutdown...");
		FSOUND_Close();
#endif
	}
}


text:
export declare class IndentingStringBuilder {
    private readonly lines;
    private readonly indent;
    private readonly startIndex;
    constructor(parentBuilder?: IndentingStringBuilder);
    /** Add the given line(s) with the correct indent level. */
    push(...lines: string[]): void;
    /**
     * Allow indenting a block at a time. Can be used either via a lambda argument
     * or via the return value.
     *
     * Example 1:
     *
     * ```
     * const indented = builder.withIndent();
     * indented.push('a');
     * indented.push('a');
     * ```
     *
     * Example 2:
     *
     * ```
     * builder.withIndent(indented => {
     *   indented.push('a');
     *   indented.push('a');
     * });
     * ```
     */
    withIndent(fn?: (builder: IndentingStringBuilder) => void): IndentingStringBuilder;
    toString(): string;
}


text:
import tree from '../pages/editor/state';
import fabricjs from '../../../../bower_components/fabric.js/dist/fabric.min.js';
import * as draw from './draw';
import * as filters from './filters';
import * as importImage from './importImage';

export let canvas = null;
let workspace = null;

export function engineInit(w, h) {

	const canvasElem = document.createElement('canvas');
	workspace = document.getElementsByClassName('workspace')[0];
	canvasElem.setAttribute('id', 'mainCanvas');
	workspace.appendChild(canvasElem);

	canvas = new fabricjs.fabric.Canvas('mainCanvas', {
		backgroundColor: 'rgb(255,255,255)',
		selection: false,
		width: w,
		height: h,
		selectionColor: 'rgba(0,255,0,0.3)',
		selectionBorderColor: 'red',
		selectionLineWidth: 5
	});

	tree.set(['canvas', 'width'], w);
	tree.set(['canvas', 'height'], h);
};

export function deleteEngine() {
	const canvasContainer = document.getElementsByClassName('canvas-container')[0];
	workspace.removeChild(canvasContainer);

	tree.set(['canvas', 'width'], null);
	tree.set(['canvas', 'height'], null);
};

export function getBlob(rawBlob) {
	let byteString = null;
	let mimestring = null;

	canvas.deactivateAll().renderAll();
	const dataURI = canvas.toDataURL('png');

	if(dataURI.split(',')[0].indexOf('base64') !== -1 ) {
		byteString = atob(dataURI.split(',')[1]);
	} else {
		byteString = decodeURI(dataURI.split(',')[1]);
	}

	mimestring = dataURI.split(',')[0].split(':')[1].split(';')[0];

	const content = new Array();
	for (let i = 0; i < byteString.length; i++) {
		content[i] = byteString.charCodeAt(i);
	}
	const rawContent = new Uint8Array(content);

	const returnBlob = new Blob([rawContent], {type: mimestring});
	const urlCreator = window.URL || window.webkitURL;

	let imageUrl = null;
	if (rawBlob) {
		imageUrl = {returnBlob, mimestring};
	} else {
		imageUrl = urlCreator.createObjectURL(returnBlob);
	}

	return dataURI;
};

const updateTool = () => {
	const currentState = tree.get();

	switch (currentState.selectedTool) {
		case 'pencil':
			draw.pencil(currentState);
			break;
		case 'eraser':
			draw.deleteLayer();
			break;
		case 'filters':
			console.log('filters');
			filters.applyFilter(currentState);
			break;
		default:
			if (canvas !== null) {
				canvas.isDrawingMode = false;
			}
			break;
	}
};

tree.on('update', () => {
	updateTool();
});

const uploadedCursor = tree.select('uploadedImage');
uploadedCursor.on('update', () => {
	const imageUrl = tree.get().uploadedImage;
	if (imageUrl !== null) {
		importImage.addImage(imageUrl);
	}
});


text:
namespace rubinius {
  class NilClass : public Object {
  public:
    static const object_type type = NilType;

    class Info : public TypeInfo {
    public:
      Info(object_type type) : TypeInfo(type) { }
      virtual void mark(Object* t, ObjectMark& mark);
      virtual void show(STATE, Object* self, int level);
      virtual void show_simple(STATE, Object* self, int level);
      virtual void auto_mark(Object* obj, ObjectMark& mark) {}
    };
  };

  class TrueClass : public Object {
  public:
    static const object_type type = TrueType;

    class Info : public TypeInfo {
    public:
      Info(object_type type) : TypeInfo(type) { }
      virtual void mark(Object* t, ObjectMark& mark);
      virtual void show(STATE, Object* self, int level);
      virtual void auto_mark(Object* obj, ObjectMark& mark) {}
    };
  };

  class FalseClass : public Object {
  public:
    static const object_type type = FalseType;

    class Info : public TypeInfo {
    public:
      Info(object_type type) : TypeInfo(type) { }
      virtual void mark(Object* t, ObjectMark& mark);
      virtual void show(STATE, Object* self, int level);
      virtual void auto_mark(Object* obj, ObjectMark& mark) {}
    };
  };
}

#endif


text:
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using NUnit.Framework.Interfaces;
using Wyam.Testing.Tracing;
using Trace = Wyam.Common.Tracing.Trace;

namespace Wyam.Testing.Attributes
{
    [AttributeUsage(AttributeTargets.All, AllowMultiple = false)]
    public class NonWindowsTestAttribute : Attribute, ITestAction
    {
        public ActionTargets Targets { get; }

        public void BeforeTest(ITest test)
        {
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                Assert.Ignore("Non-Windows only");
            }
        }

        public void AfterTest(ITest test)
        {
        }
    }
}


text: java -cp ../../bin ie.dit.student.mahon.christopher.GameServer 4444


text:
@interface ProductDetailBoardCell_iPhone()
{
	//<#@private var#>
}
@end

@implementation ProductDetailBoardCell_iPhone

SUPPORT_AUTOMATIC_LAYOUT( YES )
SUPPORT_RESOURCE_LOADING( YES )

- (void)load
{
}

- (void)unload
{
}

- (void)dataDidChanged
{
    NSDictionary * indexs = self.data;
    if ( indexs ) {
        $(@"#realtime_online_desc").DATA( [indexs objectForKey:@"realtime_online_desc"] );
        $(@"#act_user_desc").DATA( [indexs objectForKey:@"act_user_desc"] );
        $(@"#new_user_desc").DATA( [indexs objectForKey:@"new_user_desc"] );
        $(@"#income_desc").DATA( [indexs objectForKey:@"income_desc"] );
    }
}

@end


text:
require 'spec_helper'

module TSM

  describe ScreenAttribute do
    let(:struct) { ScreenAttributeStruct.new }

    describe '#to_screen_attribute' do
      let(:attribute) { struct.to_screen_attribute }

      describe 'fg' do
        subject { attribute.fg }

        before do
          struct[:fccode] = 5
        end

        it { should eq(5) }
      end

      describe 'bg' do
        subject { attribute.bg }

        before do
          struct[:bccode] = 7
        end

        it { should eq(7) }
      end

      describe 'bold?' do
        subject { attribute.bold? }

        context "when first bit is not set" do
          before do
            struct[:flags] = 2 # second only
          end

          it { should be(false) }
        end

        context "when first bit is set" do
          before do
            struct[:flags] = 1 # first only
          end

          it { should be(true) }
        end
      end

      describe 'underline?' do
        subject { attribute.underline? }

        context "when second bit is not set" do
          before do
            struct[:flags] = 1 # first only
          end

          it { should be(false) }
        end

        context "when second bit is set" do
          before do
            struct[:flags] = 3 # first + second
          end

          it { should be(true) }
        end
      end

      describe 'inverse?' do
        subject { attribute.inverse? }

        context "when third bit is not set" do
          before do
            struct[:flags] = 8 # fourth only
          end

          it { should be(false) }
        end

        context "when third bit is set" do
          before do
            struct[:flags] = 6 # second + third
          end

          it { should be(true) }
        end
      end

      describe 'blink?' do
        subject { attribute.blink? }

        context "when fifth bit is not set" do
          before do
            struct[:flags] = 15 # first four
          end

          it { should be(false) }
        end

        context "when fifth bit is set" do
          before do
            struct[:flags] = 17 # first + fifth
          end

          it { should be(true) }
        end
      end
    end
  end

end


text:
class XAudio2SoundPlayer
{
	struct ImplData;

public:
	XAudio2SoundPlayer(uint32 sampleRate);
	~XAudio2SoundPlayer();

	size_t AddSound(_In_ WAVEFORMATEX* format, _In_ Platform::Array<byte>^ data);
	bool   PlaySound(size_t index);
	bool   StopSound(size_t index);
	bool   IsSoundPlaying(size_t index) const;
	size_t GetSoundCount() const;

	void Suspend();
	void Resume();

private:
	interface IXAudio2*                     m_audioEngine;
	interface IXAudio2MasteringVoice*       m_masteringVoice;
	std::vector<std::shared_ptr<ImplData>>  m_soundList;
};


text:
module Data.Monoid.Operator where

import Data.Monoid

(++) :: (Monoid a) => a -> a -> a
(++) = mappend


text:
layout: post
title: Mobile APO
---

Mobile APO has been an running side project of mine in an attempt to learn Android programming targeting sdk version 21 (Lollipop), with a minimum sdk version 15 (Ice Cream Sandwich). In it I've tried to look up and follow Material Design guidelines as much as possible using correct [color palettes](https://www.google.com/design/spec/style/color.html#color-color-palette), [app bar](https://www.google.com/design/spec/layout/structure.html#structure-app-bar), [side nav](https://www.google.com/design/spec/layout/structure.html#structure-side-nav), and [card views](https://www.google.com/design/spec/components/cards.html) as well as learning how to separate code into fragments with fewer activities.

    Previous

    Next

Quick Stats:

* When: Spring 2015 - Present
* Where: UT Austin
* How:
  - Android IDE: Android Studio
  - Android Emulator: [Genymotion](https://www.genymotion.com/)
  - Android Libraries:
      * HTML Parser: [Jsoup](https://github.com/jhy/jsoup/).
      * View Injector: [Butterknife](https://github.com/JakeWharton/butterknife)
  - Prototyping tool: [Pencil](https://github.com/prikhi/pencil)

Alpha Phi Omega is known as a large co-ed service fraternity with about 150 active members every semester. With a large focus on volunteering we try and keep track of as many volunteer oportunities available around campus. Historically, APO has only had a web app to coordinate volunteer events which, when on the go, could be a little anoying to open up a phone browser, direct it to [apoonline](http://apoonline.org/alpharho/), log in, and check the event details. Having tried to learn Android previously via tutorials, but never coming up with a project that I've been excited for this was the perfect opportunity to set everything in motion.

By using the already established web server Mobile APO only serves as a front end app for Android, allowing me to learn the basics about views, events, and how activities connect to each other without worrying about the server side of things just yet. For now I am using jsoup to emulate a browser, send GET requests for page navigations, and parse out relevant information into a json. This is done in a separate helper file that the rest of my app can use to abstract an API that can later be replaced easily should I get access to the real database.

This app also marks the first time I've really had to worry about creating my own UI/UX from scratch. Even though figuring out font sizes, margin spacings, and even graphic design turned out to be harder than I thought, after going through a couple of sketches I began to have an idea of what I wanted. To help with this I used Pencil to wireframe each view before implementing them and get a better picture of what the final product would look like.


text:
class HealthCheck
  include ChefResource

  OK = 'ok'.freeze
  NOT_OK = 'not ok'.freeze
  REACHABLE = 'reachable'.freeze
  TIMEOUT = 'timeout'.freeze
  UNREACHABLE = 'unreachable'.freeze
  ERRORING = 'erroring'.freeze
  AUTHERROR = 'authentication error'.freeze

  attr_reader :status, :erchef, :postgres

  def initialize
    @status = OK
    @erchef = { status: REACHABLE }
    @postgres = { status: REACHABLE }
  end

  #
  # Do a general health check.
  #
  def check
    erchef_health
    erchef_key
    postgres_health
    overall
  end

  #
  # Shortcut to see if all is well
  #
  def ok?
    @status == OK
  end

  private

  #
  # Try to ping erchef as an indicator of general health
  #
  def erchef_health
    erchef_health_metric do
      output = chef.get_rest '_status'

      if output['status'] != 'pong'
        @erchef[:status] = ERRORING
      end
    end
  end

  #
  # Try to fetch /users/pivotal, which will only succeed if we have the correct
  # webui_priv.pem key in place.
  #
  def erchef_key
    erchef_health_metric do
      chef.get_rest '/users/pivotal'
    end
  end

  #
  # Check the number of active Postgres connections as an indicator of
  # general health
  #
  def postgres_health
    begin
      ActiveRecord::Base.connection.query(
        'SELECT count(*) FROM pg_stat_activity'
      ).flatten.first.to_i.tap do |connections|
        @postgres[:connections] = connections
      end
    rescue ActiveRecord::ConnectionTimeoutError
      @postgres[:status] = TIMEOUT
    rescue PG::ConnectionBad
      @postgres[:status] = UNREACHABLE
    end
  end

  #
  # What is the overall system status
  #
  def overall
    if @postgres[:status] != REACHABLE || @erchef[:status] != REACHABLE
      @status = NOT_OK
    end
  end

  def erchef_health_metric
    begin
      yield
    rescue Errno::ETIMEDOUT
      @erchef[:status] = TIMEOUT
    rescue Net::HTTPServerException => e
      if e.message =~ /401/
        @erchef[:status] = AUTHERROR
      else
        @erchef[:status] = ERRORING
      end
    end
  end
end


text:
namespace device {

class UsbDevice;

// Extends UsbDeviceHandleUsbfs with support for managing a device connection
// through an instance of android.hardware.usb.UsbDeviceConnection.
class UsbDeviceHandleAndroid : public UsbDeviceHandleUsbfs {
 public:
  static scoped_refptr<UsbDeviceHandleAndroid> Create(
      JNIEnv* env,
      scoped_refptr<UsbDevice> device,
      const base::android::JavaRef<jobject>& usb_connection);

 private:
  // |wrapper| is an instance of org.chromium.device.usb.ChromeUsbConnection.
  UsbDeviceHandleAndroid(scoped_refptr<UsbDevice> device,
                         base::ScopedFD fd,
                         const base::android::JavaRef<jobject>& wrapper);
  ~UsbDeviceHandleAndroid() override;

  // UsbDeviceHandleUsbfs:
  void CloseBlocking() override;

  void CloseConnection();

  // Java object org.chromium.device.usb.ChromeUsbConnection.
  base::android::ScopedJavaGlobalRef<jobject> j_object_;
};

}  // namespace device

#endif  // SERVICES_DEVICE_USB_USB_DEVICE_HANDLE_ANDROID_H_


text:
layout: post
title: "New-in"
date: 2015-12-15
comments: true
description: "New in CSS"
keywords: "Trick"
categories:
- Trick
tags:
- Trick
---

-webkit-filter: Sepia(100%)
                grayscale(100%)
                opacity(100%)
                blur(100%/6px)
                hue-rotate(100%/degree)
                drop-shadow(20px 20px 10px #000)

-webkit-calc()

display: -webkit-flex
-webkit-flex-flow: row
-webkit-justify-content
-webkit-flex-grow: 1
-webkit-order: -1
-webkit-align-self: center
-webkit-flex-wrap:
flexbox(any demension)

Great for responsive web design
-webkit-column-count: 3
-webkit-column-gap: 3em
-webkit-column-rule: 1px dotted
-webkit-c olumn-width: 100px
-webkit-column-span

local-link

only-child


text:
import pytest
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
import sys
import unittest

hub_host = pytest.config.option.hub_host
# Error out if --hub_host value wasn't given or isn't a string
try:
    if not isinstance(hub_host, basestring):
        message = "The --hub_host value '{0}' is not a valid string!".format(hub_host)
        sys.exit(message)
except NameError:
    message = "Please provide the IP of your grid hub with --hub_host."
    sys.exit(message)

class TestDemo(unittest.TestCase):
    def setUp(self):
        # Set desired capabilities
        desired_cap = {
            'platform': "Linux",
            'browserName': "chrome",
        }
        hub_host = pytest.config.option.hub_host
        hub_port = "4444"
        hub_url = "http://test:PUT_YOUR_OWN_UNIQUE_GRID_PASSWORD_HERE@{0}:{1}/wd/hub".format(hub_host, hub_port)
        self.video_dashboard_url = "http://{0}:{1}/dashboard/".format(hub_host, hub_port)
        self.driver = webdriver.Remote(
            command_executor=hub_url,
            desired_capabilities=desired_cap)
        live_url = "http://{0}:{1}/grid/admin/live".format(hub_host, hub_port)
        print("View live VNC session for your test at {0}".format(live_url))

    def tearDown(self):
        # On Sauce Labs this is important to stop running tests:
        self.driver.quit()
        print("View archived video of your test at {0}".format(self.video_dashboard_url))

    # Test logic goes here
    def test_demo(self):
        self.driver.get("http://www.google.com")
        if not "Google" in self.driver.title:
            raise Exception("Unable to load google page!")
        elem = self.driver.find_element_by_name("q")
        elem.send_keys("Zalenium")
        elem.submit()
        print self.driver.title


text:
<?php

namespace Enqueue\Mongodb\Tests\Spec;

use Enqueue\Test\MongodbExtensionTrait;
use Interop\Queue\Spec\SendAndReceiveDelayedMessageFromQueueSpec;

/**
 * @group functional
 * @group mongodb
 */
class MongodbSendAndReceiveDelayedMessageFromQueueTest extends SendAndReceiveDelayedMessageFromQueueSpec
{
    use MongodbExtensionTrait;

    /**
     * {@inheritdoc}
     */
    protected function createContext()
    {
        return $this->buildMongodbContext();
    }
}