text:
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

defined('MOODLE_INTERNAL') || die();

/**
 * Send javascript file content with as much caching as possible
 * @param string $jspath
 * @param string $etag
 * @param string $filename
 */
function js_send_cached($jspath, $etag, $filename = 'javascript.php') {
    require(__DIR__ . '/xsendfilelib.php');

    // 90 days only - based on Moodle point release cadence being every 3 months.
    $lifetime = 60 * 60 * 24 * 90;

    header('Etag: "'.$etag.'"');
    header('Content-Disposition: inline; filename="'.$filename.'"');
    header('Last-Modified: '. gmdate('D, d M Y H:i:s', filemtime($jspath)) .' GMT');
    header('Expires: '. gmdate('D, d M Y H:i:s', time() + $lifetime) .' GMT');
    header('Pragma: ');
    header('Cache-Control: public, max-age='.$lifetime.', immutable');
    header('Accept-Ranges: none');
    header('Content-Type: application/javascript; charset=utf-8');

    if (xsendfile($jspath)) {
        die;
    }

    if (!min_enable_zlib_compression()) {
        header('Content-Length: '.filesize($jspath));
    }

    readfile($jspath);
    die;
}

/**
 * Send javascript without any caching
 * @param string $js
 * @param string $filename
 */
function js_send_uncached($js, $filename = 'javascript.php') {
    header('Content-Disposition: inline; filename="'.$filename.'"');
    header('Last-Modified: '. gmdate('D, d M Y H:i:s', time()) .' GMT');
    header('Expires: '. gmdate('D, d M Y H:i:s', time() + 2) .' GMT');
    header('Pragma: ');
    header('Accept-Ranges: none');
    header('Content-Type: application/javascript; charset=utf-8');
    header('Content-Length: '.strlen($js));

    echo $js;
    die;
}

/**
 * Send file not modified headers
 * @param int $lastmodified
 * @param string $etag
 */
function js_send_unmodified($lastmodified, $etag) {
    // 90 days only - based on Moodle point release cadence being every 3 months.
    $lifetime = 60 * 60 * 24 * 90;
    header('HTTP/1.1 304 Not Modified');
    header('Expires: '. gmdate('D, d M Y H:i:s', time() + $lifetime) .' GMT');
    header('Cache-Control: public, max-age='.$lifetime);
    header('Content-Type: application/javascript; charset=utf-8');
    header('Etag: "'.$etag.'"');
    if ($lastmodified) {
        header('Last-Modified: '. gmdate('D, d M Y H:i:s', $lastmodified) .' GMT');
    }
    die;
}

/**
 * Create cache file for JS content
 * @param string $file full file path to cache file
 * @param string $content JS code
 */
function js_write_cache_file_content($file, $content) {
    global $CFG;

    clearstatcache();
    if (!file_exists(dirname($file))) {
        @mkdir(dirname($file), $CFG->directorypermissions, true);
    }

    // Prevent serving of incomplete file from concurrent request,
    // the rename() should be more atomic than fwrite().
    ignore_user_abort(true);
    if ($fp = fopen($file.'.tmp', 'xb')) {
        fwrite($fp, $content);
        fclose($fp);
        rename($file.'.tmp', $file);
        @chmod($file, $CFG->filepermissions);
        @unlink($file.'.tmp'); // just in case anything fails
    }
    ignore_user_abort(false);
    if (connection_aborted()) {
        die;
    }
}

/**
 * Sends a 404 message about CSS not being found.
 */
function js_send_css_not_found() {
    header('HTTP/1.0 404 not found');
    die('JS was not found, sorry.');
}


text:
:mod:`anyconfig.backend.json`
==============================

.. automodule:: anyconfig.backend.json
    :members:
    :special-members:
    :private-members:
    :undoc-members:
    :show-inheritance:

.. toctree::

   anyconfig.backend.json.common
   anyconfig.backend.json.default
   anyconfig.backend.json.simplejson

redpajama_set_name: RedPajamaGithub


text:
interface IFilterToolbarModel {
	formControlType: string;
	selectOptions: any[];
	placeholder: string;
	onEnter: boolean;
	onKeydown: boolean;
	onChange: boolean;
	allowResetButton: boolean;
	allowSubmitButton: boolean;
	transformData?: Function;
}


text:
//
//  EXTMaybe.m
//  extobjc
//
//  Created by Justin Spahr-Summers on 21.01.12.
//  Copyright (C) 2012 Justin Spahr-Summers.
//  Released under the MIT license.
//

#import "EXTMaybe.h"
#import "EXTNil.h"
#import <objc/runtime.h>

@interface EXTMaybe () {
    /**
     * The error with which this object was instantiated.
     */
    NSError *m_error;
}

@end

@implementation EXTMaybe

#pragma mark Lifecycle

+ (id)maybeWithError:(NSError *)error; {
    // NSProxy does not implement -init
    EXTMaybe *maybe = [EXTMaybe alloc];
    maybe->m_error = error;

    return maybe;
}

#pragma mark Unwrapping

+ (id)validObjectWithMaybe:(id)maybe orElse:(id (^)(NSError *))block; {
    BOOL isError = [maybe isKindOfClass:[NSError class]];
    BOOL invalid = isError || !maybe || [maybe isEqual:[NSNull null]];

    if (!invalid)
        return maybe;

    if (!block)
        return nil;

    if ([object_getClass(maybe) isEqual:[EXTMaybe class]]) {
        EXTMaybe *maybeObj = maybe;
        maybe = maybeObj->m_error;
    }

    return block(isError ? maybe : nil);
}

#pragma mark NSCopying

- (id)copyWithZone:(NSZone *)zone {
    return self;
}

#pragma mark Forwarding machinery

- (void)forwardInvocation:(NSInvocation *)invocation {
    SEL selector = invocation.selector;

    if ([m_error respondsToSelector:selector])
        [invocation invokeWithTarget:m_error];
    else
        [invocation invokeWithTarget:[EXTNil null]];
}

- (id)forwardingTargetForSelector:(SEL)selector {
    if ([m_error respondsToSelector:selector])
        return m_error;
    else
        return [EXTNil null];
}

- (NSMethodSignature *)methodSignatureForSelector:(SEL)selector {
    return [m_error methodSignatureForSelector:selector] ?: [[EXTNil null] methodSignatureForSelector:selector];
}

- (BOOL)respondsToSelector:(SEL)selector {
    return [m_error respondsToSelector:selector] || [[EXTNil null] respondsToSelector:selector];
}

#pragma mark NSObject protocol

- (Class)class {
    if (m_error)
        return [m_error class];
    else
        return [EXTNil class];
}

- (BOOL)conformsToProtocol:(Protocol *)aProtocol {
    return [m_error conformsToProtocol:aProtocol] || [[EXTNil null] conformsToProtocol:aProtocol];
}

- (NSString *)description {
    return [NSString stringWithFormat:@"<EXTMaybe: %p error: %@>", (__bridge void *)self, m_error];
}

- (NSUInteger)hash {
    return [m_error hash] ?: [[EXTNil null] hash];
}

- (BOOL)isEqual:(id)obj {
    return [m_error isEqual:obj] || [[EXTNil null] isEqual:obj];
}

- (BOOL)isKindOfClass:(Class)class {
    return [m_error isKindOfClass:class] || [[EXTNil null] isKindOfClass:class];
}

- (BOOL)isMemberOfClass:(Class)class {
    return [m_error isMemberOfClass:class] || [[EXTNil null] isMemberOfClass:class];
}

- (Class)superclass {
    if (m_error)
        return [m_error superclass];
    else
        return [EXTNil superclass];
}

@end


text:
import React from 'react'
import ResultGateway from './ResultGateway'
import SearchEngine from '../utils/SearchEngine'

const DefaultResult = () => {
  return (
    <ResultGateway showIn={[/./]} hideIn={[/^(media)$/, /^(kandidat)$/, /^(pasangan)$/]}>
      <SearchEngine />
    </ResultGateway>
  )
}

export default DefaultResult


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

<!--  Copyright (c) MediaArea.net SARL. All Rights Reserved.

      Use of this source code is governed by a BSD-style license that can
      be found in the License.html file in the root of the source tree.
-->

<resources>
    <dimen name="button_margin">16dp</dimen>
    <dimen name="text_margin">8dp</dimen>
    <dimen name="item_width">300dp</dimen>
</resources>


text:
package joshie.mariculture.asm;

public enum ObfType {
    NOTCH, FUNC, NAMED
}


text:
extern "Java"
{
  namespace java
  {
    namespace awt
    {
        class Font;
        class FontMetrics;
        class Graphics;
      namespace font
      {
          class FontRenderContext;
          class LineMetrics;
      }
      namespace geom
      {
          class Rectangle2D;
      }
    }
    namespace text
    {
        class CharacterIterator;
    }
  }
}

class java::awt::FontMetrics : public ::java::lang::Object
{

public: // actually protected
  FontMetrics(::java::awt::Font *);
public:
  virtual ::java::awt::Font * getFont();
  virtual jint getLeading();
  virtual jint getAscent();
  virtual jint getDescent();
  virtual jint getHeight();
  virtual jint getMaxAscent();
  virtual jint getMaxDescent();
  virtual jint getMaxDecent();
  virtual jint getMaxAdvance();
  virtual jint charWidth(jint);
  virtual jint charWidth(jchar);
  virtual jint stringWidth(::java::lang::String *);
  virtual jint charsWidth(JArray< jchar > *, jint, jint);
  virtual jint bytesWidth(JArray< jbyte > *, jint, jint);
  virtual JArray< jint > * getWidths();
  virtual ::java::lang::String * toString();
  virtual ::java::awt::font::LineMetrics * getLineMetrics(::java::lang::String *, ::java::awt::Graphics *);
  virtual ::java::awt::font::LineMetrics * getLineMetrics(::java::lang::String *, jint, jint, ::java::awt::Graphics *);
  virtual ::java::awt::font::LineMetrics * getLineMetrics(JArray< jchar > *, jint, jint, ::java::awt::Graphics *);
  virtual ::java::awt::geom::Rectangle2D * getMaxCharBounds(::java::awt::Graphics *);
  virtual ::java::awt::font::LineMetrics * getLineMetrics(::java::text::CharacterIterator *, jint, jint, ::java::awt::Graphics *);
  virtual ::java::awt::geom::Rectangle2D * getStringBounds(::java::lang::String *, ::java::awt::Graphics *);
  virtual ::java::awt::geom::Rectangle2D * getStringBounds(::java::lang::String *, jint, jint, ::java::awt::Graphics *);
  virtual ::java::awt::geom::Rectangle2D * getStringBounds(JArray< jchar > *, jint, jint, ::java::awt::Graphics *);
  virtual ::java::awt::geom::Rectangle2D * getStringBounds(::java::text::CharacterIterator *, jint, jint, ::java::awt::Graphics *);
private:
  ::java::awt::font::FontRenderContext * getFontRenderContext(::java::awt::Graphics *);
public:
  virtual jboolean hasUniformLineMetrics();
private:
  static const jlong serialVersionUID = 1681126225205050147LL;
public: // actually protected
  ::java::awt::Font * __attribute__((aligned(__alignof__( ::java::lang::Object)))) font;
private:
  static ::java::awt::font::FontRenderContext * gRC;
public:
  static ::java::lang::Class class$;
};

#endif // __java_awt_FontMetrics__


text:
![Imgur](https://i.imgur.com/8J9RMdt.png)

Storage Gateway
=====

What did we learn?

* `File Gateway` - For flat files, stored directly on S3
* `Volume Gateway` - For Block Storage
  * `Stored Volumes` - Entire Dataset is stored on site and is asynchronously backed up to S3
  * `Cached Volumes` - Entire Dataset is stored on S3 and the most frequently accessed data
    is cached on site
  * `Gateway Virtual Tape Library (VTL)` - Used for backup and supports popular backup applications
    like NetBackup, Backup Exec, Veeam etc.

##

**[Previous Lab/Lecture](storage-gateway.md) | [AWS (Root)](../readme.adoc) | [Next Lab/Lecture](../snowball/snowball-101.md)**


text:
- Highlight theme
- Articles whit `sidebar.toc` support section navigator (previous and next navigator)
- Aside Toc show immediately after page get ready (no more delay)

### Bug Fixes

- Aside Toc may display error when scroll to bottom

## 2.0.1 (2018-07-07)

> "All elements that respond to press should have a visual feedback when touched."
>
> —TouchableWithoutFeedback in *React Native Docs*

### Enhancements

- Some interaction details optimize: button and link add feedback when clicked, cancel button of input in archive layout, button focus style, etc

### Bug Fixes

- `mathjax` and `mermaid` config may not work

## 2.0.0 (2018-07-01)

Breaking changes, please check [Update form 1.x to 2.x](https://tianqi.name/jekyll-TeXt-theme/docs/en/update-form-1-to-2) for details

### Enhancements

- Authors
- License
- New layouts (page, article, landing, etc)

## 1.5.0 (2018-03-18)

### Enhancements

- `text_color_theme` config
- Long pagination
- Additional styles (Alert, Image)
- Mathjax autoNumber config (@liao961120)
- Article heading anchor
- Previous and next post
- Search

## 1.4.3 (2018-01-13)

### Enhancements

- New TOC style
- Gitalk support (@WangQiru)
- Mermaid support
- `site.paths` & `site.nav_lists` support absolute URL

## 1.4.2 (2017-12-10)

### Enhancements

- Use new liquid syntax `{%-` `-%}` to avoid unnecessary output whitespace
- Add paths.base config

## 1.4.1 (2017-12-05)

### Enhancements

- New color themes(Chocolate, Orange)

### Bug Fixes

- Issues 9: the _posts file can't recorded by git

## 1.4.0 (2017-11-19)

### Enhancements

- Multi-language support

### Bug Fixes

- Table overflow-x smooth on iOS

## 1.3.0 (2017-11-11)

### Enhancements

- Article tag supports special characters
- Excerpts type (HTML | TEXT)
- Titles on the phone become smaller
- Styles change (table, code, blockquote)

## 1.2.2 (2017-11-04)

### Enhancements

- MathJax Support
- Add "Read more" link at the end of article excerpt.
- 404 page

### Bug Fixes

- Fix Email link URL error
- Fix Site Title link URL error
- Fix table responsive style error

## 1.2.1 (2017-10-27)

### Enhancements

- Optimize Article TOC

### Bug Fixes

- Issues 4: View count display error when the post key include `-` (@yuxianda)
- Email url error

## 1.2.0 (2017-10-22)

### Enhancements

- Article excerpt no more than 200 words
- If `leancloud` is not set, 0 view won't display

### Bug Fixes

- Fix article TOC 's display error at proper situation
- Fix footer social buttons not in the center bug

## 1.1.0 (2017-10-19)

### Enhancements

- Color variables
- More color themes (dark, forest, ocean)

## 1.0.0 (2017-10-17)

### Enhancements

- Better article directories
- Dark color theme


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RandomForest.Lib.Numerical.Interfaces
{
    public class ForestGrowParameters
    {
        private SplitMode _splitMode = SplitMode.RSS;

        /// <summary>
        /// Path to Microsoft Excel file (*.xlsx) contained data to learn and build trees
        /// </summary>
        public string TrainingDataPath { get; set; }

        /// <summary>
        /// Number of trees to grow
        /// </summary>
        public int TreeCount { get; set; }

        /// <summary>
        /// Name of the feature to make classification by
        /// </summary>
        public string ResolutionFeatureName { get; set; }

        /// <summary>
        /// Max number of items in a category while classifying
        /// </summary>
        public int MaxItemCountInCategory { get; set; }

        /// <summary>
        /// Ratio to define number of items from learn data subset for each tree
        /// </summary>
        public float ItemSubsetCountRatio { get; set; }

        /// <summary>
        /// Export trees to directory in Json format
        /// </summary>
        public bool ExportToJson { get; set; }

        /// <summary>
        /// Path to directory for Json files
        /// </summary>
        public string ExportDirectoryPath { get; set; }

        public SplitMode SplitMode
        {
            get { return _splitMode; }
            set { _splitMode = value; }
        }
    }
}


text:
Before creating the airline theme you need at least one color palette in
`estilos/palettes` folder. Then proceed to add the blank airline template from
the command line:

```sh
estilo add-airline
```

This command will create a style file in `estilos/airline` directory of your
project. Open it, it will look like this:

```yml
normal1: ''
normal2: ''
normal3: ''
inactive1: ''
inactive2: ''
inactive3: ''
insert1: ''
insert2: ''
insert3: ''
replace1: ''
replace2: ''
replace3: ''
visual1: ''
visual2: ''
visual3: ''
```

Every property in the template is composed by a name and a number, they
represents how a part of the status line will look in a particular vim mode.
That means the first line defines the style of the part 1 of the bar in normal
mode, and so on.

Part 1 represents the first and the last block of the status bar, part 2 the
second and fourth, and the part 3 is for the center block (the third one).

![airline blocks](https://cloud.githubusercontent.com/assets/829859/16402004/55f3682c-3ce9-11e6-8bd9-eaafbaaccb2e.png)

Go to the first definition and fill its value inside the quotes (`''`), write
the foreground and the background color names separated by a space (these ones
should be in your color template). It should look something like this:

```yml
normal1: 'myblue mydark'
```

## Add theme to `estilo.yml`

Open `estilo.yml` file and add an object for each theme with its parameters
inside `airline` list. Every one has 3 parameters:

- name: the name of the airline theme (should have not spaces)
- palette: the name of the color palette. It's the same as the file inside
  `palettes` folder without the `.yml` extension
- style: It's the same as the file inside `airline` folder without the `.yml`
  extension

Example:

```yml
airline:
  - name: 'awesome-night'
    palette: 'awesome'
    style: 'night'
  - name: 'awesome-day'
    palette: 'awesome'
    style: 'day'
```

## Render

With the command line in the project folder:

```sh
estilo render
```

Rendered files are in `plugins` folder of your project

## Activating the theme

Open your vim config file and add the next lines:

```vim
let g:PKG_NAME_airline = 1
let g:airline_theme = 'MY_THEME_NAME'
```

Replace `PKG_NAME` with the name of your project (the name from `estilo.yml`),
and `MY_THEME_NAME` with the name of the Airline theme you want to activate.

Remember to add instructions to the `README` of your project before you publish
it.


text:
require 'httpclient/auth'

require 'winrm/helpers/assert_patch'

def validate_patch
  # The code below patches the httpclient library to add support
  # for encrypt/decrypt as described below.
  # Add few restriction to make sure the patched methods are still
  # available, but still give a way to consciously use later versions
  PatchAssertions.assert_major_version("httpclient", [2.6,2.7], "USE_HTTPCLIENT_MAJOR")
  PatchAssertions.assert_arity_of_patched_method(HTTPClient::WWWAuth, "filter_request", 1)
  PatchAssertions.assert_arity_of_patched_method(HTTPClient::WWWAuth, "filter_response", 2)
  PatchAssertions.assert_arity_of_patched_method(HTTPClient::SSPINegotiateAuth, "set", -1)
  PatchAssertions.assert_arity_of_patched_method(HTTPClient::SSPINegotiateAuth, "get", 1)
end

# Perform the patch validations
validate_patch

# Overrides the HTTPClient::WWWAuth code to add support for encryption/decryption
# of data sent during the NTLM auth over negotiate.

# Also Overrides HTTPClient::SSPINegotiateAuth to remember user credentials, original
# library code relies on the current login user credentials on the client machine.

# Below code helps ruby client to perform auth using the credentials provided to
# ruby client, and also enhances to use encrypted channel.

class HTTPClient

  class WWWAuth

    # Filter API implementation.  Traps HTTP request and insert
    # 'Authorization' header if needed.
    def filter_request(req)
      @authenticator.each do |auth|
        next unless auth.set? # hasn't be set, don't use it
        if cred = auth.get(req)
          auth.encrypt_payload(req) if auth.respond_to?(:encrypt_payload)
          req.header.set('Authorization', auth.scheme + " " + cred)
          return
        end
      end
    end

    # Filter API implementation.  Traps HTTP response and parses
    # 'WWW-Authenticate' header.
    #
    # This remembers the challenges for all authentication methods
    # available to the client. On the subsequent retry of the request,
    # filter_request will select the strongest method.
    def filter_response(req, res)
      command = nil
      if res.status == HTTP::Status::UNAUTHORIZED
        if challenge = parse_authentication_header(res, 'www-authenticate')
          uri = req.header.request_uri
          challenge.each do |scheme, param_str|
            @authenticator.each do |auth|
              next unless auth.set? # hasn't be set, don't use it
              if scheme.downcase == auth.scheme.downcase
                challengeable = auth.challenge(uri, param_str)
                command = :retry if challengeable
              end
            end
          end
          # ignore unknown authentication scheme
        end
      else
        decrypted_content = res.content
        @authenticator.each do |auth|
          next unless auth.set? # hasn't be set, don't use it
          decrypted_content = auth.decrypt_payload(res.content) if auth.respond_to?(:encrypted_channel?) && auth.encrypted_channel? && encrypted_content?(res.content)
        end
        # update with decrypted content
        res.content.replace(decrypted_content) if res.content and !res.content.empty?
      end
      command
    end

    private
    def encrypted_content? content
      content.start_with?('--Encrypted ')
    end
  end

  class SSPINegotiateAuth

    begin
      require 'win32/sspi'
      SSPIEnabled = true
    rescue LoadError
      SSPIEnabled = false
    end

    begin
      require 'gssapi'
      GSSAPIEnabled = true
    rescue LoadError
      GSSAPIEnabled = false
    end

    # Override to remember creds
    # Set authentication credential.
    def set(uri, user, passwd)
      # Check if user has domain specified in it.
      if user
        creds = user.split("\\")
        creds.length.eql?(2) ? (@domain,@user = creds) : @user = creds[0]
      end
      @passwd = passwd
    end

    def set?
      SSPIEnabled || GSSAPIEnabled
    end

    # Response handler: returns credential.
    # See win32/sspi for negotiation state transition.
    def get(req)
      return nil unless SSPIEnabled || GSSAPIEnabled
      target_uri = req.header.request_uri
      domain_uri, param = @challenge.find { |uri, v|
        Util.uri_part_of(target_uri, uri)
      }

      return nil unless param

      state = param[:state]
      authenticator = param[:authenticator]
      authphrase = param[:authphrase]
      case state
      when :init
        if SSPIEnabled
          # Over-ride ruby win32 sspi to support encrypt/decrypt
          require 'winrm/win32/sspi'
          authenticator = param[:authenticator] = Win32::SSPI::NegotiateAuth.new(@user, @domain, @passwd)
          @authenticator = authenticator #  **** Hacky remember as we need this for encrypt/decrypt
          return authenticator.get_initial_token
        else # use GSSAPI
          authenticator = param[:authenticator] = GSSAPI::Simple.new(domain_uri.host, 'HTTP')
          # Base64 encode the context token
          return [authenticator.init_context].pack('m').gsub(/\n/,'')
        end
      when :response
        @challenge.delete(domain_uri)
        if SSPIEnabled
          return authenticator.complete_authentication(authphrase)
        else # use GSSAPI
          return authenticator.init_context(authphrase.unpack('m').pop)
        end
      end
      nil
    end

    def encrypted_channel?
      @encrypted_channel
    end

    def encrypt_payload(req)
      if SSPIEnabled
        body = @authenticator.encrypt_payload(req.body)
        req.http_body = HTTP::Message::Body.new
        req.http_body.init_request(body)
        req.http_header.body_size = body.length if body
        # if body is encrypted update the header
        if body.include? "HTTP-SPNEGO-session-encrypted"
          @encrypted_channel = true
          req.header.set('Content-Type', "multipart/encrypted;protocol=\"application/HTTP-SPNEGO-session-encrypted\";boundary=\"Encrypted Boundary\"")
        end
      end
    end

    def decrypt_payload(body)
      body = @authenticator.decrypt_payload(body) if SSPIEnabled
      body
    end
  end
end


text:
require 'fileutils'

# This is a set of tools for extracting data from simple text files, where the data appears in regular formats, for example columns.
# For more information see the individual submodules.
module TextDataTools

class DataFileBase

		def exists?
			FileTest.exists?(@filename)
		end
		def to_s
			@filename
		end
		def view
			system ENV['EDITOR'], @filename
		end

end

# Tools for extracting data from text files where the data appears in columns
# with or without headers for each column.
module Column
	#  Return a one-dimensional array containing data from the file filename,
	#  which may or may not have a line of column headers,
	#  in the column column_header, where column_header maybe either a string
	#  or a regex which matches the title of the column,  or an integer
	#  giving the zero-based  column number.
	#
	#  Match is a regexp that matches data items, and header_match is a regexp that
	#  matches items in the headers.
	#
	#  All data is returned as strings
	def self.get_1d_array(filename, has_header_line, column_header, match=/\S+/, header_match=/\S+/, skip_blank=true)
		raise ArgumentError.new("column_header header should be a string, regex or integer") unless [String, Regexp, Integer].find{|cls| column_header.kind_of? cls}
		array = []
		File.open(filename) do |file|
			headers = file.gets if has_header_line
			if [String, Regexp].find{|cls| column_header.kind_of? cls}
				raise ("Header search given but has_header_line = false") if not has_header_line
				column_header = column_index_from_headers(headers, column_header, header_match)
			end
			while line = file.gets
        next if line == "\n" and skip_blank
				values = line.scan(match)
			 	array.push values[column_header]
				#puts line
			end
		end
		array
	end

	#
	# Calls get_1d_array and converts all data elements to floats
	def self.get_1d_array_float(*args)
		get_1d_array(*args).map{|v| v.to_f}
	end
	def self.get_1d_array_integer(*args)
		get_1d_array(*args).map{|v| v.to_i}
	end

	#  Return a two-dimensional array containing data from the file filename,
	#  which may or may not have a line of column headers,
	#  in the column column_header, where column_header maybe either a string
	#  or a regex which matches the title of the column,  or an integer
	#  giving the zero-based  column number.
	#
	#  It is assumed that two-dimensional array is in one column.
	#  If index_header is nil, data is assumed to be separated by blank lines.
	#  E.g.
	#  		1.2
	#  		4.2
	#  		7.2
	#
	#  		8.2
	#  		4.2
	#  		2.2
	#  If index_header is an integer or string or regexp, it selects a column
	#  in the manner of column_header, and the data is divided by values of this
	#  column.
	#  E.g.
	#  		1  5.5
	#  		1  3.2
	#  		1  2.6
	#  		2  3.2
	#			2  2.2
	#			2  6.3
	#
	#  Match is a regexp that matches data items, and header_match is a regexp that
	#  matches items in the headers.
	#
	#  All data is returned as strings
	def self.get_2d_array(filename, has_header_line, column_header, index_header=nil, match=/\S+/, header_match=/\S+/)
		raise ArgumentError.new("column_header header should be a string, regex or integer") unless [String, Regexp, Integer].find{|cls| column_header.kind_of? cls}
		raise ArgumentError.new("index_header should be a string, regex, integer or nil") unless [String, Regexp, Integer, NilClass].find{|cls| column_header.kind_of? cls}
		array = []
		File.open(filename) do |file|
			headers = file.gets if has_header_line
			if [String, Regexp].find{|cls| column_header.kind_of? cls}
				raise ("Header search given but has_header_line = false") if not has_header_line
				column_header = column_index_from_headers(headers, column_header, header_match)
			end
			if [String, Regexp].find{|cls| index_header.kind_of? cls}
				raise ("Header search given but has_header_line = false") if not has_header_line
				index_header = column_index_from_headers(headers, index_header, header_match)
			end
			index_value = false
			index = 0
			while line = file.gets
				if index_header.nil?
					if line =~ /^\s*$/
						if array.size == 0 # ignore empty lines at top
							next
						else
							(array.push []; index+=1;next)
						end
					end
					array.push [] if array.size = 0
				else
					next if line =~ /^\s*$/
				end
				values = line.scan(match)
				if not index_header.nil?
					if array.size ==0
						array.push []
						index_value = values[index_header]
					elsif index_value != values[index_header]
						array.push []
						index+=1
						index_value = values[index_header]
					end
				end
			 	array[index].push values[column_header]
				#puts line
			end
		end
		array
	end

	# Calls get_2d_array and converts all data elements to floats
	def self.get_2d_array_float(*args)
		get_2d_array(*args).map{|a| a.map{|v| v.to_f}}
	end
	def self.get_2d_array_integer(*args)
		get_2d_array(*args).map{|a| a.map{|v| v.to_i}}
	end

	class NotFoundError < StandardError
	end

	def self.column_index_from_headers(line, column_header, header_match)
		headers = line.scan(header_match)
		#p headers
		index_array = headers.map{|head| head =~ (column_header.kind_of?(Regexp) ? column_header : Regexp.new(Regexp.escape(column_header)))}
		#p index_array
		raise ArgumentError.new("column_header: #{column_header.inspect} does not match any columns in #{headers.inspect}") if index_array.compact.size == 0
		raise ArgumentError.new("column_header: #{column_header.inspect} matches more than 1 column in #{headers.inspect}") if index_array.compact.size > 1
		column_header = index_array.index(index_array.compact[0])
	end

	# This is a simple class which can interface with the methods of TextDataTools::Column
	# to prevent the user having to specify the file name and other properties of the
	# data file for every call. In a
	# nutshell, create a new instance of this class giving it the filename, and any
	# appropriate options,
	# then call methods from TextDataTools omitting the appropriate arguments.
	class DataFile < DataFileBase
		def inspect
			"#{self.class}.new(#{@filename.inspect}, #{@has_header_line.inspect}, #{@match.inspect}, #{@header_match.inspect})"
		end
		def initialize(filename, has_header_line = false, match = /\S+/, header_match = /\S+/)
			@filename = filename
			@match = match
			@header_match = header_match
			@has_header_line = has_header_line
			self
		end
		def get_1d_array(column_header)
			TextDataTools::Column.get_1d_array(@filename, @has_header_line, column_header, @match, @header_match)
		end
		def get_1d_array_float(column_header)
			TextDataTools::Column.get_1d_array_float(@filename, @has_header_line, column_header, @match, @header_match)
		end
		def get_1d_array_integer(column_header)
			TextDataTools::Column.get_1d_array_integer(@filename, @has_header_line, column_header, @match, @header_match)
		end
		def get_2d_array(column_header, index_header)
			TextDataTools::Column.get_2d_array(@filename, @has_header_line, column_header, index_header, @match, @header_match)
		end
		def get_2d_array_float(column_header, index_header)
			TextDataTools::Column.get_2d_array_float(@filename, @has_header_line, column_header, index_header, @match, @header_match)
		end
		def get_2d_array_integer(column_header, index_header)
			TextDataTools::Column.get_2d_array_integer(@filename, @has_header_line, column_header, index_header, @match, @header_match)
		end
		def exists?
			FileTest.exists?(@filename)
		end
		#def method_missing(meth, *args)
			#if TextDataTools.methods.include? meth
				#TextDataTools.send(meth, @filename, *args)
			#else
				#super
			#end
		#end
	end
end

#  Tools for dealing with files where named variables are assigned in the form
#    name sep base
#  E.g.
#    height = 4.0
module Named
	# Extract a variable value from the given file where the variable is defined
	# in this form:
	#   name sep value
	# E.g.
	# 	heat = 4.0
	#
	# Both name and sep can be either regexps or strings
	def self.get_variable_value(filename, name, sep='=')
		value = nil
		File.open(filename) do |file|
			while line= file.gets
				next unless line =~ Regexp.new("#{name.kind_of?(Regexp) ? name : Regexp.escape(name) }\\s*#{sep.kind_of?(Regexp) ? sep : Regexp.escape(sep) }\\s*(?<value>.*)")
				value = $~[:value]

			end
		end
		raise NotFoundError.new("Can't find #{name} in #{filename}") unless value
		value
	end
	# This is a simple class which can interface with the methods of TextDataTools::Named
	# to prevent the user having to specify the file name and other properties of the
	# data file for every call. In a
	# nutshell, create a new instance of this class giving it the filename, and any
	# appropriate options,
	# then call methods from TextDataTools omitting the appropriate arguments.
	class DataFile < DataFileBase
		def initialize(filename, sep = ':')
			@filename = filename
			@sep = sep
			self
		end
		def inspect
			"#{self.class}.new(#{@filename.inspect}, #{@sep.inspect})"
		end
		def get_variable_value(name)
			TextDataTools::Named.get_variable_value(@filename, name, @sep)
		end
	end
end
end # module TextDataTools


text:
#region "Copyright"

/*
FOR FURTHER DETAILS ABOUT LICENSING, PLEASE VISIT "LICENSE.txt" INSIDE THE SAGEFRAME FOLDER
*/

#endregion

#region "References"

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

#endregion

namespace SageFrame.GoogleAdsense
{
    /// <summary>
    /// Business logic for google adsense controller.
    /// </summary>
    public class GoogleAdsenseController
    {
        /// <summary>
        /// Counts  adsense settings for given.
        /// </summary>
        /// <param name="UserModuleID">userModuleID</param>
        /// <param name="PortalID">portalID</param>
        /// <returns>Count of adsense settings</returns>
        public int CountAdsenseSettings(int UserModuleID, int PortalID)
        {
            try
            {
                GoogleAdsenseProvider objProvider = new GoogleAdsenseProvider();
                return objProvider.CountAdsenseSettings(UserModuleID, PortalID);
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }

        /// <summary>
        /// Returns list of google adsense settings by usermoduleID.
        /// </summary>
        /// <param name="UserModuleID">userModuleID</param>
        /// <param name="PortalID">portalID</param>
        /// <returns>Returns list of google adsense settings</returns>
        public List<GoogleAdsenseInfo> GetAdSenseSettingsByUserModuleID(int UserModuleID, int PortalID)
        {
            try
            {
                GoogleAdsenseProvider objProvider = new GoogleAdsenseProvider();
                return objProvider.GetAdSenseSettingsByUserModuleID(UserModuleID, PortalID);
            }
            catch (Exception)
            {

                throw;
            }
        }

        /// <summary>
        /// Updates the google adsense.
        /// </summary>
        /// <param name="UserModuleID">userModuleID</param>
        /// <param name="SettingName">Setting name</param>
        /// <param name="SettingValue">Setting value</param>
        /// <param name="IsActive">Set true if adsense is active</param>
        /// <param name="PortalID">portalID</param>
        /// <param name="UpdatedBy">User's name updatating the data</param>
        /// <param name="UpdateFlag">Update Flag</param>
        public void AddUpdateAdSense(int UserModuleID, string SettingName, string SettingValue, bool IsActive, int PortalID, string UpdatedBy, bool UpdateFlag)
        {
            try
            {
                GoogleAdsenseProvider objProvider = new GoogleAdsenseProvider();
                objProvider.AddUpdateAdSense(UserModuleID, SettingName, SettingValue, IsActive, PortalID, UpdatedBy, UpdateFlag);
            }
            catch (Exception)
            {

                throw;
            }
        }

        /// <summary>
        /// Deletes google adsense.
        /// </summary>
        /// <param name="UserModuleID">userModuleID</param>
        /// <param name="PortalID">portalID</param>
        public void DeleteAdSense(int UserModuleID, int PortalID)
        {
            try
            {
                GoogleAdsenseProvider objProvider = new GoogleAdsenseProvider();
                objProvider.DeleteAdSense(UserModuleID, PortalID);
            }
            catch (Exception)
            {

                throw;
            }
        }

        /// <summary>
        /// Counts google adsense.
        /// </summary>
        /// <param name="UserModuleID">userModuleID</param>
        /// <param name="PortalID">portalID</param>
        /// <returns>Returns google adsense count</returns>
        public int CountAdSense(int UserModuleID, int PortalID)
        {
            try
            {
                GoogleAdsenseProvider objProvider = new GoogleAdsenseProvider();
                return objProvider.CountAdSense(UserModuleID, PortalID);
            }
            catch (Exception)
            {

                throw;
            }
        }
    }
}


text:
package org.hswebframework.web.commons.entity.param;

import org.hswebframework.ezorm.core.param.Param;
import org.hswebframework.web.commons.entity.Entity;

/**
 * 查询参数实体,使用easyorm进行动态查询参数构建

 * 可通过静态方法创建:

 * {@link DeleteParamEntity#build()}

 *
 * @author zhouhao
 * @see Param
 * @see Entity
 * @since 3.0
 */
public class DeleteParamEntity extends Param implements Entity {
    /**
     * 创建一个无条件的删除条件实体
     * 创建后需自行指定条件({@link DeleteParamEntity#where(String, Object)})
     * 否则可能无法执行更新(dao实现应该禁止无条件的删除)
     *
     * @return DeleteParamEntity
     */
    public static DeleteParamEntity build() {
        return new DeleteParamEntity();
    }
}


text:
import mongoose from 'mongoose';
import request from 'supertest-as-promised';
import httpStatus from 'http-status';
import chai, { expect } from 'chai';
import app from '../index';

chai.config.includeStack = true;
/**
 * root level hooks
 */

after((done) => {
    // required because https://github.com/Automattic/mongoose/issues/1251#issuecomment-65793092
    mongoose.models = {};
    mongoose.modelSchemas = {};
    mongoose.connection.close();
    done();
});

  describe('## CurriculumCategory APIs', () => {
    let curriculumCategory = {
      name: 'test',
    };

    describe('# POST /api/curriculumCategorys', () => {
      it('should create a new curriculumCategory', (done) => {
        request(app)
          .post('/api/curriculumCategorys')
          .send(curriculumCategory)
          .expect(httpStatus.OK)
          .then((res) => {
            expect(res.body.name).to.equal(curriculumCategory.name);
            curriculumCategory = res.body;
            done();
          })
          .catch(done);
      });
    });

    describe('# GET /api/curriculumCategorys', () => {
        it('should retrieve the curriculumCategory', (done) => {
          request(app)
            .get('/api/curriculumCategorys/' + curriculumCategory._id)
            .expect(httpStatus.OK)
            .then((res) => {
              expect(res.body.name).to.equal(curriculumCategory.name);
              done();
            })
            .catch(done);
        });
        it('should return not found', (done) => {
            request(app)
              .get('/api/curriculumCategorys/56c787ccc67fc16ccc1a5e92')
              .expect(httpStatus.NOT_FOUND)
              .then((res) => {
                expect(res.body.message).to.equal('Not Found');
                done();
              })
              .catch(done);
        });
    });

    describe('# PUT /api/curriculumCategorys/:userId', () => {
        it('should update user details', (done) => {
          curriculumCategory.name = 'bama';
          request(app)
            .put(`/api/curriculumCategorys/${curriculumCategory._id}`)
            .send(curriculumCategory)
            .expect(httpStatus.OK)
            .then((res) => {
              expect(res.body.name).to.equal('bama');
              done();
            })
            .catch(done);
        });
      });

      describe('# Get /api/curriculumCategorys/', () => {
        it('should search curriculumCategorys and return array', (done) => {
          request(app)
            .get(`/api/curriculumCategorys?name=${curriculumCategory.name}`)
            .expect(httpStatus.OK)
            .then((res) => {
                expect(res.body).to.be.an('array');
                done();
            })
            .catch(done);
        });
      });

      describe('# DELETE /api/curriculumCategorys', () => {
        it('should delete the curriculumCategory', (done) => {
          request(app)
            .delete(`/api/curriculumCategorys/${curriculumCategory._id}`)
            .expect(httpStatus.OK)
            .then((res) => {
              expect(res.body.name).to.equal(curriculumCategory.name);
              done();
            })
            .catch(done);
        });
      });

});


text:
module Azure::StorSimple8000Series::Mgmt::V2017_06_01
  module Models
    #
    # Defines values for RecurrenceType
    #
    module RecurrenceType
      Minutes = "Minutes"
      Hourly = "Hourly"
      Daily = "Daily"
      Weekly = "Weekly"
    end
  end
end


text:
package org.schema.api.model.thing.place.residence;

import org.schema.api.model.thing.place.Place;
import org.schema.api.model.thing.intangible.structuredValue.PropertyValue;
import org.schema.api.model.thing.intangible.rating.AggregateRating;
import org.schema.api.model.thing.place.Place;
import org.schema.api.model.thing.place.Place;
import org.schema.api.model.thing.event.Event;
import org.schema.api.model.thing.intangible.structuredValue.GeoCoordinates;
import org.schema.api.model.thing.intangible.structuredValue.OpeningHoursSpecification;
import org.schema.api.model.thing.creativeWork.mediaObject.imageObject.ImageObject;
import org.schema.api.model.thing.creativeWork.Review;
import org.schema.api.model.thing.intangible.structuredValue.OpeningHoursSpecification;

public class Residence extends Place
{
	private PropertyValue additionalProperty;
	private String address;//Notes - Allowed types- [PostalAddress, Text]
	private AggregateRating aggregateRating;
	private LocationFeatureSpecification amenityFeature;
	private String branchCode;
	private Place containedInPlace;//Notes - Allowed types- [Place, containsPlace]
	private Place containsPlace;//Notes - Allowed types- [Place, containedInPlace]
	private Event event;
	private String faxNumber;
	private GeoCoordinates geo;//Notes - Allowed types- [GeoCoordinates, GeoShape]
	private GeospatialGeometry geospatiallyContains;//Notes - Allowed types- [GeospatialGeometry, Place, DE-9IM]
	private GeospatialGeometry geospatiallyCoveredBy;//Notes - Allowed types- [GeospatialGeometry, Place, DE-9IM]
	private GeospatialGeometry geospatiallyCovers;//Notes - Allowed types- [GeospatialGeometry, Place, DE-9IM]
	private GeospatialGeometry geospatiallyCrosses;//Notes - Allowed types- [GeospatialGeometry, Place, DE-9IM]
	private GeospatialGeometry geospatiallyDisjoint;//Notes - Allowed types- [GeospatialGeometry, Place, DE-9IM]
	private GeospatialGeometry geospatiallyEquals;//Notes - Allowed types- [GeospatialGeometry, Place, DE-9IM]
	private GeospatialGeometry geospatiallyIntersects;//Notes - Allowed types- [GeospatialGeometry, Place, DE-9IM]
	private GeospatialGeometry geospatiallyOverlaps;//Notes - Allowed types- [GeospatialGeometry, Place, DE-9IM]
	private GeospatialGeometry geospatiallyTouches;//Notes - Allowed types- [GeospatialGeometry, Place, DE-9IM]
	private GeospatialGeometry geospatiallyWithin;//Notes - Allowed types- [GeospatialGeometry, Place, DE-9IM]
	private String globalLocationNumber;
	private String hasMap;//Notes - Allowed types- [Map, URL]
	private Boolean isAccessibleForFree;//Notes - Allowed types- [Boolean, free]
	private String isicV4;
	private String logo;//Notes - Allowed types- [ImageObject, URL]
	private Integer maximumAttendeeCapacity;
	private OpeningHoursSpecification openingHoursSpecification;
	private ImageObject photo;//Notes - Allowed types- [ImageObject, Photograph]
	private Boolean publicAccess;
	private Review review;//Notes - Allowed types- [Review, reviews]
	private Boolean smokingAllowed;
	private OpeningHoursSpecification specialOpeningHoursSpecification;
	private String telephone;

	public PropertyValue getAdditionalProperty()
	{
		return additionalProperty;
	}

	public void setAdditionalProperty(PropertyValue additionalProperty)
	{
		this.additionalProperty = additionalProperty;
	}

	public String getAddress()
	{
		return address;
	}

	public void setAddress(String address)
	{
		this.address = address;
	}

	public AggregateRating getAggregateRating()
	{
		return aggregateRating;
	}

	public void setAggregateRating(AggregateRating aggregateRating)
	{
		this.aggregateRating = aggregateRating;
	}

	public LocationFeatureSpecification getAmenityFeature()
	{
		return amenityFeature;
	}

	public void setAmenityFeature(LocationFeatureSpecification amenityFeature)
	{
		this.amenityFeature = amenityFeature;
	}

	public String getBranchCode()
	{
		return branchCode;
	}

	public void setBranchCode(String branchCode)
	{
		this.branchCode = branchCode;
	}

	public Place getContainedInPlace()
	{
		return containedInPlace;
	}

	public void setContainedInPlace(Place containedInPlace)
	{
		this.containedInPlace = containedInPlace;
	}

	public Place getContainsPlace()
	{
		return containsPlace;
	}

	public void setContainsPlace(Place containsPlace)
	{
		this.containsPlace = containsPlace;
	}

	public Event getEvent()
	{
		return event;
	}

	public void setEvent(Event event)
	{
		this.event = event;
	}

	public String getFaxNumber()
	{
		return faxNumber;
	}

	public void setFaxNumber(String faxNumber)
	{
		this.faxNumber = faxNumber;
	}

	public GeoCoordinates getGeo()
	{
		return geo;
	}

	public void setGeo(GeoCoordinates geo)
	{
		this.geo = geo;
	}

	public GeospatialGeometry getGeospatiallyContains()
	{
		return geospatiallyContains;
	}

	public void setGeospatiallyContains(GeospatialGeometry geospatiallyContains)
	{
		this.geospatiallyContains = geospatiallyContains;
	}

	public GeospatialGeometry getGeospatiallyCoveredBy()
	{
		return geospatiallyCoveredBy;
	}

	public void setGeospatiallyCoveredBy(GeospatialGeometry geospatiallyCoveredBy)
	{
		this.geospatiallyCoveredBy = geospatiallyCoveredBy;
	}

	public GeospatialGeometry getGeospatiallyCovers()
	{
		return geospatiallyCovers;
	}

	public void setGeospatiallyCovers(GeospatialGeometry geospatiallyCovers)
	{
		this.geospatiallyCovers = geospatiallyCovers;
	}

	public GeospatialGeometry getGeospatiallyCrosses()
	{
		return geospatiallyCrosses;
	}

	public void setGeospatiallyCrosses(GeospatialGeometry geospatiallyCrosses)
	{
		this.geospatiallyCrosses = geospatiallyCrosses;
	}

	public GeospatialGeometry getGeospatiallyDisjoint()
	{
		return geospatiallyDisjoint;
	}

	public void setGeospatiallyDisjoint(GeospatialGeometry geospatiallyDisjoint)
	{
		this.geospatiallyDisjoint = geospatiallyDisjoint;
	}

	public GeospatialGeometry getGeospatiallyEquals()
	{
		return geospatiallyEquals;
	}

	public void setGeospatiallyEquals(GeospatialGeometry geospatiallyEquals)
	{
		this.geospatiallyEquals = geospatiallyEquals;
	}

	public GeospatialGeometry getGeospatiallyIntersects()
	{
		return geospatiallyIntersects;
	}

	public void setGeospatiallyIntersects(GeospatialGeometry geospatiallyIntersects)
	{
		this.geospatiallyIntersects = geospatiallyIntersects;
	}

	public GeospatialGeometry getGeospatiallyOverlaps()
	{
		return geospatiallyOverlaps;
	}

	public void setGeospatiallyOverlaps(GeospatialGeometry geospatiallyOverlaps)
	{
		this.geospatiallyOverlaps = geospatiallyOverlaps;
	}

	public GeospatialGeometry getGeospatiallyTouches()
	{
		return geospatiallyTouches;
	}

	public void setGeospatiallyTouches(GeospatialGeometry geospatiallyTouches)
	{
		this.geospatiallyTouches = geospatiallyTouches;
	}

	public GeospatialGeometry getGeospatiallyWithin()
	{
		return geospatiallyWithin;
	}

	public void setGeospatiallyWithin(GeospatialGeometry geospatiallyWithin)
	{
		this.geospatiallyWithin = geospatiallyWithin;
	}

	public String getGlobalLocationNumber()
	{
		return globalLocationNumber;
	}

	public void setGlobalLocationNumber(String globalLocationNumber)
	{
		this.globalLocationNumber = globalLocationNumber;
	}

	public String getHasMap()
	{
		return hasMap;
	}

	public void setHasMap(String hasMap)
	{
		this.hasMap = hasMap;
	}

	public Boolean getIsAccessibleForFree()
	{
		return isAccessibleForFree;
	}

	public void setIsAccessibleForFree(Boolean isAccessibleForFree)
	{
		this.isAccessibleForFree = isAccessibleForFree;
	}

	public String getIsicV4()
	{
		return isicV4;
	}

	public void setIsicV4(String isicV4)
	{
		this.isicV4 = isicV4;
	}

	public String getLogo()
	{
		return logo;
	}

	public void setLogo(String logo)
	{
		this.logo = logo;
	}

	public Integer getMaximumAttendeeCapacity()
	{
		return maximumAttendeeCapacity;
	}

	public void setMaximumAttendeeCapacity(Integer maximumAttendeeCapacity)
	{
		this.maximumAttendeeCapacity = maximumAttendeeCapacity;
	}

	public OpeningHoursSpecification getOpeningHoursSpecification()
	{
		return openingHoursSpecification;
	}

	public void setOpeningHoursSpecification(OpeningHoursSpecification openingHoursSpecification)
	{
		this.openingHoursSpecification = openingHoursSpecification;
	}

	public ImageObject getPhoto()
	{
		return photo;
	}

	public void setPhoto(ImageObject photo)
	{
		this.photo = photo;
	}

	public Boolean getPublicAccess()
	{
		return publicAccess;
	}

	public void setPublicAccess(Boolean publicAccess)
	{
		this.publicAccess = publicAccess;
	}

	public Review getReview()
	{
		return review;
	}

	public void setReview(Review review)
	{
		this.review = review;
	}

	public Boolean getSmokingAllowed()
	{
		return smokingAllowed;
	}

	public void setSmokingAllowed(Boolean smokingAllowed)
	{
		this.smokingAllowed = smokingAllowed;
	}

	public OpeningHoursSpecification getSpecialOpeningHoursSpecification()
	{
		return specialOpeningHoursSpecification;
	}

	public void setSpecialOpeningHoursSpecification(OpeningHoursSpecification specialOpeningHoursSpecification)
	{
		this.specialOpeningHoursSpecification = specialOpeningHoursSpecification;
	}

	public String getTelephone()
	{
		return telephone;
	}

	public void setTelephone(String telephone)
	{
		this.telephone = telephone;
	}
}


text:
import _plotly_utils.basevalidators

class BoxgroupgapValidator(_plotly_utils.basevalidators.NumberValidator):
    def __init__(self, plotly_name="boxgroupgap", parent_name="layout", **kwargs):
        super(BoxgroupgapValidator, self).__init__(
            plotly_name=plotly_name,
            parent_name=parent_name,
            edit_type=kwargs.pop("edit_type", "calc"),
            max=kwargs.pop("max", 1),
            min=kwargs.pop("min", 0),
            **kwargs,
        )


text:
from app.db import Base, User, Address
from settings import SQLALCHEMY_ENGINE, SQLALCHEMY_SESSION

if __name__ == '__main__':
    Base.metadata.create_all(SQLALCHEMY_ENGINE)
    session = SQLALCHEMY_SESSION()

    session.add_all([
        User(name='ed', fullname='Ed Jones', password='edspassword'),
        User(name='wendy', fullname='Wendy Williams', password='foobar'),
        User(name='mary', fullname='Mary Contrary', password='xxg527'),
        User(name='fred', fullname='Fred Flinstone', password='blah')
    ])

    jack = User(name='jack', fullname='Jack Bean', password='gjffdd')
    jack.addresses = [
        Address(email_address='jack@google.com'),
        Address(email_address='j25@yahoo.com')
    ]
    session.add(jack)
    session.commit()


text:
namespace MyEpiserverSite.Business.Rendering
{
    /// <summary>
    /// Marker interface for content types which should not be handled by DefaultPageController.
    /// </summary>
    interface IContainerPage
    {
    }
}


text:
package com.rxbytes.splitpal.ui.commons

import android.view.View
import android.widget.{RelativeLayout, ImageView}
import com.fortysevendeg.macroid.extras.DeviceVersion._
import com.fortysevendeg.macroid.extras.ViewTweaks._
import com.rxbytes.splitpal.ui.components.CircularTransformation
import com.squareup.picasso.Picasso
import macroid.{ContextWrapper, ActivityContextWrapper, Tweak}
import scala.language.postfixOps

object AsyncImageTweaks {
  type W = ImageView

  def roundedImage(url: String,
        placeHolder: Int,
        size: Int)(implicit context: ActivityContextWrapper) = CurrentVersion match {
    case sdk if sdk >= Lollipop =>
      srcImage(url, placeHolder) + vCircleOutlineProvider(0)
    case _ =>
      roundedImageTweak(url, placeHolder, size)
  }

  private def roundedImageTweak(
      url: String,
      placeHolder: Int,
      size: Int
      )(implicit context: ActivityContextWrapper): Tweak[W] = Tweak[W](
    imageView => {
      Picasso.`with`(context.getOriginal)
          .load(url)
          .transform(new CircularTransformation(size))
          .placeholder(placeHolder)
          .into(imageView)
    }
  )

  def srcImage(
      url: String,
      placeHolder: Int
      )(implicit context: ActivityContextWrapper): Tweak[W] = Tweak[W](
    imageView => {
      Picasso.`with`(context.getOriginal)
          .load(url)
          .placeholder(placeHolder)
          .into(imageView)
    }
  )

  def srcImage(url: String)(implicit context: ActivityContextWrapper): Tweak[W] = Tweak[W](
    imageView => {
      Picasso.`with`(context.getOriginal)
          .load(url)
          .into(imageView)
    }
  )

}

object RelativeLayoutTweaks {

  type W = RelativeLayout

  def rlAlignParentLeft(implicit contextWrapper: ContextWrapper): Tweak[View] = Tweak[View] {
    view =>
      val param: RelativeLayout.LayoutParams = new RelativeLayout.LayoutParams(view.getLayoutParams)
      param.addRule(RelativeLayout.ALIGN_PARENT_LEFT)
      view.setLayoutParams(param)
  }

  def rlAlignParentRight(implicit contextWrapper: ContextWrapper): Tweak[View] = Tweak[View] {
    view =>
      val param: RelativeLayout.LayoutParams = new RelativeLayout.LayoutParams(view.getLayoutParams)
      param.addRule(RelativeLayout.ALIGN_PARENT_RIGHT)
      param.addRule(RelativeLayout.CENTER_VERTICAL)
      view.setLayoutParams(param)
  }

  def rlAlignParent(verb: Int)(implicit contextWrapper: ContextWrapper): Tweak[View] = Tweak[View] {
    view =>
      val param: RelativeLayout.LayoutParams = new RelativeLayout.LayoutParams(view.getLayoutParams)
      param.addRule(verb)
      view.setLayoutParams(param)
  }

  def rlGravity(gravity: Int): Tweak[W] = Tweak[W](_.setGravity(gravity))

  def rlLayoutMargin(
                      marginLeft: Int = 0,
                      marginTop: Int = 0,
                      marginRight: Int = 0,
                      marginBottom: Int = 0): Tweak[View] = Tweak[View] {
    view ⇒
      val params = new RelativeLayout.LayoutParams(view.getLayoutParams)
      params.setMargins(marginLeft, marginTop, marginRight, marginBottom)
      view.setLayoutParams(params)
  }

}


text:
package com.lmntrx.surwaze_sdk.model;

/***
 * Created by livin on 16/2/17.
 */

public class Option {

    private String option;
    private String optionSL;

    public String getOptionSL() {
        return optionSL;
    }

    public String getOption() {
        return option;
    }

    public Option(String optionSL, String option){
        this.option = option;
        this.optionSL = optionSL;
    }
}


text:
package com.better.alarm.model;

import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;

import com.better.alarm.model.interfaces.AlarmNotFoundException;
import com.better.alarm.model.interfaces.PresentationToModelIntents;
import com.github.androidutils.logger.Logger;
import com.github.androidutils.wakelock.WakeLockManager;

public class AlarmsService extends Service implements Handler.Callback {
    /**
     * TODO SM should report when it is done
     */
    private static final int WAKELOCK_HOLD_TIME = 5000;
    private static final int EVENT_RELEASE_WAKELOCK = 1;
    Alarms alarms;
    private Logger log;
    private Handler handler;

    /**
     * Dispatches intents to the KlaxonService
     */
    public static class Receiver extends BroadcastReceiver {
        @Override
        public void onReceive(final Context context, final Intent intent) {
            intent.setClass(context, AlarmsService.class);
            WakeLockManager.getWakeLockManager().acquirePartialWakeLock(intent, "AlarmsService");
            context.startService(intent);
        }
    }

    @Override
    public void onCreate() {
        alarms = AlarmsManager.getInstance();
        log = Logger.getDefaultLogger();
        handler = new Handler(this);
        super.onCreate();
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        try {
            String action = intent.getAction();
            if (action.equals(AlarmsScheduler.ACTION_FIRED)) {
                int id = intent.getIntExtra(AlarmsScheduler.EXTRA_ID, -1);

                AlarmCore alarm = alarms.getAlarm(id);
                alarms.onAlarmFired(alarm,
                        CalendarType.valueOf(intent.getExtras().getString(AlarmsScheduler.EXTRA_TYPE)));
                log.d("AlarmCore fired " + id);

            } else if (action.equals(Intent.ACTION_BOOT_COMPLETED) || action.equals(Intent.ACTION_TIMEZONE_CHANGED)
                    || action.equals(Intent.ACTION_LOCALE_CHANGED)) {
                log.d("Refreshing alarms because of " + action);
                alarms.refresh();

            } else if (action.equals(Intent.ACTION_TIME_CHANGED)) {
                alarms.onTimeSet();

            } else if (action.equals(PresentationToModelIntents.ACTION_REQUEST_SNOOZE)) {
                int id = intent.getIntExtra(AlarmsScheduler.EXTRA_ID, -1);
                alarms.getAlarm(id).snooze();

            } else if (action.equals(PresentationToModelIntents.ACTION_REQUEST_DISMISS)) {
                int id = intent.getIntExtra(AlarmsScheduler.EXTRA_ID, -1);
                alarms.getAlarm(id).dismiss();

            }
        } catch (AlarmNotFoundException e) {
            Logger.getDefaultLogger().d("Alarm not found");
        }

        Message msg = handler.obtainMessage(EVENT_RELEASE_WAKELOCK);
        msg.obj = intent;
        handler.sendMessageDelayed(msg, WAKELOCK_HOLD_TIME);

        return START_NOT_STICKY;
    }

    @Override
    public boolean handleMessage(Message msg) {
        WakeLockManager.getWakeLockManager().releasePartialWakeLock((Intent) msg.obj);
        return true;
    }

    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }
}


text:
try:
   from osgeo import ogr
   from osgeo import osr
except ImportError:
   import ogr
   import osr

import os
import re
import sys

import conf
import g

log = g.log.getLogger('br_defs_base')

from merge.import_init import Feat_Skipped

# NOTE: TA ==> Target Attribute.
#       Maps between Cyclopath tags and attributes and Shapefile fields.

class Branch_Defs_Base(object):

   # ***

   def __init__(self, mjob):
      #
      self.mjob = mjob
      #
      self.init_import_defns()
      #
      self.init_field_defns()
      #
      self.init_field_domains()
      #
      self.init_metadata()

   # ***

   #
   def init_field_defns(self):

      self.attrs_temporary = list()

      self.attrs_metadata = []

      # Sometimes we need just a subset of the list, which is the collection of
      # field definitions for specific branches.
      # FIXME: This feature is not well defined.
      self.attrs_by_branch = {}

   #
   def init_field_domains(self):

      # For string enum fields, we check the field values when we read them to
      # make sure they match a value in the enum.
      #
      # Also, ArcGIS -- or maybe OpenJUMP or RoadMatcher -- sometimes truncates
      # field values, so the collection here is a dictionary. The keys are the
      # expected values from the shapefile and their values are the value we
      # should use for the Cyclopath attribute value. (Update: I've heard that
      # exporting from ArcGIS to shapefile truncates strings (key names and
      # values?), possibly because of the shapefile specification.)

      # Derived classes should update this.

      self.attrs_field_values = {}

   #
   def init_import_defns(self):

      # SYNC_ME: See Branch_Defs_Base.init_import_defns
      #          and Public_Basemap_Defs.init_field_defns

      # Cyclopath Import and Conflation attributes.
      self.confln_action = 'ACTION_'
      self.confln_context = '_CONTEXT'
      self.confln_delete = '_DELETE'
      self.confln_revert = '_REVERT'
      self.confln_conflated = '_CONFLATED'
      self.confln_new_geom = '_NEW_GEOM'

      # MAYBE: Will we need to worry about line segment direction? I.e., if we
      # conflate two lines that run in opposite values, the m-values will need
      # to be reversed.
      # MAYBE?: self.confln_direction_reversed = '_REVERSED'

      # In the Hausdorff import script, OTHERS_IDS is used to indicate
      # copying of attributes between items.
      self.confln_others_ids = 'OTHERS_IDS'

      # Edited indicator.
      self.confln_edit_date = 'EDIT_DATE'

      # Item_Versioned name and stack ID.
      self.confln_ccp_system_id = 'CCP_SYS'
      self.confln_ccp_stack_id = 'CCP_ID'
      self.confln_ccp_version = 'CCP_VERS'
      self.confln_ccp_name = 'CCP_NAME'

      # Agency IDs.
      self.confln_agy_obj_id = 'AGY_ID'
      self.confln_agy_name = 'AGY_NAME'

      self.confln_required_fields = [
         self.confln_action,
         self.confln_context,
         self.confln_delete,
         self.confln_revert,
         # Nope: self.confln_conflated
         # Nope: self.confln_confidence
         # Nope: self.confln_new_geom
         # Nope: self.confln_edit_date
         #self.confln_ccp_system_id
         self.confln_ccp_stack_id,
         #self.confln_ccp_version
         self.confln_ccp_name,
         self.confln_agy_obj_id,
         # self.confln_agy_name,
         ]

      # MAYBE: 'def' makes [lb] think of 'default', not 'definition'.
      self.action_shpf_def = 'CCP_'
      # MAGIC_NUMBER: When _ACTION == 'CCP_', generally CCP_ID == -1, but
      #               this isn't strictly enforced (it's just so when you
      #               sort by stack ID in you GIS app that the spf_confs
      #               group together at the top of the list).
      self.shpf_def_stack_id = -1
      self.action_import = 'Import'
      self.action_ignore = 'Ignore'
      self.action_fix_me = 'FIXME'

   #
   def init_metadata(self):

      # For Cyclopath string-type attributes, we define a set of acceptable
      # input values (the attribute's "domain"). This is useful for checking
      # data integrity and also for making a nice drop-down list of values in
      # the user interface.

      # FIXME: self.attrs_ccp_enums is not implemented...
      self.attrs_ccp_enums = {}
      for attr_name, attr_values in self.attrs_field_values.iteritems():
         enum = set()
         for attr_val in attr_values.itervalues():
            enum.add(attr_val)
         value_restraint = '"%s"' % ('","'.join(enum))
         log.verbose4('.. adding enum: %s: %s' % (attr_name, value_restraint,))
         self.attrs_ccp_enums[attr_name] = value_restraint

   # *** Target Attribute Definition

   # The target attribute definition describes an attribute as its imported,
   # modified, and exported and saved.

   # Remember: The Shapefile spec. says 10-characters max for a field name.
   #           If it's longer, it'll get laundered to a 10-character width.

   class TA_Defn(object):

      def __init__(self,
                   attr_source='',     # Cyclopath attribute internal_name
                   attr_type=None,     # Python type, e.g., str
                   byway_source='',    # byway.One attribute name
                   # FIXME: You can access byway cols and attribute link_values
                   #        Ratings are made into mock cols. What about notes?
                   #        Discussions? Nonwiki Items (Watchers?)?
                   field_target='',    # Target shapefile field name
                   field_type=None,    # .shp type, e.g., ogr.OFTString
                   field_source='',    # Update shapefile fld name; c.b.N
                   field_width=None,   # For OFTString, number of characters
                   field_clone=False,  # If a CCP_ field, if we copy src field.
                   val_callback=None,  # Returns attr. value; can be None
                   attr_edit=True,     # Is new attr. value editable?
                   deleted_on=None,    # How to save if attr_type bool
                   comparable=False,   # If attr is special, for joining
                   stackable=False,    # For less-special, coalesce vals?
                   stackable_xor=None, # How to coalesce certain types.
                   settable=False,     # If we look for this value in the input
                   cmp_ignore_empties=False, # If '' == 'whatever'
                   ):

         # Not always true:
         #  g.assurt((attr_source and attr_type) or (byway_source))
         g.assurt(field_target)
         # Note that field type is ogr.OFT*, e.g., ogr.OFTInteger,
         # which range from 0 (OFTInteger) to 11 (ogr.OFTDateTime).
         # We could but currently don't support many of the OFT types:
         #  ogr.OFTBinary, OFTDate, OFTDateTime, ogr.OFTTime
         #  ogr.OFTIntegerList, ogr.OFTRealList, ogr.OFTStringList
         #  ogr.OFTWideString
         g.assurt(field_type in (ogr.OFTInteger,
                                 ogr.OFTReal,
                                 ogr.OFTString,))

         #
         self.attr_source = attr_source
         self.attr_type = attr_type
         self.byway_source = byway_source
         self.field_target = field_target
         self.field_type = field_type
         self.field_source = field_source or field_target
         # Manually specify the field_width. Ogr defaults it to 80 (though if
         # you call ogr.FieldDefn(fname, ftype).GetWidth(), ogr reports '0').
         # If you try to set a value with more characters than field_width
         # (e.g., using SetFrom), ogr willfully truncates the value and writes
         # to std_err something like,
         #    Warning 1: Value '...' of field NOTES has been truncated to 80
         #    characters. This warning will not be emitted any more for that
         #    layer.
         # which means you're calling fcn. won't know of the error (or at least
         # not without checking the value it tried to set, after setting it).
         self.field_width = field_width
         self.field_clone = field_clone
         self.val_callback = val_callback
         self.attr_edit = attr_edit
         if deleted_on is None:
            self.deleted_on = ()
         else:
            self.deleted_on = deleted_on
         self.comparable = comparable
         self.stackable = stackable
         self.stackable_xor = stackable_xor
         self.settable = settable
         self.cmp_ignore_empties = cmp_ignore_empties

         # For, now comparable and stackable are exclusive of one another. I
         # [lb] was thinking not comparable and not stackable might mean the
         # max or avg value for be used, or something. Meh.
         #g.assurt((comparable is None) or (comparable ^ stackable))

         # This is the stack ID of the new attribute, set once it's created.
         self.ccp_atid = None

      #
      def __str__(self):
         sstr = ('TA_Defn: ft: %s / bs: %s'
                 % (field_target,
                    byway_source,))
         return sstr

   # end: class TA_Defn

   # *** TA_Defn wrappers, one for each atomic type

   # NOTE: The following attrs_define_* fcns. are very similar to one another.

   #
   def attrs_define_boolean(self,
         attr_source='',
         #attr_type=bool,
         byway_source='',
         field_target='',
         #field_type=ogr.OFTString,
         field_source='',

         # FIXME: This should be 1, ideally?
         field_width=5, # MAGIC_NUMBER: max(len('true'), len('false'))

         field_clone=False,
         val_callback=None,
         attr_edit=True,
         deleted_on=None,
         comparable=False,
         stackable=False,
         stackable_xor=None,
         settable=False,
         cmp_ignore_empties=False,
         #
         by_branch='',
         ):
      g.assurt(field_target)
      if deleted_on is None:
         # Delete Ccp attr if bool is False or None.
         # No?: deleted_on = (False, None,)
         deleted_on = ('', None,)
      ta_def = Branch_Defs_Base.TA_Defn(
                  attr_source=attr_source, #
                  attr_type=bool, #
                  byway_source=byway_source,
                  field_target=field_target,
                  field_type=ogr.OFTString, #
                  field_source=field_source,
                  field_width=field_width,
                  field_clone=field_clone,
                  val_callback=val_callback,
                  attr_edit=attr_edit,
                  deleted_on=deleted_on,
                  comparable=comparable,
                  stackable=stackable,
                  stackable_xor=stackable_xor,
                  settable=settable,
                  cmp_ignore_empties=cmp_ignore_empties,
                  )
      self.attrs_by_branch[by_branch].append(ta_def)
      self.attrs_metadata.append(ta_def)
      return ta_def

   #
   def attrs_define_integer(self,
         attr_source='',
         #attr_type=int,
         byway_source='',
         field_target='',
         #field_type=ogr.OFTInteger,
         field_source='',
         field_width=None,
         field_clone=False,
         val_callback=None,
         attr_edit=True,
         deleted_on=None,
         comparable=False,
         stackable=False,
         settable=False,
         cmp_ignore_empties=False,
         by_branch='',
         ):
      g.assurt(field_target)
      # Integers cannot be stacked, unless, e.g., you made 'em a
      # comma-separated string list of ints, or if you averaged them, etc.
      g.assurt(not stackable)
      ta_def = Branch_Defs_Base.TA_Defn(
                  attr_source=attr_source, #
                  attr_type=int, #
                  byway_source=byway_source,
                  field_target=field_target,
                  field_type=ogr.OFTInteger, #
                  field_source=field_source,
                  field_width=field_width,
                  field_clone=field_clone,
                  val_callback=val_callback,
                  attr_edit=attr_edit,
                  deleted_on=deleted_on,
                  comparable=comparable,
                  stackable=stackable,
                  settable=settable,
                  cmp_ignore_empties=cmp_ignore_empties,
                  )
      self.attrs_by_branch[by_branch].append(ta_def)
      self.attrs_metadata.append(ta_def)
      return ta_def

   #
   def attrs_define_float(self,
         attr_source='',
         #attr_type=float,
         byway_source='',
         field_target='',
         #field_type=ogr.OFTReal,
         field_source='',
         field_width=None,
         field_clone=False,
         val_callback=None,
         attr_edit=True,
         deleted_on=None,
         comparable=False,
         stackable=False,
         settable=False,
         cmp_ignore_empties=False,
         by_branch='',
         ):
      g.assurt(field_target)
      # Integers cannot be stacked, unless, e.g., you made 'em a
      # comma-separated string list of ints, or if you averaged them, etc.
      g.assurt(not stackable)
      ta_def = Branch_Defs_Base.TA_Defn(
                  attr_source=attr_source, #
                  attr_type=float, #
                  byway_source=byway_source,
                  field_target=field_target,
                  field_type=ogr.OFTReal, #
                  field_source=field_source,
                  field_width=field_width,
                  field_clone=field_clone,
                  val_callback=val_callback,
                  attr_edit=attr_edit,
                  deleted_on=deleted_on,
                  comparable=comparable,
                  stackable=stackable,
                  settable=settable,
                  cmp_ignore_empties=cmp_ignore_empties,
                  )
      self.attrs_by_branch[by_branch].append(ta_def)
      self.attrs_metadata.append(ta_def)
      return ta_def

   #
   def attrs_define_string(self,
         attr_source='',
         #attr_type=str,
         byway_source='',
         field_target='',
         #field_type=ogr.OFTString,
         field_source='',

         # FIXME: What's the OGR default? I think it's 50.
         field_width=50,

         field_clone=False,
         val_callback=None,
         attr_edit=True,
         deleted_on=None,
         comparable=False,
         stackable=False,
         settable=False,
         cmp_ignore_empties=False,
         by_branch='',
         ):
      # deleted_on = ('', None,) is implied
      g.assurt(field_target)
      if deleted_on is None:
         # Delete attr if string is empty or None.
         deleted_on = ('', None,)
      ta_def = Branch_Defs_Base.TA_Defn(
                  attr_source=attr_source, #
                  attr_type=str, #
                  byway_source=byway_source,
                  field_target=field_target,
                  field_type=ogr.OFTString, #
                  field_source=field_source,
                  field_width=field_width,
                  field_clone=field_clone,
                  val_callback=val_callback,
                  attr_edit=attr_edit,
                  deleted_on=deleted_on,
                  comparable=comparable,
                  stackable=stackable,
                  settable=settable,
                  cmp_ignore_empties=cmp_ignore_empties,
                  )
      self.attrs_by_branch[by_branch].append(ta_def)
      self.attrs_metadata.append(ta_def)
      return ta_def

   # ***

   #
   def field_val_setup_all(self, dst_layer, old_byway, src_feat, context,
                                 just_copy_from=False, bad_geom_okay=False):
      skip_feat = ''
      # Get a handle on the layer.
      layer_defn = dst_layer.GetLayerDefn()
      # Make the new feature.
      dst_feat = ogr.Feature(layer_defn)
      # Set the geometry and fields.
      if src_feat is not None:
         g.assurt(not just_copy_from) # Not used.
         if just_copy_from:
            ogr_err = dst_feat.SetFrom(src_feat, forgiving=False)
         else:
            #ogr_err = dst_feat.SetGeometry(src_feat.GetGeometryRef())
            ogr_err = dst_feat.SetFrom(src_feat, forgiving=True)
         g.assurt(not ogr_err)
         g.assurt(dst_feat.GetFID() == -1)
         g.assurt(dst_feat.GetGeometryRef() is not None)
         g.assurt((dst_feat.GetGeometryRef().GetZ() == -9999.0)
                  or (dst_feat.GetGeometryRef().GetZ() == 0))
         dst_feat.GetGeometryRef().FlattenTo2D()
      else:
         g.assurt(old_byway is not None)
         geometry_wkt = old_byway.geometry_wkt
         if geometry_wkt.startswith('SRID='):
            geometry_wkt = geometry_wkt[geometry_wkt.index(';')+1:]
         old_geom = ogr.CreateGeometryFromWkt(geometry_wkt)
         old_geom.FlattenTo2D() # Keep enforce_dims_geometry happy.
         dst_feat.SetGeometryDirectly(old_geom)
         # If a split-into segment is missing, we'll try to copy the old
         # byway's geometry, which means the old_byway's geometry has not been
         # vetted yet.
         if not dst_feat.GetGeometryRef().IsSimple():
            skip_feat = 'simple'
         if dst_feat.GetGeometryRef().IsRing():
            skip_feat += ' and ' if skip_feat else ''
            skip_feat += 'isring'
      # Set the fields.
      # DEV_TRICK: 2013.04ish: [lb] was importing the Bikeways Shapefile anew,
      #            after it had been edited. A few features were edited
      #            weirdly. Here's how I trapped the error on a dbg prompt.
      #      if old_byway.stack_id == 1358797:
      #         import pdb;pdb.set_trace()
      if not just_copy_from:
         for ta_def in self.attrs_metadata:
            self.field_val_setup_one(ta_def, dst_feat, old_byway, src_feat)
      # We've copied the context from the src_feat, but if the caller specified
      # it, use that instead.
      if skip_feat:
         context = 'Bad geom: %s' % (skip_feat,)
      if context:
         dst_feat.SetField(self.confln_action, self.action_fix_me)
         dst_feat.SetField(self.confln_context, context)
      if skip_feat and not bad_geom_okay:
         raise Feat_Skipped()
      # Finally, add the feature to the layer.
      # NOTE to the callees: If you call SetField or SetGeometry on this
      #      returned feature, you have to call SetFeature for the changes to
      #      stick.
      ogr_err = dst_layer.CreateFeature(dst_feat)
      g.assurt(not ogr_err)
      log.verbose('field_val_setup_all: dst_feat/CreateFeat: FID: %d'
                  % (dst_feat.GetFID(),))
      return dst_feat

   #
   # FIXME: Will this fcn. work for polygons and points? If so, rename
   # old_byway...
   def field_val_setup_one(self, ta_def, dst_feat, old_byway, src_feat):

      # This fcn. is called just once, after the source feature and source
      # byway are loaded.
      the_val = None

      # We expect at least a byway or a feature to be the source, or both.
      # If both are set, we prefer to find the_val in the source shapefile
      # (i.e., because we're importing). We use the source byway to hydrate
      # the_val otherwise (either because it's NULL/Unset in the source
      # shapefile or because we're exporting).
      #
      # FIXME: If we export a file with an attribute value set, and the
      #        user deletes/unsets the value in a GIS app and we import
      #        the Shapefile, will we unset/clear the value in Cyclopath??
      #        BUG nnnn: Test unset attr value, delete feature, and revert
      #                  feature on import.
      #
      g.assurt((old_byway is not None) or (src_feat is not None))

      # First see if the source feature has the target field set. This may or
      # may not matter, as we'll find out.
      source_val = None
      source_set = False
      if src_feat is not None:
         try:
            source_val = self.ta_def_get_field_value(ta_def, src_feat,
                                                     use_target=True)
            source_set = True
         except Exception, e:
            try:
               source_val = self.ta_def_get_field_value(ta_def, src_feat,
                                                        use_source=True)
               source_set = True
            except Exception, e:
               pass

      # Find the value per the target attribute definition. There are three
      # source types and two source objects, so that's six places we need to
      # look to find the_val. [callback, link attr, bway attr,] x [bway, feat,]
      if ta_def.val_callback is not None:
         # This is a calculated value, and we always expect target to be None.
         g.assurt((source_val is None) and (not source_set))
         # Call the custom callback to make the value.
         the_val = ta_def.val_callback(ta_def, old_byway, src_feat)
         # If the callback returns None, it either means there's no information
         # or the information does not indicate positive (i.e., instead of None
         # the value could have been 0, '' or False).

      # 2013.05.02: "Where have you been all my life?!" [lb] finds that
      #             TA_Defns using ta_def.attr_source are all NULL in the
      #             export Shapefile. Didn't this used to work for Cycloplan?
      #             I know I implemented the fast-loading of attributes since,
      #             but I don't remember not using attr_source (and using
      #             ccp_atid instead), and a cursory examination of the 2012
      #             CcpV2 Cycloplan demo doesn't suggest I changed anything.
      # Weird and old and wrong: elif ta_def.ccp_atid:
      elif ta_def.ccp_atid or ta_def.attr_source:
         # This is a byway attribute (link_value). If the target field is
         # already set, use that value. Then try the source field. Lastly, try
         # the byway.
         if source_set:
            the_val = source_val
         elif old_byway is not None:
            # See also:
            #   item_mgr.cache_attrnames[attc_attr.internal_name] = attc_attr
            if ta_def.ccp_atid:
               attr = self.mjob.handler.attributes_all[ta_def.ccp_atid]
               try:
                  # This fails (throws AttributeError) unless heavyweight
                  # link_values are being used. It also fails if the byway says
                  # the attribute is unset or deleted (KeyError). If it works,
                  # it'll be the real value, or a defauly value which could be
                  # None.
                  the_val = old_byway.link_values[ta_def.ccp_atid].get_value(
                                                                        attr)
               except AttributeError:
                  # This means old_byway.link_values isn't set but maybe
                  # old_byway.attrs is.
                  # This won't throw but could also return None.
                  the_val = old_byway.attr_val(attr.value_internal_name)
               except KeyError:
                  # The byway says the attribute is informationless (i.e.,
                  # unset or deleted).
                  #verbose
                  log.verbose5('field_val_setup_one: no attr: %s / %s'
                               % (attr.value_internal_name, old_byway,))
            else:
               g.assurt(ta_def.attr_source)
               # This returns None on not found/absent so this is easy.
               the_val = old_byway.attr_val(ta_def.attr_source)
         else:
            log.warning('field_val_setup_one: ccp_atid defined, no val: %s'
                        % (ta_def.ccp_atid,))
            g.assurt(False) # I don't think we'll find ourselves here.

      elif ta_def.byway_source:
         if source_set:
            # FIXME: A 'None' value is ignored by item_base.
            the_val = source_val
         elif old_byway is not None:
            the_val = getattr(old_byway, ta_def.byway_source)
         else:
            log.warning('field_val_setup_one: byway_source defined, no val: %s'
                        % (ta_def.byway_source,))
            g.assurt(False) # I don't think we'll find ourselves here.

      else:
         # Only ta_def.field_target is set, meaning this is not an attribute,
         # and it's not a byway value; it's just a field in the Shapefile (like
         # _ACTION, _CONTEXT, _DELETE, etc.). Sometimes we keep this value the
         # same and sometimes we don't.
         if ta_def.field_clone and source_set:
            the_val = source_val

      # If the value is a deleted_on value, unset the field.
      if ta_def.deleted_on and (the_val in ta_def.deleted_on):
   # FIXME: What about integers? We want to be able to store 0, and using,
   # i.e., -1 for special purposes is not cool.

# FIXME: Shapefile Integer fields *must* be set. So use a magic number!
#        Or, use a String field.......
         the_val = None

      # Store the value in the target feature's target field.
      field_idx = dst_feat.GetFieldIndex(ta_def.field_target)
      g.assurt(field_idx != -1)
      if the_val is not None:
         log.verbose5('field_val_setup_one: target: %10s / the_val: %s'
                      % (ta_def.field_target, the_val,))
         dst_feat.SetField(ta_def.field_target, the_val)
      else:
         log.verbose5('field_val_setup_one:  unset: %10s / the_val: %s'
                      % (ta_def.field_target, the_val,))
         dst_feat.UnsetField(field_idx)

   # ***

   SPACES_RE = re.compile(r'^ +$')

   #
   def link_value_get_field_value(self, ta_def, the_val):
      val_boolean, val_integer, val_string = [None,] * 3
      if ta_def.attr_type == bool:
         g.assurt(isinstance(the_val, bool))
         val_boolean = the_val
      elif ta_def.attr_type == int:
         g.assurt(isinstance(the_val, int))
         val_integer = the_val
      elif ta_def.attr_type == str:
         g.assurt(isinstance(the_val, str))
         if Branch_Defs_Base.SPACES_RE.search(the_val):
            self.stats['field_string_spaces'] += 1
            the_val = ''
         val_string = the_val
      else:
         g.assurt(False)
      return val_boolean, val_integer, val_string

   #
   def ta_def_get_field_value(self, ta_def, feat,
                                    use_target=False,
                                    use_source=False):

      # The field_type is the ogr value type, which indicates which fcn we call
      # to get the value (GetFieldAs____()).
      if ta_def.field_type == ogr.OFTInteger:
         ogr_fcn = feat.GetFieldAsInteger
      elif ta_def.field_type == ogr.OFTReal:
         ogr_fcn = feat.GetFieldAsDouble
      elif ta_def.field_type == ogr.OFTString:
         ogr_fcn = feat.GetFieldAsString
      else:
         # See list of OFTs. Search this file: OFT types.
         #  ogr.OFTInteger, ogr.OFTReal, ogr.OFTString
         #  ogr.OFTBinary, OFTDate, OFTDateTime, ogr.OFTTime
         #  ogr.OFTIntegerList, ogr.OFTRealList, ogr.OFTStringList
         #  ogr.OFTWideString
         log.error('Unknown field_type: %s' % (str(ta_def.field_type),))
         g.assurt(False)

      # Note that we fetch from the update-named field, and not the
      # target-named field. The target field is write-only.
      g.assurt(use_target ^ use_source)
      if use_target:
         fname = ta_def.field_target
      elif use_source:
         fname = ta_def.field_source
      g.assurt(fname)

      # If you know the field exists, you can call IsFieldSet, but only if you
      # know the field is defined, lest, e.g., # ERROR 1: No such field: '...'.
      if feat.GetFieldIndex(fname) != -1:
         if feat.IsFieldSet(fname):
            val_raw = ogr_fcn(fname)
            if ta_def.attr_type == bool:
               g.assurt(val_raw is not None)
               the_val = self.ogr_to_bool(val_raw)
               g.assurt(isinstance(the_val, bool))
            else:
               the_val = ta_def.attr_type(val_raw)
            g.assurt(the_val is not None)
         else:
            the_val = None
      else:
         raise Exception('ta_def_get_field_value: does not exist: %s'
                         % (fname,))

      return the_val

   #
   def ta_def_get_attr_value(self, ta_def, ref_byway):
      try:
         # If byway_source wasn't a string, this would throw TypeError
         the_val = getattr(ref_byway, ta_def.byway_source)
      except AttributeError:
         # The byway should always have the attribute defined, so this
         # is a programmer error.
         raise Exception('byway_source not found on byway: %s / %s'
                         % (ta_def.byway_source, ref_byway,))
      return the_val

   # *** Class helpers

   #
   def ogr_str_as_bool(self, feat, field_name, default):
      # Always return a value. Caller should use default=None if they want to
      # know if the field really exists or not. Or set confln_required_fields.
      g.assurt(field_name)
      if feat.GetFieldIndex(field_name) == -1:
         val = default
      else:
         val = feat.GetFieldAsString(field_name)
         if val == '':
            val = default
         else:
            try:
               val = self.ogr_to_bool(val)
            except Exception, e:
               log.warning('ogr_str_as_bool: %s' % (str(e),))
               val = default
      return val

   #
   # FIXME: Move to util file?
   def ogr_to_bool(self, test_value):
      truth = None
      if isinstance(test_value, float):
         log.verbose('ogr_to_bool: float: %.2f' % (test_value,))
         truth = True if test_value else False
      elif isinstance(test_value, str):
         log.verbose('ogr_to_bool: str: %s' % (test_value,))
         if test_value.lower() in ('y', 'yes', 'true', '1',):
            truth = True
         elif test_value.lower() in ('n', 'no', 'false', '0',):
            truth = False
         else:
            raise Exception('Not a boolean value: %s' % (test_value,))
      elif isinstance(test_value, int):
         log.verbose('ogr_to_bool: int: %s' % (test_value,))
         truth = True if test_value else False
      elif isinstance(test_value, bool):
         log.verbose('ogr_to_bool: bool: %s' % (test_value,))
         truth = test_value
      else:
         raise Exception('Unexpected type: %s' % (type(test_value),))
      log.verbose('ogr_to_bool: truth: %s' % (truth,))
      return truth

   # ***

# ***

if (__name__ == '__main__'):
   pass


text:
layout: page
title: Ward - Webb Wedding
date: 2016-05-24
author: Thomas Hall
tags: weekly links, java
status: published
summary: Aenean viverra, ipsum vel molestie molestie, justo.
banner: images/banner/people.jpg
booking:
  startDate: 06/24/2016
  endDate: 06/27/2016
  ctyhocn: BVDNCHX
  groupCode: WWW
published: true
---
Vivamus vestibulum cursus nisi eu elementum. Cras sagittis accumsan lacus. Pellentesque vestibulum pellentesque vestibulum. Vestibulum congue hendrerit consequat. Suspendisse placerat arcu a lectus accumsan auctor pulvinar in nisi. Morbi sodales felis in elit condimentum sodales. Maecenas sodales elementum consectetur. Quisque a nibh nibh. Suspendisse in lacus scelerisque, sagittis urna vitae, fringilla risus. Nam a magna volutpat, ornare dui at, convallis magna.
Vestibulum et ligula ac metus condimentum volutpat non in nibh. Fusce malesuada pharetra tellus, nec scelerisque dolor elementum malesuada. Quisque convallis viverra massa bibendum lacinia. Nam vulputate hendrerit lacus, eget fringilla urna pulvinar vestibulum. Praesent malesuada et sem eget porttitor. Sed eget lorem commodo, mollis turpis a, congue ex. Phasellus suscipit felis quis enim cursus, vel vulputate justo lobortis. Ut euismod pretium quam sit amet facilisis. Aenean quis arcu lectus. Nulla nec rhoncus augue. Nullam malesuada risus eu est vulputate, ac pharetra nunc euismod. Quisque volutpat ac quam vitae faucibus.

* Proin commodo augue condimentum massa efficitur bibendum
* Nunc vel velit sit amet mi aliquam suscipit quis non nisl
* Mauris nec ante et nisl aliquam egestas at a tellus.

Quisque sollicitudin imperdiet turpis vel sagittis. Integer luctus a leo auctor euismod. Nulla nec faucibus tellus, id suscipit nisi. Mauris sit amet ultricies ligula. Donec tristique lacinia justo sit amet ullamcorper. Nunc tincidunt ex a velit luctus porta. Maecenas laoreet nisi eget ex mattis ultrices. Mauris pellentesque quam mi. Curabitur vitae congue mi. Nulla ante augue, cursus quis pretium et, dapibus in metus. Mauris porttitor at libero sed ullamcorper. Ut ex magna, tincidunt eget tortor dapibus, dignissim fermentum augue. Ut eget feugiat erat. Quisque nec laoreet elit, nec dignissim arcu. Mauris purus velit, consequat at ante quis, malesuada placerat orci.


text:
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta http-equiv="Cache-control" content="No-Cache">

    <title>{{.Title}}</title>

<!--[if lt IE 9]>
    <script src="http://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7/html5shiv.js"></script>
<![endif]-->

    {{ range $i, $v := .Stylesheets }}
    <link rel="stylesheet" href="{{ $v }}">
    {{ end }}

  </head>
  <body>
    <div id="layout">


text:
namespace boost {
  namespace unordered {
    template <class K, class T, class H = boost::hash<K>,
      class P = std::equal_to<K>,
      class A = std::allocator<std::pair<const K, T> > >
    class unordered_map;

    template <class K, class T, class H, class P, class A>
    inline bool operator==(
      unordered_map<K, T, H, P, A> const&, unordered_map<K, T, H, P, A> const&);
    template <class K, class T, class H, class P, class A>
    inline bool operator!=(
      unordered_map<K, T, H, P, A> const&, unordered_map<K, T, H, P, A> const&);
    template <class K, class T, class H, class P, class A>
    inline void swap(
      unordered_map<K, T, H, P, A>& m1, unordered_map<K, T, H, P, A>& m2)
      BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(m1.swap(m2)));

    template <class K, class T, class H = boost::hash<K>,
      class P = std::equal_to<K>,
      class A = std::allocator<std::pair<const K, T> > >
    class unordered_multimap;

    template <class K, class T, class H, class P, class A>
    inline bool operator==(unordered_multimap<K, T, H, P, A> const&,
      unordered_multimap<K, T, H, P, A> const&);
    template <class K, class T, class H, class P, class A>
    inline bool operator!=(unordered_multimap<K, T, H, P, A> const&,
      unordered_multimap<K, T, H, P, A> const&);
    template <class K, class T, class H, class P, class A>
    inline void swap(unordered_multimap<K, T, H, P, A>& m1,
      unordered_multimap<K, T, H, P, A>& m2)
      BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(m1.swap(m2)));

    template <class N, class K, class T, class A> class node_handle_map;
    template <class N, class K, class T, class A> struct insert_return_type_map;
  }

  using boost::unordered::unordered_map;
  using boost::unordered::unordered_multimap;
  using boost::unordered::swap;
  using boost::unordered::operator==;
  using boost::unordered::operator!=;
}

#endif


text:
'''
Created on Jan 7, 2014

@author: Jose Borreguero
'''

from logger import vlog, tr
import numpy

class Dsf(object):
  '''
  This class implements a dynamic structure factor
  '''

  def __init__(self):
    '''
    Attributes:
      fvalue: value of the external parameter
      intensities: actual values of the structure factor
      errors: associated errors of the intensities. Mostly for experimentally-derived data
      shape: shape of the intensities array
    '''
    self.fvalue = None
    self.intensities = None
    self.errors = None

  @property
  def shape(self):
    return self.intensities.shape

  def ExtractIntensity(self, index ):
    return self.intensities.ravel()[ index ]

  def ExtractError(self, index ):
    if self.errors is not None:
      return self.errors.ravel()[ index ]
    else:
      return None

  def SetFvalue(self,fvalue):
    self.fvalue = fvalue

  def SetIntensities(self,intensities):
    self.intensities = numpy.array(intensities)

  def SetErrors(self,errors):
    if self.intensities is None:
      vlog.error('Error: Set intensities before setting errors')
      return
    if numpy.array(errors).shape != self.intensities.shape:
      vlog.error('Error: shape of errors different than shape of intensities')
      return
    self.errors = numpy.array(errors)

  def Load(self, container, datatype=None):
    ''' Load intensities and errors from an object or reference.

    Iterates over all data loaders until it finds an appropriate loader

    Arguments:
      [datatype]: one of the DsfLoad types registered in DsfLoaderFactory

    Returns:
      intensities array loaded from the data

    Exceptions:
      TypeError is data cannot be loaded
    '''
    from dsfload import DsfLoaderFactory
    loader_factory = DsfLoaderFactory()
    datatypes = [datatype,] if datatype else loader_factory.datatypes
    for datatype in datatypes:
      try:
        loader = loader_factory.Instantiate(datatype)
        self.intensities, self.errors = loader.Load(container)
        return self.intensities # stop iteration over loaders
      except Exception, e:
        pass
    vlog.error('Appropriate loader not found for supplied data')
    raise TypeError

  def Save(self, container, datatype=None):
    ''' Save intensities and errors to a container

    Iterates over all data savers until it finds appropiate saver

    Arguments:
      [datatype]: one of the DsfSave types registered in DsfSaverFactory

    Returns:
      first successful datatype

    Exceptions:
      TypeError if container and datatype don't agree
    '''
    from dsfsave import DsfSaveFactory
    save_factory = DsfSaveFactory()
    datatypes = [datatype,] if datatype else save_factory.datatypes
    for datatype in datatypes:
      try:
        saver = save_factory.Instantiate(datatype)
        saver.Save(self, container)
        return datatype
      except Exception, e:
        pass
    vlog.error('Appropriate loader not found for supplied data')
    raise TypeError


text:
package com.haulmont.cuba.web.widgets.client.searchselect;

import com.haulmont.cuba.web.widgets.CubaSearchSelect;
import com.vaadin.client.communication.StateChangeEvent;
import com.vaadin.client.ui.combobox.ComboBoxConnector;
import com.vaadin.shared.ui.Connect;

@Connect(value = CubaSearchSelect.class, loadStyle = Connect.LoadStyle.LAZY)
public class CubaSearchSelectConnector extends ComboBoxConnector {

    @Override
    public CubaSearchSelectState getState() {
        return (CubaSearchSelectState) super.getState();
    }

    @Override
    public CubaSearchSelectWidget getWidget() {
        return (CubaSearchSelectWidget) super.getWidget();
    }

    @Override
    public void onStateChanged(StateChangeEvent stateChangeEvent) {
        super.onStateChanged(stateChangeEvent);

        if (stateChangeEvent.hasPropertyChanged("tabIndex")) {
            getWidget().updateTabIndex(getState().tabIndex);
        }
    }

    @Override
    protected void refreshData() {
        String filterInState = getState().currentFilterText != null ?
                getState().currentFilterText : "";
        if (!filterInState.equals(getWidget().lastFilter)) {
            return;
        }

        if (getDataSource().size() > 0) {
            super.refreshData();
        }
        getWidget().applyNewSuggestions();
    }
}