text:
Timeouts
========

Because WebDriver tests are asynchronous and involve many components, there are several reasons why a timeout could occur in a Protractor test.

Timeouts from Protractor
------------------------

### Waiting for Page to Load

When navigating to a new page using `browser.get`, Protractor waits for the page to
be loaded and the new URL to appear before continuing.

 - Looks like: an error in your test results - `Error: Timed out waiting for page to load after 10000ms`

 - Default timeout: 10 seconds

 - How to change: To change globally, add `getPageTimeout: timeout_in_millis` to your Protractor configuration file. For an individual call to `get`, pass an additional parameter: `browser.get(address, timeout_in_millis)`

### Waiting for Angular

Before performing any action, Protractor waits until there are no pending asynchronous tasks in your Angular application. This means that all timeouts and http requests are finished. If your application continuously polls $timeout or $http, Protractor will wait indefinitely and time out. You should use the
[$interval](https://github.com/angular/angular.js/blob/master/src/ng/interval.js) for anything that polls continuously (introduced in Angular 1.2rc3).

You can also disable waiting for angular, [see below](#how-to-disable-waiting-for-angular).

 - Looks like: an error in your test results - `Timed out waiting for asynchronous Angular tasks to finish after 11 seconds.`

 - Default timeout: 11 seconds

 - How to change: Add `allScriptsTimeout: timeout_in_millis` to your Protractor configuration file.

### Waiting for Angular on Page Load

Protractor waits for the `angular` variable to be present when loading a new page.

 - Looks like: an error in your test results - `Angular could not be found on the page: retries looking for angular exceeded`

 - Default timeout: 10 seconds

 - How to change: To change globally, add `getPageTimeout: timeout_in_millis` to your Protractor configuration file. For an individual call to `get`, pass an additional parameter: `browser.get(address, timeout_in_millis)`

### _How to disable waiting for Angular_

If you need to navigate to a page which does not use Angular, you can turn off waiting for Angular by setting
`browser.ignoreSynchronization = true`. For example:

```js
browser.ignoreSynchronization = true;
browser.get('/non-angular-login-page.html');

element(by.id('username')).sendKeys('Jane');
element(by.id('password')).sendKeys('1234');
element(by.id('clickme')).click();

browser.ignoreSynchronization = false;
browser.get('/page-containing-angular.html');
```

Timeouts from WebDriver
-----------------------

### Asynchronous Script Timeout

Sets the amount of time to wait for an asynchronous script to finish execution before throwing an error.

 - Looks like: an error in your test results - `ScriptTimeoutError: asynchronous script timeout: result was not received in 11 seconds`

 - Default timeout: 11 seconds

 - How to change: Add `allScriptsTimeout: timeout_in_millis` to your Protractor configuration file.

Timeouts from Jasmine
---------------------

### Spec Timeout

If a spec (an 'it' block) takes longer than the Jasmine timeout for any reason, it will fail.

 - Looks like: a failure in your test results - `timeout: timed out after 30000 msec waiting for spec to complete`

 - Default timeout: 30 seconds

 - How to change: To change for all specs, add `jasmineNodeOpts: {defaultTimeoutInterval: timeout_in_millis}` to your Protractor configuration file. To change for one individual spec, pass a third parameter to `it`: `it(description, testFn, timeout_in_millis)`.

Timeouts from Sauce Labs
------------------------
If you are using Sauce Labs, there are a couple additional ways your test can time out. See [Sauce Labs Timeouts Documentation](https://docs.saucelabs.com/reference/test-configuration/#timeouts) for more information.

### Maximum Test Duration

Sauce Labs limits the maximum total duration for a test.

 - Looks like: `Test exceeded maximum duration after 1800 seconds`

 - Default timeout: 30 minutes

 - How to change: Edit the "max-duration" key in the capabilities object.

### Command Timeout

As a safety measure to prevent Selenium crashes from making your tests run indefinitely, Sauce limits how long Selenium can take to run a command in browsers. This is set to 300 seconds by default.

 - Looks like: `Selenium took too long to run your command`

 - Default timeout: 300 seconds

 - How to change: Edit the "command-timeout" key in the capabilities object.

### Idle Timeout

As a safety measure to prevent tests from running too long after something has gone wrong, Sauce limits how long a browser can wait for a test to send a new command. This is set to 90 seconds by default. You can adjust this limit on a per-job basis.

 - Looks like: `Test did not see a new command for 90 seconds. Timing out.`

 - Default timeout: 90 seconds

 - How to change: Edit the "idle-duration" key in the capabilities object.


text:
package com.king.app.workhelper.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.king.applib.log.Logger;

/**
 * 亮屏和息屏广播。需要 android.permission.WAKE_LOCK 权限。只能动态注册。
 *
 * @author VanceKing
 * @since 2022/2/9
 */
public class ScreenOnOffReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(final Context context, final Intent intent) {
        Logger.i("onReceive:" + intent.getAction());
    }
}

redpajama_set_name: RedPajamaGithub


text:
module.exports = getHapiOptions

var url = require('url')

function getHapiOptions (options) {
  var hapiOptions = {
    server: {},
    connection: {
      port: options.port,
      address: options.address,
      routes: { log: true }
    }
  }

  if (options.loglevel === 'debug') {
    hapiOptions.server.debug = {
      request: ['error'],
      log: ['error']
    }
  }

  if (options.url) {
    hapiOptions.connection.host = url.parse(options.url).hostname
  } else {
    hapiOptions.connection.host = 'localhost'
  }

  return hapiOptions
}


text:
package com.google.cloud.spanner.pgadapter.statements;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThrows;

import com.google.cloud.spanner.Dialect;
import com.google.cloud.spanner.SpannerException;
import com.google.cloud.spanner.Statement;
import com.google.cloud.spanner.connection.AbstractStatementParser;
import com.google.cloud.spanner.pgadapter.statements.SessionStatementParser.ResetStatement;
import com.google.cloud.spanner.pgadapter.statements.SessionStatementParser.SetStatement;
import com.google.cloud.spanner.pgadapter.statements.SessionStatementParser.ShowStatement;
import com.google.cloud.spanner.pgadapter.statements.SimpleParser.TableOrIndexName;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

@RunWith(JUnit4.class)
public class SessionStatementParserTest {
  private static final AbstractStatementParser PG_PARSER =
      AbstractStatementParser.getInstance(Dialect.POSTGRESQL);

  @Test
  public void testParseShowAll() {
    assertEquals(
        ShowStatement.createShowAll(),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("show all"))));
  }

  @Test
  public void testParseShow() {
    assertEquals(
        new ShowStatement(new TableOrIndexName("foo", "bar")),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("show foo.bar"))));

    assertEquals(
        new ShowStatement(new TableOrIndexName("foo")),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("show foo"))));
    assertEquals(
        new ShowStatement(new TableOrIndexName("foo")),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("show \"foo\""))));
    assertEquals(
        new ShowStatement(new TableOrIndexName("foo")),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("show\t\"foo\""))));
    assertEquals(
        new ShowStatement(new TableOrIndexName("foo")),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("show FOO"))));
    assertEquals(
        new ShowStatement(new TableOrIndexName("foo")),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("show \"FOO\""))));
    assertEquals(
        new ShowStatement(new TableOrIndexName("foo")),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("show\t\"FOO\""))));

    assertEquals(
        new ShowStatement(new TableOrIndexName("foo", "bar")),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("show foo.bar"))));
    assertEquals(
        new ShowStatement(new TableOrIndexName("foo", "bar")),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("show \"FOO\".bar"))));
    assertEquals(
        new ShowStatement(new TableOrIndexName("foo", "bar")),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("show\t\"FOO\".\"Bar\""))));

    assertThrows(
        SpannerException.class,
        () -> SessionStatementParser.parse(PG_PARSER.parse(Statement.of("show"))));
    assertThrows(
        SpannerException.class,
        () -> SessionStatementParser.parse(PG_PARSER.parse(Statement.of("show foo bar"))));
  }

  @Test
  public void testParseReset() {
    assertEquals(
        new ResetStatement(new TableOrIndexName("foo")),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("reset foo"))));
    assertEquals(
        new ResetStatement(new TableOrIndexName("foo")),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("reset \"foo\""))));
    assertEquals(
        new ResetStatement(new TableOrIndexName("foo")),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("reset\t\"foo\""))));
    assertEquals(
        new ResetStatement(new TableOrIndexName("foo")),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("reset FOO"))));
    assertEquals(
        new ResetStatement(new TableOrIndexName("foo")),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("reset \"FOO\""))));
    assertEquals(
        new ResetStatement(new TableOrIndexName("foo")),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("reset\t\"FOO\""))));

    assertEquals(
        new ResetStatement(new TableOrIndexName("foo", "bar")),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("reset foo.bar"))));
    assertEquals(
        new ResetStatement(new TableOrIndexName("foo", "bar")),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("reset \"FOO\".bar"))));
    assertEquals(
        new ResetStatement(new TableOrIndexName("foo", "bar")),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("reset\t\"FOO\".\"Bar\""))));

    assertThrows(
        SpannerException.class,
        () -> SessionStatementParser.parse(PG_PARSER.parse(Statement.of("reset"))));
    assertThrows(
        SpannerException.class,
        () -> SessionStatementParser.parse(PG_PARSER.parse(Statement.of("reset foo bar"))));
  }

  @Test
  public void testParseResetAll() {
    assertEquals(
        ResetStatement.createResetAll(),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("reset all"))));
  }

  @Test
  public void testParseSetTo() {
    assertEquals(
        new SetStatement(false, new TableOrIndexName("foo"), "bar"),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("set foo to bar"))));
    assertEquals(
        new SetStatement(false, new TableOrIndexName("foo"), "bar"),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("set session foo to bar"))));
    assertEquals(
        new SetStatement(true, new TableOrIndexName("foo"), "bar"),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("set local foo to bar"))));
    assertEquals(
        new SetStatement(false, new TableOrIndexName("foo"), "bar"),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("set \"foo\" to 'bar'"))));
    assertEquals(
        new SetStatement(false, new TableOrIndexName("foo"), "bar"),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("set \"foo\" to \"bar\""))));
    assertEquals(
        new SetStatement(false, new TableOrIndexName("foo"), null),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("set foo to default"))));
  }

  @Test
  public void testParseSetEquals() {
    assertEquals(
        new SetStatement(false, new TableOrIndexName("foo"), "bar"),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("set foo = bar"))));
    assertEquals(
        new SetStatement(false, new TableOrIndexName("foo"), "bar"),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("set session foo = bar"))));
    assertEquals(
        new SetStatement(true, new TableOrIndexName("foo"), "bar"),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("set local foo = bar"))));
    assertEquals(
        new SetStatement(false, new TableOrIndexName("foo"), "bar"),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("set \"foo\" = 'bar'"))));
    assertEquals(
        new SetStatement(false, new TableOrIndexName("foo"), "bar"),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("set \"foo\" = \"bar\""))));
    assertEquals(
        new SetStatement(false, new TableOrIndexName("foo"), null),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("set foo = default"))));
  }

  @Test
  public void testSetTimeZone() {
    assertEquals(
        new SetStatement(false, new TableOrIndexName("TIMEZONE"), "'UTC'"),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("set time zone 'UTC'"))));
    assertEquals(
        new SetStatement(false, new TableOrIndexName("TIMEZONE"), "'UTC'"),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("set TIME ZONE 'UTC'"))));
  }

  @Test
  public void testShowTimeZone() {
    assertEquals(
        new ShowStatement(new TableOrIndexName("timezone")),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("show time zone"))));
    assertEquals(
        new ShowStatement(new TableOrIndexName("timezone")),
        SessionStatementParser.parse(PG_PARSER.parse(Statement.of("show TIME ZONE"))));
  }
}


text:
from django.conf import settings

from celery.task import task

from mail import send_email
from shortcuts import render_send_email

@task(name="mailing.queue_send_email")
def queue_send_email(recipients, subject, text_content=None, html_content=None, from_email=settings.DEFAULT_FROM_EMAIL, use_base_template=True, category=None, fail_silently=False, language=None, cc=None, bcc=None, attachments=None, headers=None, bypass_hijacking=False, attach_files=None):

    logger = queue_send_email.get_logger()
    logger.debug('Sending %s to %s' % (subject, ','.join(recipients), ))

    send_email(recipients=recipients, subject=subject, text_content=text_content, html_content=html_content, from_email=from_email, use_base_template=use_base_template, category=category, fail_silently=fail_silently, language=language, cc=cc, bcc=bcc, attachments=attachments, headers=headers, bypass_queue=True, bypass_hijacking=bypass_hijacking, attach_files=attach_files)

    return True

@task(name="mailing.queue_render_send_email")
def queue_render_send_email(recipients, template, data, from_email=settings.DEFAULT_FROM_EMAIL, subject=None, use_base_template=True, category=None, fail_silently=False, language=None, cc=None, bcc=None, attachments=None, headers=None, bypass_hijacking=False, attach_files=None):

    logger = queue_render_send_email.get_logger()

    logger.debug('Rendering and sending %s to %s' % (template, ','.join(recipients), ))

    render_send_email(recipients=recipients, template=template, data=data, from_email=from_email, subject=subject, use_base_template=use_base_template, category=category, fail_silently=fail_silently, language=language, cc=cc, bcc=bcc, attachments=attachments, headers=headers, bypass_queue=True, bypass_hijacking=bypass_hijacking, attach_files=attach_files)

    return True


text:
default['icinga2']['web2']['enable'] = false
default['icinga2']['web2']['source_url'] = 'git://git.icinga.org/icingaweb2.git'
default['icinga2']['web2']['version'] = 'v2.0.0-rc1'
default['icinga2']['web2']['web_root'] = '/usr/share/icingaweb2'
default['icinga2']['web2']['web_uri'] = '/icingaweb2'
default['icinga2']['web2']['conf_dir'] = '/etc/icingaweb2'
default['icinga2']['web2']['log_dir'] = '/var/log/icingaweb2'


text:
'use strict';
'use strong';

const test = require('tap').test;
const endpoint = require('endpoint');
const institutions = require('./index.js');

test('keys are numbers, items are objects', {timeout: 0}, function (t) {
  institutions().pipe(endpoint({ objectMode: true }, function (err, items) {
    t.ifError(err);
    t.ok(items.length > 0);

    for (const item of items) {
      t.ok(typeof item === 'object' && item !== null, 'item is object');
      t.ok(typeof item.instnr === 'number', 'instr is number');
    }
    t.end();
  }));
});


text:
#include "MainMenuScene.h"

/*
 * Constructor
 */
MainMenuScene::MainMenuScene() {

}

/*
 * Destructor
 */
MainMenuScene::~MainMenuScene() {

}

/*
 * Renders the current scene
 * Shows the Help Data for the Game.
 */
bool MainMenuScene::render(std::shared_ptr<GameModel> gameModelPtr, std::shared_ptr<GameController> gameControllerPtr)
{
	std::cout<<"---------------------------------------------------------------------------"<<std::endl;
	std::cout<<"*************************MasterMind Game*****************************************"<<std::endl;
	std::cout<<"---------------------------------------------------------------------------"<<std::endl;

	std::cout<<"Main Menu :: "<<std::endl;
	std::cout<<"1 :: Start The Game"<<std::endl;
	std::cout<<"2 :: Help"<<std::endl;
	std::cout<<"3 :: Exit"<<std::endl;
	std::cout<<"Please Enter your choice  :: ";
	int choice = 0;
	std::cin>>choice;
	if(choice == 1)
		gameControllerPtr->startGame();
	else if(choice == 2)
		gameControllerPtr->gotoHelpMenu();
	else if(choice == 3)
		return false;
	else
		std::cout<<"Wrong Input, Please Retry"<<std::endl;
	return true;

}


text:
layout: post
title: Some Notes on Design Patterns & Anti-Patterns
---

AntiPatterns

solutions that create more problems than it solves
cut and paste programming

Christopher Alexander Architecture
Gang of Four
Akroyd Antipatterns

Understanding of common solutions
informed of bad practices
common vocabulary
understanding in organization

development antipatterns
architecture antipatterns
management antipatterns

God/Blob Class
One controller for processing and many classes for data
Procedural design instead of Object Oriented design

Symptons
A class with many function and attributes
A controller class with operations whose required operations are in different classes
Bad OOD

Consequences

Inflexible to extend
Reduces reusability
Affects performance

Solution
Identify related attributes in God Class
Move to appropriate classes to reduce complexity
Remove indirect associations
Use inheritance properly

Two types of God Class
Behavioral form - object has all behaviors tied to it
Data form - object has all data run through it

Lava Flow/Dead Code
dead code lying into application

This is what happens when code is inherited and does nothing about it. Nobody wants to touch it.
Research project end up as application
Prototype

Symptoms
Lof of undocumented code /complex code that has nothing to do w architecture
improper architecture

Consequences
Lack of configuration/process management
Insufficient architecture leads to code fragment

Solution
Development on complete architecture
Defined development process
Address architectural problems first
Document the complete system


text:
import {SourceMapGenerator} from 'source-map';
import * as ts from 'typescript';

import {Rewriter} from './rewriter';
import {assertTypeChecked, TypeTranslator} from './type-translator';
import {toArray} from './util';

export const ANNOTATION_SUPPORT_CODE = `
interface DecoratorInvocation {
  type: Function;
  args?: any[];
}
`;

// ClassRewriter rewrites a single "class Foo {...}" declaration.
// It's its own object because we collect decorators on the class and the ctor
// separately for each class we encounter.
class ClassRewriter extends Rewriter {
  /** Decorators on the class itself. */
  decorators: ts.Decorator[];
  /** The constructor parameter list and decorators on each param. */
  ctorParameters: ([string | undefined, ts.Decorator[]|undefined]|null)[];
  /** Per-method decorators. */
  propDecorators: Map<string, ts.Decorator[]>;

  constructor(private typeChecker: ts.TypeChecker, sourceFile: ts.SourceFile) {
    super(sourceFile);
  }

  /**
   * Determines whether the given decorator should be re-written as an annotation.
   */
  private shouldLower(decorator: ts.Decorator) {
    // Walk down the expression to find the identifier of the decorator function
    let node: ts.Node = decorator;
    while (node.kind !== ts.SyntaxKind.Identifier) {
      switch (node.kind) {
        case ts.SyntaxKind.Decorator:
          node = (node as ts.Decorator).expression;
          break;
        case ts.SyntaxKind.CallExpression:
          node = (node as ts.CallExpression).expression;
          break;
        default:
          return false;
      }
    }

    let decSym = this.typeChecker.getSymbolAtLocation(node);
    if (decSym.flags & ts.SymbolFlags.Alias) {
      decSym = this.typeChecker.getAliasedSymbol(decSym);
    }
    return decSym.getDocumentationComment().some(c => c.text.indexOf('@Annotation') >= 0);
  }

  private decoratorsToLower(n: ts.Node): ts.Decorator[] {
    if (n.decorators) {
      return n.decorators.filter((d) => this.shouldLower(d));
    }
    return [];
  }

  /**
   * process is the main entry point, rewriting a single class node.
   */
  process(node: ts.ClassDeclaration): {output: string, diagnostics: ts.Diagnostic[]} {
    if (node.decorators) {
      let toLower = this.decoratorsToLower(node);
      if (toLower.length > 0) this.decorators = toLower;
    }

    // Emit the class contents, but stop just before emitting the closing curly brace.
    // (This code is the same as Rewriter.writeNode except for the curly brace handling.)
    let pos = node.getFullStart();
    ts.forEachChild(node, child => {
      // This forEachChild handles emitting the text between each child, while child.visit
      // recursively emits the children themselves.
      this.writeRange(pos, child.getFullStart());
      this.visit(child);
      pos = child.getEnd();
    });

    // At this point, we've emitted up through the final child of the class, so all that
    // remains is the trailing whitespace and closing curly brace.
    // The final character owned by the class node should always be a '}',
    // or we somehow got the AST wrong and should report an error.
    // (Any whitespace or semicolon following the '}' will be part of the next Node.)
    if (this.file.text[node.getEnd() - 1] !== '}') {
      this.error(node, 'unexpected class terminator');
    }
    this.writeRange(pos, node.getEnd() - 1);
    this.emitMetadata();
    this.emit('}');
    return this.getOutput();
  }

  /**
   * gatherConstructor grabs the parameter list and decorators off the class
   * constructor, and emits nothing.
   */
  private gatherConstructor(ctor: ts.ConstructorDeclaration) {
    let ctorParameters: ([string | undefined, ts.Decorator[] | undefined]|null)[] = [];
    let hasDecoratedParam = false;
    for (let param of ctor.parameters) {
      let paramCtor: string|undefined;
      let decorators: ts.Decorator[]|undefined;
      if (param.decorators) {
        decorators = this.decoratorsToLower(param);
        hasDecoratedParam = decorators.length > 0;
      }
      if (param.type) {
        // param has a type provided, e.g. "foo: Bar".
        // Verify that "Bar" is a value (e.g. a constructor) and not just a type.
        let sym = this.typeChecker.getTypeAtLocation(param.type).getSymbol();
        if (sym && (sym.flags & ts.SymbolFlags.Value)) {
          paramCtor = new TypeTranslator(this.typeChecker, param.type).symbolToString(sym);
        }
      }
      if (paramCtor || decorators) {
        ctorParameters.push([paramCtor, decorators]);
      } else {
        ctorParameters.push(null);
      }
    }

    // Use the ctor parameter metadata only if the class or the ctor was decorated.
    if (this.decorators || hasDecoratedParam) {
      this.ctorParameters = ctorParameters;
    }
  }

  /**
   * gatherMethod grabs the decorators off a class method and emits nothing.
   */
  private gatherMethodOrProperty(method: ts.Declaration) {
    if (!method.decorators) return;
    if (!method.name || method.name.kind !== ts.SyntaxKind.Identifier) {
      // Method has a weird name, e.g.
      //   [Symbol.foo]() {...}
      this.error(method, 'cannot process decorators on strangely named method');
      return;
    }

    let name = (method.name as ts.Identifier).text;
    let decorators: ts.Decorator[] = this.decoratorsToLower(method);
    if (decorators.length === 0) return;
    if (!this.propDecorators) this.propDecorators = new Map<string, ts.Decorator[]>();
    this.propDecorators.set(name, decorators);
  }

  /**
   * maybeProcess is called by the traversal of the AST.
   * @return True if the node was handled, false to have the node emitted as normal.
   */
  protected maybeProcess(node: ts.Node): boolean {
    switch (node.kind) {
      case ts.SyntaxKind.ClassDeclaration:
        // Encountered a new class while processing this class; use a new separate
        // rewriter to gather+emit its metadata.
        let {output, diagnostics} =
            new ClassRewriter(this.typeChecker, this.file).process(node as ts.ClassDeclaration);
        this.diagnostics.push(...diagnostics);
        this.emit(output);
        return true;
      case ts.SyntaxKind.Constructor:
        this.gatherConstructor(node as ts.ConstructorDeclaration);
        return false;  // Proceed with ordinary emit of the ctor.
      case ts.SyntaxKind.PropertyDeclaration:
      case ts.SyntaxKind.SetAccessor:
      case ts.SyntaxKind.GetAccessor:
      case ts.SyntaxKind.MethodDeclaration:
        this.gatherMethodOrProperty(node as ts.Declaration);
        return false;  // Proceed with ordinary emit of the method.
      case ts.SyntaxKind.Decorator:
        if (this.shouldLower(node as ts.Decorator)) {
          // Return true to signal that this node should not be emitted,
          // but still emit the whitespace *before* the node.
          this.writeRange(node.getFullStart(), node.getStart());
          return true;
        }
        return false;
      default:
        return false;
    }
  }

  /**
   * emitMetadata emits the various gathered metadata, as static fields.
   */
  private emitMetadata() {
    if (this.decorators) {
      this.emit(`static decorators: DecoratorInvocation[] = [\n`);
      for (let annotation of this.decorators) {
        this.emitDecorator(annotation);
        this.emit(',\n');
      }
      this.emit('];\n');
    }

    if (this.decorators || this.ctorParameters) {
      this.emit(`/** @nocollapse */\n`);
      // ctorParameters may contain forward references in the type: field, so wrap in a function
      // closure
      this.emit(
          `static ctorParameters: () => ({type: any, decorators?: DecoratorInvocation[]}|null)[] = () => [\n`);
      for (let param of this.ctorParameters || []) {
        if (!param) {
          this.emit('null,\n');
          continue;
        }
        let [ctor, decorators] = param;
        this.emit(`{type: ${ctor}, `);
        if (decorators) {
          this.emit('decorators: [');
          for (let decorator of decorators) {
            this.emitDecorator(decorator);
            this.emit(', ');
          }
          this.emit(']');
        }
        this.emit('},\n');
      }
      this.emit(`];\n`);
    }

    if (this.propDecorators) {
      this.emit('static propDecorators: {[key: string]: DecoratorInvocation[]} = {\n');
      for (let name of toArray(this.propDecorators.keys())) {
        this.emit(`'${name}': [`);

        for (let decorator of this.propDecorators.get(name)!) {
          this.emitDecorator(decorator);
          this.emit(',');
        }
        this.emit('],\n');
      }
      this.emit('};\n');
    }
  }

  private emitDecorator(decorator: ts.Decorator) {
    this.emit('{ type: ');
    let expr = decorator.expression;
    switch (expr.kind) {
      case ts.SyntaxKind.Identifier:
        // The decorator was a plain @Foo.
        this.visit(expr);
        break;
      case ts.SyntaxKind.CallExpression:
        // The decorator was a call, like @Foo(bar).
        let call = expr as ts.CallExpression;
        this.visit(call.expression);
        if (call.arguments.length) {
          this.emit(', args: [');
          for (let arg of call.arguments) {
            this.emit(arg.getText());
            this.emit(', ');
          }
          this.emit(']');
        }
        break;
      default:
        this.errorUnimplementedKind(expr, 'gathering metadata');
        this.emit('undefined');
    }
    this.emit(' }');
  }
}

class DecoratorRewriter extends Rewriter {
  constructor(private typeChecker: ts.TypeChecker, sourceFile: ts.SourceFile) {
    super(sourceFile);
  }

  process(): {output: string, diagnostics: ts.Diagnostic[], sourceMap: SourceMapGenerator} {
    this.visit(this.file);
    return this.getOutput();
  }

  protected maybeProcess(node: ts.Node): boolean {
    switch (node.kind) {
      case ts.SyntaxKind.ClassDeclaration:
        let {output, diagnostics} =
            new ClassRewriter(this.typeChecker, this.file).process(node as ts.ClassDeclaration);
        this.diagnostics.push(...diagnostics);
        this.emit(output);
        return true;
      default:
        return false;
    }
  }
}

export function convertDecorators(typeChecker: ts.TypeChecker, sourceFile: ts.SourceFile):
    {output: string, diagnostics: ts.Diagnostic[], sourceMap: SourceMapGenerator} {
  assertTypeChecked(sourceFile);
  return new DecoratorRewriter(typeChecker, sourceFile).process();
}


text:
package com.linkedin.thirdeye.api;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Wrapper class to represent the metric schema <code>
 * e.g.
 * </code>
 *
 * @author kgopalak
 *
 */
public class MetricSchema {

  int[] coloffsets;

  private final List<MetricType> types;

  private int rowSize;

  Map<String, Integer> mapping;

  private final List<String> names;

  public MetricSchema(List<String> names, List<MetricType> types) {
    this.names = names;
    mapping = new HashMap<String, Integer>();
    this.types = types;
    int rowSize = 0;
    coloffsets = new int[names.size()];
    for (int i = 0; i < types.size(); i++) {
      coloffsets[i] = rowSize;
      rowSize += types.get(i).byteSize();
      mapping.put(names.get(i), i);
    }
    this.rowSize = rowSize;
  }

  public int getRowSizeInBytes() {
    return rowSize;
  }

  public int getOffset(String name) {
    return coloffsets[mapping.get(name)];
  }

  public int getNumMetrics() {
    return types.size();
  }

  public String getMetricName(int index) {
    return names.get(index);
  }

  public MetricType getMetricType(int index) {
    return types.get(index);
  }

  public MetricType getMetricType(String name) {
    return types.get(mapping.get(name));
  }

  public List<String> getNames() {
    return names;
  }

  public static MetricSchema fromMetricSpecs(List<MetricSpec> metricSpecs)
  {
    List<String> metricNames = new ArrayList<String>(metricSpecs.size());
    List<MetricType> metricTypes = new ArrayList<MetricType>(metricSpecs.size());

    for (MetricSpec metricSpec : metricSpecs)
    {
      metricNames.add(metricSpec.getName());
      metricTypes.add(metricSpec.getType());
    }

    return new MetricSchema(metricNames, metricTypes);
  }

  @Override
  public boolean equals(Object o)
  {
    if (!(o instanceof MetricSchema))
    {
      return false;
    }

    MetricSchema s = (MetricSchema) o;

    return names.equals(s.names) && types.equals(s.types);
  }

  @Override
  public int hashCode()
  {
    return names.hashCode() + 13 * types.hashCode();
  }
}


text:
{% extends "password_reset/base.html" %}
{% load i18n %}
{% load i18n grp_tags %}

{% block title %}{% trans "Password recovery sent" %}{% endblock %}

{% block content %}

    <fieldset class="grp-module grp-module-login">

            {% if grappelli_admin_title %}{{ grappelli_admin_title }}{% else %}{% get_admin_title %}{% endif %}
            {% trans "Password Recovery" %}

{% blocktrans with ago=timestamp|timesince %}An email was sent to the email address associated with this account {{ ago }} ago. Use the link in it to set a new password.{% endblocktrans %}

    </fieldset>

        Back to Login

{% endblock %}


text:
//Originally by David Dahl and released under the BSD license (used with permission).  See Package.scala for details

package org.apache.zeppelin.rinterpreter.rscala

// TODO:  Add libdir to constructor

import java.io._
import java.net.{InetAddress, ServerSocket}

import org.slf4j.{Logger, LoggerFactory}

import scala.language.dynamics

class RClient (private val in: DataInputStream,
               private val out: DataOutputStream,
               val debug: Boolean = true) extends Dynamic {
  var damagedState : Boolean = false
  private val logger: Logger = LoggerFactory.getLogger(getClass)

  case class RObjectRef(val reference : String)  {
    override def toString() = ".$"+reference
  }

  /** __For rscala developers only__: Sets whether debugging output should be displayed. */
  def debug_=(v: Boolean) = {
    if ( v != debug ) {
      if ( debug ) logger.debug("Sending DEBUG request.")
      out.writeInt(RClient.Protocol.DEBUG)
      out.writeInt(if ( v ) 1 else 0)
      out.flush()
    }
  }

  def exit() = {
    logger.debug("Sending EXIT request.")
    out.writeInt(RClient.Protocol.EXIT)
    out.flush()
  }

  def eval(snippet: String, evalOnly: Boolean = true): Any = try {
    if (damagedState) throw new RException("Connection to R already damaged")
    logger.debug("Sending EVAL request.")
    out.writeInt(RClient.Protocol.EVAL)
    RClient.writeString(out,snippet)
    out.flush()
    val status = in.readInt()
    val output = RClient.readString(in)
    if ( output != "" ) {
      logger.error("R Error " + snippet + " " + output)
      throw new RException(snippet, output)
    }
    if ( status != RClient.Protocol.OK ) throw new RException(snippet, output, "Error in R evaluation.")
    if ( evalOnly ) null else get(".rzeppelin.last.value")._1
  } catch {
    case e : java.net.SocketException => {
      logger.error("Connection to R appears to have shut down" + e)
      damagedState = true
    }
  }

  def evalI0(snippet: String) = { eval(snippet,true); getI0(".rzeppelin.last.value") }

  def evalB0(snippet: String) = { eval(snippet,true); getB0(".rzeppelin.last.value") }

  def evalS0(snippet: String) = { eval(snippet,true); getS0(".rzeppelin.last.value") }

  def evalI1(snippet: String) = { eval(snippet,true); getI1(".rzeppelin.last.value") }

  def evalB1(snippet: String) = { eval(snippet,true); getB1(".rzeppelin.last.value") }

  def evalS1(snippet: String) = { eval(snippet,true); getS1(".rzeppelin.last.value") }

  def evalR( snippet: String) = { eval(snippet,true); getR( ".rzeppelin.last.value") }

  def set(identifier: String, value: Any): Unit = set(identifier,value,"",true)

  def set(identifier: String, value: Any, index: String = "", singleBrackets: Boolean = true): Unit = {
    if (damagedState) throw new RException("Connection to R already damaged")
    val v = value
    if ( index == "" ) out.writeInt(RClient.Protocol.SET)
    else if ( singleBrackets ) {
      out.writeInt(RClient.Protocol.SET_SINGLE)
      RClient.writeString(out,index)
    } else {
      out.writeInt(RClient.Protocol.SET_DOUBLE)
      RClient.writeString(out,index)
    }
    RClient.writeString(out,identifier)
    if ( v == null || v.isInstanceOf[Unit] ) {
      logger.debug("... which is null")
      out.writeInt(RClient.Protocol.NULLTYPE)
      out.flush()
      if ( index != "" ) {
        val status = in.readInt()
        if ( status != RClient.Protocol.OK ) {
          val output = RClient.readString(in)
          if ( output != "" ) {
            logger.error("R error setting " + output)
            throw new RException(identifier + value.toString(), output, "Error setting")
          }
          throw new RException("Error in R evaluation. Set " + identifier + " to " + value.toString())
        }
      }
      return
    }
    val c = v.getClass
    logger.debug("... whose class is: "+c)
    logger.debug("... and whose value is: "+v)
    if ( c.isArray ) {
      c.getName match {
        case "[I" =>
          val vv = v.asInstanceOf[Array[Int]]
          out.writeInt(RClient.Protocol.VECTOR)
          out.writeInt(vv.length)
          out.writeInt(RClient.Protocol.INTEGER)
          for ( i <- 0 until vv.length ) out.writeInt(vv(i))
        case "[Z" =>
          val vv = v.asInstanceOf[Array[Boolean]]
          out.writeInt(RClient.Protocol.VECTOR)
          out.writeInt(vv.length)
          out.writeInt(RClient.Protocol.BOOLEAN)
          for ( i <- 0 until vv.length ) out.writeInt(if ( vv(i) ) 1 else 0)
        case "[Ljava.lang.String;" =>
          val vv = v.asInstanceOf[Array[String]]
          out.writeInt(RClient.Protocol.VECTOR)
          out.writeInt(vv.length)
          out.writeInt(RClient.Protocol.STRING)
          for ( i <- 0 until vv.length ) RClient.writeString(out,vv(i))
        case _ =>
          throw new RException("Unsupported array type: "+c.getName)
      }
    } else {
      c.getName match {
        case "java.lang.Integer" =>
          out.writeInt(RClient.Protocol.ATOMIC)
          out.writeInt(RClient.Protocol.INTEGER)
          out.writeInt(v.asInstanceOf[Int])
        case "java.lang.Boolean" =>
          out.writeInt(RClient.Protocol.ATOMIC)
          out.writeInt(RClient.Protocol.BOOLEAN)
          out.writeInt(if (v.asInstanceOf[Boolean]) 1 else 0)
        case "java.lang.String" =>
          out.writeInt(RClient.Protocol.ATOMIC)
          out.writeInt(RClient.Protocol.STRING)
          RClient.writeString(out,v.asInstanceOf[String])
        case _ =>
          throw new RException("Unsupported non-array type: "+c.getName)
      }
    }
    out.flush()
    if ( index != "" ) {
      val status = in.readInt()
      if ( status != RClient.Protocol.OK ) {
        val output = RClient.readString(in)
        if ( output != "" ) throw new RException(identifier + value.toString(), output, "Error setting")
        throw new RException("Error in R evaluation.")
      }
    }
  }

  def get(identifier: String, asReference: Boolean = false): (Any,String) = {
    logger.debug("Getting: "+identifier)
    out.writeInt(if ( asReference ) RClient.Protocol.GET_REFERENCE else RClient.Protocol.GET)
    RClient.writeString(out,identifier)
    out.flush()
    if ( asReference ) {
      val r = in.readInt() match {
        case RClient.Protocol.REFERENCE => (RObjectRef(RClient.readString(in)),"RObject")
        case RClient.Protocol.UNDEFINED_IDENTIFIER =>
          throw new RException("Undefined identifier")
      }
      return r
    }
    in.readInt match {
      case RClient.Protocol.NULLTYPE =>
        logger.debug("Getting null.")
        (null,"Null")
      case RClient.Protocol.ATOMIC =>
        logger.debug("Getting atomic.")
        in.readInt() match {
          case RClient.Protocol.INTEGER => (in.readInt(),"Int")
          case RClient.Protocol.DOUBLE => (in.readDouble(),"Double")
          case RClient.Protocol.BOOLEAN => (( in.readInt() != 0 ),"Boolean")
          case RClient.Protocol.STRING => (RClient.readString(in),"String")
          case _ => throw new RException("Protocol error")
        }
      case RClient.Protocol.VECTOR =>
        logger.debug("Getting vector...")
        val length = in.readInt()
        logger.debug("... of length: "+length)
        in.readInt() match {
          case RClient.Protocol.INTEGER => (Array.fill(length) { in.readInt() },"Array[Int]")
          case RClient.Protocol.DOUBLE => (Array.fill(length) { in.readDouble() },"Array[Double]")
          case RClient.Protocol.BOOLEAN => (Array.fill(length) { ( in.readInt() != 0 ) },"Array[Boolean]")
          case RClient.Protocol.STRING => (Array.fill(length) { RClient.readString(in) },"Array[String]")
          case _ => throw new RException("Protocol error")
        }
      case RClient.Protocol.MATRIX =>
        logger.debug("Getting matrix...")
        val nrow = in.readInt()
        val ncol = in.readInt()
        logger.debug("... of dimensions: "+nrow+","+ncol)
        in.readInt() match {
          case RClient.Protocol.INTEGER => (Array.fill(nrow) { Array.fill(ncol) { in.readInt() } },"Array[Array[Int]]")
          case RClient.Protocol.DOUBLE => (Array.fill(nrow) { Array.fill(ncol) { in.readDouble() } },"Array[Array[Double]]")
          case RClient.Protocol.BOOLEAN => (Array.fill(nrow) { Array.fill(ncol) { ( in.readInt() != 0 ) } },"Array[Array[Boolean]]")
          case RClient.Protocol.STRING => (Array.fill(nrow) { Array.fill(ncol) { RClient.readString(in) } },"Array[Array[String]]")
          case _ => throw new RException("Protocol error")
        }
      case RClient.Protocol.UNDEFINED_IDENTIFIER => throw new RException("Undefined identifier")
      case RClient.Protocol.UNSUPPORTED_STRUCTURE => throw new RException("Unsupported data type")
      case _ => throw new RException("Protocol error")
    }
  }

  def getI0(identifier: String): Int = get(identifier) match {
    case (a,"Int") => a.asInstanceOf[Int]
    case (a,"Double") => a.asInstanceOf[Double].toInt
    case (a,"Boolean") => if (a.asInstanceOf[Boolean]) 1 else 0
    case (a,"String") => a.asInstanceOf[String].toInt
    case (a,"Array[Int]") => a.asInstanceOf[Array[Int]](0)
    case (a,"Array[Double]") => a.asInstanceOf[Array[Double]](0).toInt
    case (a,"Array[Boolean]") => if ( a.asInstanceOf[Array[Boolean]](0) ) 1 else 0
    case (a,"Array[String]") => a.asInstanceOf[Array[String]](0).toInt
    case (_,tp) => throw new RException(s"Unable to cast ${tp} to Int")
  }

  def getD0(identifier: String): Double = get(identifier) match {
    case (a,"Int") => a.asInstanceOf[Int].toDouble
    case (a,"Double") => a.asInstanceOf[Double]
    case (a,"Boolean") => if (a.asInstanceOf[Boolean]) 1.0 else 0.0
    case (a,"String") => a.asInstanceOf[String].toDouble
    case (a,"Array[Int]") => a.asInstanceOf[Array[Int]](0).toDouble
    case (a,"Array[Double]") => a.asInstanceOf[Array[Double]](0)
    case (a,"Array[Boolean]") => if ( a.asInstanceOf[Array[Boolean]](0) ) 1.0 else 0.0
    case (a,"Array[String]") => a.asInstanceOf[Array[String]](0).toDouble
    case (_,tp) => throw new RException(s"Unable to cast ${tp} to Double")
  }

  def getB0(identifier: String): Boolean = get(identifier) match {
    case (a,"Int") => a.asInstanceOf[Int] != 0
    case (a,"Boolean") => a.asInstanceOf[Boolean]
    case (a,"String") => a.asInstanceOf[String].toLowerCase != "false"
    case (a,"Array[Int]") => a.asInstanceOf[Array[Int]](0) != 0
    case (a,"Array[Boolean]") => a.asInstanceOf[Array[Boolean]](0)
    case (a,"Array[String]") => a.asInstanceOf[Array[String]](0).toLowerCase != "false"
    case (_,tp) => throw new RException(s"Unable to cast ${tp} to Boolean")
  }

  def getS0(identifier: String): String = get(identifier) match {
    case (a,"Int") => a.asInstanceOf[Int].toString
    case (a,"Boolean") => a.asInstanceOf[Boolean].toString
    case (a,"String") => a.asInstanceOf[String]
    case (a,"Array[Int]") => a.asInstanceOf[Array[Int]](0).toString
    case (a,"Array[Boolean]") => a.asInstanceOf[Array[Boolean]](0).toString
    case (a,"Array[String]") => a.asInstanceOf[Array[String]](0)
    case (_,tp) => throw new RException(s"Unable to cast ${tp} to String")
  }

  def getI1(identifier: String): Array[Int] = get(identifier) match {
    case (a,"Int") => Array(a.asInstanceOf[Int])
    case (a,"Boolean") => Array(if (a.asInstanceOf[Boolean]) 1 else 0)
    case (a,"String") => Array(a.asInstanceOf[String].toInt)
    case (a,"Array[Int]") => a.asInstanceOf[Array[Int]]
    case (a,"Array[Boolean]") => a.asInstanceOf[Array[Boolean]].map(x => if (x) 1 else 0)
    case (a,"Array[String]") => a.asInstanceOf[Array[String]].map(_.toInt)
    case (_,tp) => throw new RException(s"Unable to cast ${tp} to Array[Int]")
  }

  def getB1(identifier: String): Array[Boolean] = get(identifier) match {
    case (a,"Int") => Array(a.asInstanceOf[Int] != 0)
    case (a,"Boolean") => Array(a.asInstanceOf[Boolean])
    case (a,"String") => Array(a.asInstanceOf[String].toLowerCase != "false")
    case (a,"Array[Int]") => a.asInstanceOf[Array[Int]].map(_ != 0)
    case (a,"Array[Boolean]") => a.asInstanceOf[Array[Boolean]]
    case (a,"Array[String]") => a.asInstanceOf[Array[String]].map(_.toLowerCase != "false")
    case (_,tp) => throw new RException(s"Unable to cast ${tp} to Array[Boolean]")
  }

  def getS1(identifier: String): Array[String] = get(identifier) match {
    case (a,"Int") => Array(a.asInstanceOf[Int].toString)
    case (a,"Boolean") => Array(a.asInstanceOf[Boolean].toString)
    case (a,"String") => Array(a.asInstanceOf[String])
    case (a,"Array[Int]") => a.asInstanceOf[Array[Int]].map(_.toString)
    case (a,"Array[Boolean]") => a.asInstanceOf[Array[Boolean]].map(_.toString)
    case (a,"Array[String]") => a.asInstanceOf[Array[String]]
    case (_,tp) => throw new RException(s"Unable to cast ${tp} to Array[String]")
  }

  def getR(identifier: String): RObjectRef = get(identifier,true) match {
    case (a,"RObject") => a.asInstanceOf[RObjectRef]
    case (_,tp) => throw new RException(s"Unable to cast ${tp} to RObject")
  }

  def gc(): Unit = {
    logger.debug("Sending GC request.")
    out.writeInt(RClient.Protocol.GC)
    out.flush()
  }

}

object RClient {

  object Protocol {

    // Data Types
    val UNSUPPORTED_TYPE = 0
    val INTEGER = 1
    val DOUBLE =  2
    val BOOLEAN = 3
    val STRING =  4
    val DATE = 5
    val DATETIME = 6

    // Data Structures
    val UNSUPPORTED_STRUCTURE = 10
    val NULLTYPE  = 11
    val REFERENCE = 12
    val ATOMIC    = 13
    val VECTOR    = 14
    val MATRIX    = 15
    val LIST      = 16
    val DATAFRAME = 17
    val S3CLASS   = 18
    val S4CLASS   = 19
    val JOBJ      = 20

    // Commands
    val EXIT          = 100
    val RESET         = 101
    val GC            = 102
    val DEBUG         = 103
    val EVAL          = 104
    val SET           = 105
    val SET_SINGLE    = 106
    val SET_DOUBLE    = 107
    val GET           = 108
    val GET_REFERENCE = 109
    val DEF           = 110
    val INVOKE        = 111
    val SCALAP        = 112

    // Result
    val OK = 1000
    val ERROR = 1001
    val UNDEFINED_IDENTIFIER = 1002

    // Misc.
    val CURRENT_SUPPORTED_SCALA_VERSION = "2.10"

  }

  def writeString(out: DataOutputStream, string: String): Unit = {
    val bytes = string.getBytes("UTF-8")
    val length = bytes.length
    out.writeInt(length)
    out.write(bytes,0,length)
  }

  def readString(in: DataInputStream): String = {
    val length = in.readInt()
    val bytes = new Array[Byte](length)
    in.readFully(bytes)
    new String(bytes,"UTF-8")
  }

  def isMatrix[T](x: Array[Array[T]]): Boolean = {
    if ( x.length != 0 ) {
      val len = x(0).length
      for ( i <- 1 until x.length ) {
        if ( x(i).length != len ) return false
      }
    }
    true
  }

  import scala.sys.process._
  private val logger: Logger = LoggerFactory.getLogger(getClass)
  val OS = sys.props("os.name").toLowerCase match {
    case s if s.startsWith("""windows""") => "windows"
    case s if s.startsWith("""linux""") => "linux"
    case s if s.startsWith("""unix""") => "linux"
    case s if s.startsWith("""mac""") => "macintosh"
    case _ => throw new RException("Unrecognized OS")
  }

  val defaultArguments = OS match {
    case "windows" =>    Array[String]("--vanilla","--silent","--slave","--ess")
    case "linux" =>      Array[String]("--vanilla","--silent","--slave","--interactive")
    case "unix" =>       Array[String]("--vanilla","--silent","--slave","--interactive")
    case "macintosh" =>  Array[String]("--vanilla","--silent","--slave","--interactive")
  }

  lazy val defaultRCmd = OS match {
    case "windows" =>   findROnWindows
    case "linux" =>     """R"""
    case "unix" =>      """R"""
    case "macintosh" => """R"""
  }

  def findROnWindows: String = {
    val NEWLINE = sys.props("line.separator")
    var result : String = null
    for ( root <- List("HKEY_LOCAL_MACHINE","HKEY_CURRENT_USER") ) {
      val out = new StringBuilder()
      val logger = ProcessLogger((o: String) => { out.append(o); out.append(NEWLINE) },(e: String) => {})
      try {
        ("reg query \"" + root + "\\Software\\R-core\\R\" /v \"InstallPath\"") ! logger
        val a = out.toString.split(NEWLINE).filter(_.matches("""^\s*InstallPath\s*.*"""))(0)
        result = a.split("REG_SZ")(1).trim() + """\bin\R.exe"""
      } catch {
        case _ : Throwable =>
      }
    }
    if ( result == null ) throw new RException("Cannot locate R using Windows registry.")
    else return result
  }

  def reader(label: String)(input: InputStream) = {
    val in = new BufferedReader(new InputStreamReader(input))
    var line = in.readLine()
    while ( line != null ) {
      logger.debug(label+line)
      line = in.readLine()
    }
    in.close()
  }

  class ScalaSockets(portsFilename: String) {
    private val logger: Logger = LoggerFactory.getLogger(getClass)

    val serverIn  = new ServerSocket(0,0,InetAddress.getByName(null))
    val serverOut = new ServerSocket(0,0,InetAddress.getByName(null))

    locally {
      logger.info("Trying to open ports filename: "+portsFilename)
      val portNumberFile = new File(portsFilename)
      val p = new PrintWriter(portNumberFile)
      p.println(serverIn.getLocalPort+" "+serverOut.getLocalPort)
      p.close()
      logger.info("Servers are running on port "+serverIn.getLocalPort+" "+serverOut.getLocalPort)
    }

    val socketIn = serverIn.accept
    logger.info("serverinaccept done")
    val in = new DataInputStream(new BufferedInputStream(socketIn.getInputStream))
    logger.info("in has been created")
    val socketOut = serverOut.accept
    logger.info("serverouacceptdone")
    val out = new DataOutputStream(new BufferedOutputStream(socketOut.getOutputStream))
    logger.info("out is done")
  }

  def makeSockets(portsFilename : String) = new ScalaSockets(portsFilename)

  def apply(): RClient = apply(defaultRCmd)

  def apply(rCmd: String, libdir : String = "",debug: Boolean = false, timeout: Int = 60): RClient = {
    logger.debug("Creating processIO")
    var cmd: PrintWriter = null
    val command = rCmd +: defaultArguments
    val processCmd = Process(command)

    val processIO = new ProcessIO(
      o => { cmd = new PrintWriter(o) },
      reader("STDOUT DEBUG: "),
      reader("STDERR DEBUG: "),
      true
    )
    val portsFile = File.createTempFile("rscala-","")
    val processInstance = processCmd.run(processIO)
    val snippet = s"""
rscala:::rServe(rscala:::newSockets('${portsFile.getAbsolutePath.replaceAll(File.separator,"/")}',debug=${if ( debug ) "TRUE" else "FALSE"},timeout=${timeout}))
q(save='no')
    """
    while ( cmd == null ) Thread.sleep(100)
    logger.info("sending snippet " + snippet)
    cmd.println(snippet)
    cmd.flush()
    val sockets = makeSockets(portsFile.getAbsolutePath)
    sockets.out.writeInt(Protocol.OK)
    sockets.out.flush()
    try {
      assert( readString(sockets.in) == org.apache.zeppelin.rinterpreter.rscala.Version )
    } catch {
      case _: Throwable => throw new RException("The scala and R versions of the package don't match")
    }
    apply(sockets.in,sockets.out)
  }

  /** __For rscala developers only__: Returns an instance of the [[RClient]] class.  */
  def apply(in: DataInputStream, out: DataOutputStream): RClient = new RClient(in,out)

}


text:
<META http-equiv="content-type" content="text/html;charset=iso-8859-9"/><meta name="viewport" content="width=device-width, initial-scale=1"><title>ac</title> <link rel="stylesheet"  href="css/jquery.mobile-1.2.0.css" />

ABDÜLMUGÝS BÝN ZÜHEYR

Geri

Baðdad'da yetiþen âlim ve evliyâdan. Ýsmi Abdülmugîs bin Züheyr bin Alevî'dir. 1106

(H.500) senesinde doðdu. Ýlim ve edeb üzere yetiþti. Haram ve þüpheli her þeyden þiddetle
kaçýnýrdý. 1187 (H.583) senesi Muharrem ayýnýn on üçüncü Cumâ günü vefât etti. Dört hak
mezhebden birisinin kurucusu olan Ahmed bin Hanbel hazretlerinin kabri yakýnýna
defnedildi.
Abdülmugîs bin Züheyr Baðdad'da zamânýn en meþhur âlim ve evliyâsýnýn sohbet ve
derslerinde yetiþti. Güvenilir bir kiþi oldu. Bilhassa hadîs-i þerîf ilminde üstün bir dereceye
yükseldi. Ebü'l-Kâsým bin Hüseyin, Ebü'l-Ýz bin Kâdeþ, Ebû Gâlib, Ebû Abdullah bin Ali bin
el-Bennâ, Ebü'l-Hüseyin bin Ferrâ, el-Müzrefî, Kâdý Ebû Bekr el-Ensârî ders okuduðu
hocalardandýr. Kendisinden de; Muvaffakuddîn, El-Hâfýz Abdülganî, El-Beha Abdurrahmân
el-Makdisiyyûn, El-Fakîh Abdullah Ahmed gibi büyük zâtlar hadîs-i þerîf rivâyetinde
bulundular.

Abdülmugîs hazretleri zamânýnýn büyük âlimleri ve devlet erkânýnýn ileri gelenleri tarafýndan
ziyâret edilirdi. Bir defâsýnda halîfe En-Nâsýr tebdîl-i kýyâfet yaparak yoksul bir kimse
kýlýðýnda Abdülmugîs hazretlerinin ziyâretine gitti. Abdülmugîs hazretleri halîfeyi o kýyâfette
tanýdýysa da belli etmedi. Halîfe; "Yezîd'e lânet etmenin câiz olup olmadýðýný öðrenmek
istiyorum." dedi. Abdülmugîs hazretleri; "Ben þahsen lânet edilmesine karþýyým. Çünkü bu
meseleye câiz diye fetvâ verecek olursak, insanlar þimdiki halîfeyi de lânetleme cesâretini
bulurlar." cevâbýný verdi. Halîfe; "Niçin?" diye sordu. Abdülmugîs hazretleri; "Çünkü halîfe,
hoþ olmayan bir takým iþleri yapmaktadýr." diyerek halîfenin hatâlarýný îmâ etti. Bundan
gâyesi, halîfeyi bu kötü ve çirkin iþlerinden vaz geçirmekti. Halîfe bu sözleri duyunca
yaptýklarýna piþman oldu. Üzerinde hakký olanlarla helallaþtý. Çok geçmeden de vefât etti.

Abdülmugîs hazretleri, Allahü teâlânýn emirlerini yapmaya ve yasaklarýndan kaçýnmaya çok
dikkat ederdi. Dînine baðlýlýðý, Kur'ân-ý kerîm okumaktaki üstünlüðü ile çok meþhûr oldu.
Vefâtýna kadar, insanlarýn kurtuluþ ve saâdeti için çalýþtý.

Dûbeysî der ki: "Abdülmugîs, hadîs-i þerîf toplamak ve rivâyet etmekte büyük bir hassâsiyet
gösterirdi."

Abdülmugîs hazretlerinin cenâze namazý çok kalabalýk oldu. Sevdiklerinden Yâkûb bin
Yûsuf el-Harbî der ki:

"Abdülmugîs'e rüyâda, Allahü teâlâ sana nasýl muâmelede bulundu? diye sordum.
Cevâbýnda; ilim, kabirde insanlarý diriltir. Cehâlet ise, diri insaný ölülere dâhil eder, buyurdu.

El-Ýntisar li-Müsned-il-Ýmâm Ahmed, er-Reddü alel-Müteassýb, Kitâb fi Fedâil-i Yezîd bin
Mu'âviye Abdülmugîs hazretlerinin en önemli kitaplarýdýr.

1) Mu'cem-ül-Müellifîn; c.6, s.178

2) El-Bidâye ven-Nihâye; c.12, s.328

3) Þezerât-üz-Zeheb; c.4, s. 275-276

4) Zeylü Tabakât-ý Hanâbile; c.1, s.354

5) Ýslâm Âlimleri Ansiklopedisi; c.5, s.379


text:
/*//////////////////////////////////////////////////////
	Description
	Java script used to prevent the 3rd convolution
	patch from fading in when the first patch has
	faded in for the first time.

	Author: Lewis Thresh
*///////////////////////////////////////////////////////

inlets = 1;
outlets = 1;

function msg_int(input){
	if(input < 2){
		//Dont send doneLoad2 through
	}else{
		outlet(0,1);
	}
}


text:
int _module_help_log_dom;

#define CRI(...) EINA_LOG_DOM_CRIT(_module_help_log_dom, __VA_ARGS__)
#define DBG(...) EINA_LOG_DOM_DBG(_module_help_log_dom, __VA_ARGS__)
#define NFO(...) EINA_LOG_DOM_INFO(_module_help_log_dom, __VA_ARGS__)
#define ERR(...) EINA_LOG_DOM_ERR(_module_help_log_dom, __VA_ARGS__)

typedef struct _Module_Help
{
   Gotham *gotham;
   Eina_Bool (*access_allowed)(Gotham_Module_Command *, Gotham_Citizen *);
} Module_Help;

void event_help_list(void *data, Gotham_Citizen_Command *command);
#endif


text:
angular.module('ngUpload', []).controller('fileUpload', ["$scope",function ($scope) {
    var tabFileUpload = $("#tabFileUpload");

    //文件列表中的Model
    var fileModel = function () {
        this.IsImage = false;//是否为图片(不包含gif)
        this.Path = "";//原路径
        this.ImgSmallPath = "";//较小尺寸(文件为图片时180*180)
        this.ImgBigPath = "";//较大尺寸(文件为图片时600*600)
        this.Id = "";//选择文件时,自动分配的id
        this.Size = "";//文件大小
        this.Format = "";//文件格式
        this.Name = "";//文件名
        this.ImgWidth = 0;//原图宽度
        this.ImgHeight = 0;//原图高度
        this.ImgPreviewWidth = 0;//裁剪界面中操作的图片的宽度
        this.ImgPreviewHeight = 0;//裁剪界面中操作的图片的高度
        this.ImgPreviewRatio = 0;//当前操作的预览图与原图的比例,因为裁剪的操作是在预览的小图片上面进行的,最终提交上传的时候,是要对原图进行操作,而不是该小图片。
        this.X1 = 0;//编辑预览时的坐标x1
        this.Y1 = 0;//编辑预览时的坐标y1
        this.X2 = 0;//编辑预览时的坐标x2
        this.Y2 = 0;//编辑预览时的坐标y2
        this.W = 0;//编辑预览时,所选的预览图的宽度
        this.H = 0;//编辑预览时,所选的预览图的高度
        this.ImgX1 = 0;//裁剪后的坐标x1
        this.ImgY1 = 0;//裁剪后的坐标y1
        this.ImgX2 = 0;//裁剪后的坐标x2
        this.ImgY2 = 0;//裁剪后的坐标y2
        this.ImgCropWidth = 0;//裁剪后最终图片的宽度
        this.ImgCropHeight = 0;//裁剪后最终图片的高度
        this.ThumbImgSettings = [];//要生成的缩略图选项设置

        this.Title = "";//文件标题
        this.ViewType = "NOR";//查看类型
        this.DownloadCount = 0;//下载数
        this.ViewCount = 0;//查看数
        this.Description = "";//描述

        this.IsUploadSuccess = false;//是否上传成功
        this.UploadMsg = "";//上传结果消息
    };

    //文件编辑中缩略图设置model
    var thumbImgSettingModel = function () {
        this.Width = 0;//宽度
        this.Height = 0;//高度
    };

    //当前文件列表
    $scope.FileModelList = [];

    //是否允许添加待上传文件
    $scope.IsCanAddFile = true;

    //是否允许开始上传的操作
    $scope.IsCanUploadFile = true;

    //是否允许操作每一个文件下方的按钮
    $scope.IsCanOperateFileItem = true;

    //当前在操作中的model(如:查询该文件详情、修改该文件信息)
    $scope.CurrentFileModel = null;

    //上传对象
    var _uploader = null;

    //编辑时的图片裁剪对象
    var _jcp = null;

    /**
     * 根据文件id,返回该文件的json model信息
     */
    var getModelById = function (id) {
        var result = null, _this = this;
        if ($scope.FileModelList) {
            $.each($scope.FileModelList, function (index, n) {
                if (n.Id == id) {
                    result = n;
                    return false;
                }
            });
        }
        return result;
    };

    /**
     * 根据文件id,删除该文件的json model信息
     */
    var removeModelById = function (id) {
        if ($scope.FileModelList) {
            $scope.FileModelList = $.map($scope.FileModelList, function (n) {
                return n.Id == id ? null : n;
            });
        }
        if ($scope.CurrentFileModel && id === $scope.CurrentFileModel.Id) {
            $scope.CurrentFileModel = null;
        }
    };

    /*******************************文件列表页开始*************************************/

    /**
    *改变上传按钮的相关状态(可用、不可用)
    */
    var changeUploadButton = function (enable) {
        if (enable) {
            _uploader.disableBrowse(false);
            $scope.IsCanAddFile = true;
            $scope.IsCanUploadFile = true;
            $scope.IsCanOperateFileItem = true;
        } else {
            _uploader.disableBrowse(true);
            $scope.IsCanAddFile = false;
            $scope.IsCanUploadFile = false;
            $scope.IsCanOperateFileItem = false;
            $scope.CurrentFileModel = null;
        }
    };

    //单击开始上传文件
    $scope.startUpload = function () {
        if (_uploader) {
            _uploader.start();
        }
    };

    //单击清空重来
    $scope.clearFunction = function () {
        $("#fileUploaderProgress").progressbar("setValue", 0);
        $scope.FileModelList = [];
        $scope.CurrentFileModel = null;
        _uploader.splice(0, _uploader.files.length);
        _uploader.refresh();
        changeUploadButton(true);
    };

    //单击修改文件
    $scope.fileEditFunction = function (id) {
        tabFileUpload.tabs('select', "文件设置");
        if ($scope.CurrentFileModel && id == $scope.CurrentFileModel.Id) {
            return false;
        }
        if (_jcp) {
            _jcp.destroy();
        }
        $scope.CurrentFileModel = getModelById(id);
        if (null == $scope.CurrentFileModel.ThumbImgSettings || $scope.CurrentFileModel.ThumbImgSettings.length == 0) {
            $scope.CurrentFileModel.ThumbImgSettings = [new thumbImgSettingModel()];
        }
    };

    //单击文件详情
    $scope.fileDetailFunction = function (id) {
        tabFileUpload.tabs('select', "文件详情");
        if ($scope.CurrentFileModel && id == $scope.CurrentFileModel.Id) {
            return false;
        }
        if (_jcp) {
            _jcp.destroy();
        }
        $scope.CurrentFileModel = getModelById(id);
    };

    //单击删除文件
    $scope.fileDelFunction = function (id) {
        _uploader.removeFile(id);
        removeModelById(id);
    };

    /*******************************文件设置页开始*************************************/

    /**
     * 图片预览
     */
    var previewImage = function (options) {
        if (!options.file || !XJ.ContentType.IsImage(options.file.type) || XJ.ContentType.IsGif(options.file.type)) return; //确保文件是图片
        if (XJ.ContentType.IsGif(options.file.type)) {//gif使用FileReader进行预览,因为mOxie.Image只支持jpg和png
            var fr = new mOxie.FileReader();
            fr.onload = function () {
                options.callback(fr.result);
                fr.destroy();
                fr = null;
            };
            fr.readAsDataURL(options.file.getSource());
        } else {
            var preloader = new mOxie.Image();
            preloader.onload = function () {
                options.callback && options.callback(preloader);
                preloader.destroy();
                preloader = null;
            };
            preloader.load(options.file.getSource());
        }
    };

    //图片裁剪
    var getCropImgXYInfo = function (img) {
        $scope.CurrentFileModel.X1 = img.x;
        $scope.CurrentFileModel.X2 = img.x2;
        $scope.CurrentFileModel.Y1 = img.y;
        $scope.CurrentFileModel.Y2 = img.y2;
        $scope.CurrentFileModel.W = img.w;
        $scope.CurrentFileModel.H = img.h;
        $scope.CurrentFileModel.ImgX1 = parseInt(img.x / $scope.CurrentFileModel.ImgPreviewRatio);
        $scope.CurrentFileModel.ImgX2 = parseInt(img.x2 / $scope.CurrentFileModel.ImgPreviewRatio);
        $scope.CurrentFileModel.ImgY1 = parseInt(img.y / $scope.CurrentFileModel.ImgPreviewRatio);
        $scope.CurrentFileModel.ImgY2 = parseInt(img.y2 / $scope.CurrentFileModel.ImgPreviewRatio);
        $scope.CurrentFileModel.ImgCropWidth = parseInt(img.w / $scope.CurrentFileModel.ImgPreviewRatio);
        $scope.CurrentFileModel.ImgCropHeight = parseInt(img.h / $scope.CurrentFileModel.ImgPreviewRatio);
    };

    //单击查看原图
    $scope.showSourceImg = function () {
        $("#formShowImg").submit();
    };

    //添加缩略图配置行
    $scope.thumbImgSettingAdd = function () {
        $scope.CurrentFileModel.ThumbImgSettings.push(new thumbImgSettingModel());
    };

    //删除缩略图配置行
    $scope.thumbImgSettingDel = function (idx) {
        $scope.CurrentFileModel.ThumbImgSettings.splice(idx, 1);
    };

    var setEqualRatioFunction = function (model) {
        if (model.Width) {
            model.Height = XJ.Data.GetInt((model.Width * $scope.CurrentFileModel.ImgCropHeight) / $scope.CurrentFileModel.ImgCropWidth);
        } else {
            model.Width = XJ.Data.GetInt((model.Height * $scope.CurrentFileModel.ImgCropWidth) / $scope.CurrentFileModel.ImgCropHeight);
        }
    };

    //设置缩略图的等比值
    $scope.setEqualRatio = function (m) {
        if (m) {
            setEqualRatioFunction.call(this, m);
            return;
        }
        $.each($scope.CurrentFileModel.ThumbImgSettings, function (idx, k) {
            setEqualRatioFunction.call(this, k);
        });
    };

    //图片编辑时,初始化裁剪插件
    $scope.initImgCrop = function () {
        $("img#ImgToEdit").removeAttr("style").hide().Jcrop({
            onSelect: function () {
                getCropImgXYInfo.apply(this, arguments);
                $scope.$apply();
            },
            onChange: function () {
                getCropImgXYInfo.apply(this, arguments);
                $scope.$apply();
            },
            onRelease: function () {
                if ($scope.CurrentFileModel.ImgCropWidth == 0 || $scope.CurrentFileModel.ImgCropWidth == 0) {
                    this.setSelect([0, 0, $scope.CurrentFileModel.ImgPreviewWidth, $scope.CurrentFileModel.ImgPreviewHeight]);
                } else {
                    this.setSelect([$scope.CurrentFileModel.X1, $scope.CurrentFileModel.Y1, $scope.CurrentFileModel.X2, $scope.CurrentFileModel.Y2]);
                }
            }
        }, function () {
            _jcp = this;
            this.release.call(this);
        });
    };

    $scope.$watch("CurrentFileModel", function (model) {
        //tab选项卡状态更新
        try {
            if (model) {
                tabFileUpload.tabs('enableTab', "文件详情");
                tabFileUpload.tabs('enableTab', "文件设置");
            } else {
                tabFileUpload.tabs('select', "选择文件");
                tabFileUpload.tabs('disableTab', "文件详情");
                tabFileUpload.tabs('disableTab', "文件设置");
            }
        } catch (ex) { }
        //计算等比值更新
        if (model) {
            $scope.setEqualRatio();
        }
    }, true);

    //初始化
    $scope.init = function () {
        //初始化上传
        _uploader = new plupload.Uploader({
            browse_button: 'btnAddFile',
            url: AppConfig.RootUrl + 'Upload/UploadSubmit',
            file_data_name: "FileInfo",
            filters: {
                mime_types: [{ title: "选择文件", extensions: window.AppConfig.AllowUploadExtInfo }],
                prevent_duplicates: true
            },
            flash_swf_url: AppConfig.RootUrl + "Resources/src/js/plupload/Moxie.swf",
            silverlight_xap_url: AppConfig.RootUrl + "Resources/src/js/plupload/Moxie.xap"
        });
        _uploader.init();

        //文件被添加进来的事件
        _uploader.bind('FilesAdded', function (up, files) {
            var lst = [];
            plupload.each(files, function (file) {
                var model = new fileModel();
                model.Id = file.id;
                model.Name = file.name;
                model.Size = plupload.formatSize(file.size);
                model.IsImage = XJ.ContentType.IsImage(file.type) && !XJ.ContentType.IsGif(file.type);
                model.Format = file.name.slice(file.name.lastIndexOf(".") + 1);
                //生成预览图
                previewImage({
                    file: file,
                    callback: function (preloader) {
                        model.ImgWidth = preloader.width;
                        model.ImgHeight = preloader.height;
                        model.Path = preloader.getAsDataURL();

                        preloader.downsize(180, 180);//预览图片的最大宽高,自动等比。
                        model.ImgSmallPath = preloader.getAsDataURL();

                        var imgObj = new mOxie.Image();
                        imgObj.onload = function () {
                            imgObj.downsize(600, 600);
                            model.ImgBigPath = imgObj.getAsDataURL();
                            model.ImgPreviewWidth = imgObj.width;
                            model.ImgPreviewHeight = imgObj.height;
                            model.ImgPreviewRatio = model.ImgPreviewWidth / model.ImgWidth;
                            preloader.destroy();
                            preloader = null;
                        };
                        imgObj.load(file.getSource());

                        $("img#" + file.id).attr({ src: model.ImgSmallPath });
                    }
                });
                lst.push(model);
            });
            $scope.FileModelList = XJ.Array.Concat($scope.FileModelList, lst);
            $scope.$apply();
        });
        //文件上传前事件
        _uploader.bind("BeforeUpload", function (up,file) {
            changeUploadButton(false);
            var f = $.map($scope.FileModelList, function (n) {
                return file.id == n.Id ? n : null;
            });
            if (f && f.length > 0) {
                //去掉不使用的image-data数据,避免post到服务器
                f[0].ImgSmallPath = "";
                f[0].ImgBigPath = "";
                f[0].Path = "";
            }
            up.settings.multipart_params = { FileSetting: JSON.stringify(f[0]) };
        });
        //文件上传中的事件
        _uploader.bind("UploadProgress", function (up, file) {
            $("#fileUploaderProgress").progressbar("setValue", up.total.percent);
        });
        //当队列中的某一个文件上传完成后触发
        _uploader.bind("FileUploaded", function (uploader, file, r) {
            var resp = JSON.parse(r.response);
            var m = getModelById(file.id);
            m.UploadMsg = resp.Message;
            m.IsUploadSuccess = resp.IsSuccess;
            $scope.$apply();
        });
        //所有文件上传完成后事件
        _uploader.bind("UploadComplete", function (up, files) {
            if (files.length == 0) {
                art.dialog({
                    icon: "face-smile",
                    content: "当前没有待上传的文件!",
                    ok: true
                });
            }
        });
    };
    $scope.init();
}]);

$(function () {
    var tabFileUpload = $("#tabFileUpload");
    tabFileUpload.tabs('disableTab', "文件详情");
    tabFileUpload.tabs('disableTab', "文件设置");
});


text:
const WHITESPACE = ' '

function hasText(str) {
    return str.trim().length > 0
}

function toClass(classes, attrs = {}) {
	var classes = Object.keys( classes ).filter( key => !!classes[key] )
	if (attrs["class"]) {
      classes.push(attrs["class"])
    }
	var classStr = classes.join( WHITESPACE )
    if( hasText( classStr ) ) {
      attrs["class"] = classStr
    }
    return attrs
}

module.exports = toClass;


text:
package dad.practica.pesemu.repositories;

import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.jpa.repository.JpaRepository;
import dad.practica.pesemu.model.Factura;

@CacheConfig(cacheNames="facturasCache")
public interface FacturaRepository extends JpaRepository<Factura, Long> {

	@CacheEvict
	Factura save(Factura factura);

	@Cacheable
	Factura findOne(long id);

}


text:
/* @flow */

import { generateActionsForFetchWithTypeName } from 'redux-action-api-utils'
import RNFetchBlob from 'react-native-fetch-blob'
import { _ } from 'lodash'
import { xmlToJSON } from '../../Vendor/xmlToJSON'

const getResults = generateActionsForFetchWithTypeName('GET_RESULTS')
export function fetchResults (year?: string = '2016') {
  return function (dispatch: Function) {
    dispatch(getResults.start())
    RNFetchBlob.fetch('GET', `http://rsl00.epimg.net/elecciones/${year}/generales/congreso/index.xml2`)
      .then(response => {
        const xml = response.text()
        const data = xmlToJSON.parseString(xml)
        const antesInicio = data.escrutinio_sitio[0].antes_inicio
        const electionsStarted: boolean = (antesInicio) ? false : true
        if (!electionsStarted) {
          dispatch(getResults.success([]))
        } else {
          const partidos = data.escrutinio_sitio[0].resultados[0].partido
          const processedList = _.chain(partidos)
            .omitBy(p => p.electos[0]._text === 0)
            .map(p => ({
                partyName: p.nombre[0]._text,
                result: p.electos[0]._text,
              })
            )
            .value()
          dispatch(getResults.success(processedList))
        }
      })
  }
}


text:
Vue.component('todo-item', {
  props: ['todo'],
  template: '
{{ todo.text }}
'
})

var app7 = new Vue({
  el: '#app-7',
  data: {
    groceryList: [
      { id: 0, text: 'Vegetables' },
      { id: 1, text: 'Cheese' },
      { id: 2, text: 'Whatever else humans are supposed to eat' }
    ]
  }
})

var vm = new Vue({
	el: 'body',

	data: {
		projects: [
			{
				title: 'The reception',
				anchor: 'thereception',
				images: [
					'img/large/mottagning/1.jpg',
					'img/large/mottagning/2.jpg',
					'img/large/mottagning/3.jpg',
					'img/large/mottagning/4.jpg'],
				date: 'July 2015',
				timeframe: '1 month',
				tools: 'JavaScript, PHP, HTML, MySQL, CSS',
				color: 'purple',
				skew: 'right',
				description: 'This is a website made for the reception of newly admitted students for my program at KTH. The website was used daily by about 120 people during 4 weeks.

The website is written in basic JavaScript and PHP. It features a full login system with editable profiles, an admin system, schedule with data taken from google calendar, news feed, gallery and chat.'
			},
			{
				title: 'Car Noises',
				anchor: 'carnoises',
				images: [
					'img/large/carnoises/1.jpg',
					'img/large/carnoises/2.jpg',
					'img/large/carnoises/3.jpg',
					'img/large/carnoises/4.jpg'],
				date: 'June 2015',
				timeframe: '24 hours',
				tools: 'Maya, Unity, Photoshop',
				color: 'green',
				skew: 'left',
				description: "This is a game made for the Dreamhackathon with the theme "collaboration". The goal of the game is to get the car around the race track. The input comes from the microphone, the more sound and vrooms going into the microphone the faster the car goes. But if it goes too fast it will derail.

I made all the graphics, 3D modelling and texturing during this project. I improved my abilities in creating something simple and good looking during a short period of time. "
			},
			{
				title: 'Skeduls',
				anchor: 'skeduls',
				images: [
					'img/large/skeduls/1.jpg',
					'img/large/skeduls/2.jpg',
					'img/large/skeduls/3.jpg',
					'img/large/skeduls/4.jpg',
					'img/large/skeduls/5.jpg'],
				date: 'Mars 2015',
				timeframe: '2 weeks',
				tools: 'Meteor, HTML, CSS',
				color: 'red',
				skew: 'right',
				description: 'This web application is made by me and a class mate. It is an event planner and is very inspired by  trello.com. All the events and days can be dragged and dropped in any order and automatically be updated on the database.

This was a very fun project and I learnt a lot about how to make fully functional applications made entirely for the web. I also improved my abilities to plan and work with bigger projects.'
			},
			{
				title: 'Webhallen',
				anchor: 'webhallen',
				images: [
					'img/large/webhallen/1.jpg',
					'img/large/webhallen/2.jpg',
					'img/large/webhallen/3.jpg',
					'img/large/webhallen/4.jpg'],
				date: 'February 2015',
				timeframe: '1.5 weeks',
				tools: 'Maya, Unity, Photoshop',
				color: 'blue',
				skew: 'left',
				description: 'Me and a friend made an Oculus Rift demo for Webhallen Fridhemsplan. It is only meant to showcase the capabilities of the Rift. I had the responsibility of creating all the art and assets.'
			},
			{
				title: 'Space Over Time',
				anchor: 'spaceovertime',
				images: [
					'img/large/spaceovertime/1.jpg',
					'img/large/spaceovertime/2.jpg',
					'img/large/spaceovertime/3.jpg',
					'img/large/spaceovertime/4.jpg',
					'img/large/spaceovertime/5.jpg'],
				date: 'November 2014',
				timeframe: '24 hours',
				tools: 'Maya, Unity, Photoshop',
				color: 'orange',
				skew: 'right',
				description: 'This project is the grand prize winner of the hackathon at Dreamhack Winter 2014. It is made by me and a friend for the Oculus Rift. The goal of the game is to navigate through the different levels with the help of the head tracking ability of the Oculus Rift.

I made all the graphics, 3D modelling and some movement of the objects. During this project I improved my abilities to work and deliver something in a very short and hectic timeframe.

Gameplay: https://www.youtube.com/watch?v=PeqhI-iXxFM'
			}
		]
	},

	methods: {
		isOdd: function(n) {
			if (parseInt(n) % 2 == 0) {
				return false;
			}
			return true;
		}
	},

	ready: function() {
		var galleryElems = document.querySelectorAll('.slider');

		for ( var i=0, len = galleryElems.length; i < len; i++ ) {
			var galleryElem = galleryElems[i];
			new Flickity( galleryElem, {
				// options
				cellAlign: 'center',
				contain: true,
				imagesLoaded: true,
				lazyLoad: 2,
				wrapAround: true
			});
		}
	}
});

hash = "";

$(function() {
	$('a[href*=#]:not([href=#])').click(function(e) {
		e.preventDefault();
		e.stopImmediatePropagation();
		scrollTo(this);
	});

	// Mobile click event
	$('a[href*=#]:not([href=#])').on('click touchend', function(e) {
		scrollTo(this);
	});

	var navbar = $('.navbar');
	var coloredLine = $('.colored-line');

	var navbarPosX = navbar.position().top;
	var navbarPosXInitial = navbarPosX;
	var coloredLinePosX = coloredLine.position().top;
	var coloredLinePosXInitial = coloredLinePosX;
	var screenHeight = $(window).height();

	$(window).scroll(function() {
		scrollMenu($(this));
	});

	// Change the values for when the navbar should snap to top or not.
	$(window).resize(function() {
		// Since the menu at the top is 40% of the screen height we have to account for that
		var ratio = ($(this).height() * 0.4) / (screenHeight * 0.4);
		console.log(ratio);
		navbarPosX = navbarPosXInitial * ratio;
		coloredLinePosX = coloredLinePosXInitial * ratio;
	});

	$('.colored-line-red').fadeOut();
	$('.colored-line-green').fadeOut();
	$('.colored-line-blue').fadeOut();

	$('.link-red').hover(function() {
		$('.colored-line-red').fadeIn();
	}, function() {
		$('.colored-line-red').fadeOut();
	});

	$('.link-green').hover(function() {
		$('.colored-line-green').fadeIn();
	}, function() {
		$('.colored-line-green').fadeOut();
	});

	$('.link-blue').hover(function() {
		$('.colored-line-blue').fadeIn();
	}, function() {
		$('.colored-line-blue').fadeOut();
	});

	function scrollMenu(w) {
		if (w.scrollTop() >= navbarPosX) {
			navbar.addClass("navbar-top");
		} else {
			navbar.removeClass("navbar-top");
		}
		if (w.scrollTop() >= coloredLinePosX - 50) {
			coloredLine.addClass("colored-line-top");
		} else {
			coloredLine.removeClass("colored-line-top");
		}
	}

	function scrollTo(t) {
		if (location.pathname.replace(/^\//,'') == t.pathname.replace(/^\//,'') && location.hostname == t.hostname) {
			var target = $(t.hash);
			hash = $(t).attr('href');
			target = target.length ? target : $('[name=' + t.hash.slice(1) +']');
			if (target.length) {
				$('html,body').animate({
					scrollTop: target.offset().top
				}, 500, function() {
					window.location.hash = hash;
				});
				return false;
			}
		}
	}
});


text:
<?php
/**
 *
 * This file is part of Aura for PHP.
 *
 * @license http://opensource.org/licenses/bsd-license.php BSD
 *
 */
namespace Aura\SqlQuery\Pgsql;

use Aura\SqlQuery\Common;

/**
 *
 * An object for PgSQL UPDATE queries.
 *
 * @package Aura.SqlQuery
 *
 */
class Delete extends Common\Delete implements Common\ReturningInterface
{
    /**
     *
     * Adds returning columns to the query.
     *
     * Multiple calls to returning() will append to the list of columns, not
     * overwrite the previous columns.
     *
     * @param array $cols The column(s) to add to the query.
     *
     * @return $this
     *
     */
    public function returning(array $cols)
    {
        return $this->addReturning($cols);
    }
}


text:
{% extends "site_base.html" %}

{% load i18n %}

{% block head_title %}{% trans "Confirm your email address" %}{% endblock %}

{% block body %}

{% trans "Confirm your email address" %}

{% blocktrans %}We have sent you an email to {{ email }} for verification. Follow the link provided to finalize the signup process. If you do not receive it within a few minutes, contact us at {{ THEME_CONTACT_EMAIL }}.{% endblocktrans %}

{% trans "Go back" %}

{% endblock %}


text:
using namespace boost::intrusive;
struct my_tag;

template<class VoidPtr = void*, link_mode_type mode = normal_link>
class MyClass
:  public make_list_base_hook
   < void_pointer<VoidPtr>, link_mode<mode> >::type
,  public make_slist_base_hook
   < void_pointer<VoidPtr>, link_mode<mode> >::type
,  public make_set_base_hook
   < void_pointer<VoidPtr>, link_mode<mode> >::type
,  public make_unordered_set_base_hook
   < void_pointer<VoidPtr>, link_mode<mode> >::type
,  public make_avl_set_base_hook
   < void_pointer<VoidPtr>, link_mode<mode> >::type
,  public make_bs_set_base_hook
   < void_pointer<VoidPtr>, link_mode<mode> >::type
{
   int int_;

   public:
   MyClass(int i)
      :  int_(i)
   {}

   friend bool operator<(const MyClass &l, const MyClass &r)
   {  return l.int_ < r.int_; }

   friend bool operator==(const MyClass &l, const MyClass &r)
   {  return l.int_ == r.int_; }

   friend std::size_t hash_value(const MyClass &v)
   {  return boost::hash_value(v.int_); }

   friend bool priority_order(const MyClass &l, const MyClass &r)
   {  return l.int_ < r.int_; }
};

template<class T>
struct inverse_priority
{
   bool operator()(const T &l, const T &r)
   {  return l.int_ > r.int_; }
};

template<class T>
struct inverse_hash
{
   bool operator()(const T &l)
   {  return hash_value(l); }
};

template<class T>
struct alternative_equal
{
   bool operator()(const T &l, const T &r)
   {  return l.int_ == r.int_; }
};

int main()
{
   ////////////
   // list
   ////////////
   BOOST_STATIC_ASSERT((!detail::is_same< list<MyClass<> >::iterator
                                        , list<MyClass<> >::const_iterator
                         >::value));
   //constant_time_size does not change iterator
   BOOST_STATIC_ASSERT((detail::is_same< list<MyClass<>, constant_time_size<true>  >::iterator
                                       , list<MyClass<>, constant_time_size<false> >::iterator
                        >::value));
   //void_pointer does change iterator
   BOOST_STATIC_ASSERT((!detail::is_same< list<MyClass<> >::iterator
                                        , list<MyClass<smart_ptr<void> > >::iterator
                         >::value));
   //size_type does not change iterator
   BOOST_STATIC_ASSERT((detail::is_same< list<MyClass<>, size_type<unsigned int > >::iterator
                                       , list<MyClass<>, size_type<unsigned char> >::iterator
                         >::value));
   ////////////
   // slist
   ////////////
   BOOST_STATIC_ASSERT((!detail::is_same< slist<MyClass<> >::iterator
                                        , slist<MyClass<> >::const_iterator
                         >::value));
   //constant_time_size does not change iterator
   BOOST_STATIC_ASSERT((detail::is_same< slist<MyClass<>, constant_time_size<true>  >::iterator
                                       , slist<MyClass<>, constant_time_size<false> >::iterator
                        >::value));
   //void_pointer does change iterator
   BOOST_STATIC_ASSERT((!detail::is_same< slist<MyClass<> >::iterator
                                        , slist<MyClass<smart_ptr<void> > >::iterator
                         >::value));
   //size_type does not change iterator
   BOOST_STATIC_ASSERT((detail::is_same< slist<MyClass<>, size_type<unsigned int > >::iterator
                                       , slist<MyClass<>, size_type<unsigned char> >::iterator
                         >::value));
   //cache_last does not change iterator
   BOOST_STATIC_ASSERT((detail::is_same< slist<MyClass<>, cache_last<false> >::iterator
                                       , slist<MyClass<>, cache_last<true>  >::iterator
                         >::value));
   //linear does not change iterator
   BOOST_STATIC_ASSERT((detail::is_same< slist<MyClass<>, linear<false> >::iterator
                                       , slist<MyClass<>, linear<true>  >::iterator
                         >::value));
   ////////////
   // set
   ////////////
   BOOST_STATIC_ASSERT((!detail::is_same< set<MyClass<> >::iterator
                                        , set<MyClass<> >::const_iterator
                         >::value));
   //constant_time_size does not change iterator
   BOOST_STATIC_ASSERT((detail::is_same< set<MyClass<>, constant_time_size<true>  >::iterator
                                       , set<MyClass<>, constant_time_size<false> >::iterator
                        >::value));
   //void_pointer does change iterator
   BOOST_STATIC_ASSERT((!detail::is_same< set<MyClass<> >::iterator
                                        , set<MyClass<smart_ptr<void> > >::iterator
                         >::value));
   //size_type does not change iterator
   BOOST_STATIC_ASSERT((detail::is_same< set<MyClass<>, size_type<unsigned int > >::iterator
                                       , set<MyClass<>, size_type<unsigned char> >::iterator
                         >::value));
   //compare does not change iterator
   BOOST_STATIC_ASSERT((detail::is_same< set<MyClass<>, compare< std::greater<MyClass<> > > >::iterator
                                       , set<MyClass<>, compare< std::less<MyClass<> > > >::iterator
                         >::value));
   ////////////
   // avl_set
   ////////////
   BOOST_STATIC_ASSERT((!detail::is_same< avl_set<MyClass<> >::iterator
                                        , avl_set<MyClass<> >::const_iterator
                         >::value));
   //constant_time_size does not change iterator
   BOOST_STATIC_ASSERT((detail::is_same< avl_set<MyClass<>, constant_time_size<true>  >::iterator
                                       , avl_set<MyClass<>, constant_time_size<false> >::iterator
                        >::value));
   //void_pointer does change iterator
   BOOST_STATIC_ASSERT((!detail::is_same< avl_set<MyClass<> >::iterator
                                        , avl_set<MyClass<smart_ptr<void> > >::iterator
                         >::value));
   //size_type does not change iterator
   BOOST_STATIC_ASSERT((detail::is_same< avl_set<MyClass<>, size_type<unsigned int > >::iterator
                                       , avl_set<MyClass<>, size_type<unsigned char> >::iterator
                         >::value));
   //compare does not change iterator
   BOOST_STATIC_ASSERT((detail::is_same< avl_set<MyClass<>, compare< std::greater<MyClass<> > > >::iterator
                                       , avl_set<MyClass<>, compare< std::less<MyClass<> > > >::iterator
                         >::value));
   ////////////
   // sg_set
   ////////////
   BOOST_STATIC_ASSERT((!detail::is_same< sg_set<MyClass<> >::iterator
                                        , sg_set<MyClass<> >::const_iterator
                         >::value));
   //void_pointer does change iterator
   BOOST_STATIC_ASSERT((!detail::is_same< sg_set<MyClass<> >::iterator
                                        , sg_set<MyClass<smart_ptr<void> > >::iterator
                         >::value));
   //size_type does not change iterator
   BOOST_STATIC_ASSERT((detail::is_same< sg_set<MyClass<>, size_type<unsigned int > >::iterator
                                       , sg_set<MyClass<>, size_type<unsigned char> >::iterator
                         >::value));
   //compare does not change iterator
   BOOST_STATIC_ASSERT((detail::is_same< sg_set<MyClass<>, compare< std::greater<MyClass<> > > >::iterator
                                       , sg_set<MyClass<>, compare< std::less<MyClass<> > > >::iterator
                         >::value));
   //floating_point does not change iterator
   BOOST_STATIC_ASSERT((detail::is_same< sg_set<MyClass<>, floating_point<false> >::iterator
                                       , sg_set<MyClass<>, floating_point<true>  >::iterator
                         >::value));
   ////////////
   // bs_set
   ////////////
   BOOST_STATIC_ASSERT((!detail::is_same< bs_set<MyClass<> >::iterator
                                        , bs_set<MyClass<> >::const_iterator
                         >::value));
   //constant_time_size does not change iterator
   BOOST_STATIC_ASSERT((detail::is_same< bs_set<MyClass<>, constant_time_size<true>  >::iterator
                                       , bs_set<MyClass<>, constant_time_size<false> >::iterator
                         >::value));
   //void_pointer does change iterator
   BOOST_STATIC_ASSERT((!detail::is_same< bs_set<MyClass<> >::iterator
                                        , bs_set<MyClass<smart_ptr<void> > >::iterator
                         >::value));
   //size_type does not change iterator
   BOOST_STATIC_ASSERT((detail::is_same< bs_set<MyClass<>, size_type<unsigned int > >::iterator
                                       , bs_set<MyClass<>, size_type<unsigned char> >::iterator
                         >::value));
   //compare does not change iterator
   BOOST_STATIC_ASSERT((detail::is_same< bs_set<MyClass<>, compare< std::greater<MyClass<> > > >::iterator
                                       , bs_set<MyClass<>, compare< std::less<MyClass<> > > >::iterator
                         >::value));
   ////////////
   // splay_set
   ////////////
   BOOST_STATIC_ASSERT((!detail::is_same< splay_set<MyClass<> >::iterator
                                        , splay_set<MyClass<> >::const_iterator
                         >::value));
   //constant_time_size does not change iterator
   BOOST_STATIC_ASSERT((detail::is_same< splay_set<MyClass<>, constant_time_size<true>  >::iterator
                                       , splay_set<MyClass<>, constant_time_size<false> >::iterator
                        >::value));
   //void_pointer does change iterator
   BOOST_STATIC_ASSERT((!detail::is_same< splay_set<MyClass<> >::iterator
                                        , splay_set<MyClass<smart_ptr<void> > >::iterator
                         >::value));
   //size_type does not change iterator
   BOOST_STATIC_ASSERT((detail::is_same< splay_set<MyClass<>, size_type<unsigned int > >::iterator
                                       , splay_set<MyClass<>, size_type<unsigned char> >::iterator
                         >::value));
   //compare does not change iterator
   BOOST_STATIC_ASSERT((detail::is_same< splay_set<MyClass<>, compare< std::greater<MyClass<> > > >::iterator
                                       , splay_set<MyClass<>, compare< std::less<MyClass<> > > >::iterator
                         >::value));
   ////////////
   // treap_set
   ////////////
   BOOST_STATIC_ASSERT((!detail::is_same< treap_set<MyClass<> >::iterator
                                        , treap_set<MyClass<> >::const_iterator
                         >::value));
   //constant_time_size does not change iterator
   BOOST_STATIC_ASSERT((detail::is_same< treap_set<MyClass<>, constant_time_size<true>  >::iterator
                                       , treap_set<MyClass<>, constant_time_size<false> >::iterator
                        >::value));
   //void_pointer does change iterator
   BOOST_STATIC_ASSERT((!detail::is_same< treap_set<MyClass<> >::iterator
                                        , treap_set<MyClass<smart_ptr<void> > >::iterator
                         >::value));
   //size_type does not change iterator
   BOOST_STATIC_ASSERT((detail::is_same< treap_set<MyClass<>, size_type<unsigned int > >::iterator
                                       , treap_set<MyClass<>, size_type<unsigned char> >::iterator
                         >::value));
   //compare does not change iterator
   BOOST_STATIC_ASSERT((detail::is_same< treap_set<MyClass<>, compare< std::greater<MyClass<> > > >::iterator
                                       , treap_set<MyClass<>, compare< std::less<MyClass<> > > >::iterator
                         >::value));
   //priority does not change iterator
   BOOST_STATIC_ASSERT((detail::is_same< treap_set<MyClass<> >::iterator
                                       , treap_set<MyClass<>, priority< inverse_priority<MyClass<> > > >::iterator
                         >::value));
   //////////////
   // common tree
   //////////////
   BOOST_STATIC_ASSERT((detail::is_same< bs_set<MyClass<> >::iterator
                                       , sg_set<MyClass<> >::iterator
                         >::value));
   BOOST_STATIC_ASSERT((detail::is_same< bs_set<MyClass<> >::iterator
                                       , treap_set<MyClass<> >::iterator
                         >::value));
   BOOST_STATIC_ASSERT((detail::is_same< bs_set<MyClass<> >::iterator
                                       , splay_set<MyClass<> >::iterator
                         >::value));
   ////////////
   // unordered_set
   ////////////
   BOOST_STATIC_ASSERT((!detail::is_same< unordered_set<MyClass<> >::iterator
                                        , unordered_set<MyClass<> >::const_iterator
                         >::value));
   //constant_time_size does not change iterator
   BOOST_STATIC_ASSERT((detail::is_same< unordered_set<MyClass<>, constant_time_size<true>  >::iterator
                                       , unordered_set<MyClass<>, constant_time_size<false> >::iterator
                        >::value));
   //void_pointer does change iterator
   BOOST_STATIC_ASSERT((!detail::is_same< unordered_set<MyClass<> >::iterator
                                        , unordered_set<MyClass<smart_ptr<void> > >::iterator
                         >::value));
   //size_type does not change iterator
   BOOST_STATIC_ASSERT((detail::is_same< unordered_set<MyClass<>, size_type<unsigned int > >::iterator
                                       , unordered_set<MyClass<>, size_type<unsigned char> >::iterator
                         >::value));
   //hash does not change iterator
   BOOST_STATIC_ASSERT((detail::is_same< unordered_set<MyClass<> >::iterator
                                       , unordered_set<MyClass<>, hash< inverse_hash<MyClass<> > > >::iterator
                         >::value));
   //equal does not change iterator
   BOOST_STATIC_ASSERT((detail::is_same< unordered_set<MyClass<> >::iterator
                                       , unordered_set<MyClass<>, equal< alternative_equal<MyClass<> > > >::iterator
                         >::value));
   //power_2_buckets does not change iterator
   BOOST_STATIC_ASSERT((detail::is_same< unordered_set<MyClass<> >::iterator
                                       , unordered_set<MyClass<>, power_2_buckets<true> >::iterator
                         >::value));
   //cache_begin does not change iterator
   BOOST_STATIC_ASSERT((detail::is_same< unordered_set<MyClass<> >::iterator
                                       , unordered_set<MyClass<>, cache_begin<true> >::iterator
                         >::value));
   return 0;
}


text:
<?php

namespace ReCaptcha\RequestMethod;

/**
 * Convenience wrapper around native socket and file functions to allow for
 * mocking.
 */
class Socket
{
    private $handle = null;

    /**
     * fsockopen
     *
     * @see http://php.net/fsockopen
     * @param string $hostname
     * @param int $port
     * @param int $errno
     * @param string $errstr
     * @param float $timeout
     * @return resource
     */
    public function fsockopen($hostname, $port = -1, &$errno = 0, &$errstr = '', $timeout = null)
    {
        $this->handle = fsockopen($hostname, $port, $errno, $errstr, (is_null($timeout) ? ini_get("default_socket_timeout") : $timeout));

        if ($this->handle != false && $errno === 0 && $errstr === '') {
            return $this->handle;
        }
        return false;
    }

    /**
     * fwrite
     *
     * @see http://php.net/fwrite
     * @param string $string
     * @param int $length
     * @return int | bool
     */
    public function fwrite($string, $length = null)
    {
        return fwrite($this->handle, $string, (is_null($length) ? strlen($string) : $length));
    }

    /**
     * fgets
     *
     * @see http://php.net/fgets
     * @param int $length
     * @return string
     */
    public function fgets($length = null)
    {
        return fgets($this->handle, $length);
    }

    /**
     * feof
     *
     * @see http://php.net/feof
     * @return bool
     */
    public function feof()
    {
        return feof($this->handle);
    }

    /**
     * fclose
     *
     * @see http://php.net/fclose
     * @return bool
     */
    public function fclose()
    {
        return fclose($this->handle);
    }
}