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

<TITLE>
CellValue (POI API Documentation)
</TITLE>

<META NAME="date" CONTENT="2010-10-29">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

org.apache.poi.ss.usermodel

Class CellValue

java.lang.Object
  org.apache.poi.ss.usermodel.CellValue

public final class CellValue
extends java.lang.Object

Mimics the 'data view' of a cell. This allows formula evaluator
 to return a CellValue instead of precasting the value to String
 or Number or boolean type.

Author:

Amol S. Deshmukh < amolweb at ya hoo dot com >

Field Summary

static CellValue
FALSE

static CellValue
TRUE

Constructor Summary

CellValue(double numberValue)

CellValue(java.lang.String stringValue)

Method Summary

 java.lang.String
formatAsString()

 boolean
getBooleanValue()

 int
getCellType()

static CellValue
getError(int errorCode)

 byte
getErrorValue()

 double
getNumberValue()

 java.lang.String
getStringValue()

 java.lang.String
toString()

static CellValue
valueOf(boolean booleanValue)

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Field Detail

TRUE

public static final CellValue TRUE

FALSE

public static final CellValue FALSE

Constructor Detail

CellValue

public CellValue(double numberValue)

CellValue

public CellValue(java.lang.String stringValue)

Method Detail

valueOf

public static CellValue valueOf(boolean booleanValue)

getError

public static CellValue getError(int errorCode)

getBooleanValue

public boolean getBooleanValue()

Returns:
Returns the booleanValue.

getNumberValue

public double getNumberValue()

Returns:
Returns the numberValue.

getStringValue

public java.lang.String getStringValue()

Returns:
Returns the stringValue.

getCellType

public int getCellType()

Returns:
Returns the cellType.

getErrorValue

public byte getErrorValue()

Returns:
Returns the errorValue.

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

formatAsString

public java.lang.String formatAsString()

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

                Copyright 2010 The Apache Software Foundation or
        its licensors, as applicable.


text:
package com.sinyuk.yuk.utils;

/**
 * Created by Sinyuk on 16/7/13.
 */
public final class PrefsKeySet {

    // Login
    public static final String KEY_ACCESS_TOKEN = "access_token";

    public static final String KEY_AUTO_REFRESH = "auto_refresh";
    public static final String KEY_AUTO_PLAY_GIF = "auto_play_gif";
    public static final String KEY_AUTO_CACHING = "auto_caching";

    public static final String KEY_USER_ID = "user_id";
    public static final String KEY_USER_NAME = "user_name";
    public static final String KEY_USER_USERNAME = "user_username";
    public static final String KEY_USER_AVATAR = "user_avatar";
    public static final String KEY_USER_TYPE = "user_type";
}

redpajama_set_name: RedPajamaGithub


text:
define([
  /* Libraries */
  'backbone',
  /* Templates */
  'hbs!modules/post/templates/createOne'
],

function(Backbone, CreateOneTemplate){
  'use strict';
  /*
   * Returns a Marionette.ItemView with a template.
   *
   * [https://github.com/marionettejs/backbone.marionette/blob/master/docs/marionette.itemview.md]
   */
  return Backbone.Marionette.ItemView.extend({
    template: CreateOneTemplate
  });
});


text:
- Fix cls function TAccountComp.EqualOperationBlocks
- Create UAbstractMemBlockchainStorage.pas
- Enable to use indexed data on Blockchain storage
- Added OnFLushedCache event on AbstractMem library
- Added OnFLushedCache event log
- Memory Improvements


text:
namespace Cofoundry.Domain.Extendable;

/// <inheritdoc/>
public class DomainRepositoryExecutor : IDomainRepositoryExecutor
{
    private readonly IQueryExecutor _queryExecutor;
    private readonly ICommandExecutor _commandExecutor;

    public DomainRepositoryExecutor(
        IQueryExecutor queryExecutor,
        ICommandExecutor commandExecutor
        )
    {
        _queryExecutor = queryExecutor;
        _commandExecutor = commandExecutor;
    }

    public async Task ExecuteAsync(ICommand command, IExecutionContext executionContext)
    {
        await _commandExecutor.ExecuteAsync(command, executionContext);
    }

    public async Task<TResult> ExecuteAsync<TResult>(IQuery<TResult> query, IExecutionContext executionContext)
    {
        return await _queryExecutor.ExecuteAsync(query, executionContext);
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <groupId>com.kumuluz.ee.examples</groupId>
    <artifactId>java-magazine-trains</artifactId>
    <version>2.1.0-SNAPSHOT</version>
    <modelVersion>4.0.0</modelVersion>
    <packaging>pom</packaging>

    <name>Java Magazine KumuluzEE Docker with Zookeeper</name>
    <description>KumuluzEE example using Docker and Zookeeper for Java Magazine</description>

    <modules>
        <module>ui</module>
        <module>routes</module>
        <module>models</module>
        <module>utils</module>
        <module>bookings</module>
    </modules>

    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <kumuluzee.version>2.1.0-SNAPSHOT</kumuluzee.version>
    </properties>

    <repositories>
        <repository>
            <id>sonatype-snapshots</id>
            <name>Sonatype Snapshots</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
            <releases><enabled>false</enabled></releases>
            <snapshots><enabled>true</enabled></snapshots>
        </repository>
    </repositories>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.kumuluz.ee.examples</groupId>
                <artifactId>java-magazine-trains-bookings</artifactId>
                <version>2.1.0-SNAPSHOT</version>
            </dependency>
            <dependency>
                <groupId>com.kumuluz.ee.examples</groupId>
                <artifactId>java-magazine-trains-models</artifactId>
                <version>2.1.0-SNAPSHOT</version>
            </dependency>
            <dependency>
                <groupId>com.kumuluz.ee.examples</groupId>
                <artifactId>java-magazine-trains-routes</artifactId>
                <version>2.1.0-SNAPSHOT</version>
            </dependency>
            <dependency>
                <groupId>com.kumuluz.ee.examples</groupId>
                <artifactId>java-magazine-trains-ui</artifactId>
                <version>2.1.0-SNAPSHOT</version>
            </dependency>
            <dependency>
                <groupId>com.kumuluz.ee.examples</groupId>
                <artifactId>java-magazine-trains-utils</artifactId>
                <version>2.1.0-SNAPSHOT</version>
            </dependency>

            <dependency>
                <groupId>org.postgresql</groupId>
                <artifactId>postgresql</artifactId>
                <version>9.4-1201-jdbc41</version>
            </dependency>
            <dependency>
                <groupId>org.apache.curator</groupId>
                <artifactId>curator-framework</artifactId>
                <version>2.8.0</version>
                <exclusions>
                    <exclusion>
                        <groupId>io.netty</groupId>
                        <artifactId>netty</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-simple</artifactId>
                <version>1.6.1</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>2.10</version>
                    <executions>
                        <execution>
                            <id>copy-dependencies</id>
                            <phase>package</phase>
                            <goals>
                                <goal>copy-dependencies</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>


text:
import * as path from 'path';

import _ from 'lodash';
import gift from 'gift';
import Promise from 'bluebird';

import log from '../../lib/log';

let readDirRecursive = Promise.promisify(require('recursive-readdir'));

export default function (taskConfig, eTagMap) {
	let repo = Promise.promisifyAll(gift(taskConfig.gitPath));
	let rootPath = path.join(taskConfig.gitPath, taskConfig.filePath || '');

	log.info(`Pulling changes for the bootstrap repo...`);

	return repo.pullAsync().then(() => {
		log.info(`Done bootstrap pull...`);
		return readDirRecursive(rootPath);
	}, (error) => {
		log.err(`Could not pull repo ${taskConfig.gitPath}`);
		throw error;
	}).then(function (files) {
		return parse(files.map(file => path.relative(rootPath, file).replace(/\\/g, '/')), taskConfig, eTagMap);
	}).filter(project => project);
}

let pattern = /^([^/]+)\/(\d+(\.\d+){0,2}[^/]*)/i;

function parse(files, taskConfig, eTagMap) {
	let libraries = {};

	_.forEach(files, (file) => {
		let fName = file.replace(/(?:\.min|\.pack)?\.\w+$/i, '');

		if (pattern.test(fName)) {
			let match = fName.match(pattern);
			let name = match[1];
			let version = match[2];

			// several projects here, see https://github.com/jsdelivr/api/issues/56
			if (name === 'bootswatch') {
				let folder = fName.split('/')[2];

				if (!/fonts|img/i.test(folder)) {
					name += '.' + folder;
				}
			}

			if (!libraries[name]) {
				libraries[name] = {
					name: name,
					versions: [],
					assets: {},
				}
			}

			if(!~libraries[name].versions.indexOf(version)) {
				libraries[name].versions.push(version);
			}

			if(!libraries[name].assets[version]) {
				let bp = fName.split('/').slice(0, name.indexOf('bootswatch.') === 0 ? 3 : 2).join('/');

				libraries[name].assets[version] = {
					baseUrl: `${taskConfig.cdnRoot}/${bp}/`,
					files: [],
					mainfile: '',
				};
			}

			libraries[name].assets[version].files.push(file.substr(name.length + version.length + 2));
		}
	});

	_.forEach(libraries, (project) => {
		if (/^bootswatch/i.test(project.name)) {
			eTagMap[project.name] = 'bootswatch';
		} else {
			eTagMap[project.name] = project.name;
		}
	});

	return _.values(libraries);
}


text:
/*

         ###
#  #  #########     _______ _     _  ______ _     _
##  ######## @ ##   |______ |     | |  ____ |     |
##################  |       |_____| |_____| |_____|
##  #############      f  r  a  m  e  w  o  r  k
#  #  #########
         ###

(c) 2015 - 2017 FUGU framework project

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

*/

namespace Fugu.EntityFrameworkCore.Sql
{
    internal class RawSqlCommandBuilder : SqlCommandConcreteBuilderBase<IRawSqlCommand>
    {
        protected override SqlCommandInput BuildInternal(IRawSqlCommand sqlCommand, object[] parameters)
        {
            return new SqlCommandInput(sqlCommand.SqlText, parameters);
        }
    }
}


text:
from django.core.management import execute_manager
import sys
from django.conf import settings

PROJECT_APPS = ('web_performance', 'tests')

try:
    import django_jenkins
    JENKINS_APP = ('django_jenkins',)
except ImportError:
    JENKINS_APP = tuple()

settings.configure(DEBUG = True,
                   DATABASE_ENGINE = 'sqlite3',
                   DATABASES = {
                        'default': {
                            'ENGINE': 'django.db.backends.sqlite3',
                            }
                   },
                   INSTALLED_APPS = ('django.contrib.auth',
                                     'django.contrib.contenttypes',
                                     'django.contrib.sessions',
                                     'django.contrib.admin',) + PROJECT_APPS + JENKINS_APP,
                   PROJECT_APPS = PROJECT_APPS,
                   JENKINS_TASKS = (
                        'django_jenkins.tasks.with_coverage',
                        'django_jenkins.tasks.django_tests',
                        'django_jenkins.tasks.run_pep8',
                        'django_jenkins.tasks.run_pylint',
                   ),
                   ROOT_URLCONF = 'tests.urls'
)

if __name__ == "__main__":
    if len(sys.argv) == 1:
        sys.argv += ['test', 'tests']
    execute_manager(settings)
else:
    from django.test.simple import DjangoTestSuiteRunner
    failures = DjangoTestSuiteRunner().run_tests(['tests',])
    if failures:
        sys.exit(failures)


text:
A Circular progress bar with a progress thumb(icon) written in pure Swift.
Customise your own thumb images to the Circular progress bar.

![Alt Text](https://github.com/khanxc/KXThumbCircularProgressBar/blob/master/Example/KXThumbCircular-Example/KXThumbCircular-Example/gifs/feature3.gif)

![Alt Text](https://github.com/khanxc/KXThumbCircularProgressBar/blob/master/Example/KXThumbCircular-Example/KXThumbCircular-Example/gifs/feature2.gif)

![Alt Text](https://github.com/khanxc/KXThumbCircularProgressBar/blob/master/Example/KXThumbCircular-Example/KXThumbCircular-Example/gifs/feature1.gif)

![Alt Text](https://github.com/khanxc/KXThumbCircularProgressBar/blob/master/Example/KXThumbCircular-Example/KXThumbCircular-Example/gifs/animatingText.gif)

# Features
- [x] Customise thumb images
- [x] Increase/decrease the width of inner/outer ring
- [x] Customize inner/outer ring colors
- [x] Customize Start / End angle
- [x] Add Image / Text (with unit of measurement) at the centre
- [x] Animating text

# Requirements
- iOS 8.0+
- Xcode 7.3

# Installation
## Cocoapods
You can use [CocoaPods](http://cocoapods.org/pods/KXThumbCircularProgressBar) to install *KXThumbCircularProgressBar* by adding it to your podfile

```
    pod 'KXThumbCircularProgressBar', '~> 0.0.4'
```
And import the header and use it in the ViewController where you want to use this framework

```swift
  import KXThumbCircularProgressBar
```

Drag and drop a UIView in your storyboard and change the class of UIView like below

![Alt Text](https://github.com/khanxc/KXThumbCircularProgressBar/blob/master/Example/KXThumbCircular-Example/KXThumbCircular-Example/gifs/SS.png)

Create the IBOutlet and initiate the progress animation
```swift
  @IBOutlet weak var kx: KXThumbCircularProgressBar!

  override func viewDidLoad() {
        super.viewDidLoad()
        kx.animateScale = 0.75 //value between 0 to 1
    }
```

# To Do & Progress
- [x] Enabling this framework programmatically

# License
Distributed under MIT license. Please see [LICENSE](https://github.com/khanxc/KXThumbCircularProgressBar/blob/master/LICENSE.md) file.


text:
package org.eclipse.gemini.jpa.configadmin;

import java.io.InputStream;
import java.io.StringBufferInputStream;
import java.net.URL;

import org.eclipse.gemini.jpa.PersistenceDescriptorInfo;

@SuppressWarnings("deprecation")
public class InlinedDescriptorInfo extends PersistenceDescriptorInfo {

    // Inlined descriptor string
    String descriptor;

    public InlinedDescriptorInfo(PersistenceUnitConfiguration config) {
        this.setDescriptorPath(config.getDescriptorName());
        this.descriptor = config.getDescriptor();
    }

    // Not supported by this kind of descriptorInfo
    @Override public URL getUrl() { notSupported(); return null; }
    @Override public void setUrl(URL url) { notSupported(); }
    @Override public String getJarPath() { notSupported(); return null; }
    @Override public void setJarPath(String jarPath) { notSupported(); }
    private void notSupported() { /*throw new UnsupportedOperationException();  */ }

    // Subclass overrides
    @Override public boolean isEmbedded() {
        return false;
    }

    @Override public InputStream getDescriptorStream() {
        return new StringBufferInputStream(descriptor);
    }

    @Override public String toString() {
        return "InlinedDescriptorInfo(" + getDescriptorPath() + ")";
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;

namespace GoogleReaderWp7TestApp
{
    public partial class MainPage : PhoneApplicationPage
    {
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            // Set the data context of the listbox control to the sample data
            DataContext = App.ViewModel;
            this.Loaded += new RoutedEventHandler(MainPage_Loaded);
        }

        // Handle selection changed on ListBox
        private void MainListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            // If selected index is -1 (no selection) do nothing
            if (MainListBox.SelectedIndex == -1)
                return;

            // Navigate to the new page
            NavigationService.Navigate(new Uri("/DetailsPage.xaml?selectedItem=" + MainListBox.SelectedIndex, UriKind.Relative));

            // Reset selected index to -1 (no selection)
            MainListBox.SelectedIndex = -1;
        }

        // Load data for the ViewModel Items
        private void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            if (!App.ViewModel.IsDataLoaded)
            {
                App.ViewModel.LoadData();
            }
        }
    }
}


text:
require "nexussw/lxd/driver"
require "nexussw/lxd/driver/mixins/rest"

module NexusSW
  module LXD
    class Driver
      class Rest < Driver
        include Mixins::Rest
      end
    end
  end
end


text:
#include "El.hpp"
#include "../../../QP/affine/IPM/util.hpp"

namespace El {
namespace lp {
namespace affine {

// Initialize
// ==========
template<typename Real>
void Initialize
( const Matrix<Real>& A,
  const Matrix<Real>& G,
  const Matrix<Real>& b,
  const Matrix<Real>& c,
  const Matrix<Real>& h,
        Matrix<Real>& x,
        Matrix<Real>& y,
        Matrix<Real>& z,
        Matrix<Real>& s,
  bool primalInit, bool dualInit, bool standardShift );
template<typename Real>
void Initialize
( const ElementalMatrix<Real>& A,
  const ElementalMatrix<Real>& G,
  const ElementalMatrix<Real>& b,
  const ElementalMatrix<Real>& c,
  const ElementalMatrix<Real>& h,
        ElementalMatrix<Real>& x,
        ElementalMatrix<Real>& y,
        ElementalMatrix<Real>& z,
        ElementalMatrix<Real>& s,
  bool primalInit, bool dualInit, bool standardShift );
template<typename Real>
void Initialize
( const SparseMatrix<Real>& JStatic,
  const Matrix<Real>& regTmp,
  const Matrix<Real>& b,
  const Matrix<Real>& c,
  const Matrix<Real>& h,
        Matrix<Real>& x,
        Matrix<Real>& y,
        Matrix<Real>& z,
        Matrix<Real>& s,
  const vector<Int>& map,
  const vector<Int>& invMap,
  const ldl::Separator& rootSep,
  const ldl::NodeInfo& info,
  bool primalInit, bool dualInit, bool standardShift,
  const RegSolveCtrl<Real>& solveCtrl );
template<typename Real>
void Initialize
( const DistSparseMatrix<Real>& JStatic,
  const DistMultiVec<Real>& regTmp,
  const DistMultiVec<Real>& b,
  const DistMultiVec<Real>& c,
  const DistMultiVec<Real>& h,
        DistMultiVec<Real>& x,
        DistMultiVec<Real>& y,
        DistMultiVec<Real>& z,
        DistMultiVec<Real>& s,
  const DistMap& map,
  const DistMap& invMap,
  const ldl::DistSeparator& rootSep,
  const ldl::DistNodeInfo& info,
        vector<Int>& mappedSources,
        vector<Int>& mappedTargets,
        vector<Int>& colOffs,
  bool primalInit, bool dualInit, bool standardShift,
  const RegSolveCtrl<Real>& solveCtrl );

// Full system
// ===========
template<typename Real>
void KKT
( const Matrix<Real>& A,
  const Matrix<Real>& G,
  const Matrix<Real>& s,
  const Matrix<Real>& z,
        Matrix<Real>& J,
  bool onlyLower=true );
template<typename Real>
void KKT
( const ElementalMatrix<Real>& A,
  const ElementalMatrix<Real>& G,
  const ElementalMatrix<Real>& s,
  const ElementalMatrix<Real>& z,
        ElementalMatrix<Real>& J,
  bool onlyLower=true );
template<typename Real>
void KKT
( const SparseMatrix<Real>& A,
  const SparseMatrix<Real>& G,
  const Matrix<Real>& s,
  const Matrix<Real>& z,
        SparseMatrix<Real>& J,
  bool onlyLower=true );
template<typename Real>
void StaticKKT
( const SparseMatrix<Real>& A,
  const SparseMatrix<Real>& G,
        Real gamma,
        Real delta,
        Real beta,
        SparseMatrix<Real>& J,
  bool onlyLower=true );
template<typename Real>
void KKT
( const DistSparseMatrix<Real>& A,
  const DistSparseMatrix<Real>& G,
  const DistMultiVec<Real>& s,
  const DistMultiVec<Real>& z,
        DistSparseMatrix<Real>& J,
  bool onlyLower=true );
template<typename Real>
void StaticKKT
( const DistSparseMatrix<Real>& A,
  const DistSparseMatrix<Real>& G,
        Real gamma,
        Real delta,
        Real beta,
        DistSparseMatrix<Real>& J,
  bool onlyLower=true );

using qp::affine::FinishKKT;

using qp::affine::KKTRHS;
using qp::affine::ExpandCoreSolution;
using qp::affine::ExpandSolution;

} // namespace affine
} // namespace lp
} // namespace El


text:
using UnityEngine;
using System.Collections;

public class Interface : MonoBehaviour
{
	// Drives weapon changing and accessing game menu
	void Update ()
    {
        transform.position = new Vector2(Camera.main.transform.position.x, Camera.main.transform.position.y - 10.625f);

	    if(Input.GetKeyDown("1"))
        {
            Player.pistol = true;
        }
        if(Input.GetKeyDown("2") && Player.shotgunCollected)
        {
            Player.pistol = false;
        }
        if (Input.GetKey(KeyCode.Escape))
        {
            Time.timeScale = 0;
        }
		// Memory leaks
        Resources.UnloadUnusedAssets();
	}
}


text:
package com.current.queue.jdkAPI;

import com.current.queue.BlockingQueue;

import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * Author Mr.Pro
 * Date   9/6/17 = 8:32 PM
 */
public class ArraysSynchronizedQueue<T> implements BlockingQueue<T>{
    private Logger logger = Logger.getLogger(ArraysSynchronizedQueue.class.getName());
    private static int DEFAULT_SIZE = 100;
    private int arraySize;
    private int putIndex;
    private int takeIndex;
    private int size;
    private Byte[] lock;
    private Object[] obj;

    public ArraysSynchronizedQueue(){
        this(DEFAULT_SIZE);
    }

    public ArraysSynchronizedQueue(int arraySize){
        this.arraySize = arraySize;
        initialize();
    }

    private void initialize(){
        lock = new Byte[0];
        obj = new Object[arraySize];
        putIndex = 0;
        takeIndex = 0;
        size = 0;
    }

    @Override
    public T take() throws InterruptedException{
        synchronized (lock){
            while (size == 0){
                logger.log(Level.INFO, "queue is empty");
                lock.wait();
            }
            T result = (T)obj[takeIndex++];
            size --;
            takeIndex = setIndex(takeIndex);
            lock.notifyAll();
            return result;
        }
    }

    @Override
    public void put(T object) throws InterruptedException{
        synchronized (lock){
            while (size == arraySize){
                logger.log(Level.INFO, "queue is full");
                lock.wait();
            }
            obj[putIndex++] = object;
            size++;
            putIndex = setIndex(putIndex);
            lock.notifyAll();
        }
    }

    private int setIndex(int index){
        if(index >= arraySize){
            return 0;
        }
        return index;
    }

}


text:
#include "ceres.h"
#include "play.h"

#include <sndlib.h>

/* Only call once per process. */
Boolean InitPlay(void){
  //printf("sndlib init: %d %d\n",mus_sound_initialize(),MUS_NO_ERROR);
  mus_sound_initialize();
  return TRUE;
}

struct Sndplay{
  int outport;
};

void *OpenPlay(struct FFTSound *fftsound){
  struct Sndplay *sndplay;
  sndplay=malloc(sizeof(struct Sndplay));
  sndplay->outport = mus_audio_open_output(MUS_AUDIO_DEFAULT, fftsound->R, fftsound->samps_per_frame, MUS_COMPATIBLE_FORMAT, 1024 * fftsound->samps_per_frame);

  if(sndplay->outport==-1){
    free(sndplay);
    fprintf(stderr,"Could not open sndlib outport.\n");
    return NULL;
  }

  return sndplay;
}

void WritePlay(
		      struct FFTSound *fftsound,
		      void *port,double **samples,int num_samples
		      )
{
  struct Sndplay *sndplay=(struct Sndplay *)port;
  int i,ch;
  int16_t framebuff[fftsound->Nw*2*MAX_SAMPS_PER_FRAME];

  for (i=0; i<num_samples; i++) {
    for (ch=0; ch<fftsound->samps_per_frame; ch++)
      *(framebuff+i*fftsound->samps_per_frame+ch)=(short)(samples[ch][i]*32767.);
  }

  mus_audio_write(sndplay->outport,(char*)framebuff,num_samples*2*fftsound->samps_per_frame);

}

void ClosePlay(void *port){
  struct Sndplay *sndplay=(struct Sndplay *)port;
  mus_audio_close(sndplay->outport);
  free(sndplay);
}


text:
require 'rubygems'
require 'rspec'
require 'serverspec/version'
require 'serverspec/matchers'
require 'serverspec/backend'
require 'serverspec/helper'
require 'serverspec/setup'
require 'serverspec/filter'
require 'serverspec/subject'
require 'serverspec/commands/base'
require 'serverspec/commands/linux'
require 'serverspec/commands/redhat'
require 'serverspec/commands/debian'
require 'serverspec/commands/gentoo'
require 'serverspec/commands/solaris'
require 'serverspec/commands/darwin'

RSpec.configure do |c|
  c.include(Serverspec::Helper::RedHat,  :os => :redhat)
  c.include(Serverspec::Helper::Debian,  :os => :debian)
  c.include(Serverspec::Helper::Gentoo,  :os => :gentoo)
  c.include(Serverspec::Helper::Solaris, :os => :solaris)
  c.include(Serverspec::Helper::Darwin,  :os => :darwin)
  c.add_setting :os,            :default => nil
  c.add_setting :host,          :default => nil
  c.add_setting :ssh,           :default => nil
  c.add_setting :sudo_password, :default => nil
  c.before :each do
    if described_class.nil? && subject == 'value'
      def subject
        Serverspec::Filter.filter_subject example
      end
    end
  end
end

module RSpec
  module Matchers
    module DSL
      class Matcher
        def failure_message_for_should(&block)
          if block.to_s =~ /serverspec\/matchers\/.+\.rb/
            @custom = true
          end
          if @custom
            cache_or_call_cached(:failure_message_for_should, &block)
          else
            message =  "#{example.metadata[:command]}\n"
            message += "#{example.metadata[:stdout]}"
            message
          end
        end
      end
    end
  end
end


text:
package org.apache.aries.samples.goat.dummy2;

import java.util.ArrayList;
import java.util.List;

import org.apache.aries.samples.goat.info.RelationshipInfoImpl;

import org.apache.aries.samples.goat.api.ComponentInfo;
import org.apache.aries.samples.goat.api.ComponentInfoProvider;
import org.apache.aries.samples.goat.api.RelationshipInfo;
import org.apache.aries.samples.goat.api.RelationshipInfoProvider;

public class DummyRelationshipProvider implements RelationshipInfoProvider {

	ComponentInfoProvider cip = null;

	public DummyRelationshipProvider(ComponentInfoProvider cip){
		this.cip = cip;
	}

	@Override
	public List<RelationshipInfo> getRelationships() {

		ArrayList<RelationshipInfo> ris = new ArrayList<RelationshipInfo>();

		ComponentInfo ci1 = cip.getComponentForId("/root/1");
		ComponentInfo ci2 = cip.getComponentForId("/root/2");
		ComponentInfo ci3 = cip.getComponentForId("/root/3");

		RelationshipInfoImpl ri1 = new RelationshipInfoImpl();
		RelationshipInfoImpl ri2 = new RelationshipInfoImpl();
		RelationshipInfoImpl ri3 = new RelationshipInfoImpl();
		RelationshipInfoImpl ri4 = new RelationshipInfoImpl();
		RelationshipInfoImpl ri5 = new RelationshipInfoImpl();
		RelationshipInfoImpl ri6 = new RelationshipInfoImpl();
		ris.add(ri1);
		ris.add(ri2);
		ris.add(ri3);
		ris.add(ri4);
		ris.add(ri5);
		ris.add(ri6);

		ri1.setName("i.am.exported.by.1.and.used.by.2.and.3");
		ri1.setProvidedBy(ci1);
		ArrayList<ComponentInfo> c = new ArrayList<ComponentInfo>();
		c.add(ci2);
		c.add(ci3);
		ri1.setConsumedBy(c);
		ri1.setType("Package");

		ri2.setName("i.am.exported.by.1.and.used.by.3");
		ri2.setProvidedBy(ci1);
		c = new ArrayList<ComponentInfo>();
		c.add(ci3);
		ri2.setConsumedBy(c);
		ri2.setType("Package");

		ri3.setName("i.am.exported.by.2.and.used.by.3");
		ri3.setProvidedBy(ci2);
		c = new ArrayList<ComponentInfo>();
		c.add(ci3);
		ri3.setConsumedBy(c);
		ri3.setType("Package");

		ri4.setName("i.am.exported.by.3.and.used.by.2");
		ri4.setProvidedBy(ci3);
		c = new ArrayList<ComponentInfo>();
		c.add(ci2);
		ri4.setConsumedBy(c);
		ri4.setType("Package");

		ri5.setName("i.am.a.funky.service.from.3.used.by.2");
		ri5.setProvidedBy(ci3);
		c = new ArrayList<ComponentInfo>();
		c.add(ci2);
		ri5.setConsumedBy(c);
		ri5.setType("Service");

		ri6.setName("i.am.a.funky.service.from.1.used.by.2");
		ri6.setProvidedBy(ci1);
		c = new ArrayList<ComponentInfo>();
		c.add(ci2);
		ri6.setConsumedBy(c);
		ri6.setType("Service");
		return ris;
	}

	@Override
	public void registerRelationshipInfoListener(RelationshipInfoListener listener) {
		// TODO Auto-generated method stub

	}

}


text:
<?xml version="1.0"?>
<!-- This file is used to register new types of portlets. It can also
     be used to register completely new column types. See CMFPlone's version
     of this file for more information.
  -->
<portlets
    xmlns:i18n="http://xml.zope.org/namespaces/i18n"
    i18n:domain="plone">
  <!-- -*- extra stuff goes here -*- -->
</portlets>


text:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "interface/vchi/vchi.h"

#include "interface/vmcs_host/vcgencmd.h"
#include "interface/vchi/os/os.h"

#include "vcfw/drivers/chip/mphi.h"

#ifdef __cplusplus
extern "C" {
#endif

#include "dbg.h"
int  vchiq_test_main(void);

#ifdef __cplusplus
}
#endif

#ifdef __GNUC__
#define COMPILER "gcc"
#define COMPILER_VERSION_MAJ (__GNUC__)
#define COMPILER_VERSION_MIN (__GNUC_MINOR__)
#elif defined(_MSC_VER)
#define COMPILER "cl"
#define COMPILER_VERSION_MAJ (_MSC_VER/100)
#define COMPILER_VERSION_MIN (_MSC_VER%100)
#else
#define COMPILER "armcc"
#define COMPILER_VERSION_MAJ 400
#define COMPILER_VERSION_MIN 400
//#error
#endif

#define VERSION "4"

typedef struct {
   fourcc_t fourcc;
   uint32_t messages;
   uint32_t last_messages, av_messages;
   uint32_t errors;
} INFO_FOURCC_T;
#define MAX_INFO 256
#define TEST_DURATION (30*1000000)
#define UPDATE_INFO_TIME 1000000
static INFO_FOURCC_T info[MAX_INFO];
static int test_failed = 0;

static OS_SEMAPHORE_T test_sem;
// need physical (i.e. local_mphi_get_func_table) implementation that supports multiple connections for this
#define num_connections 1

extern const MPHI_DRIVER_T *local_mphi_get_func_table(void);
void vc_dc4_server_init( VCHI_INSTANCE_T, VCHI_CONNECTION_T **, uint32_t);
void vc_dc4_client_init( VCHI_INSTANCE_T, VCHI_CONNECTION_T **, uint32_t);
void host_dc4_client_init( VCHI_INSTANCE_T, VCHI_CONNECTION_T **, uint32_t);
void host_dc4_server_init( VCHI_INSTANCE_T, VCHI_CONNECTION_T **, uint32_t);

void main_vc(unsigned a, void *b)
{
   int32_t success = -1; //fail by default
   VCHI_INSTANCE_T initialise_instance;
   VCHI_CONNECTION_T *connection[num_connections];
   int i;

   dprintf(1, "main_vc\n");

   // initialise the vchi layer
   success = vchi_initialise( &initialise_instance );
   assert( success == 0 );

   for (i=0; i<num_connections; i++) {
      connection[i] = vchi_create_connection(single_get_func_table(),
                                             vchi_mphi_message_driver_func_table());
   }
   // start up our test servers
#if 1
   vc_dc4_server_init (initialise_instance, &connection[0], num_connections);
#else
   vchi_long_server_init(initialise_instance, &connection[0], num_connections);
   vchi_short_server_init(initialise_instance, &connection[0], num_connections);
   // This is the test server initialisation
   vchi_cli_server_init(initialise_instance, &connection[0], num_connections);
   vchi_tstb_server_init(initialise_instance, &connection[0], num_connections);
   vchi_tstd_server_init(initialise_instance, &connection[0], num_connections);
#endif
   // now turn on the control service and initialise the connection
   success = vchi_connect(&connection[0], num_connections, initialise_instance);
   assert( success == 0 );
   vc_dc4_client_init(initialise_instance, &connection[0], num_connections);
}

void main_host(unsigned a, void *b)
{
   int success, iterations;
   VCHI_INSTANCE_T initialise_instance;
   VCHI_CONNECTION_T *connection[1];

   dprintf(1, "main_host\n");

   success = vchi_initialise( &initialise_instance );
   os_assert( success == 0 );

   connection[0] = vchi_create_connection( single_get_func_table(),
                                           vchi_mphi_message_driver_func_table() );

#if 1
   host_dc4_server_init(initialise_instance, &connection[0], num_connections);
#else
   host_test_init_long_short   ( initialise_instance, &connection[0], num_connections );
   host_test_init_client_server( initialise_instance, &connection[0], num_connections );
   host_test_init_bulk         ( initialise_instance, &connection[0], num_connections );
   host_test_init_bulkdata     ( initialise_instance, &connection[0], num_connections );
#endif
   // now turn on the control service and initialise the connection
   success = vchi_connect( &connection[0], 1, initialise_instance);
   os_assert( success == 0 );
   host_dc4_client_init(initialise_instance, &connection[0], num_connections);
}

int vchiq_test_main(void)
{
   int32_t success;
   VCOS_THREAD_T thread_vc, thread_host;
   const MPHI_DRIVER_T *mphi_driver;
   const int STACK=16*1024;

   //setvbuf(stdout, NULL, _IOLBF, 256);

   dprintf(1, "Testing MPHI driver layer\n");
   dprintf(1, "=========================\n");

   dprintf(1, "Version: %s\n", VERSION);
   dprintf(1, "Compiler %s (%d.%d)\n", COMPILER, COMPILER_VERSION_MAJ, COMPILER_VERSION_MIN);

   //dprintf(1, "Press any key to start system\n");
   //getchar();

   // System init
   os_init();
   os_time_init();

   //mphi_driver = mphi_get_func_table();
   //mphi_driver->init();

   success = os_semaphore_create( &test_sem, OS_SEMAPHORE_TYPE_SUSPEND );
   assert(success==0);

   success = os_thread_start( &thread_host, main_host, NULL, STACK, "main_host" );
   assert(success==0);

   success = os_thread_start( &thread_vc, main_vc, NULL, STACK, "main_vc" );
   assert(success==0);

   while (1)
   {
      uint32_t t = os_get_time_in_usecs();
      static uint32_t last_t;
      if (last_t == 0) last_t = t;
      if (t - last_t > TEST_DURATION) {
         break;
         //os_print_stats();
         last_t = t;
      }
      os_sleep(500);
   }
   dprintf(1, test_failed ? "Failed\n":"Passed\n");
   return test_failed;
}

void vchi_test_display_init(void)
{
   dprintf(1, "vchi_test_display_init\n");
}

static int find_fourcc(fourcc_t fourcc)
{
   int i;
   for (i=0; i<MAX_INFO; i++) {
      if (info[i].fourcc == fourcc)
         return i;
   }
   for (i=0; i<MAX_INFO; i++) {
      if (info[i].fourcc == 0) {
         info[i].fourcc = fourcc;
         return i;
      }
   }
   assert(0);
   return 0;
}

void update_display_info( fourcc_t service_id,int errors, int client_or_server )
{
   static uint32_t last_info_time;
   uint32_t now;
   int index;
   os_semaphore_obtain(&test_sem);
   now = os_get_time_in_usecs();
   if (!last_info_time) last_info_time = now;
   index = find_fourcc(service_id);
   info[index].errors = errors;
   info[index].messages++;

   if (now - last_info_time > UPDATE_INFO_TIME) {
      int i;
      last_info_time = now;
      for (i=0; i<MAX_INFO; i++) {
         if (info[i].fourcc == 0) continue;
         if (info[i].av_messages == 0) info[i].av_messages = info[i].messages;
         else info[i].av_messages = (15*info[i].av_messages + info[i].messages-info[i].last_messages)>>4;
         // failed if numbers stop increasing
         if (info[i].last_messages == info[i].messages)
            test_failed = 1;
         info[i].last_messages = info[i].messages;
         dprintf(1, "%c%c%c%c:%d (%d) %d\n", (info[i].fourcc>>24)&0xff, (info[i].fourcc>>16)&0xff, (info[i].fourcc>>8)&0xff, (info[i].fourcc>>0)&0xff, info[i].messages, info[i].errors, info[i].av_messages);
      }
      if (i < 8)
         test_failed = 1;
   }
   os_semaphore_release(&test_sem);
}
void update_display_speed( int type, double speed )
{
   dprintf(1, "update_display_speed(%d,%f)\n", type, speed);
}
void _dummy_function(void)
{
   assert(0);
}


text:
/** Automatically generated file. DO NOT MODIFY */
package de.xiaoxia.xstatusbarlunardate;

public final class BuildConfig {
    public final static boolean DEBUG = true;
}


text:
package com.wise.common.fdfs;

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.csource.common.NameValuePair;
import org.csource.fastdfs.ClientGlobal;
import org.csource.fastdfs.StorageClient1;
import org.csource.fastdfs.StorageServer;
import org.csource.fastdfs.TrackerClient;
import org.csource.fastdfs.TrackerServer;
import org.springframework.core.io.ClassPathResource;

/**
 * 连接Fast
 * 上传图片
 * 返回上传之后的路径 用此路径就能访问此图片
 *    group1/M00/00/01/wKjIgFWOYc6APpjAAAD-qk29i78248.jpg
 * @author lingyuwang
 *
 */
public class FastDFSUtils {

	private static final String CONF_FILENAME = "fdfs_client.properties";
	private static StorageClient1 storageClient1 = null;

	private static Logger logger = Logger.getLogger(FastDFSUtils.class);

	/**
	 * 只加载一次.
	 */
	static {
		try {
			logger.info("=== CONF_FILENAME:" + CONF_FILENAME);
			ClassPathResource resource = new ClassPathResource(CONF_FILENAME);
			ClientGlobal.init(resource.getClassLoader().getResource(CONF_FILENAME).getPath());
			TrackerClient trackerClient = new TrackerClient(ClientGlobal.g_tracker_group);
			TrackerServer trackerServer = trackerClient.getConnection();
			if (trackerServer == null) {
				logger.error("getConnection return null");
			}
			StorageServer storageServer = trackerClient.getStoreStorage(trackerServer);
			if (storageServer == null) {
				logger.error("getStoreStorage return null");
			}
			storageClient1 = new StorageClient1(trackerServer, storageServer);
		} catch (Exception e) {
			logger.error(e);
		}
	}

	/**
	 *
	 * @param file
	 *            文件
	 * @param fileName
	 *            文件名
	 * @return 返回Null则为失败
	 */
	public static String uploadFile(File file, String fileName) {
		FileInputStream fis = null;
		try {
			NameValuePair[] meta_list = null; // new NameValuePair[0];
			fis = new FileInputStream(file);
			byte[] file_buff = null;
			if (fis != null) {
				int len = fis.available();
				file_buff = new byte[len];
				fis.read(file_buff);
			}

			String fileid = storageClient1.upload_file1(file_buff, getFileExt(fileName), meta_list);
			return fileid;
		} catch (Exception ex) {
			logger.error(ex);
			return null;
		}finally{
			if (fis != null){
				try {
					fis.close();
				} catch (IOException e) {
					logger.error(e);
				}
			}
		}
	}

	/**
	 * 上传文件
	 * @param bytes
	 * @param name
	 * @param size
	 * @return
	 */
	public static String uploadFile(byte[] bytes,String name,Long size) {
		FileInputStream fis = null;
		try {
			//扩展名
			String ext = FilenameUtils.getExtension(name);
			NameValuePair[] meta_list = new NameValuePair[3];
			meta_list[0] = new NameValuePair("filename",name);
			meta_list[1] = new NameValuePair("fileext",ext);
			meta_list[2] = new NameValuePair("filesize",String.valueOf(size));
			String fileid = storageClient1.upload_file1(bytes, ext, meta_list);
			return fileid;
		} catch (Exception ex) {
			logger.error(ex);
			return null;
		}finally{
			if (fis != null){
				try {
					fis.close();
				} catch (IOException e) {
					logger.error(e);
				}
			}
		}
	}

	/**
	 * 根据组名和远程文件名来删除一个文件
	 *
	 * @param groupName
	 *            例如 "group1" 如果不指定该值,默认为group1
	 * @param fileName
	 *            例如"M00/00/00/wKgxgk5HbLvfP86RAAAAChd9X1Y736.jpg"
	 * @return 0为成功,非0为失败,具体为错误代码
	 */
	public static int deleteFile(String groupName, String fileName) {
		try {
			int result = storageClient1.delete_file(groupName == null ? "group1" : groupName, fileName);
			return result;
		} catch (Exception ex) {
			logger.error(ex);
			return 0;
		}
	}

	/**
	 * 根据fileId来删除一个文件(我们现在用的就是这样的方式,上传文件时直接将fileId保存在了数据库中)
	 *
	 * @param fileId
	 *            file_id源码中的解释file_id the file id(including group name and filename);例如 group1/M00/00/00/ooYBAFM6MpmAHM91AAAEgdpiRC0012.xml
	 * @return 0为成功,非0为失败,具体为错误代码
	 */
	public static int deleteFile(String fileId) {
		try {
			int result = storageClient1.delete_file1(fileId);
			return result;
		} catch (Exception ex) {
			logger.error(ex);
			return 0;
		}
	}

	/**
	 * 修改一个已经存在的文件
	 *
	 * @param oldFileId
	 *            原来旧文件的fileId, file_id源码中的解释file_id the file id(including group name and filename);例如 group1/M00/00/00/ooYBAFM6MpmAHM91AAAEgdpiRC0012.xml
	 * @param file
	 *            新文件
	 * @param filePath
	 *            新文件路径
	 * @return 返回空则为失败
	 */
	public static String modifyFile(String oldFileId, File file, String filePath) {
		String fileid = null;
		try {
			// 先上传
			fileid = uploadFile(file, filePath);
			if (fileid == null) {
				return null;
			}
			// 再删除
			int delResult = deleteFile(oldFileId);
			if (delResult != 0) {
				return null;
			}
		} catch (Exception ex) {
			logger.error(ex);
			return null;
		}
		return fileid;
	}

	/**
	 * 文件下载
	 *
	 * @param fileId
	 * @return 返回一个流
	 */
	public static InputStream downloadFile(String fileId) {
		try {
			byte[] bytes = storageClient1.download_file1(fileId);
			InputStream inputStream = new ByteArrayInputStream(bytes);
			return inputStream;
		} catch (Exception ex) {
			logger.error(ex);
			return null;
		}
	}

	/**
	 * 获取文件后缀名(不带点).
	 *
	 * @return 如:"jpg" or "".
	 */
	private static String getFileExt(String fileName) {
		if (StringUtils.isBlank(fileName) || !fileName.contains(".")) {
			return "";
		} else {
			return fileName.substring(fileName.lastIndexOf(".") + 1); // 不带最后的点
		}
	}
}


text:
import sys

total_energy = 0
total_time = 0
total_iters = 0
num_files = 0
for fname in sys.argv[1:]:
    num_files += 1
    f = open(fname, "r")
    final_energy = 0
    final_time = 0
    total_lines = 0
    for line in f:
        total_lines += 1
        fields = line.split()
        final_energy = float(fields[4])
        final_time = float(fields[2])
    total_energy += final_energy
    total_time += final_time
    total_iters += total_lines
total_energy /= num_files
total_time /= num_files
total_iters /= float(num_files)

print "Average energy: ", total_energy
print "Average time: ", total_time
print "Average iters: ", total_iters


text:
package org.gradle.launcher.daemon.registry;

import org.gradle.util.internal.GFileUtils;
import org.gradle.util.GradleVersion;

import java.io.File;

public class DaemonDir {
    private final File baseDir;
    private final File versionedDir;
    private final File registryFile;

    public DaemonDir(File baseDir) {
        this.baseDir = baseDir;
        this.versionedDir = new File(baseDir, GradleVersion.current().getVersion());
        this.registryFile = new File(versionedDir, "registry.bin");
        GFileUtils.mkdirs(this.versionedDir);
    }

    public File getBaseDir() {
        return baseDir;
    }

    public File getVersionedDir() {
        return versionedDir;
    }

    public File getRegistry() {
        return registryFile;
    }
}


text:
<?php namespace Unisharp\Laravelfilemanager\controllers;

use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\View;
use Intervention\Image\Facades\Image;

/**
 * Class LfmController
 * @package Unisharp\Laravelfilemanager\controllers
 */
class LfmController extends Controller {

    /**
     * @var
     */
    public $file_location;
    public $dir_location;

    /**
     * Constructor
     */
    public function __construct()
    {
        $this->setPathAndType();

        $this->checkMyFolderExists();

        $this->checkSharedFolderExists();
    }

    /**
     * Show the filemanager
     *
     * @return mixed
     */
    public function show()
    {
        if (Input::has('working_dir')) {
            $working_dir = Input::get('working_dir');
        } else {
            $working_dir = '/';
        }

        return View::make('laravel-filemanager::index')
            ->with('working_dir', $working_dir);
    }

    /*****************************
     ***   Private Functions   ***
     *****************************/

    private function setPathAndType()
    {
        if (Input::has('type') && Input::get('type') === 'Files') {
            Session::put('lfm_type', 'Files');
            $this->file_location = Config::get('lfm.files_dir');
            $this->dir_location = Config::get('lfm.files_url');
        } else {
            Session::put('lfm_type', 'Images');
            $this->file_location = Config::get('lfm.images_dir');
            $this->dir_location = Config::get('lfm.images_url');
        }
    }

    private function checkMyFolderExists()
    {
        if (\Config::get('lfm.allow_multi_user') === true) {
            $path = base_path($this->file_location . Input::get('working_dir'));

            if (!File::exists($path)) {
                File::makeDirectory($path, $mode = 0777, true, true);
            }
        }
    }

    private function checkSharedFolderExists()
    {
        $path = base_path($this->file_location . Config::get('lfm.shared_folder_name'));

        if (!File::exists($path)) {
            File::makeDirectory($path, $mode = 0777, true, true);
        }
    }

    private function formatLocation($location, $type = null)
    {
        $working_dir = Input::get('working_dir');

        if ($working_dir !== '/') {
            $location .= $working_dir . '/';
        }

        if ($type === 'thumb') {
            $location = $location . Config::get('lfm.thumb_folder_name') . '/';
        }

        return $location;
    }

    /****************************
     ***   Shared Functions   ***
     ****************************/

    public function getPath($type = null)
    {
        $path = base_path() . '/' . $this->file_location;

        $path = $this->formatLocation($path, $type);

        return $path;
    }

    public function getUrl($type = null)
    {
        $url = $this->dir_location;

        $url = $this->formatLocation($url, $type);

        return $url;
    }

    public function getDirectories($path)
    {
        $thumb_folder_name = Config::get('lfm.thumb_folder_name');
        $all_directories = File::directories(base_path($path));

        $arr_dir = [];

        foreach ($all_directories as $directory) {
            $dir_name = $this->getFileName($directory);

            if ($dir_name !== $thumb_folder_name) {
                $arr_dir[] = $dir_name;
            }
        }

        return $arr_dir;
    }

    public function getFileName($file)
    {
        $path_parts = explode('/', $file);

        $filename = end($path_parts);

        return $filename;
    }
}


text:
<!DOCTYPE html><html><head><meta charset="utf-8" />
<meta http-equiv="refresh" content="0;url=/place/cote-divoire/postcodes/" />
</head></html>


text:
import java.util.*;

class Main {
  void test(Map<String, Integer> map) {
    Map<String, Integer> result = new HashMap<>();
    result.put("answer", 42);
    for (Iterator<Map.Entry<String, Integer>> iterator = map.entrySet().iterator(); iterator.hasNext(); ) {
      Map.Entry<String, Integer> e = iterator.next();
      result<caret>.put(e.getKey(), e.getValue());
    }
  }
}


text:
#ifndef CPL_VSI_ERROR_H_INCLUDED
#define CPL_VSI_ERROR_H_INCLUDED

#include "cpl_port.h"
#include "cpl_error.h"

/* ====================================================================
        Filesystem error codes.
   ==================================================================== */

CPL_C_START

typedef int VSIErrorNum;

#define VSIE_None                       0
#define VSIE_FileError                  1
#define VSIE_HttpError                  2

#define VSIE_AWSError                   5
#define VSIE_AWSAccessDenied            6
#define VSIE_AWSBucketNotFound          7
#define VSIE_AWSObjectNotFound          8
#define VSIE_AWSInvalidCredentials      9
#define VSIE_AWSSignatureDoesNotMatch   10

void CPL_DLL VSIError(VSIErrorNum err_no, const char *fmt, ...)  CPL_PRINT_FUNC_FORMAT (2, 3);

void CPL_DLL CPL_STDCALL VSIErrorReset( void );
VSIErrorNum CPL_DLL CPL_STDCALL VSIGetLastErrorNo( void );
const char CPL_DLL * CPL_STDCALL VSIGetLastErrorMsg( void );

int CPL_DLL CPL_STDCALL VSIToCPLError(CPLErr eErrClass, CPLErrorNum eDefaultErrorNo);

CPL_C_END

#endif /* CPL_VSI_ERROR_H_INCLUDED */


text:
package com.edu.ncu.cc.ncumapwiki;

import android.app.Activity;
import android.app.ListActivity;
import android.app.SearchManager;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.util.Log;
import android.view.View;
import android.widget.ListView;
import android.widget.Toast;

import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

public class SearchableActivity extends ListActivity {
    JSONObject objects;
    Context context;
    RequestQueue mQueue;
    String query;
    Search tempQuery;
    ArrayList<Search> getQuery = new ArrayList<>();
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        handleIntent(getIntent());
        //Volley
        mQueue = Volley.newRequestQueue(this);
        context = this;
        setDefaultKeyMode(DEFAULT_KEYS_SEARCH_GLOBAL);
    }
    @Override
    protected void onNewIntent(Intent intent) {
        setIntent(intent);//must store the new intent unless getIntent() will return the old one
        handleIntent(intent);
        /*Intent intentSearch = new Intent();
        intentSearch.setClass(this, MapSearchActivity.class);*/
        //doSearch(query);
    }

    private void handleIntent(Intent intent) {
        if (ContactsContract.Intents.SEARCH_SUGGESTION_CLICKED.equals(intent.getAction())) {
            //handles suggestion clicked query
            //String displayName = getDisplayNameForContact(intent);
            //resultText.setText(displayName);
        }
        //this else if is called when you will press Search Icon  or Go (on soft keyboard)
        else if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
            query = intent.getStringExtra(SearchManager.QUERY);
            Log.e("serach",query);
            //doSearch();
        }
    }
    private void doSearch() {
        String url = "http://140.115.189.151:9292/location/v2/search?q="+query;
        StringRequest mStringRequest = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() {
            @Override
            public void onResponse(String response) {
                Log.e("TAG", response);
                try {
                    JSONArray ArrayObjects=new JSONArray(response);
                    for (int i = 0; i < ArrayObjects.length(); i++) {
                        objects=ArrayObjects.getJSONObject(i);
                        tempQuery=new Search(objects.getString("name"),objects.getString("type"),objects.getString("id"));
                        getQuery.add(tempQuery);
                        getQuery.get(i);
                        Toast.makeText(getApplicationContext(), query, Toast.LENGTH_LONG).show();
                    }
                } catch (JSONException e) {
                    Log.e("debug", "Json parse failed!");
                    Log.e("debug", e.getLocalizedMessage());
                    e.printStackTrace();
                }
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                Log.e("TAG", error.getMessage(), error);
                Toast.makeText(context, error.getLocalizedMessage(), Toast.LENGTH_LONG).show();
            }
        }) {
            public Map<String, String> getHeaders() throws AuthFailureError {
                Map<String, String> headers = new HashMap<>();
                headers.put("X-NCU-API-TOKEN", getResources().getString(R.string.apiToken));
                return headers;
            }
        };
        mQueue.add(mStringRequest);
    }
    /*public void onListItemClick(ListView l, View v, int position, long id) {
        // call the appropriate detail activity
    }

    @Override
    public boolean onSearchRequested() {
        Bundle appSearchData = new Bundle();
        appSearchData.putString("KEY", query);
        startSearch(null, false, appSearchData, false);
        // 必须返回true。否则绑定的数据作废
        return true;
    }*/
}


text:
package com.ctrip.platform.dal.dao;

/**
 * @author c7ch23en
 */
public interface DalCallback<T extends CallbackContext> {

    void handle(T context);

}


text:
Model driven updates

Split `update()` into two functions called in response to model changes.


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<title>Basic Filters in jQuery</title>

First List Item

Second List Item

Third List Item

Fourth List Item

First Paragraph <p class="normal">

Second Paragraph with no class

Third Paragraph <p class="special">

Fourth Paragraph with no class


text:
package com.cedricziel.idea.fluid.viewHelpers;

import com.cedricziel.idea.fluid.extensionPoints.ViewHelperProvider;
import com.cedricziel.idea.fluid.viewHelpers.model.ViewHelper;
import com.cedricziel.idea.fluid.viewHelpers.model.ViewHelperArgument;
import com.intellij.lang.xml.XMLLanguage;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiFileFactory;
import com.intellij.psi.XmlRecursiveElementVisitor;
import com.intellij.psi.xml.XmlAttribute;
import com.intellij.psi.xml.XmlFile;
import com.intellij.psi.xml.XmlTag;
import com.intellij.psi.xml.XmlText;
import gnu.trove.THashMap;
import org.jetbrains.annotations.NotNull;

import java.io.*;
import java.util.Map;
import java.util.Objects;

public class DefaultViewHelpersProvider implements ViewHelperProvider {
    private static final Map<String, Map<String, ViewHelper>> myCache = new THashMap<>();

    @NotNull
    @Override
    public Map<String, ViewHelper> provideForNamespace(@NotNull Project project, @NotNull String namespace) {
        if (!namespace.equals("TYPO3/Fluid/ViewHelpers") && !namespace.isEmpty()) {

            return new THashMap<>();
        }

        String schemaLocation = "/schemas/fluid/7.6.xsd";
        return getStringViewHelperMap(project, schemaLocation);
    }

    private synchronized Map<String, ViewHelper> getStringViewHelperMap(@NotNull Project project, String schemaLocation) {
        if (myCache.containsKey(schemaLocation)) {

            return myCache.get(schemaLocation);
        }

        String schema = readSchema(schemaLocation);

        XmlFile xmlLanguage = (XmlFile) PsiFileFactory.getInstance(project).createFileFromText(XMLLanguage.INSTANCE, schema);

        ViewHelperSchemaRecursiveElementVisitor visitor = new ViewHelperSchemaRecursiveElementVisitor();
        visitor.visitXmlFile(xmlLanguage);

        myCache.put(schemaLocation, visitor.viewHelpers);

        return myCache.get(schemaLocation);
    }

    private String readSchema(String schemaLocation) {
        InputStream resourceAsStream = DefaultViewHelpersProvider.class.getResourceAsStream(schemaLocation);
        String schema = "";
        try {
            schema = readFromInputStream(resourceAsStream);
        } catch (IOException e) {
            e.printStackTrace();
        }

        return schema;
    }

    private class ViewHelperSchemaRecursiveElementVisitor extends XmlRecursiveElementVisitor {
        Map<String, ViewHelper> viewHelpers = new THashMap<>();

        @Override
        public void visitXmlTag(XmlTag tag) {
            if (!tag.getName().equals("xsd:element")) {
                super.visitXmlTag(tag);

                return;
            }

            XmlAttribute nameAttribute = tag.getAttribute("name");
            if (nameAttribute == null || nameAttribute.getValue() == null) {
                super.visitXmlTag(tag);

                return;
            }

            ViewHelper viewHelper = new ViewHelper(nameAttribute.getValue());
            viewHelper.setDocumentation(extractDocumentation(tag));

            XmlTag complexType = tag.findFirstSubTag("xsd:complexType");
            if (complexType != null) {
                XmlTag[] attributeTags = complexType.findSubTags("xsd:attribute");
                for (XmlTag attributeTag : attributeTags) {
                    String argumentName = attributeTag.getAttributeValue("name");
                    if (argumentName == null) {
                        continue;
                    }

                    ViewHelperArgument argument = new ViewHelperArgument(argumentName);

                    argument.setDocumentation(extractDocumentation(attributeTag));

                    String attributeType = attributeTag.getAttributeValue("php:type");
                    argument.setType(Objects.requireNonNullElse(attributeType, "mixed"));

                    String requiredAttribute = attributeTag.getAttributeValue("use");
                    if (requiredAttribute != null && requiredAttribute.equals("required")) {
                        argument.setRequired(true);
                    }

                    viewHelper.addArgument(argumentName, argument);
                }
            }

            viewHelpers.put(nameAttribute.getValue(), viewHelper);

            super.visitXmlTag(tag);
        }

        private @NotNull
        String extractDocumentation(XmlTag attributeTag) {
            StringBuilder attributeDocumentation = new StringBuilder();

            XmlTag attributeAnnotation = attributeTag.findFirstSubTag("xsd:annotation");
            if (attributeAnnotation != null) {
                XmlTag attributeDoc = attributeAnnotation.findFirstSubTag("xsd:documentation");
                if (attributeDoc != null) {
                    for (XmlText textElement : attributeDoc.getValue().getTextElements()) {
                        attributeDocumentation.append(textElement.getValue());
                    }
                }
            }

            return attributeDocumentation.toString();
        }
    }

    private String readFromInputStream(InputStream inputStream)
        throws IOException {
        StringBuilder resultStringBuilder = new StringBuilder();
        try (BufferedReader br = new BufferedReader(new InputStreamReader(inputStream))) {
            String line;
            while ((line = br.readLine()) != null) {
                resultStringBuilder.append(line).append("\n");
            }
        } finally {
            if (inputStream != null) {
                try {
                    inputStream.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }

        return resultStringBuilder.toString();
    }
}


text:
import json
from sqlalchemy import Column, Integer, String, PickleType, Enum, ForeignKey, Table, Boolean
from sqlalchemy.ext.declarative import declarative_base, DeclarativeMeta
from sqlalchemy.orm import relationship
from sm.so.service_orchestrator import LOG

# conf = SysUtil().get_sys_conf()
Base = declarative_base()
# engine = DatabaseManager().engine

# create_engine(
# 'mysql://' + conf['db_username'] + ':' + conf['db_password'] + '@' + conf['db_url'] + '/' + conf['db_name'],
# echo=False)

__author__ = 'giuseppe'

state = ('ERROR', 'DEFINED', 'DEPLOYING', 'DEPLOYED', 'INITIALISING', 'INITIALISED', 'DELETING', 'DELETED', 'UPDATING',
         'UPDATED', 'STATE_NOT_IMPLEMENTED', 'STARTED')

class State:
    ref_state = state

class AbstractService(object):
    def __init__(self, **entries):
        self.__dict__.update(entries)

    def __init__(self):
        self.service_type
        self.type
        self.image
        self.flavor
        self.size
        self.config
        self.adapter

class Service(AbstractService, Base):
    __tablename__ = 'Service'
    id = Column(Integer, primary_key=True)
    service_type = Column(String(50), unique=True)
    flavor = relationship('Flavor', cascade='save-update, merge, refresh-expire, expunge', lazy='select')
    flavor_id = Column(Integer, ForeignKey('Flavor.id'))
    image = relationship('Image', cascade='save-update, merge, refresh-expire, expunge', lazy='select')
    image_id = Column(Integer, ForeignKey('Image.id'))
    key = relationship('Key', cascade='save-update, merge, refresh-expire, expunge', lazy='select')
    key_id = Column(Integer, ForeignKey('Key.id'))
    user_data = relationship('Command', cascade="all, delete-orphan", lazy='immediate')
    requirements = relationship('Requirement', cascade="all, delete-orphan", lazy='immediate')
    networks = relationship('Network_Instance', cascade="all, delete-orphan", lazy='immediate')
    adapter = Column(String(50))
    size = Column(PickleType)
    version = Column(String(50))
    configuration = Column(PickleType)

    def __init__(self, service_type, image, flavor, size, version=None, user_data=[], requirements=[], networks=[], key=None, configuration={}, adapter=None):
        self.id = None
        self.service_type = service_type
        self.configuration = configuration
        self.image = image
        self.image_id = None
        self.flavor = flavor
        self.flavor_id = None
        self.key = key
        self.key_id = None
        self.user_data = user_data
        self.requirements = requirements
        self.networks = networks
        self.size = size
        self.version = version
        self.adapter = adapter

    def __str__(self):
        t = ""
        t += '<Service>['
        t += 'id:%s, ' % (self.id)
        t += 'service_type:%s, ' % (self.service_type)
        t += 'version:%s, ' % (self.version)
        t += 'image:%s, ' % (self.image)
        t += 'image_id:%s, ' % (self.image_id)
        t += 'flavor:%s, ' % (self.flavor)
        t += 'flavor_id:%s, ' % (self.flavor_id)
        t += 'key:%s, ' % (self.key)
        t += 'key_id:%s, ' % (self.key_id)
        t += 'size:%s, ' % self.size
        t += 'adapter:%s, ' % self.adapter
        t += 'networks:['
        if self.networks:
            t += '%s' % self.networks[0].__str__()
            for network in self.networks[1:]:
                t += ', %s' % network.__str__()
        else:
            t += 'None'
        t += '], '
        t += 'requirements:['
        if self.requirements:
            t += '%s' % self.requirements[0].__str__()
            for requirement in self.requirements[1:]:
                t += ', %s' % requirement.__str__()
        else:
            t += 'None'
        t += '], '
        t += 'user_data:['
        if self.user_data:
            t += '%s' % self.user_data[0].__str__()
            for user_data in self.user_data[1:]:
                t += ', %s' % user_data.__str__()
        else:
            t += 'None'
        t += ']'
        t += 'configuration:%s ' % (self.configuration)
        t += ']'
        return t

class Command(Base):
    __tablename__ = 'Command'

    id = Column(Integer, primary_key=True)
    command = Column(String(256))
    service_id = Column(Integer, ForeignKey('Service.id'))
    service_instance_id = Column(Integer, ForeignKey('ServiceInstance.id'), onupdate='CASCADE')

    def __init__(self, command):
        self.id = None
        self.command = command
        self.service_instance_id = None

    def __str__(self):
        t = ""
        t += '<Command>['
        t += 'id:%s, ' % (self.id)
        t += 'command:%s, ' % (self.command)
        t += 'service_id:%s, ' % (self.service_id)
        t += 'service_instance_id:%s' % (self.service_instance_id)
        t += ']'
        return t

NetworkInstance_SecurityGroup = Table('NetworkInstance_SecurityGroup', Base.metadata,
                                      Column('Network_Instance_id', Integer, ForeignKey('Network_Instance.id', ondelete='SET NULL')),
                                      Column('SecurityGroup_id', Integer, ForeignKey('SecurityGroup.id', ondelete='SET NULL'))
)
NetworkInstance_SecurityGroup.__name__ = 'NetworkInstance_SecurityGroup'

class ServiceInstance(AbstractService, Base):
    __tablename__ = 'ServiceInstance'

    id = Column(Integer, primary_key=True)
    topology_id = Column(Integer, ForeignKey('Topology.id'))
    networks = relationship('Network_Instance', cascade="all, delete-orphan", lazy='immediate')
    policies = relationship('Policy', cascade="all, delete-orphan", lazy='select')
    requirements = relationship('Requirement', cascade="all, delete-orphan", lazy='select')
    units = relationship('Unit', cascade="all, delete-orphan", lazy='select')
    user_data = relationship('Command', cascade="all, delete-orphan", lazy='select')
    configuration = Column(PickleType)
    flavor_id = Column(Integer, ForeignKey('Flavor.id'))
    flavor = relationship('Flavor', cascade='save-update, merge, refresh-expire, expunge', lazy='select')
    image_id = Column(Integer, ForeignKey('Image.id'))
    image = relationship('Image', cascade='save-update, merge, refresh-expire, expunge', lazy='select')
    key_id = Column(Integer, ForeignKey('Key.id'))
    key = relationship('Key', cascade='save-update, merge, refresh-expire, expunge', lazy='select')
    key_id = Column(Integer, ForeignKey('Key.id'))
    key = relationship('Key', cascade='save-update, merge, refresh-expire, expunge', lazy='select')
    location = relationship('Location', cascade='all, delete-orphan', lazy='select')
    relation = relationship('Relation', cascade='all, delete-orphan', lazy='select')
    name = Column(String(50))
    service_type = Column(String(50))
    adapter = Column(String(50))
    size = Column(PickleType)
    state = Column('State', Enum(*state))

    def __init__(self, name, service_type, state, image, flavor, size, key=None, location=[], relation=[],
                 policies=[], units=[], requirements=[], user_data=[], networks=[], configuration={}, adapter=None):
        self.id = None
        self.topology_id = None
        self.configuration = configuration
        self.image = image
        self.image_id = None
        self.flavor = flavor
        self.flavor_id = None
        self.key = key
        self.key_id = None
        self.location = location
        self.relation = relation
        self.name = name
        self.networks = networks
        self.policies = policies
        self.requirements = requirements
        self.service_type = service_type
        self.size = size
        self.state = state
        self.units = units
        self.user_data = user_data
        self.adapter = adapter
        self.instace_adapter = None

    def __str__(self):
        t = ""
        t += '<ServiceInstance>['
        t += 'id:%s, ' % (self.id)
        t += 'topology_id:%s, ' % (self.topology_id)
        t += 'name:%s, ' % (self.name)
        t += 'service_type:%s, ' % (self.service_type)
        t += 'adapter: %s, ' % (self.adapter)
        t += 'state: %s, ' % (self.state)
        t += 'configuration:%s, ' % (self.configuration)
        t += 'image:%s, ' % (self.image)
        t += 'image_id:%s, ' % (self.image_id)
        t += 'flavor:%s, ' % (self.flavor)
        t += 'flavor_id:%s, ' % (self.flavor_id)
        t += 'key:%s, ' % (self.key)
        t += 'key_id:%s, ' % (self.key_id)
        t += 'relation:%s, ' % (self.relation)
        t += 'location:%s, ' % (self.location)
        t += 'networks:['
        if self.networks:
            t += '%s' % self.networks[0].__str__()
            for network in self.networks[1:]:
                t += ', %s' % network.__str__()
        else:
            t += 'None'
        t += '], '
        t += 'relations:['
        if self.relation:
            t += '%s' % self.relation[0].__str__()
            for rel in self.relation[1:]:
                t += ', %s' % rel.__str__()
        else:
            t += 'None'
        t += '], '
        t += 'locations:['
        if self.location:
            t += '%s' % self.location[0].__str__()
            for loc in self.location[1:]:
                t += ', %s' % loc.__str__()
        else:
            t += 'None'
        t += '], '
        t += 'policies:['
        if self.policies:
            t += '%s' % self.policies[0].__str__()
            for policy in self.policies[1:]:
                t += ', %s' % policy.__str__()
        else:
            t += 'None'
        t += '], '
        t += 'requirements:['
        if self.requirements:
            t += '%s' % self.requirements[0].__str__()
            for requirement in self.requirements[1:]:
                t += ', %s' % requirement.__str__()
        else:
            t += 'None'
        t += '], '
        t += 'size:%s, ' % self.size
        t += 'units:['
        if self.units:
            t += '%s' % self.units[0].__str__()
            for unit in self.units[1:]:
                t += ', %s' % unit.__str__()
        else:
            t += 'None'
        t += '], '
        t += 'user_data:['
        if self.user_data:
            t += '%s' % self.user_data[0].__str__()
            for user_data in self.user_data[1:]:
                t += ', %s' % user_data.__str__()
        else:
            t += 'None'
        t += ']'
        t += ']'
        return t

class Topology(Base):
    __tablename__ = 'Topology'

    id = Column(Integer, primary_key=True)
    ext_name = Column(String(50), unique=True)  # heat constraint
    name = Column(String(50), unique=False)
    ext_id = Column(String(50))
    state = Column('State', Enum(*state))
    detailed_state = Column(String(300))
    service_instances = relationship('ServiceInstance', cascade='all, delete-orphan', lazy='select')

    def __init__(self, name, state, detailed_state=None, service_instances=[], ext_id=None, ext_name=None):
        self.id = None
        self.name = name
        self.ext_id = ext_id
        self.state = state
        self.detailed_state = detailed_state
        self.service_instances = service_instances
        self.ext_name = ext_name

    def __str__(self):
        t = ""
        t += '<Topology>['
        t += 'id:%s, ' % self.id
        t += 'name:%s, ' % self.name
        t += 'ext_id:%s, ' % self.ext_id
        t += 'ext_name:%s, ' % self.ext_name
        t += 'state:%s, ' % self.state
        t += 'detailed_state:%s, ' % self.detailed_state
        t += 'service_instance_components:['
        if self.service_instances:
            t += '%s' % self.service_instances[0].__str__()
            for si in self.service_instances[1:]:
                t += ', %s' % si.__str__()
        else:
            t += 'None'
        t += ']'
        t += ']'
        return t

class Port(Base):
    __tablename__ = 'Port'

    id = Column(Integer, primary_key=True)
    name = Column(String(150))
    ext_id = Column(String(50))
    mac_address = Column(String(50))
    unit_id = Column(Integer, ForeignKey('Unit.id', onupdate='CASCADE'))
    ips = Column(PickleType)

    def __init__(self, name, ext_id=None, mac_address=None, ips={}):
        self.id = None
        self.unit_id = None
        self.name = name
        self.ext_id = ext_id
        self.mac_address = mac_address
        self.ips = ips

    def __str__(self):
        t = ""
        t += '<Port>['
        t += 'id:%s, ' % self.id
        t += 'unit_id:%s, ' % self.unit_id
        t += 'name:%s, ' % self.name
        t += 'mac_address:%s, ' % self.mac_address
        t += 'ext_id:%s' % self.ext_id
        t += ']'
        return t

class Unit(Base):
    __tablename__ = 'Unit'

    id = Column(Integer, primary_key=True)
    hostname = Column(String(20))
    ext_id = Column(String(50))
    availability_zone = Column(String(50))
    ws = Column(String(100))
    ips = Column(PickleType)
    floating_ips = Column(PickleType)
    ports = relationship('Port', cascade='all, delete-orphan')
    state = Column('State', Enum(*state))
    service_instance_id = Column(Integer, ForeignKey('ServiceInstance.id'))

    def __init__(self, hostname, state, availability_zone=None, ext_id=None, ips={}, floating_ips={}, ports=[]):
        self.id = None
        self.hostname = hostname
        self.state = state
        self.ext_id = ext_id
        self.ips = ips
        self.ports = ports
        self.floating_ips = floating_ips
        self.availability_zone = availability_zone
        self.ws = None

    def __str__(self):
        t = ""
        t += '<Unit>['
        t += 'id:%s, ' % self.id
        t += 'service_instance_id:%s, ' % self.service_instance_id
        t += 'hostname:%s, ' % self.hostname
        t += 'state:%s, ' % self.state
        t += 'ext_id:%s, ' % self.ext_id
        t += 'ips:%s, ' % self.ips
        t += 'floating_ips:%s, ' % self.floating_ips
        t += 'ws:%s, ' % self.ws
        t += 'availability_zone:%s, ' % self.availability_zone
        t += 'ports:['
        if self.ports:
            t += '%s' % self.ports[0].__str__()
            for port in self.ports[1:]:
                t += ', %s' % port.__str__()
        else:
            t += 'None'
        t += ']'
        t += ']'
        return t

class SecurityGroup(Base):
    __tablename__ = 'SecurityGroup'

    id = Column(Integer, primary_key=True)
    name = Column(String(50), unique=True)
    rules = relationship('Rule', cascade="all, delete-orphan", lazy='immediate')

    def __init__(self, name, rules=[]):
        self.id = None
        self.name = name
        self.rules = rules

    def __str__(self):
        t = ""
        t += '<SecurityGroup>['
        t += 'id:%s, ' % self.id
        t += 'name:%s, ' % self.name
        t += 'Rules:['
        if self.rules:
            t += '%s' % self.rules[0].__str__()
            for rule in self.rules[1:]:
                t += ', %s' % rule.__str__()
        else:
            t += 'None'
        t += ']'
        t += ']'
        return t

class Subnet(Base):
    __tablename__ = 'Subnet'

    id = Column(Integer, primary_key=True)
    name = Column(String(50), unique=True)
    cidr = Column(String(50))
    network_id = Column(Integer, ForeignKey('Network.id'))
    start_ip = Column(String(50))
    end_ip = Column(String(50))
    ext_id = Column(String(50))

    def __init__(self, name, ext_id, cidr, start_ip, end_ip):
        self.id = None
        self.network_id = None
        self.name = name
        self.ext_id = ext_id
        self.end_ip = end_ip
        self.start_ip = start_ip
        self.cidr = cidr

    def __str__(self):
        t = ""
        t += '<Subnet>['
        t += 'id:%s, ' % self.id
        t += 'name:%s, ' % self.name
        t += 'ext_id:%s, ' % self.ext_id
        t += 'network_id:%s, ' % self.network_id
        t += 'cidr:%s, ' % self.cidr
        t += 'start_ip:%s, ' % self.start_ip
        t += 'end_ip:%s, ' % self.end_ip
        t += ']'
        return t

class Network(Base):
    __tablename__ = 'Network'

    id = Column(Integer, primary_key=True)
    # This colum is unique because of heat issue: in case of 2 or more Network with the same name in the HOT,
    # heat randomly pick up a Network
    name = Column(String(50), unique=True)
    public = Column(Boolean)
    subnets = relationship('Subnet', cascade="all, delete, delete-orphan", lazy='immediate')
    ext_id = Column(String(50))

    def __init__(self, name, ext_id, public=False, subnets=[]):
        self.id = None
        self.name = name
        self.ext_id = ext_id
        self.public = public
        self.subnets = subnets

    def __str__(self):
        t = ""
        t += '<Network>['
        t += 'id:%s, ' % self.id
        t += 'name:%s, ' % self.name
        t += 'ext_id:%s, ' % self.ext_id
        t += 'public:%s, ' % self.public
        t += 'subnets:['
        if self.subnets:
            t += '%s' % self.subnets[0].__str__()
            for subnet in self.subnets[1:]:
                t += ', %s' % subnet.__str__()
        else:
            t += 'None'
        t += ']'
        t += ']'
        return t

class Key(Base):
    __tablename__ = "Key"
    id = Column(Integer, primary_key=True)
    name = Column(String(50))

    def __init__(self, name):
        self.id = None
        self.name = name

    def __str__(self):
        t = ""
        t += '<Key>['
        t += 'id:%s, ' % self.id
        t += 'name:%s' % self.name
        t += ']'
        return t

class Flavor(Base):
    __tablename__ = "Flavor"
    id = Column(Integer, primary_key=True)
    name = Column(String(50))
    ram = Column(String(50))
    vcpus = Column(String(50))

    def __init__(self, name, ram, vcpus):
        self.id = None
        self.name = name
        self.ram = ram
        self.vcpus = vcpus

    def __str__(self):
        t = ""
        t += '<Flavor>['
        t += 'id: %s, ' % self.id
        t += 'name: %s, ' % self.name
        t += 'ram: %s, ' % self.ram
        t += 'vcpus: %s' % self.vcpus
        t += ']'
        return t

class Image(Base):
    __tablename__ = "Image"
    id = Column(Integer, primary_key=True)
    name = Column(String(50))
    ext_id = Column(String(50))
    status = Column(String(50))
    created = Column(String(50))
    updated = Column(String(50))

    def __init__(self, name, ext_id, status, created, updated):
        self.id = None
        self.name = name
        self.ext_id = ext_id
        self.status = status
        self.created = created
        self.updated = updated

    def __str__(self):
        t = ""
        t += '<Image>['
        t += 'id:%s, ' % self.id
        t += 'name:%s, ' % self.name
        t += 'ext_id:%s, ' % self.ext_id
        t += 'status:%s, ' % self.status
        t += 'created:%s, ' % self.created
        t += 'updated:%s' % self.updated
        t += ']'
        return t

class Location(Base):
    __tablename__ = "Location"

    id = Column(Integer, primary_key=True)
    location = Column(String(256))
    service_instance_id = Column(Integer, ForeignKey('ServiceInstance.id'), onupdate='CASCADE')

    def __init__(self, location):
        self.id = None
        self.location = location
        self.service_instance_id = None

    def __str__(self):
        t = ""
        t += '<Location>['
        t += 'id:%s, ' % self.id
        t += 'location:%s' % self.location
        t += ']'
        return t

class Relation(Base):
    __tablename__ = "Relation"
    id = Column(Integer, primary_key=True)
    name = Column(String(256))

    service_instance_id = Column(Integer, ForeignKey('ServiceInstance.id'))

    def __init__(self, name):
        self.id = None
        self.name = name

    def __str__(self):
        t = ""
        t += '<Relation>['
        t += 'id:%s, ' % self.id
        t += 'name:%s' % self.name
        t += ']'
        return t

class Quotas(Base):
    __tablename__ = "Quotas"
    id = Column(Integer, primary_key=True)
    tenant_id = Column(String(50))
    instances = Column(Integer)
    cores = Column(Integer)
    ram = Column(Integer)
    floating_ips = Column(Integer)
    fixed_ips = Column(Integer)
    metadata_items = Column(Integer)
    injected_files = Column(Integer)
    injected_file_content_bytes = Column(Integer)
    injected_file_path_bytes = Column(Integer)
    key_pairs = Column(Integer)
    security_groups = Column(Integer)
    security_group_rules = Column(Integer)
    server_groups = Column(Integer)
    server_group_members = Column(Integer)

    def __init__(self, id, instances, cores, ram, floating_ips, fixed_ips, metadata_items, injected_files,
                 injected_file_content_bytes, injected_file_path_bytes, key_pairs, security_groups,
                 security_group_rules, server_groups=None, server_group_members=None):
        self.id = None
        self.tenant_id = id
        self.instances = instances
        self.cores = cores
        self.ram = ram
        self.floating_ips = floating_ips
        self.fixed_ips = fixed_ips
        self.metadata_items = metadata_items
        self.injected_files = injected_files
        self.injected_file_content_bytes = injected_file_content_bytes
        self.injected_file_path_bytes = injected_file_path_bytes
        self.key_pairs = key_pairs
        self.security_groups = security_groups
        self.security_group_rules = security_group_rules
        self.server_groups = server_groups
        self.server_group_members = server_group_members

    def __str__(self):
        t = ""
        t += '<Quotas>['
        t += 'id:%s, ' % self.id
        t += 'tenant_id:%s, ' % self.tenant_id
        t += 'instances:%s, ' % self.instances
        t += 'cores:%s, ' % self.cores
        t += 'ram:%s, ' % self.ram
        t += 'floating_ips:%s, ' % self.floating_ips
        t += 'fixed_ips:%s, ' % self.fixed_ips
        t += 'metadata_items:%s, ' % self.metadata_items
        t += 'injected_files:%s, ' % self.injected_files
        t += 'injected_file_content_bytes:%s, ' % self.injected_file_content_bytes
        t += 'injected_file_path_bytes:%s, ' % self.injected_file_path_bytes
        t += 'key_pairs:%s, ' % self.key_pairs
        t += 'security_groups:%s, ' % self.security_groups
        t += 'security_group_rules:%s, ' % self.security_group_rules
        t += 'server_groups:%s, ' % self.server_groups
        t += 'server_group_members:%s' % self.server_group_members
        t += ']'
        return t

class Network_Instance(Base):
    __tablename__ = 'Network_Instance'

    id = Column(Integer, primary_key=True)
    name = Column(String(50))
    private_net = Column(String(50))
    private_subnet = Column(String(50))
    public_net = Column(String(50))
    fixed_ip = Column(String(50))
    service_id = Column(Integer, ForeignKey('Service.id'))
    service_instance_id = Column(Integer, ForeignKey('ServiceInstance.id'))
    security_groups = relationship('SecurityGroup', cascade="save-update, merge, expunge, refresh-expire", secondary=NetworkInstance_SecurityGroup,lazy='select')

    def __init__(self, name, private_net, private_subnet=None, public_net=None, fixed_ip=None, security_groups=[]):
        self.id = None
        self.name = name
        self.private_net = private_net
        self.public_net = public_net
        self.private_subnet = private_subnet
        self.fixed_ip = fixed_ip
        self.security_groups = security_groups

    def __str__(self):
        t = ""
        t += '<Network>['
        t += 'id:%s, ' % self.id
        t += 'name:%s, ' % self.name
        t += 'private_net:%s, ' % self.private_net
        t += 'private_subnet:%s, ' % self.private_subnet
        t += 'public_net:%s, ' % self.public_net
        t += 'fixed_ip:%s, ' % self.fixed_ip
        t += 'security_groups:['
        if self.security_groups:
            t += '%s' % self.security_groups[0].__str__()
            for security_group in self.security_groups[1:]:
                t += ', %s' % security_group.__str__()
        else:
            t += 'None'
        t += ']'
        t += ']'
        return t

class Rule(Base):
    __tablename__ = 'Rule'
    id = Column(Integer, primary_key=True)
    name = Column(String(50))
    remote_ip_prefix = Column(String(50))
    protocol = Column(String(50))
    port_range_min = Column(Integer)
    port_range_max = Column(Integer)
    security_group_id = Column(Integer, ForeignKey('SecurityGroup.id'))

    def __init__(self, name, remote_ip_prefix, protocol, port_range_min=None, port_range_max=None):
        self.id = None
        self.security_group_id = None
        self.name = name
        self.remote_ip_prefix = remote_ip_prefix
        self.protocol = protocol
        self.port_range_min = port_range_min
        self.port_range_max = port_range_max

    def __str__(self):
        t = ""
        t += '<Rule>['
        t += 'id:%s, ' % (self.id)
        t += 'security_group_id:%s, ' % (self.security_group_id)
        t += 'name:%s, ' % (self.name)
        t += 'remote_ip_prefix:%s, ' % (self.remote_ip_prefix)
        t += 'protocol:%s, ' % (self.protocol)
        t += 'port_range_min:%s, ' % (self.port_range_min)
        t += 'port_range_max:%s' % (self.port_range_max)
        t += ']'
        return t

class Policy(Base):
    __tablename__ = 'Policy'

    id = Column(Integer, primary_key=True)
    name = Column(String(50))
    period = Column(Integer)
    alarm = relationship('Alarm', uselist=False, cascade='all, delete, delete-orphan', lazy='immediate')
    action = relationship('Action', uselist=False, cascade='all, delete, delete-orphan', lazy='immediate')

    service_instance_id = Column(Integer, ForeignKey('ServiceInstance.id'))

    def __init__(self, name, period, alarm, action):
        self.id = None
        self.name = name
        self.period = period
        self.alarm = alarm
        self.action = action

    def __str__(self):
        t = ""
        t += '<Policy>['
        t += 'id:%s, ' % (self.id)
        t += 'name:%s, ' % (self.name)
        t += 'alarm:%s, ' % (self.alarm.__str__())
        t += 'action:%s, ' % (self.action.__str__())
        t += ']'
        return t

class Alarm(Base):
    __tablename__ = 'Alarm'
    id = Column(Integer, primary_key=True)
    meter_name = Column(String(50))
    statistic = Column(String(50))
    evaluation_periods = Column(Integer)
    threshold = Column(Integer)
    comparison_operator = Column(String(5))

    policy_id = Column(Integer, ForeignKey('Policy.id'))

    def __init__(self, meter_name, statistic, evaluation_periods, threshold, comparison_operator):
        self.id = None
        self.meter_name = meter_name
        self.statistic = statistic
        self.evaluation_periods = evaluation_periods
        self.threshold = threshold
        self.comparison_operator = comparison_operator

    def __str__(self):
        t = ""
        t += '<Alarm>['
        t += 'id:%s, ' % (self.id)
        t += 'meter_name:%s, ' % (self.meter_name)
        t += 'statistic:%s, ' % (self.statistic)
        t += 'evaluation_periods:%s, ' % (self.evaluation_periods)
        t += 'threshold:%s, ' % (self.threshold)
        t += 'comparision_operator:%s' % (self.comparison_operator)
        t += ']'
        return t

class Action(Base):
    __tablename__ = 'Action'
    id = Column(Integer, primary_key=True)
    adjustment_type = Column(String(50))
    cooldown = Column(Integer)
    scaling_adjustment = Column(Integer)

    policy_id = Column(Integer, ForeignKey('Policy.id'))

    def __init__(self, adjustment_type, cooldown, scaling_adjustment):
        self.id = None
        self.adjustment_type = adjustment_type
        self.cooldown = cooldown
        self.scaling_adjustment = scaling_adjustment

    def __str__(self):
        t = ""
        t += '<Action>['
        t += 'id:%s, ' % (self.id)
        t += 'adjustment_type:%s, ' % (self.adjustment_type)
        t += 'cooldown:%s, ' % (self.cooldown)
        t += 'scaling_adjustment:%s' % (self.scaling_adjustment)
        t += ']'
        return t

class Requirement(Base):
    __tablename__ = 'Requirement'
    id = Column(Integer, primary_key=True)
    name = Column(String(50))
    parameter = Column(String(50))
    # from who
    source = Column(String(50))
    obj_name = Column(String(50))
    service_id = Column(Integer, ForeignKey('Service.id'))
    service_instance_id = Column(Integer, ForeignKey('ServiceInstance.id'), onupdate='CASCADE')

    def __init__(self, name, parameter, source, obj_name):
        self.id = None
        self.name = name
        self.parameter = parameter
        self.source = source
        self.obj_name = obj_name

    def __str__(self):
        t = ""
        t += '<Requirement>['
        t += 'id:%s, ' % self.id
        t += 'name:%s, ' % self.name
        t += 'service_id:%s, ' % self.service_id
        t += 'service_instance_id:%s, ' % self.service_instance_id
        t += 'parameter:%s, ' % self.parameter
        t += 'source:%s, ' % self.source
        t += 'obj_name:%s' % self.obj_name
        t += ']'
        return t

class Configuration(Base):
    __tablename__ = 'Configuration'

    id = Column(Integer, primary_key=True)
    name = Column(String(50))
    props = Column(PickleType)

    def __init__(self, name=None, props={}):
        self.id = None
        self.name = name
        self.props = props

    def __str__(self):
        t = ""
        t += '<Configuration>['
        t += 'id:%s, ' % self.id
        t += 'name:%s, ' % self.name
        t += 'props:%s' % self.props
        t += ']'
        return t

def new_alchemy_encoder():
    _visited_objs = []

    class AlchemyEncoder(json.JSONEncoder):
        def default(self, obj):
            if isinstance(obj.__class__, DeclarativeMeta):
                # don't re-visit self
                if obj in _visited_objs:
                    return None
                _visited_objs.append(obj)

                # an SQLAlchemy class
                fields = {}
                for field in [x for x in dir(obj) if not x.startswith('_') and x != 'metadata']:
                    fields[field] = obj.__getattribute__(field)
                # a json-encodable dict
                return fields

            return json.JSONEncoder.default(self, obj)

    return AlchemyEncoder

def create_tables(engine):
    """
        Drop all and recreate
        """
    LOG.debug("drop and create tables")
    Base.metadata.drop_all(engine)
    Base.metadata.create_all(engine)


text:
package controllers

import (
	"fmt"
	"github.com/gin-gonic/gin"
	clayControllers "github.com/qb0C80aE/clay/controllers"
	"github.com/qb0C80aE/clay/extensions"
	"github.com/qb0C80aE/pottery/logics"
	"github.com/qb0C80aE/pottery/models"
)

type vlanInterfaceAssignmentChildController struct {
	*clayControllers.BaseController
}

func newVlanInterfaceAssignmentChildController() extensions.Controller {
	controller := &vlanInterfaceAssignmentChildController{
		BaseController: clayControllers.NewBaseController(
			models.SharedVlanInterfaceAssignmentModel(),
			logics.UniqueVlanInterfaceAssignmentLogic(),
		),
	}
	return controller
}

func (controller *vlanInterfaceAssignmentChildController) ResourceSingleURL() string {
	portResourceName := extensions.RegisteredResourceName(models.SharedInterfaceModel())
	return fmt.Sprintf("%s/%s/:interface_id/:vlan_id", controller.ResourceName(), portResourceName)
}

func (controller *vlanInterfaceAssignmentChildController) ResourceMultiURL() string {
	portResourceName := extensions.RegisteredResourceName(models.SharedInterfaceModel())
	return fmt.Sprintf("%s/%s/:interface_id", controller.ResourceName(), portResourceName)
}

func (controller *vlanInterfaceAssignmentChildController) RouteMap() map[int]map[int]gin.HandlerFunc {
	routeMap := map[int]map[int]gin.HandlerFunc{
		extensions.MethodGet: {
			extensions.URLMulti: controller.GetMulti,
		},
		extensions.MethodDelete: {
			extensions.URLSingle: controller.Delete,
		},
	}
	return routeMap
}

var uniqueVlanInterfaceAssignmentChildController = newVlanInterfaceAssignmentChildController()

func init() {
	extensions.RegisterController(uniqueVlanInterfaceAssignmentChildController)
}


text:
FOUNDATION_EXPORT double KeePassHTTPKitVersionNumber;

//! Project version string for KeePassHTTPKit.
FOUNDATION_EXPORT const unsigned char KeePassHTTPKitVersionString[];

#import "KPHDelegate.h"
#import "KPHServer.h"
#import "KPHResponse.h"