text:
    Elasticsearch is a search server based on Lucene.
    It provides a distributed, multitenant-capable full-text search engine with a RESTful web interface and schema-free JSON documents.
    Elasticsearch is developed in Java and is released as open source under the terms of the Apache License.

More on http://www.elasticsearch.org/

###ElasticSearch in Vipa

We use ElasticSearch with [FriendsOfSymfony/FOSElasticaBundle](https://github.com/FriendsOfSymfony/FOSElasticaBundle) for searching articles,journals and users full-texts and suggestions.

You can find FosElastica configurtation under `app/config/elastica.yml`

redpajama_set_name: RedPajamaGithub


text:
package com.burning.iplay.adapter.forumhot;

import android.graphics.Color;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.burning.iplay.R;
import com.burning.iplay.bean.forum.ForumHotBean;
import com.burning.iplay.utils.ImageLoader;

import java.util.Random;

import butterknife.BindView;

/**
 * @FileName ForumHotHolder2
 * @Author Jay_Ping
 * @Time 2017/3/7
 * @Email 1054335787@qq.com
 * @Desc 社区 热门推荐 只加载两张图片的
 */
public class ForumHotHolder2 extends ForumHotAdapterSum.MessageHolder {

    @BindView(R.id.iv_icon)
    ImageView mIvIcon;
    @BindView(R.id.tv_author)
    TextView mTvAuthor;
    @BindView(R.id.tv_fname)
    TextView mTvFname;
    @BindView(R.id.tv_title)
    TextView mTvTitle;
    @BindView(R.id.tv_subtitle)
    TextView mTvSubtitle;
    @BindView(R.id.iv_imag1)
    ImageView mIvImag1;
    @BindView(R.id.iv_imag2)
    ImageView mIvImag2;

    public ForumHotHolder2(View itemView) {
        super(itemView);
    }

    @Override
    public void bindHolder(ForumHotBean.InfoBean.ThreadListBean bean) {
        mTvAuthor.setText(bean.getAuthor());

        mTvTitle.setText(bean.getTitle());
        mTvSubtitle.setText(bean.getSubtitle());

        mTvFname.setText(bean.getFname());

        //fname来源背景随机
        Random ran = new Random();
        int coclor = ran.nextInt();
        mTvFname.setBackgroundColor(Color.rgb(coclor, coclor, coclor));

        mIvImag1.setVisibility(View.VISIBLE);
        mIvImag2.setVisibility(View.VISIBLE);
        ImageLoader.loadImage(itemView.getContext(), bean.getImgUrl(), mIvImag1);
        ImageLoader.loadImage(itemView.getContext(), bean.getImg2Url(), mIvImag2);
    }
}


text:
from __future__ import unicode_literals

from django.db import models, migrations
import django_fsm

class Migration(migrations.Migration):

    dependencies = [
        ('erp_test', '0001_initial'),
    ]

    operations = [
        migrations.AddField(
            model_name='component',
            name='state',
            field=django_fsm.FSMField(default=b'free', max_length=50, verbose_name='Component State', choices=[(b'installed', 'Installed'), (b'free', 'Free'), (b'broken', 'Broken')]),
        ),
    ]


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

<plugin
    xmlns="http://apache.org/cordova/ns/plugins/1.0"
    xmlns:android="http://schemas.android.com/apk/res/android"
    id="readbeyond-plugin-mediarb"
    version="3.0.1">

    <name>MediaRB</name>
    <description>This is a tweaked version of the official Cordova Media Plugin, with no dependency from File Plugin, play-only functions (recording removed), playback rate setting, support for Android and iOS, and a few bug fixes to work around Cordova bugs management.</description>
    <license>MIT</license>
    <keywords>cordova,media</keywords>

    <js-module src="www/MediaErrorRB.js" name="MediaErrorRB">
        <clobbers target="window.MediaErrorRB" />
    </js-module>

    <js-module src="www/MediaRB.js" name="MediaRB">
        <clobbers target="window.MediaRB" />
    </js-module>

    <!-- android -->
    <platform name="android">
        <config-file target="res/xml/config.xml" parent="/*">
            <feature name="MediaRB" >
                <param name="android-package" value="it.readbeyond.minstrel.mediarb.AudioHandler"/>
            </feature>
        </config-file>

        <config-file target="AndroidManifest.xml" parent="/*">
            <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
            <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
            <!--<uses-permission android:name="android.permission.READ_PHONE_STATE" />-->
        </config-file>

        <source-file src="src/android/AudioHandler.java"  target-dir="src/it/readbeyond/minstrel/mediarb" />
        <source-file src="src/android/AudioPlayer.java"   target-dir="src/it/readbeyond/minstrel/mediarb" />
        <source-file src="src/android/FileHelper.java"    target-dir="src/it/readbeyond/minstrel/mediarb" />
        <source-file src="src/android/MediaPlayer.java"   target-dir="src/it/readbeyond/minstrel/mediarb" />
        <source-file src="src/android/MediaPlayerRB.java" target-dir="src/it/readbeyond/minstrel/mediarb" />
        <source-file src="src/android/Sonic.java"         target-dir="src/org/vinuxproject/sonic" />
        <source-file src="libs/COPYING"                   target-dir="libs" />
        <source-file src="libs/README.txt"                target-dir="libs" />
        <source-file src="libs/armeabi/libsonic.so"       target-dir="libs/armeabi" />
        <source-file src="libs/armeabi-v7a/libsonic.so"   target-dir="libs/armeabi-v7a" />
    </platform>

    <!-- ios -->
    <platform name="ios">
        <config-file target="config.xml" parent="/*">
            <feature name="MediaRB">
                <param name="ios-package" value="RBSound" />
            </feature>
        </config-file>
        <header-file src="src/ios/RBSound.h" />
        <source-file src="src/ios/RBSound.m" />
    </platform>

    <!-- browser -->
    <!--
    <platform name="browser">
        <js-module src="www/browser/MediaRB.js" name="BrowserMediaRB">
            <clobbers target="window.MediaRB" />
        </js-module>
    </platform>
    -->

</plugin>


text:
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Diagnostics.Contracts;
using System;

// Disable the "this variable is not used" warning as every field would imply it.
#pragma warning disable 0414
// Disable the "this variable is never assigned to".
#pragma warning disable 0067
// Disable the "this event is never assigned to".
#pragma warning disable 0649
// Disable the "this variable is never used".
#pragma warning disable 0169
// Disable the "new keyword not required" warning.
#pragma warning disable 0109
// Disable the "extern without DllImport" warning.
#pragma warning disable 0626
// Disable the "could hide other member" warning, can happen on certain properties.
#pragma warning disable 0108

namespace System.Windows.Documents
{
  public partial class Bold : Span
  {
    #region Methods and constructors
    public Bold(Inline childInline, TextPointer insertionPosition)
    {
    }

    public Bold(TextPointer start, TextPointer end)
    {
    }

    public Bold()
    {
    }

    public Bold(Inline childInline)
    {
    }
    #endregion
  }
}


text:
/*global Error */

sap.ui.define([
	"jquery.sap.global", "sap/ui/fl/LrepConnector", "sap/ui/fl/Cache", "sap/ui/fl/Utils", "sap/ui/base/EventProvider"
], function(jQuery, LrepConnector, Cache, Utils, EventProvider) {
	"use strict";

	/**
	 * FlexSettings access
	 *
	 * @param {object} oSettings settings as JSON object
	 * @constructor
	 * @alias sap.ui.fl.registry.Settings
	 * @author SAP SE
	 * @experimental Since 1.27.0
	 * @private
	 */
	var Settings = function(oSettings) {
		EventProvider.apply(this);
		if (!oSettings) {
			throw new Error("no flex settings provided");
		}
		// Defaults layers used for standard changes, such as 'move' or 'add'
		if (!oSettings.defaultLayerPermissions) {
			oSettings.defaultLayerPermissions = {
				"VENDOR": true,
				"CUSTOMER_BASE": true,
				"CUSTOMER": true,
				"USER": false
			};
		}

		// These are the permissions for the Developer Mode Changes, e.g. 'propertyChange', 'propertyBindingChange'
		if (!oSettings.developerModeLayerPermissions) {
			oSettings.developerModeLayerPermissions = {
				"VENDOR": true,
				"CUSTOMER_BASE": true,
				"CUSTOMER": false,
				"USER": false
			};
		}

		this._oSettings = oSettings;
		this._hasMergeErrorOccured = false;
	};

	Settings.prototype = jQuery.sap.newObject(EventProvider.prototype);

	Settings.events = {
		flexibilityAdaptationButtonAllowedChanged: "flexibilityAdaptationButtonAllowedChanged",
		changeModeUpdated: "changeModeUpdated"
	};

	Settings._instance = undefined;
	Settings._bFlexChangeMode = true;
	Settings._bFlexibilityAdaptationButtonAllowed = false;
	Settings._oEventProvider = new EventProvider();

	/**
	 * fires the passed event via its event provider
	 *
	 * @param {string} sEventId name of the event
	 * @param {object} mParameters
	 *
	 * @public
	 */
	Settings.fireEvent = function(sEventId, mParameters) {
		Settings._oEventProvider.fireEvent(sEventId, mParameters);
	};

	/**
	 * attaches a callback to an event on the event provider of Settings
	 *
	 * @param {string} sEventId name of the event
	 * @param {function} oCallback
	 *
	 * @public
	 */
	Settings.attachEvent = function(sEventId, oCallback) {
		Settings._oEventProvider.attachEvent(sEventId, oCallback);
	};

	/**
	 * detaches a callback to an event on the event provider of Settings
	 *
	 * @param {string} sEventId name of the event
	 * @param {function} oCallback
	 *
	 * @public
	 */
	Settings.detachEvent = function(sEventId, oCallback) {
		Settings._oEventProvider.detachEvent(sEventId, oCallback);
	};

	/**
	 * Returns a settings instance after reading the settings from the back end if not already done. There is only one instance of settings during a
	 * session.
	 *
	 * @param {string} [sComponentName] - Current SAPUI5 component name
	 * @param {string} [sAppVersion] - Current application version
	 * @param {map} [mPropertyBag] - Contains additional data needed for reading changes
	 * @param {object} [mPropertyBag.appDescriptor] - App descriptor belonging to actual component
	 * @param {string} [mPropertyBag.siteId] - Side ID that belongs to actual component
	 * @returns {Promise} with parameter oInstance of type {sap.ui.fl.registry.Settings}
	 * @public
	 */
	Settings.getInstance = function(sComponentName, sAppVersion, mPropertyBag) {
		if (Settings._instance) {
			return Promise.resolve(Settings._instance);
		}
		if (sComponentName) {
			sAppVersion = sAppVersion || Utils.DEFAULT_APP_VERSION;
			return Cache.getChangesFillingCache(LrepConnector.createConnector(), { name: sComponentName, appVersion: sAppVersion }, mPropertyBag)
				.then(function (oFileContent) {
					var oSettings = {};
					if (oFileContent.changes && oFileContent.changes.settings) {
						oSettings = oFileContent.changes.settings;
					}
					return Settings._storeInstance(oSettings);
				});
		}
		return Settings._loadSettings();
	};

	/**
	 * Sends request to the back end for settings content. Stores content into internal setting instance and returns the instance.
	 *
	 * @returns {Promise} With parameter oInstance of type {sap.ui.fl.registry.Settings}
	 * @private
	 */
	Settings._loadSettings = function() {
		return LrepConnector.createConnector().loadSettings().then(function (oSettings){
			return Settings._storeInstance(oSettings);
		});
	};

	/**
	 * Writes the data received from the back end or cache into an internal instance and then returns the settings object within a Promise.
	 *
	 * @param oSettings - Data received from the back end or cache
	 * @returns {Promise} with parameter oInstance of type {sap.ui.fl.registry.Settings}
	 * @protected
	 *
	 */
	Settings._storeInstance = function(oSettings) {
		if (!Settings._instance) {
			Settings._instance = new Settings(oSettings);
		}
		return Settings._instance;
	};

	/**
	 * Returns a settings instance from the local instance cache. There is only one instance of settings during a session. If no instance has been
	 * created before, undefined will be returned.
	 *
	 * @returns {sap.ui.fl.registry.Settings} instance or undefined if no instance has been created so far.
	 * @public
	 */
	Settings.getInstanceOrUndef = function() {
		var oSettings;
		if (Settings._instance) {
			oSettings = Settings._instance;
		}
		return oSettings;
	};

	/**
	 * Checks if the flexibility change mode is enabled.
	 *
	 * @returns {boolean} true if the flexibility change mode is enabled
	 * @public
	 */
	Settings.isFlexChangeMode = function() {
		var bFlexChangeModeUrl = this._isFlexChangeModeFromUrl();
		if (bFlexChangeModeUrl !== undefined) {
			return bFlexChangeModeUrl;
		}

		return Settings._bFlexChangeMode;
	};

	/**
	 * Checks if the flexibility change mode is enabled via URL query parameter
	 *
	 * @returns {boolean} bFlexChangeMode true if the flexibility change mode is enabled, false if not enabled, undefined if not set via url.
	 * @public
	 */
	Settings._isFlexChangeModeFromUrl = function() {
		var bFlexChangeMode;
		var oUriParams = jQuery.sap.getUriParameters();
		if (oUriParams && oUriParams.mParams && oUriParams.mParams['sap-ui-fl-changeMode'] && oUriParams.mParams['sap-ui-fl-changeMode'][0]) {
			if (oUriParams.mParams['sap-ui-fl-changeMode'][0] === 'true') {
				bFlexChangeMode = true;
			} else if (oUriParams.mParams['sap-ui-fl-changeMode'][0] === 'false') {
				bFlexChangeMode = false;
			}
		}
		return bFlexChangeMode;
	};

	/**
	 * Activates the flexibility change mode.
	 *
	 * @public
	 */
	Settings.activateFlexChangeMode = function() {
		var bFlexChangeModeOn = true;
		Settings._setFlexChangeMode(bFlexChangeModeOn);
	};

	/**
	 * Deactivates / leaves the flexibility change mode.
	 *
	 * @public
	 */
	Settings.leaveFlexChangeMode = function() {
		var bFlexChangeModeOff = false;
		Settings._setFlexChangeMode(bFlexChangeModeOff);
	};

	/**
	 * sets the flexChangeMode flag
	 * fires an event if the flag has been toggled
	 *
	 * @private
	 */
	Settings._setFlexChangeMode = function (bFlexChangeModeOn) {
		if (Settings._bFlexChangeMode === bFlexChangeModeOn) {
			return; // no change
		}

		Settings._bFlexChangeMode = bFlexChangeModeOn;
		var mParameter = {
			bFlexChangeMode: bFlexChangeModeOn
		};
		Settings.fireEvent(Settings.events.changeModeUpdated, mParameter);
	};

	/**
	 * Method to check for adaptation button allowance
	 *
	 * @returns {boolean} Settings._bFlexibilityAdaptationButtonAllowed
	 * @public
	 */
	Settings.isFlexibilityAdaptationButtonAllowed = function () {
		return Settings._bFlexibilityAdaptationButtonAllowed;
	};

	/**
	 * Method to allow the adaptation button
	 *
	 * @public
	 */
	Settings.allowFlexibilityAdaptationButton = function () {
		var bFlexibilityAdaptationButtonAllowed = true;
		Settings.setFlexibilityAdaptationButtonAllowed(bFlexibilityAdaptationButtonAllowed);
	};

	/**
	 * Method to disallow the adaptation button
	 *
	 * @public
	 */
	Settings.disallowFlexibilityAdaptationButton = function () {
		var bFlexibilityAdaptationButtonDisallowed = false;
		Settings.setFlexibilityAdaptationButtonAllowed(bFlexibilityAdaptationButtonDisallowed);
	};

	/**
	 * Method to set the adaptation button allowance flag on or off depending on the passed parameter
	 * fires an event if the flag has been toggled
	 *
	 * @param {boolean} bFlexibilityAdaptationButtonAllowed
	 *
	 * @public
	 */
	Settings.setFlexibilityAdaptationButtonAllowed = function (bFlexibilityAdaptationButtonAllowed) {
		if (Settings._bFlexibilityAdaptationButtonAllowed === bFlexibilityAdaptationButtonAllowed) {
			return; // no change
		}

		Settings._bFlexibilityAdaptationButtonAllowed = bFlexibilityAdaptationButtonAllowed;

		var mParameter = {
			bFlexibilityAdaptationButtonAllowed: bFlexibilityAdaptationButtonAllowed
		};
		Settings.fireEvent(Settings.events.flexibilityAdaptationButtonAllowedChanged, mParameter);

	};

	/**
	 * Returns the key user status of the current user.
	 *
	 * @returns {boolean} true if the user is a flexibility key user, false if not supported.
	 * @public
	 */
	Settings.prototype.isKeyUser = function() {
		var bIsKeyUser = false;
		if (this._oSettings.isKeyUser) {
			bIsKeyUser = this._oSettings.isKeyUser;
		}
		return bIsKeyUser;
	};

	/**
	 * Returns true if back end is ModelS back end.
	 *
	 * @returns {boolean} true if ATO coding exists in back end.
	 * @public
	 */
	Settings.prototype.isModelS = function() {
		var bIsModelS = false;
		if (this._oSettings.isAtoAvailable) {
			bIsModelS = this._oSettings.isAtoAvailable;
		}
		return bIsModelS;
	};

	/**
	 * Returns true if ATO is enabled in the back end.
	 *
	 * @returns {boolean} true if ATO is enabled.
	 * @public
	 */
	Settings.prototype.isAtoEnabled = function() {
		var bIsAtoEnabled = false;
		if (this._oSettings.isAtoEnabled) {
			bIsAtoEnabled = this._oSettings.isAtoEnabled;
		}
		return bIsAtoEnabled;
	};

	/**
	 * Checks whether the current system is defined as a productive system.
	 *
	 * @public
	 * @returns {boolean} true if system is productive system
	 */
	Settings.prototype.isProductiveSystem = function() {
		var bIsProductiveSystem = false;
		if (this._oSettings.isProductiveSystem) {
			bIsProductiveSystem = this._oSettings.isProductiveSystem;
		}
		return bIsProductiveSystem;
	};

	Settings.prototype.setMergeErrorOccured = function(bErrorOccured) {
		this._hasMergeErrorOccoured = bErrorOccured;
	};
	/**
	 * Checks if a merge error occured during merging changes into the view on startup
	 */
	Settings.prototype.hasMergeErrorOccured = function() {
		return this._hasMergeErrorOccured;
	};

	/**
	 * Getter for the default Layer-Permissions
	 */
	Settings.prototype.getDefaultLayerPermissions = function() {
		return this._oSettings.defaultLayerPermissions;
	};

	/**
	 * Getter for the Developer Mode Layer-Permissions
	 */
	Settings.prototype.getDeveloperModeLayerPermissions = function() {
		return this._oSettings.developerModeLayerPermissions;
	};

	return Settings;
}, /* bExport= */true);


text:
import Ember from 'ember';

export default Ember.Component.extend({

  onAirRun: Ember.computed('futureRuns.[]',function(){
    return this.get('futureRuns').find((item)=>{
      let now = new Date();
      let start = item.get('start');
      let end = item.get('end');
      return start <= now && end > now;
    });
  }),
});


text:
package com.google.schemaorg.core;

import com.google.schemaorg.JsonLdContext;
import com.google.schemaorg.SchemaOrgType;
import com.google.schemaorg.core.datatype.Date;
import com.google.schemaorg.core.datatype.DateTime;
import com.google.schemaorg.core.datatype.Text;
import com.google.schemaorg.core.datatype.URL;
import com.google.schemaorg.goog.PopularityScoreSpecification;
import javax.annotation.Nullable;

/**
 * Interface of http://schema.org/ChildrensEvent}.
 */
public interface ChildrensEvent extends Event {

  /**
   * Builder interface of http://schema.org/ChildrensEvent}.
   */
  public interface Builder extends Event.Builder {

    @Override
    Builder addJsonLdContext(@Nullable JsonLdContext context);

    @Override
    Builder addJsonLdContext(@Nullable JsonLdContext.Builder context);

    @Override
    Builder setJsonLdId(@Nullable String value);

    @Override
    Builder setJsonLdReverse(String property, Thing obj);

    @Override
    Builder setJsonLdReverse(String property, Thing.Builder builder);

    /** Add a value to property additionalType. */
    Builder addAdditionalType(URL value);

    /** Add a value to property additionalType. */
    Builder addAdditionalType(String value);

    /** Add a value to property aggregateRating. */
    Builder addAggregateRating(AggregateRating value);

    /** Add a value to property aggregateRating. */
    Builder addAggregateRating(AggregateRating.Builder value);

    /** Add a value to property aggregateRating. */
    Builder addAggregateRating(String value);

    /** Add a value to property alternateName. */
    Builder addAlternateName(Text value);

    /** Add a value to property alternateName. */
    Builder addAlternateName(String value);

    /** Add a value to property attendee. */
    Builder addAttendee(Organization value);

    /** Add a value to property attendee. */
    Builder addAttendee(Organization.Builder value);

    /** Add a value to property attendee. */
    Builder addAttendee(Person value);

    /** Add a value to property attendee. */
    Builder addAttendee(Person.Builder value);

    /** Add a value to property attendee. */
    Builder addAttendee(String value);

    /** Add a value to property attendees. */
    Builder addAttendees(Organization value);

    /** Add a value to property attendees. */
    Builder addAttendees(Organization.Builder value);

    /** Add a value to property attendees. */
    Builder addAttendees(Person value);

    /** Add a value to property attendees. */
    Builder addAttendees(Person.Builder value);

    /** Add a value to property attendees. */
    Builder addAttendees(String value);

    /** Add a value to property description. */
    Builder addDescription(Text value);

    /** Add a value to property description. */
    Builder addDescription(String value);

    /** Add a value to property doorTime. */
    Builder addDoorTime(DateTime value);

    /** Add a value to property doorTime. */
    Builder addDoorTime(String value);

    /** Add a value to property duration. */
    Builder addDuration(Duration value);

    /** Add a value to property duration. */
    Builder addDuration(Duration.Builder value);

    /** Add a value to property duration. */
    Builder addDuration(String value);

    /** Add a value to property endDate. */
    Builder addEndDate(Date value);

    /** Add a value to property endDate. */
    Builder addEndDate(String value);

    /** Add a value to property eventStatus. */
    Builder addEventStatus(EventStatusType value);

    /** Add a value to property eventStatus. */
    Builder addEventStatus(String value);

    /** Add a value to property image. */
    Builder addImage(ImageObject value);

    /** Add a value to property image. */
    Builder addImage(ImageObject.Builder value);

    /** Add a value to property image. */
    Builder addImage(URL value);

    /** Add a value to property image. */
    Builder addImage(String value);

    /** Add a value to property inLanguage. */
    Builder addInLanguage(Language value);

    /** Add a value to property inLanguage. */
    Builder addInLanguage(Language.Builder value);

    /** Add a value to property inLanguage. */
    Builder addInLanguage(Text value);

    /** Add a value to property inLanguage. */
    Builder addInLanguage(String value);

    /** Add a value to property location. */
    Builder addLocation(Place value);

    /** Add a value to property location. */
    Builder addLocation(Place.Builder value);

    /** Add a value to property location. */
    Builder addLocation(PostalAddress value);

    /** Add a value to property location. */
    Builder addLocation(PostalAddress.Builder value);

    /** Add a value to property location. */
    Builder addLocation(Text value);

    /** Add a value to property location. */
    Builder addLocation(String value);

    /** Add a value to property mainEntityOfPage. */
    Builder addMainEntityOfPage(CreativeWork value);

    /** Add a value to property mainEntityOfPage. */
    Builder addMainEntityOfPage(CreativeWork.Builder value);

    /** Add a value to property mainEntityOfPage. */
    Builder addMainEntityOfPage(URL value);

    /** Add a value to property mainEntityOfPage. */
    Builder addMainEntityOfPage(String value);

    /** Add a value to property name. */
    Builder addName(Text value);

    /** Add a value to property name. */
    Builder addName(String value);

    /** Add a value to property offers. */
    Builder addOffers(Offer value);

    /** Add a value to property offers. */
    Builder addOffers(Offer.Builder value);

    /** Add a value to property offers. */
    Builder addOffers(String value);

    /** Add a value to property organizer. */
    Builder addOrganizer(Organization value);

    /** Add a value to property organizer. */
    Builder addOrganizer(Organization.Builder value);

    /** Add a value to property organizer. */
    Builder addOrganizer(Person value);

    /** Add a value to property organizer. */
    Builder addOrganizer(Person.Builder value);

    /** Add a value to property organizer. */
    Builder addOrganizer(String value);

    /** Add a value to property performer. */
    Builder addPerformer(Organization value);

    /** Add a value to property performer. */
    Builder addPerformer(Organization.Builder value);

    /** Add a value to property performer. */
    Builder addPerformer(Person value);

    /** Add a value to property performer. */
    Builder addPerformer(Person.Builder value);

    /** Add a value to property performer. */
    Builder addPerformer(String value);

    /** Add a value to property performers. */
    Builder addPerformers(Organization value);

    /** Add a value to property performers. */
    Builder addPerformers(Organization.Builder value);

    /** Add a value to property performers. */
    Builder addPerformers(Person value);

    /** Add a value to property performers. */
    Builder addPerformers(Person.Builder value);

    /** Add a value to property performers. */
    Builder addPerformers(String value);

    /** Add a value to property potentialAction. */
    Builder addPotentialAction(Action value);

    /** Add a value to property potentialAction. */
    Builder addPotentialAction(Action.Builder value);

    /** Add a value to property potentialAction. */
    Builder addPotentialAction(String value);

    /** Add a value to property previousStartDate. */
    Builder addPreviousStartDate(Date value);

    /** Add a value to property previousStartDate. */
    Builder addPreviousStartDate(String value);

    /** Add a value to property recordedIn. */
    Builder addRecordedIn(CreativeWork value);

    /** Add a value to property recordedIn. */
    Builder addRecordedIn(CreativeWork.Builder value);

    /** Add a value to property recordedIn. */
    Builder addRecordedIn(String value);

    /** Add a value to property review. */
    Builder addReview(Review value);

    /** Add a value to property review. */
    Builder addReview(Review.Builder value);

    /** Add a value to property review. */
    Builder addReview(String value);

    /** Add a value to property sameAs. */
    Builder addSameAs(URL value);

    /** Add a value to property sameAs. */
    Builder addSameAs(String value);

    /** Add a value to property startDate. */
    Builder addStartDate(Date value);

    /** Add a value to property startDate. */
    Builder addStartDate(String value);

    /** Add a value to property subEvent. */
    Builder addSubEvent(Event value);

    /** Add a value to property subEvent. */
    Builder addSubEvent(Event.Builder value);

    /** Add a value to property subEvent. */
    Builder addSubEvent(String value);

    /** Add a value to property subEvents. */
    Builder addSubEvents(Event value);

    /** Add a value to property subEvents. */
    Builder addSubEvents(Event.Builder value);

    /** Add a value to property subEvents. */
    Builder addSubEvents(String value);

    /** Add a value to property superEvent. */
    Builder addSuperEvent(Event value);

    /** Add a value to property superEvent. */
    Builder addSuperEvent(Event.Builder value);

    /** Add a value to property superEvent. */
    Builder addSuperEvent(String value);

    /** Add a value to property typicalAgeRange. */
    Builder addTypicalAgeRange(Text value);

    /** Add a value to property typicalAgeRange. */
    Builder addTypicalAgeRange(String value);

    /** Add a value to property url. */
    Builder addUrl(URL value);

    /** Add a value to property url. */
    Builder addUrl(String value);

    /** Add a value to property workFeatured. */
    Builder addWorkFeatured(CreativeWork value);

    /** Add a value to property workFeatured. */
    Builder addWorkFeatured(CreativeWork.Builder value);

    /** Add a value to property workFeatured. */
    Builder addWorkFeatured(String value);

    /** Add a value to property workPerformed. */
    Builder addWorkPerformed(CreativeWork value);

    /** Add a value to property workPerformed. */
    Builder addWorkPerformed(CreativeWork.Builder value);

    /** Add a value to property workPerformed. */
    Builder addWorkPerformed(String value);

    /** Add a value to property detailedDescription. */
    Builder addDetailedDescription(Article value);

    /** Add a value to property detailedDescription. */
    Builder addDetailedDescription(Article.Builder value);

    /** Add a value to property detailedDescription. */
    Builder addDetailedDescription(String value);

    /** Add a value to property popularityScore. */
    Builder addPopularityScore(PopularityScoreSpecification value);

    /** Add a value to property popularityScore. */
    Builder addPopularityScore(PopularityScoreSpecification.Builder value);

    /** Add a value to property popularityScore. */
    Builder addPopularityScore(String value);

    /**
     * Add a value to property.
     *
     * @param name The property name.
     * @param value The value of the property.
     */
    Builder addProperty(String name, SchemaOrgType value);

    /**
     * Add a value to property.
     *
     * @param name The property name.
     * @param builder The schema.org object builder for the property value.
     */
    Builder addProperty(String name, Thing.Builder builder);

    /**
     * Add a value to property.
     *
     * @param name The property name.
     * @param value The string value of the property.
     */
    Builder addProperty(String name, String value);

    /** Build a {@link ChildrensEvent} object. */
    ChildrensEvent build();
  }
}


text:
import web
import config

db = web.database(dbn="sqlite", db="database.db")

WAITING = 1
BUSY = 2
DOWNLOADED = 3

THUMB=1
VIDEO=2
META=3

class Videos:
    def __init__(self):
        pass

def add_new_video(origurl,origid, added):
    return db.insert('videos', origurl=origurl, origid=origid, added=added, status=WAITING)

def add_meta(id,title,description,length,downloaded,status):
    db.update('videos', title=title, description=description, length=length, downloaded=downloaded, status=status, where="id=$id", vars=locals())

def get_video(id):
    return db.select('videos', where="id=$id", vars=locals())[0]

#def get_video_ytid(ytid):
#    return db.select('videos', where="ytid=$ytid", vars=locals())[0]

def get_all_videos():
    return db.select('videos', order="id DESC").list()

def get_all_done_videos():
    return db.select('videos', where="status=$DOWNLOADED", order="id DESC", vars=globals()).list()

def video_busy(id):
    db.update('videos', status=BUSY, where="id=$id", vars=locals())

def video_done(id):
    db.update('videos', status=DOWNLOADED, where="id=$id", vars=locals())

def add_thumb(id,thumb):
    db.update('videos', thumb=thumb, where="id=$id", vars=locals())

def add_video(id,video):
    #add video filename and set the item to 'done'
    db.update('videos', video=video, status=DOWNLOADED, where="id=$id", vars=locals())

#def add_queue(status,type,options,added):
#    db.insert('queue', status=status,type=type, added=added,options=options)

def get_next_queue():
    q = db.select('videos', order="id", where="status=$WAITING", limit=1, vars=globals()).list()
    if q:
        return q[0]
    else:
        return None

#def got_meta(id):
#    db.update('videos', status=

def queue_busy(id):
    db.update('videos', status=BUSY, where="id=$id", vars=locals())

def queue_finish(id):
    db.update('videos', status=DOWNLOADED, where="id=$id", vars=locals())

def get_all_queue():
    return db.select('videos', where="status<$DOWNLOADED", order="id", vars=globals()).list()


text:
PWD="$( cd "$(dirname $0)" && pwd )"

export TERM=xterm-256color
if [[ $(uname -s) == "Darwin" ]];then
  if $(hash brew) && $(brew list | grep -q coreutils);then
    eval $(gdircolors $PWD/dircolors/dircolors.ansi-dark)
    alias ls='gls --color=auto'
    zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
  else
    export CLICOLOR=1
    export LSCOLORS=gxfxbEaEBxxEhEhBaDaCaD
    alias ls='ls -G'
  fi
else
  eval $(dircolors $PWD/dircolors/dircolors.ansi-dark)
  alias ls='ls --color=auto'
  zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
fi


text:
using System;
using System.Data;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Configuration;
using System.Diagnostics;
using System.Reflection;

using SQLDocGenerator.Helper;
using SQLDocGenerator.Properties;
using SQLDocGenerator.Helper.CHMWriter;
using SQLDocGenerator;
using System.ComponentModel;
using System.Threading;

namespace SQLDocUI
{
    public partial class SQLDocSharp : Form
    {
        private static DataSet entireDatabase = new DataSet("EntireDatabase");
        private static SqlConnection dbConnection;
        private static List<string> serverInfoToWrite = new List<string>(new string[] { "InstanceInformation", "DataSourceInformation", "DataTypes", "Restrictions", "ReservedWords", "Users", "Databases" });
        private static List<string> objectByTypesToWrite = new List<string>(new string[] { "Tables", "Views", "Procedures", "Functions", "Triggers", "UserDefinedDataTypes" });
        public static List<string> ServerInfoToWrite { get { return serverInfoToWrite; } }
        public static List<string> ObjectByTypesToWrite { get { return objectByTypesToWrite; } }
        public static SqlConnection DBConnection { get { return dbConnection; } }

        #region "Initialization"

        public SQLDocSharp()
        {
            InitializeComponent();

            //string program = GetProgramFiles();

            //SqlClientMetaDataCollectionNames
            //randomTry();
            //GetMetaDataCollections();

            ////UserDefinedTypesHelper.GetUserDefinedTypes();
            ////AllColumnsHelper.GetAllColumns();
            ////ColumnSetColumnsHelper.GetColumnSetColumns();
            ////StructuredTypeMembersHelper.GetStructuredTypeMembers();
            ////JoinAllDataTables();
            ////JoinColumnsWithTables();

        }

        private void FilIncludeExcludeObjects()
        {
            SetStatus("Populating Tables...");
            FillTables();

            SetStatus("Populating Views...");
            FillViews();

            SetStatus("Populating Procedures...");
            FillProcedures();

            SetStatus("Populating Function...");
            FillFunction();

            SetStatus("Populating Triggers...");
            FillTriggers();

            SetStatus("Populating UDDTs...");
            FillUDDTs();
        }

        private void FillDatabases()
        {
            DatabasesHelper.GetDatabases();
            FillComboBox(ddlDatabase, DatabasesHelper.Databases, "database_name", "dbid");
        }
        private void FillTables()
        {
            FillListView(listViewTables, TablesHelper.Tables, "TABLE_NAME");
        }
        private void FillViews()
        {
            FillListView(listViewViews, ViewsHelper.Views, "TABLE_NAME");
        }
        private void FillProcedures()
        {
            FillListView(listViewProcedures, ProceduresHelper.Procedures, "SPECIFIC_NAME");
        }
        private void FillFunction()
        {
            FillListView(listViewFunctions, ProceduresHelper.Functions, "SPECIFIC_NAME");
        }
        private void FillTriggers()
        {
            FillListView(listViewTriggers, SMOHelper.TriggersHelper.Triggers, "Name");
        }
        private void FillUDDTs()
        {
            FillListView(listViewProcedures, SMOHelper.UserDefinedDataTypesHelper.UserDefinedDataTypes, "Name");
        }

        private void FillComboBox(ComboBox cb, DataTable dt, string nameField, string valueField)
        {
            cb.DataSource = dt;
            cb.ValueMember = valueField;
            cb.DisplayMember = nameField;
        }

        private void FillListView(ListView lv, DataTable dt, string name)
        {
            lv.View = View.List;

            foreach (DataRow row in dt.Rows)
            {
                ListViewItem item = new ListViewItem(Convert.ToString(row[name]));
                item.Checked = true;
                lv.Items.Add(item);
            }
        }

        #endregion

        private void WriteCHMHelp()
        {
            HHCWriter hhc = new HHCWriter(Utility.DatabaseName + ".hhc", Utility.DatabaseName + ".hhp", Utility.DatabaseName + ".chm");
            hhc.Write();

            CompileCHMHelp();
        }

        private void CompileCHMHelp()
        {
            StreamReader rd = null;
            string location = Assembly.GetExecutingAssembly().Location;
            location = location.Substring(0, location.LastIndexOf("\\"));

            ProcessStartInfo startInfo = new ProcessStartInfo();
            startInfo.CreateNoWindow = true;// false;
            startInfo.FileName =  GetProgramFiles() + @"\HTML Help Workshop\hhc.exe";
            startInfo.WindowStyle = ProcessWindowStyle.Hidden;  // ProcessWindowStyle.Normal;
            startInfo.UseShellExecute = false;
            startInfo.RedirectStandardOutput = true;
            startInfo.Arguments = "\"" + location + "\\" + Utility.DatabaseName + ".hhp" + "\"";
            //MessageBox.Show(startInfo.Arguments);
            try
            {
                using (Process exeProcess = Process.Start(startInfo))
                {
                    exeProcess.WaitForExit();

                    rd = exeProcess.StandardOutput;
                    //MessageBox.Show("StandardOutput: " + rd.ReadToEnd());

                    File.Copy(location + "\\" + Utility.DatabaseName + ".chm", txtFileName.Text);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + rd != null ? rd.ReadToEnd() : string.Empty);
            }
        }

        private string GetProgramFiles()
        {
            string programFiles = Environment.GetEnvironmentVariable("ProgramFiles(x86)");
            if (programFiles == null)
                programFiles = Environment.GetEnvironmentVariable("ProgramFiles");

            return programFiles;
        }

        private OSVersion GetOSVersion()
        {
            OSVersion version = OSVersion.Unknown;
            switch (Environment.OSVersion.Platform)
            {
                case PlatformID.Win32S:
                    version = OSVersion.Windows3_1;
                    break;
                case PlatformID.Win32Windows:
                    switch (Environment.OSVersion.Version.Minor)
                    {
                        case 0:
                            version = OSVersion.Windows95;
                            break;
                        case 10:
                            if (Environment.OSVersion.Version.Revision.ToString() == "2222A")
                                version = OSVersion.Windows98SecondEdition;
                            else
                                version = OSVersion.Windows98;
                            break;
                        case 90:
                            version = OSVersion.WindowsME;
                            break;
                    }
                    break;
                case PlatformID.Win32NT:
                    switch (Environment.OSVersion.Version.Major)
                    {
                        case 3:
                            version = OSVersion.WindowsNT3_51;
                            break;
                        case 4:
                            version = OSVersion.WindowsNT4_0;
                            break;
                        case 5:
                            switch (Environment.OSVersion.Version.Minor)
                            {
                                case 0:
                                    version = OSVersion.Windows2000;
                                    break;
                                case 1:
                                    version = OSVersion.WindowsXP;
                                    break;
                                case 2:
                                    version = OSVersion.Windows2003;
                                    break;
                            }
                            break;
                        case 6:
                            switch (Environment.OSVersion.Version.Minor)
                            {
                                case 0:
                                    version = OSVersion.WindowsVista;
                                    break;
                                case 1:
                                    version = OSVersion.Windows7;
                                    break;
                            }
                            break;
                    }
                    break;
                case PlatformID.WinCE:
                    version = OSVersion.WindowsCE;
                    break;
                case PlatformID.Unix:
                    version = OSVersion.Unix;
                    break;
            }
            return version;
        }

        private void JoinColumnsWithTables()
        {
            //foreach (DataRow row in TablesHelper.Tables.Rows)
            //{
            //    string table_Schema = row["TABLE_SCHEMA"].ToString();
            //    string table_Name = row["TABLE_NAME"].ToString();

            //    DataView dv = new DataView(ColumnsHelper.Columns);
            //    dv.RowFilter = "TABLE_SCHEMA = '" + table_Schema + "' AND TABLE_NAME = '" + table_Name + "'";

            //    string xmlfile = table_Schema + "." + table_Name;
            //    string xslFile = ColumnsHelper.Columns.TableName;
            //    string htmlFile = xmlfile;

            //    Utility.WriteDatatable(dv.ToTable(), xmlfile, xslFile, htmlFile);
            //}
        }

        private void JoinAllDataTables()
        {
            //entireDatabase.Tables.Add(instanceInformation);
            //entireDatabase.Tables.Add(dataSourceInformation);
            //entireDatabase.Tables.Add(dataTypes);
            //entireDatabase.Tables.Add(restrictions);
            //entireDatabase.Tables.Add(reservedWords);
            //entireDatabase.Tables.Add(users);
            //entireDatabase.Tables.Add(databases);

            //entireDatabase.Tables.Add(tables);
            //entireDatabase.Tables.Add(columns);
            //entireDatabase.Tables.Add(allColumns);
            //entireDatabase.Tables.Add(columnSetColumns);
            //entireDatabase.Tables.Add(structuredTypeMembers);
            //entireDatabase.Tables.Add(views);
            //entireDatabase.Tables.Add(viewColumns);
            //entireDatabase.Tables.Add(procedureParameters);
            //entireDatabase.Tables.Add(procedures);
            //entireDatabase.Tables.Add(foreignKeys);
            //entireDatabase.Tables.Add(indexColumns);
            //entireDatabase.Tables.Add(indexes);
            //entireDatabase.Tables.Add(userDefinedTypes);

            //File.WriteAllText(@"xml\entireDB.xml", entireDatabase.GetXml());
        }

        private string BuildConnectionString(string serverName, bool isIntegratedSecurity, string userName, string password, string databaseName)
        {
            string conString;

            conString = "Data Source=";
            conString += serverName + ";";
            conString += "Initial Catalog=";
            conString += databaseName + ";";

            if (!isIntegratedSecurity)
                conString += "User Id=" + userName + ";Password=" + password + ";";
            else
                conString += "Trusted_Connection=True;";

            return conString;
        }

        private bool OpenConnection(string serverName, bool isIntegratedSecurity, string userName, string password, string databaseName)
        {
            try
            {
                dbConnection = new SqlConnection();
                dbConnection.ConnectionString = BuildConnectionString(serverName, isIntegratedSecurity, userName, password, databaseName);
                dbConnection.Open();
                return true;
            }
            catch
            {
                return false;
            }
        }

        private void CloseConnection()
        {
            if (dbConnection.State == ConnectionState.Open)
                dbConnection.Close();
        }

        private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AboutBox frm = new AboutBox();
            frm.Show();
        }

        private void chkIntegratedSecurity_CheckedChanged(object sender, EventArgs e)
        {
            txtUserName.Enabled = !chkIntegratedSecurity.Checked;
            txtUserPassword.Enabled = !chkIntegratedSecurity.Checked;
        }

        private void btnConnect_Click(object sender, EventArgs e)
        {
            if (this.OpenConnection(txtSQLServer.Text, chkIntegratedSecurity.Checked, txtUserName.Text, txtUserPassword.Text, "Master"))
            {
                btnConnect.Text = "Connected";
                btnConnect.ForeColor = Color.Green;
                Utility.DBConnection = dbConnection;
                EnableGenerateUI(true);
                FillDatabases();
                lblMessage.Text = "Select the database from list, and click Fetch button.";
            }
            else
            {
                btnConnect.Text = "Failed";
                btnConnect.ForeColor = Color.Red;
                EnableGenerateUI(false);
            }
            this.CloseConnection();
        }

        public void EnableGenerateUI(bool state)
        {
            ddlDatabase.Enabled = state;
            txtFileName.Enabled = state;
            ddlFormat.Enabled = state;
            txtFileName.Enabled = state;
            btnFileName.Enabled = state;
            chkExportMetadata.Enabled = state;
            btnFetch.Enabled = state;
        }

        private void btnFetch_Click(object sender, EventArgs e)
        {
            this.listViewTables.Clear();
            this.listViewFunctions.Clear();
            this.listViewProcedures.Clear();
            this.listViewTriggers.Clear();
            this.listviewUDDT.Clear();
            this.listViewViews.Clear();

            btnFetch.Enabled = false;
            txtFileName.Text = "C:\\" + ddlDatabase.Text + ".chm";
            ddlFormat.SelectedIndex = 0;

            this.OpenConnection(txtSQLServer.Text, chkIntegratedSecurity.Checked, txtUserName.Text, txtUserPassword.Text, ddlDatabase.Text);
            Utility.DBConnection = DBConnection;
            Utility.DatabaseServer = txtSQLServer.Text;
            Utility.DatabaseName = ddlDatabase.Text;

            backgroundWorker1.RunWorkerAsync();
        }

        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            SetStatus("Fetching Metadata...");
            GetMetaData();
        }

        private void GetMetaData()
        {
            SetStatus("Fetching Columns...");
            ColumnsHelper.GetColumns();
            backgroundWorker1.ReportProgress(5, ObjectTypes.Columns);

            SetStatus("Fetching ForeignKeys...");
            ForeignKeysHelper.GetForeignKeys();
            backgroundWorker1.ReportProgress(10, ObjectTypes.ForeignKeys);

            SetStatus("Fetching IndexColumns...");
            IndexColumnsHelper.GetIndexColumns();
            backgroundWorker1.ReportProgress(15, ObjectTypes.IndexColumns);

            SetStatus("Fetching Indexes...");
            IndexesHelper.GetIndexes();
            backgroundWorker1.ReportProgress(20, ObjectTypes.Indexes);

            SetStatus("Fetching Tables...");
            TablesHelper.GetTables();
            backgroundWorker1.ReportProgress(25, ObjectTypes.Tables);

            SetStatus("Fetching ViewColumns...");
            ViewColumnsHelper.GetViewColumns();
            backgroundWorker1.ReportProgress(30, ObjectTypes.ViewColumns);

            SetStatus("Fetching Views...");
            ViewsHelper.GetViews();
            backgroundWorker1.ReportProgress(35, ObjectTypes.Views);

            SetStatus("Fetching ProcedureParameters...");
            ProcedureParametersHelper.GetProcedureParameters();
            backgroundWorker1.ReportProgress(40, ObjectTypes.ProcedureParameters);

            SetStatus("Fetching Procedures...");
            ProceduresHelper.GetProcedures();
            backgroundWorker1.ReportProgress(45, ObjectTypes.Procedures);

            SetStatus("Fetching Triggers...");
            SMOHelper.TriggersHelper.GetTriggers(Utility.DatabaseName);
            backgroundWorker1.ReportProgress(50, ObjectTypes.Triggers);

            SetStatus("Fetching UserDefinedDataTypes...");
            SMOHelper.UserDefinedDataTypesHelper.GetUserDefinedDataTypes(Utility.DatabaseName);
            backgroundWorker1.ReportProgress(55, ObjectTypes.UserDefinedDataTypes);

            SetStatus("Fetching InstanceInformation...");
            InstanceInformationHelper.GetInstanceInformation();
            backgroundWorker1.ReportProgress(60, ObjectTypes.InstanceInformation);

            SetStatus("Fetching DataSourceInformation...");
            DataSourceInformationHelper.GetDataSourceInformation();
            backgroundWorker1.ReportProgress(65, ObjectTypes.DataSourceInformation);

            SetStatus("Fetching DataTypes...");
            DataTypesHelper.GetDataTypes();
            backgroundWorker1.ReportProgress(70, ObjectTypes.DataTypes);

            SetStatus("Fetching Restrictions...");
            RestrictionsHelper.GetRestrictions();
            backgroundWorker1.ReportProgress(75, ObjectTypes.Restrictions);

            SetStatus("Fetching ReservedWords...");
            ReservedWordsHelper.GetReservedWords();
            backgroundWorker1.ReportProgress(80, ObjectTypes.ReservedWords);

            SetStatus("Fetching Users...");
            UsersHelper.GetUsers();
            backgroundWorker1.ReportProgress(85, ObjectTypes.Users);
        }

        private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            ObjectTypes objectTypes = (ObjectTypes)e.UserState;
            switch (objectTypes)
            {
                case ObjectTypes.Columns:
                    SetStatus("Columns Fetched...", e.ProgressPercentage);
                    break;
                case ObjectTypes.DataSourceInformation:
                    SetStatus("DataSourceInformation Fetched...", e.ProgressPercentage);
                    break;
                case ObjectTypes.DataTypes:
                    SetStatus("DataTypes Fetched...", e.ProgressPercentage);
                    break;
                case ObjectTypes.ForeignKeys:
                    SetStatus("ForeignKeys Fetched...", e.ProgressPercentage);
                    break;
                case ObjectTypes.IndexColumns:
                    SetStatus("IndexColumns Fetched...", e.ProgressPercentage);
                    break;
                case ObjectTypes.Indexes:
                    SetStatus("Indexes Fetched...", e.ProgressPercentage);
                    break;
                case ObjectTypes.InstanceInformation:
                    SetStatus("InstanceInformation Fetched...", e.ProgressPercentage);
                    break;
                case ObjectTypes.ProcedureParameters:
                    SetStatus("ProcedureParameters Fetched...", e.ProgressPercentage);
                    break;
                case ObjectTypes.Procedures:
                    SetStatus("Procedures Fetched...", e.ProgressPercentage);
                    FillProcedures();
                    FillFunction();
                    break;
                case ObjectTypes.ReservedWords:
                    SetStatus("ReservedWords Fetched...", e.ProgressPercentage);
                    break;
                case ObjectTypes.Restrictions:
                    SetStatus("Restrictions Fetched...", e.ProgressPercentage);
                    break;
                case ObjectTypes.Tables:
                    SetStatus("Tables Fetched...", e.ProgressPercentage);
                    FillTables();
                    break;
                case ObjectTypes.Triggers:
                    SetStatus("Triggers Fetched...", e.ProgressPercentage);
                    FillTriggers();
                    break;
                case ObjectTypes.UserDefinedDataTypes:
                    SetStatus("UserDefinedDataTypes Fetched...", e.ProgressPercentage);
                    FillUDDTs();
                    break;
                case ObjectTypes.Users:
                    SetStatus("Users Fetched...", e.ProgressPercentage);
                    break;
                case ObjectTypes.ViewColumns:
                    SetStatus("ViewColumns Fetched...", e.ProgressPercentage);
                    break;
                case ObjectTypes.Views:
                    FillViews();
                    break;
            }
        }

        private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            btnFetch.Enabled = true;
            btnGenerate.Enabled = true;
            lblMessage.Text = "Provide Documentation details, and click Generate button.";

            SetStatus("Idle...", 100);
        }

        private void btnGenerate_Click(object sender, EventArgs e)
        {
            btnGenerate.Enabled = false;
            backgroundWorker2.RunWorkerAsync();

            if (chkExportMetadata.Checked)
                WriteMetaDataInXML();
        }

        private void backgroundWorker2_DoWork(object sender, DoWorkEventArgs e)
        {
            SetStatus("Writing Metadata...");
            WriteMetaDataInCHM();
        }

        private void WriteMetaDataInCHM()
        {
            SetStatus("Writing Columns...");
            ColumnsHelper.WriteColumns();
            backgroundWorker2.ReportProgress(5, ObjectTypes.Columns);

            SetStatus("Writing ForeignKeys...");
            ForeignKeysHelper.WriteForeignKeys();
            backgroundWorker2.ReportProgress(10, ObjectTypes.ForeignKeys);

            SetStatus("Writing IndexColumns...");
            IndexColumnsHelper.WriteIndexColumns();
            backgroundWorker2.ReportProgress(15, ObjectTypes.IndexColumns);

            SetStatus("Writing Indexes...");
            IndexesHelper.WriteIndexes();
            backgroundWorker2.ReportProgress(20, ObjectTypes.Indexes);

            SetStatus("Writing Tables...");
            TablesHelper.WriteTables();
            backgroundWorker2.ReportProgress(25, ObjectTypes.Tables);

            SetStatus("Writing ViewColumns...");
            ViewColumnsHelper.WriteViewColumns();
            backgroundWorker2.ReportProgress(30, ObjectTypes.ViewColumns);

            SetStatus("Writing Views...");
            ViewsHelper.WriteViews();
            backgroundWorker2.ReportProgress(35, ObjectTypes.Views);

            SetStatus("Writing ProcedureParameters...");
            ProcedureParametersHelper.WriteProcedureParameters();
            backgroundWorker2.ReportProgress(40, ObjectTypes.ProcedureParameters);

            SetStatus("Writing Procedures...");
            ProceduresHelper.WriteProcedures();
            backgroundWorker2.ReportProgress(45, ObjectTypes.Procedures);

            SetStatus("Writing Triggers...");
            SMOHelper.TriggersHelper.WriteTriggers();
            backgroundWorker2.ReportProgress(50, ObjectTypes.Triggers);

            SetStatus("Writing UserDefinedDataTypes...");
            SMOHelper.UserDefinedDataTypesHelper.WriteUserDefinedDataTypes();
            backgroundWorker2.ReportProgress(55, ObjectTypes.UserDefinedDataTypes);

            SetStatus("Writing InstanceInformation...");
            InstanceInformationHelper.WriteInstanceInformation();
            backgroundWorker2.ReportProgress(60, ObjectTypes.InstanceInformation);

            SetStatus("Writing DataSourceInformation...");
            DataSourceInformationHelper.WriteDataSourceInformation();
            backgroundWorker2.ReportProgress(65, ObjectTypes.DataSourceInformation);

            SetStatus("Writing DataTypes...");
            DataTypesHelper.WriteDataTypes();
            backgroundWorker2.ReportProgress(70, ObjectTypes.DataTypes);

            SetStatus("Writing Restrictions...");
            RestrictionsHelper.WriteRestrictions();
            backgroundWorker2.ReportProgress(75, ObjectTypes.Restrictions);

            SetStatus("Writing ReservedWords...");
            ReservedWordsHelper.WriteReservedWords();
            backgroundWorker2.ReportProgress(80, ObjectTypes.ReservedWords);

            SetStatus("Writing Users...");
            UsersHelper.WriteUsers();
            backgroundWorker2.ReportProgress(85, ObjectTypes.Users);
        }

        private void WriteMetaDataInXML()
        {
            entireDatabase.Tables.Clear();
            entireDatabase.Tables.Add(InstanceInformationHelper.InstanceInformation.Copy());
            entireDatabase.Tables.Add(DataSourceInformationHelper.DataSourceInformation.Copy());
            entireDatabase.Tables.Add(DataTypesHelper.DataTypes.Copy());
            entireDatabase.Tables.Add(RestrictionsHelper.Restrictions.Copy());
            entireDatabase.Tables.Add(ReservedWordsHelper.ReservedWords.Copy());
            entireDatabase.Tables.Add(UsersHelper.Users.Copy());
            entireDatabase.Tables.Add(DatabasesHelper.Databases.Copy());

            entireDatabase.Tables.Add(TablesHelper.Tables.Copy());
            entireDatabase.Tables.Add(ColumnsHelper.Columns.Copy());
            entireDatabase.Tables.Add(AllColumnsHelper.AllColumns.Copy());
            entireDatabase.Tables.Add(ColumnSetColumnsHelper.ColumnSetColumns.Copy());
            entireDatabase.Tables.Add(StructuredTypeMembersHelper.StructuredTypeMembers.Copy());
            entireDatabase.Tables.Add(ViewsHelper.Views.Copy());
            entireDatabase.Tables.Add(ViewColumnsHelper.ViewColumns.Copy());
            entireDatabase.Tables.Add(ProcedureParametersHelper.ProcedureParameters.Copy());
            entireDatabase.Tables.Add(ProceduresHelper.Procedures.Copy());
            entireDatabase.Tables.Add(ProceduresHelper.Functions.Copy());
            entireDatabase.Tables.Add(ForeignKeysHelper.ForeignKeys.Copy());
            entireDatabase.Tables.Add(IndexColumnsHelper.IndexColumns.Copy());
            entireDatabase.Tables.Add(IndexesHelper.Indexes.Copy());
            entireDatabase.Tables.Add(UserDefinedTypesHelper.UserDefinedTypes.Copy());
            entireDatabase.Tables.Add(SMOHelper.TriggersHelper.Triggers.Copy());
            entireDatabase.Tables.Add(SMOHelper.UserDefinedDataTypesHelper.UserDefinedDataTypes.Copy());

            File.WriteAllText(txtExportXMLFileName.Text, entireDatabase.GetXml());
        }

        private void backgroundWorker2_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            ObjectTypes objectTypes = (ObjectTypes)e.UserState;
            switch (objectTypes)
            {
                case ObjectTypes.Columns:
                    SetStatus("Columns Written...", e.ProgressPercentage);
                    break;
                case ObjectTypes.DataSourceInformation:
                    SetStatus("DataSourceInformation Written...", e.ProgressPercentage);
                    break;
                case ObjectTypes.DataTypes:
                    SetStatus("DataTypes Written...", e.ProgressPercentage);
                    break;
                case ObjectTypes.ForeignKeys:
                    SetStatus("ForeignKeys Written...", e.ProgressPercentage);
                    break;
                case ObjectTypes.IndexColumns:
                    SetStatus("IndexColumns Written...", e.ProgressPercentage);
                    break;
                case ObjectTypes.Indexes:
                    SetStatus("Indexes Written...", e.ProgressPercentage);
                    break;
                case ObjectTypes.InstanceInformation:
                    SetStatus("InstanceInformation Written...", e.ProgressPercentage);
                    break;
                case ObjectTypes.ProcedureParameters:
                    SetStatus("ProcedureParameters Written...", e.ProgressPercentage);
                    break;
                case ObjectTypes.Procedures:
                    SetStatus("Procedures Written...", e.ProgressPercentage);
                    break;
                case ObjectTypes.ReservedWords:
                    SetStatus("ReservedWords Written...", e.ProgressPercentage);
                    break;
                case ObjectTypes.Restrictions:
                    SetStatus("Restrictions Written...", e.ProgressPercentage);
                    break;
                case ObjectTypes.Tables:
                    SetStatus("Tables Written...", e.ProgressPercentage);
                    break;
                case ObjectTypes.Triggers:
                    SetStatus("Triggers Written...", e.ProgressPercentage);
                    break;
                case ObjectTypes.UserDefinedDataTypes:
                    SetStatus("UserDefinedDataTypes Written...", e.ProgressPercentage);
                    break;
                case ObjectTypes.Users:
                    SetStatus("Users Written...", e.ProgressPercentage);
                    break;
                case ObjectTypes.ViewColumns:
                    SetStatus("ViewColumns Written...", e.ProgressPercentage);
                    break;
                case ObjectTypes.Views:
                    break;
            }
        }

        private void backgroundWorker2_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            btnGenerate.Enabled = true;
            SetStatus("Idle...", 90);

            WriteCHMHelp();
            lblMessage.Text = "Documentation is generated, please refer to CHM file.";

            SetStatus("Idle...", 100);
        }

        delegate void aDelegate(string t);

        private void SetStatus(string message)
        {
            this.Invoke(new aDelegate(SetToolStripText), message);
        }

        private void SetStatus(string message, int percentage)
        {
            this.Invoke(new aDelegate(SetToolStripText), message);
            pbCopy.Value = percentage;
        }

        private void chkExportMetadata_CheckedChanged(object sender, EventArgs e)
        {
            txtExportXMLFileName.Enabled = chkExportMetadata.Checked;
            txtExportXMLFileName.Text = "C:\\" + ddlDatabase.Text + ".xml";
            btnExportXMLFileName.Enabled = chkExportMetadata.Checked;
        }

        private void beendenToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.CloseConnection();
            this.Close();
        }

        private void SetToolStripText(string text)
        {
            tsStatus.Text = text;
        }

        #region Radio button handling for Check/Uncheck/Toggle

        private void AdjustListViewCheckboxes(ListView lv, bool state, bool toggle)
        {
            foreach (ListViewItem item in lv.Items)
            {
                if (!toggle)
                    item.Checked = state;
                else
                    item.Checked = !item.Checked;
            }
        }

        private void radCheckTables_CheckedChanged(object sender, EventArgs e)
        {
            if (((RadioButton)(sender)).Checked)
                AdjustListViewCheckboxes(listViewTables, radCheckTables.Checked, false);
        }
        private void radUncheckTables_CheckedChanged(object sender, EventArgs e)
        {
            if (((RadioButton)(sender)).Checked)
                AdjustListViewCheckboxes(listViewTables, !radUncheckTables.Checked, false);
        }
        private void radToggleTables_CheckedChanged(object sender, EventArgs e)
        {
            if (((RadioButton)(sender)).Checked)
                AdjustListViewCheckboxes(listViewTables, radToggleTables.Checked, true);
        }

        private void radCheckViews_CheckedChanged(object sender, EventArgs e)
        {
            if (((RadioButton)(sender)).Checked)
                AdjustListViewCheckboxes(listViewViews, radCheckViews.Checked, false);

        }
        private void radUncheckViews_CheckedChanged(object sender, EventArgs e)
        {
            if (((RadioButton)(sender)).Checked)
                AdjustListViewCheckboxes(listViewViews, !radUncheckViews.Checked, false);

        }
        private void radToggleViews_CheckedChanged(object sender, EventArgs e)
        {
            if (((RadioButton)(sender)).Checked)
                AdjustListViewCheckboxes(listViewViews, radToggleViews.Checked, true);

        }

        private void radCheckProcedured_CheckedChanged(object sender, EventArgs e)
        {
            if (((RadioButton)(sender)).Checked)
                AdjustListViewCheckboxes(listViewProcedures, radCheckProcedured.Checked, false);

        }
        private void radUncheckProcedures_CheckedChanged(object sender, EventArgs e)
        {
            if (((RadioButton)(sender)).Checked)
                AdjustListViewCheckboxes(listViewProcedures, !radUncheckProcedures.Checked, false);

        }
        private void radToggleProcedures_CheckedChanged(object sender, EventArgs e)
        {
            if (((RadioButton)(sender)).Checked)
                AdjustListViewCheckboxes(listViewProcedures, radToggleProcedures.Checked, true);

        }

        private void radCheckFunctions_CheckedChanged(object sender, EventArgs e)
        {
            if (((RadioButton)(sender)).Checked)
                AdjustListViewCheckboxes(listViewFunctions, radCheckFunctions.Checked, false);

        }
        private void radUncheckFunctions_CheckedChanged(object sender, EventArgs e)
        {
            if (((RadioButton)(sender)).Checked)
                AdjustListViewCheckboxes(listViewFunctions, !radUncheckFunctions.Checked, false);

        }
        private void radToggleFunctions_CheckedChanged(object sender, EventArgs e)
        {
            if (((RadioButton)(sender)).Checked)
                AdjustListViewCheckboxes(listViewFunctions, radToggleFunctions.Checked, true);

        }

        private void radCheckTriggers_CheckedChanged(object sender, EventArgs e)
        {
            if (((RadioButton)(sender)).Checked)
                AdjustListViewCheckboxes(listViewTriggers, radCheckTriggers.Checked, false);
        }
        private void radUvcheckTriggers_CheckedChanged(object sender, EventArgs e)
        {
            if (((RadioButton)(sender)).Checked)
                AdjustListViewCheckboxes(listViewTriggers, !radUncheckTriggers.Checked, false);

        }
        private void radToggleTriggers_CheckedChanged(object sender, EventArgs e)
        {
            if (((RadioButton)(sender)).Checked)
                AdjustListViewCheckboxes(listViewTriggers, radToggleTriggers.Checked, true);

        }

        private void radCheckUDDTs_CheckedChanged(object sender, EventArgs e)
        {
            if (((RadioButton)(sender)).Checked)
                AdjustListViewCheckboxes(listviewUDDT, radCheckUDDTs.Checked, false);
        }
        private void radUncheckUDDTs_CheckedChanged(object sender, EventArgs e)
        {
            if (((RadioButton)(sender)).Checked)
                AdjustListViewCheckboxes(listviewUDDT, !radUncheckUDDTs.Checked, false);
        }
        private void radToggleUDDTs_CheckedChanged(object sender, EventArgs e)
        {
            if (((RadioButton)(sender)).Checked)
                AdjustListViewCheckboxes(listviewUDDT, radToggleUDDTs.Checked, true);
        }

        #endregion

        private void btnFileName_Click(object sender, EventArgs e)
        {
            saveFileDialog1.Filter = "Compiled HTML Help|*.CHM";
            saveFileDialog1.Title = "Save an CHM File";
            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                txtFileName.Text = saveFileDialog1.FileName;
            }
        }

        private void btnExportXMLFileName_Click(object sender, EventArgs e)
        {
            saveFileDialog2.Filter = "Extensible Markup Language|*.XML";
            saveFileDialog2.Title = "Save an XML File";
            if (saveFileDialog2.ShowDialog() == DialogResult.OK)
            {
                txtExportXMLFileName.Text = saveFileDialog2.FileName;
            }
        }
    }
}


text:
<?php
/**
 * Derived from SkyVerge WooCommerce Plugin Framework https://github.com/skyverge/wc-plugin-framework/
 */

namespace WPO\WC\PDF_Invoices\Compatibility;

defined( 'ABSPATH' ) or exit;

if ( ! class_exists( '\\WPO\\WC\\PDF_Invoices\\Compatibility\\Product' ) ) :

/**
 * WooCommerce product compatibility class.
 *
 * @since 4.6.0-dev
 */
class Product extends Data {

	/** @var array mapped compatibility properties, as `$new_prop => $old_prop` */
	protected static $compat_props = array(
		'catalog_visibility' => 'visibility',
		'date_on_sale_from'  => 'sale_price_dates_from',
		'date_on_sale_to'    => 'sale_price_dates_to',
		'gallery_image_ids'  => 'product_image_gallery',
		'cross_sell_ids'     => 'crosssell_ids',
	);

	/**
	 * Backports WC_Product::get_id() method to 2.4.x
	 *
	 * @link https://github.com/woothemes/woocommerce/pull/9765
	 *
	 * @since 4.2.0
	 * @param \WC_Product $product product object
	 * @return string|int product ID
	 */
	public static function get_id( \WC_Product $product ) {

		if ( self::is_wc_version_gte_2_5() ) {

			return $product->get_id();

		} else {

			return $product->is_type( 'variation' ) ? $product->variation_id : $product->id;
		}
	}

	/**
	 * Gets a product property.
	 *
	 * @since 4.6.0-dev
	 * @param \WC_Product $object the product object
	 * @param string $prop the property name
	 * @param string $context if 'view' then the value will be filtered
	 * @return mixed
	 */
	public static function get_prop( $object, $prop, $context = 'edit', $compat_props = array() ) {

		// backport 'WC_Product::get_parent_id()' to pre-3.0
		if ( WC_Core::is_wc_version_lt_3_0() && 'parent_id' === $prop ) {
			$prop    = 'id';
			$context = $object->is_type( 'variation' ) ? 'raw' : $context;
		}

		return parent::get_prop( $object, $prop, $context, self::$compat_props );
	}

	/**
	 * Sets an products's properties.
	 *
	 * Note that this does not save any data to the database.
	 *
	 * @since 4.6.0-dev
	 * @param \WC_Product $object the product object
	 * @param array $props the new properties as $key => $value
	 * @return \WC_Product
	 */
	public static function set_props( $object, $props, $compat_props = array() ) {

		return parent::set_props( $object, $props, self::$compat_props );
	}

	/**
	 * Makes WC_Product::get_parent() available for WC 3.0+
	 *
	 * @since 4.6.0-dev
	 * @param \WC_Product $product the product object
	 * @return \WC_Product
	 */
	public static function get_parent( \WC_Product $product ) {

		if ( WC_Core::is_wc_version_gte_3_0() ) {
			$parent = wc_get_product( $product->get_parent_id() );
		} else {
			$parent = $product->get_parent();
		}

		return $parent;
	}

	/**
	 * Makes WC_Product::get_dimensions() available for WC 3.0+
	 *
	 * @since 4.6.0-dev
	 * @param \WC_Product $product the product object
	 * @param string $rating Optional. The product rating
	 * @return string
	 */
	public static function get_dimensions( \WC_Product $product ) {

		if ( WC_Core::is_wc_version_gte_3_0() ) {
			$dimensions = array(
				'length' => $product->get_length(),
				'width'  => $product->get_width(),
				'height' => $product->get_height(),
			);
			return apply_filters( 'woocommerce_product_dimensions', wc_format_dimensions( $dimensions ), $product );
		} else {
			return $product->get_dimensions();
		}
	}

	/**
	 * Backports wc_update_product_stock() to pre-3.0.0
	 *
	 * @since 4.6.0-dev
	 * @param \WC_Product $product the product object
	 * @param int $amount Optional. The new stock quantity
	 * @param string $mode Optional. Can be set, add, or subtract
	 * @return int
	 */
	public static function wc_update_product_stock( \WC_Product $product, $amount = null, $mode = 'set' ) {

		if ( WC_Core::is_wc_version_gte_3_0() ) {
			return wc_update_product_stock( $product, $amount, $mode );
		} else {
			return $product->set_stock( $amount, $mode );
		}
	}

	/**
	 * Backports wc_get_price_html_from_text() to pre-3.0.0
	 *
	 * @since 4.6.0-dev
	 * @param \WC_Product $product the product object
	 * @return string
	 */
	public static function wc_get_price_html_from_text( \WC_Product $product ) {

		if ( WC_Core::is_wc_version_gte_3_0() ) {
			return wc_get_price_html_from_text();
		} else {
			return $product->get_price_html_from_text();
		}
	}

	/**
	 * Backports wc_get_price_including_tax() to pre-3.0.0
	 *
	 * @since 4.6.0-dev
	 * @param \WC_Product $product the product object
	 * @param int $qty Optional. The quantity
	 * @param string $price Optional. The product price
	 * @return string
	 */
	public static function wc_get_price_including_tax( \WC_Product $product, $qty = 1, $price = '' ) {

		if ( WC_Core::is_wc_version_gte_3_0() ) {

			return wc_get_price_including_tax( $product, array(
				'qty'   => $qty,
				'price' => $price,
			) );

		} else {

			return $product->get_price_including_tax( $qty, $price );
		}
	}

	/**
	 * Backports wc_get_price_excluding_tax() to pre-3.0.0
	 *
	 * @since 4.6.0-dev
	 * @param \WC_Product $product the product object
	 * @param int $qty Optional. The quantity
	 * @param string $price Optional. The product price
	 * @return string
	 */
	public static function wc_get_price_excluding_tax( \WC_Product $product, $qty = 1, $price = '' ) {

		if ( WC_Core::is_wc_version_gte_3_0() ) {

			return wc_get_price_excluding_tax( $product, array(
				'qty'   => $qty,
				'price' => $price,
			) );

		} else {

			return $product->get_price_excluding_tax( $qty, $price );
		}
	}

	/**
	 * Backports wc_get_price_to_display() to pre-3.0.0
	 *
	 * @since 4.6.0-dev
	 * @param \WC_Product $product the product object
	 * @param string $price Optional. The product price
	 * @param int $qty Optional. The quantity
	 * @return string
	 */
	public static function wc_get_price_to_display( \WC_Product $product, $price = '', $qty = 1 ) {

		if ( WC_Core::is_wc_version_gte_3_0() ) {

			return wc_get_price_to_display( $product, array(
				'qty'   => $qty,
				'price' => $price,
			) );

		} else {

			return $product->get_display_price( $price, $qty );
		}
	}

	/**
	 * Backports wc_get_product_category_list() to pre-3.0.0
	 *
	 * @since 4.6.0-dev
	 * @param \WC_Product $product the product object
	 * @param string $sep Optional. The list separator
	 * @param string $before Optional. To display before the list
	 * @param string $after Optional. To display after the list
	 * @return string
	 */
	public static function wc_get_product_category_list( \WC_Product $product, $sep = ', ', $before = '', $after = '' ) {

		if ( WC_Core::is_wc_version_gte_3_0() ) {

			$id = $product->is_type( 'variation' ) ? $product->get_parent_id() : $product->get_id();

			return wc_get_product_category_list( $id, $sep, $before, $after );

		} else {

			return $product->get_categories( $sep, $before, $after );
		}
	}

	/**
	 * Backports wc_get_rating_html() to pre-3.0.0
	 *
	 * @since 4.6.0-dev
	 * @param \WC_Product $product the product object
	 * @param string $rating Optional. The product rating
	 * @return string
	 */
	public static function wc_get_rating_html( \WC_Product $product, $rating = null ) {

		if ( WC_Core::is_wc_version_gte_3_0() ) {
			return wc_get_rating_html( $rating );
		} else {
			return $product->get_rating_html( $rating );
		}
	}

}

endif; // Class exists check


text:
image="clear-8260-ciao-networking.img"
certs_dir=$GOPATH/src/github.com/01org/ciao/networking/ciao-cnci-agent/scripts/certs
cnci_agent=$GOPATH/bin/ciao-cnci-agent
cnci_sysd=$GOPATH/src/github.com/01org/ciao/networking/ciao-cnci-agent/scripts/ciao-cnci-agent.service
partition="2"
download=0

usage="$(basename "$0") [--image clear_cnci_image_name] [-certs certificate_directory] [-agent cnci_agent_binary] [-script cnci_systemd_script] \n\n A simple script to create a CNCI Image from a clear cloud image. \n Defaults for any unspecified option are as follows \n\n --agent $cnci_agent \n --certs $certs_dir \n --image $image \n --script $cnci_sysd\n\n"

while :
do
    case "$1" in
      -a | --agent)
	  cnci_agent="$2"
	  shift 2
	  ;;
      -c | --certs)
	  certs_dir="$2"
	  shift 2
	  ;;
      -d | --download)
	  download=1
	  shift 1
	  ;;
      -h | --help)
	  echo -e "$usage" >&2
	  exit 0
	  ;;
      -i | --image)
	  image="$2"
	  shift 2
	  ;;
      -s | --script)
	  cnci_sysd="$2"
	  shift 2
	  ;;
      *)
	  break
	  ;;
    esac
done

set -o nounset

if [ $download -eq 1 ]
then
	rm -f "$image"
	curl -O https://download.clearlinux.org/demos/ciao/"$image".xz
	unxz "$image".xz
fi

echo -e "\nMounting image: $image"
tmpdir=$(mktemp -d)
sudo modprobe nbd max_part=63
sudo qemu-nbd --format=raw -c /dev/nbd0 "$image"

#it can take some time for the device to get created
retry=0
until [ $retry -ge 3 ]
do
	sudo udevadm settle
	sudo partprobe /dev/nbd0
	sudo mount /dev/nbd0p$partition "$tmpdir" && break
	let retry=retry+1
	echo "Mount failed, retrying $retry"
	sleep 10
done

if [ $retry -ge 3 ]
then
	echo "Unable to mount CNCI Image"
	return 1
fi

echo -e "Cleaning up any artifacts"
sudo rm -rf "$tmpdir"/var/lib/ciao

echo -e "Copying agent image"
sudo cp "$cnci_agent" "$tmpdir"/usr/sbin/

echo -e "Copying agent systemd service script"
sudo cp "$cnci_sysd" "$tmpdir"/usr/lib/systemd/system/

echo -e "Installing the service"
sudo mkdir -p "$tmpdir"/etc/systemd/system/default.target.wants
sudo rm -f "$tmpdir"/etc/systemd/system/default.target.wants/ciao-cnci-agent.service
sudo chroot "$tmpdir" /bin/bash -c "sudo ln -s /usr/lib/systemd/system/ciao-cnci-agent.service /etc/systemd/system/default.target.wants/"

echo -e "Copying CA certificates"
sudo mkdir -p "$tmpdir"/var/lib/ciao/
sudo cp "$certs_dir"/CAcert-* "$tmpdir"/var/lib/ciao/CAcert-server-localhost.pem

echo -e "Copying CNCI Agent certificate"
sudo cp "$certs_dir"/cert-CNCIAgent-* "$tmpdir"/var/lib/ciao/cert-client-localhost.pem

echo -e "Removing cloud-init traces"
sudo rm -rf "$tmpdir"/var/lib/cloud

#Umount
echo -e "Done! unmounting\n"
sudo umount "$tmpdir"
sudo qemu-nbd -d /dev/nbd0
sudo rm -rf "$tmpdir"
exit 0


text:
from __future__ import absolute_import

import sys
from unittest import TestCase, main

from lark import Lark
from lark.load_grammar import GrammarLoader, GrammarError

class TestGrammar(TestCase):
    def setUp(self):
        pass

    def test_errors(self):
        for msg, examples in GrammarLoader.ERRORS:
            for example in examples:
                try:
                    p = Lark(example)
                except GrammarError as e:
                    assert msg in str(e)
                else:
                    assert False, "example did not raise an error"

if __name__ == '__main__':
    main()


text:
<?php

namespace Proxies;

/**
 * THIS CLASS WAS GENERATED BY THE DOCTRINE ORM. DO NOT EDIT THIS FILE.
 */
class BatnaBundleArchiSiebelBundleEntityEnvironnementProxy extends \Batna\Bundle\ArchiSiebelBundle\Entity\Environnement implements \Doctrine\ORM\Proxy\Proxy
{
    private $_entityPersister;
    private $_identifier;
    public $__isInitialized__ = false;
    public function __construct($entityPersister, $identifier)
    {
        $this->_entityPersister = $entityPersister;
        $this->_identifier = $identifier;
    }
    /** @private */
    public function __load()
    {
        if (!$this->__isInitialized__ && $this->_entityPersister) {
            $this->__isInitialized__ = true;

            if (method_exists($this, "__wakeup")) {
                // call this after __isInitialized__to avoid infinite recursion
                // but before loading to emulate what ClassMetadata::newInstance()
                // provides.
                $this->__wakeup();
            }

            if ($this->_entityPersister->load($this->_identifier, $this) === null) {
                throw new \Doctrine\ORM\EntityNotFoundException();
            }
            unset($this->_entityPersister, $this->_identifier);
        }
    }

    public function __toString()
    {
        $this->__load();
        return parent::__toString();
    }

    public function getId()
    {
        $this->__load();
        return parent::getId();
    }

    public function setShortName($shortName)
    {
        $this->__load();
        return parent::setShortName($shortName);
    }

    public function getShortName()
    {
        $this->__load();
        return parent::getShortName();
    }

    public function setLongName($longName)
    {
        $this->__load();
        return parent::setLongName($longName);
    }

    public function getLongName()
    {
        $this->__load();
        return parent::getLongName();
    }

    public function setDescription($description)
    {
        $this->__load();
        return parent::setDescription($description);
    }

    public function getDescription()
    {
        $this->__load();
        return parent::getDescription();
    }

    public function setContexte($contexte)
    {
        $this->__load();
        return parent::setContexte($contexte);
    }

    public function getContexte()
    {
        $this->__load();
        return parent::getContexte();
    }

    public function __sleep()
    {
        return array('__isInitialized__', 'id', 'shortName', 'longName', 'description', 'contexte');
    }

    public function __clone()
    {
        if (!$this->__isInitialized__ && $this->_entityPersister) {
            $this->__isInitialized__ = true;
            $class = $this->_entityPersister->getClassMetadata();
            $original = $this->_entityPersister->load($this->_identifier);
            if ($original === null) {
                throw new \Doctrine\ORM\EntityNotFoundException();
            }
            foreach ($class->reflFields AS $field => $reflProperty) {
                $reflProperty->setValue($this, $reflProperty->getValue($original));
            }
            unset($this->_entityPersister, $this->_identifier);
        }

    }
}


text:
Swift 3 DispatchGroup Demo

Demo of how to use DispatchGroups to wait for multiple asychronous workers to complete.


text:
'use strict';

/**
 * Returns a substring after a specific sequence of character(s).
 * By default looks for the first occuerence of this sequence.
 * If the character or sequence of characters not found, returns the initial string.
 *
 * @category String
 * @param {String} subjectString The string to process.
 * @param {String} characters The seqquence of characters to use as delimiter.
 * @param {Boolean} [last=false] If true or any truthy value, will look for the last occurence of the characters specified.
 * @throws {TypeError} If `subjectString` is not string.
 * @throws {TypeError} If `characters` is not string.
 * @return {String} The result string.
 * @example
 *
 * subStrAfter('LOREM_IPSUM DOLOR_SIT AMET', '_');
 * // -> 'IPSUM DOLOR_SIT AMET'
 *
 * subStrAfter('LOREM_IPSUM DOLOR_SIT AMET', '_', true);
 * // -> 'SIT AMET'
 *
 * subStrAfter('LOREM_IPSUM DOLOR_SIT AMET', 'SIT ');
 * // -> 'AMET'
 *
 * subStrAfter('LOREM_IPSUM DOLOR_SIT AMET', '?', true);
 * // -> 'LOREM_IPSUM DOLOR_SIT AMET'
 */
function subStrAfter(subjectString, characters, last) {
  var arr, len;

  if (typeof subjectString !== 'string' || typeof characters !== 'string') {
    throw new TypeError('Expected a string for first second argument');
  }

  if (!last) {
    return subjectString.substr(subjectString.indexOf(characters) + characters.length);
  }

  arr = subjectString.split(characters);
  len = arr.length;
  return arr[len - 1];
}

module.exports = subStrAfter;


text:
from setuptools import setup

setup(name='arduino-python',
      version='0.2',
      install_requires=['pyserial'],
      description="A light-weight Python library that provides a serial \
      bridge for communicating with Arduino microcontroller boards.",
      author='Tristan Hearn',
      author_email='tristanhearn@gmail.com',
      url='https://github.com/thearn/Python-Arduino-Command-API',
      license='MIT',
      packages=['Arduino'],
      )


text:
<?php
	namespace VortexAI\Kurgan;

	require_once("./config.php");
	require_once('controller/ctl_user.php');

	session_start();

	if((isset($_SESSION['authenticated']) == FALSE) || (empty($_SESSION['authenticated']) == TRUE)){
		header('Location: view/login.php');
		exit;

	}
	else {
		$ses = $_SESSION['authenticated'];
		if ($ses == 1){
			header('Location: view/dashboard.php');
			exit;
		}
		else {
			header('Location: view/login.php?auth=-1');
			exit;
		}
	}
?>


text:
jui.define("util.svg.element.poly", [], function() {

    /**
     * @class util.svg.element.poly
     *
     * @alias PolyElement
     * @extends util.svg.element.transform
     */
    var PolyElement = function() {
        var orders = [];

        this.point = function(x, y) {
            orders.push(x + "," + y);
            return this;
        }

        this.join = function() {
            if(orders.length > 0) {
                // Firefox 처리
                var start = orders[0];
                orders.push(start);

                // 폴리곤 그리기
                this.attr({ points: orders.join(" ") });
                orders = [];
            }
        }
    }

    return PolyElement;
}, "util.svg.element.transform");


text:
#include "sc_boot.h"
#include "sc_game.h"
#include "sc_engine.h"
#include "sc_path.h"
#include "sc_mat4.h"

/* if we want to clean up, clean up on shutdown, otherwise do nothing */
#ifndef SC_DONT_FREE_ON_SHUTDOWN
#  define FREE_ON_SHUTDOWN(x) atexit(x)
#else
#  define FREE_ON_SHUTDOWN(x) (void)0
#endif

static void
write_config_if_changed(void)
{
    if (sc_config.dirty)
        sc_save_config();
}

static int
run_game_controlled(int argc, char **argv)
{
    sc_load_config();
    atexit(write_config_if_changed);
    sc_engine_init();
    FREE_ON_SHUTDOWN(sc_engine_shutdown);
    FREE_ON_SHUTDOWN(sc_game_shutdown);
    sc_game_mainloop();
    return 0;
}

#if SC_PLATFORM == SC_PLATFORM_WINDOWS
INT WINAPI
WinMain(HINSTANCE hinst, HINSTANCE previnst, LPSTR cmdline, INT cmdshow)
{
    return run_game_controlled(__argc, __argv);
}

/* On OS X this function is called client_main and the real main function
   is in the os x launcher which is a (not so simple) obj-c app */
#elif SC_PLATFORM == SC_PLATFORM_OSX
int
client_main(int argc, char **argv)
{
    return run_game_controlled(argc, argv);
}

/* on linux just call into run_game_controlled */
#elif SC_PLATFORM == SC_PLATFORM_LINUX
int
main(int argc, char **argv)
{
    return run_game_controlled(argc, argv);
}
#endif


text:
    Summary

    Sensors

    Effectors

    Policies

    Activities

<router-outlet></router-outlet>


text:
declare function require(module:string):any;

export class Validator {

    private _mapping = [];
    private _pluginList = {};
    private _obj:any;

    constructor(obj:any){
        this._obj = obj;
    }

    public when(path:string){
        let _currentMapping:any = {path:path,stop:false};
        this._mapping.push(_currentMapping);

        let mappingObj = {
            is:(what:string) =>{
                _currentMapping.isPositive = true;
                _currentMapping.plugin = what;
                return mappingObj;
            },
            isNot: (what)=>{
                _currentMapping.isPositive = false;
                _currentMapping.plugin = what;
                return mappingObj;
            },
            then: (message)=>{
                _currentMapping.value = message;
                return mappingObj;
            },
            stop: ()=>{
                _currentMapping.stop = true;
            }
        }

        return mappingObj;
    }

    public validate():any{
        let validationMessages = [];
        let mObj = this._mapping;

        for (let i=0;i<this._mapping.length;i++){
            let mVal = this._mapping[i];
            let mKey = mVal.path;

            let validObj;
            if (typeof mVal.plugin === "function"){
                validObj = {onValidate:mVal.plugin};
            } else {
                let plugList = this._pluginList;
                validObj = plugList[mVal.plugin];
                if (!validObj){
                    validObj = require("./validators/" + mVal.plugin + ".js");
                    plugList[mVal.plugin] = validObj;
                }
            }

            if(validObj){
                if (validObj.onValidate){
                    let value =this._obj;
                    let result = validObj.onValidate(value[mKey]);

                    if (mVal.isPositive){
                        if (result == true){
                            validationMessages.push({field:mKey, message: mVal.value});
                            if (mVal.stop == true)
                                break;
                        }
                    }else {
                        if (result == false){
                            validationMessages.push({field:mKey, message: mVal.value});
                            if (mVal.stop == true)
                                break;
                        }
                    }

                } else {
                    validationMessages.push({field:mKey, message: "onValidate is not implemented in validator : " + mVal.plugin});
                }
            } else {
                validationMessages.push({field:mKey, message: "validation plugin not found : " + mVal.plugin});
            }
        }

        return validationMessages.length ==0 ? undefined : validationMessages;
    }

}


text:
import BufferUsage from './buffer-usage'
import AttributeType from './attribute-type'

export default class VertexBuffer {

  constructor (gl, usage = BufferUsage.STATIC) {
    this.gl = gl
    this.usage = usage

    this.buffer = null
    this.attributes = []

    this.byteLength = 0
    this.stride = 0
    this.length = 0
  }

  bufferData (vertexArray) {
    const gl = this.gl

    if (!this.buffer)
      this.buffer = gl.createBuffer()

    gl.bindBuffer(gl.ARRAY_BUFFER, this.buffer)
    gl.bufferData(gl.ARRAY_BUFFER, vertexArray, this.usage)
    gl.bindBuffer(gl.ARRAY_BUFFER, null)

    this.byteLength = vertexArray.byteLength
    this.updateLength()

    return this
  }

  bufferSubData (vertexArray, offset) {
    const gl = this.gl
    gl.bindBuffer(gl.ARRAY_BUFFER, this.buffer)
    gl.bufferSubData(gl.ARRAY_BUFFER, offset, vertexArray)
    gl.bindBuffer(gl.ARRAY_BUFFER, null)
    return this
  }

  setAttribute (name, type, size, normalize = false, offset = this.stride) {
    this.attributes.push({ name, type, size, normalize, offset })
    this.updateStride(type, size)
    this.updateLength()
    return this
  }

  bind () {
    const gl = this.gl
    gl.bindBuffer(gl.ARRAY_BUFFER, this.buffer)
    return this
  }

  linkTo (shaderProgram) {
    const gl = this.gl

    gl.bindBuffer(gl.ARRAY_BUFFER, this.buffer)

    this.attributes.forEach(({ name, type, size, normalize, offset }) => {
      const location = shaderProgram.getAttributeLocation(name)

      if (location !== undefined) {
        gl.vertexAttribPointer(
          location,
          size,
          type,
          normalize,
          this.stride,
          offset
        )
        gl.enableVertexAttribArray(location)
      }
    })

    return this
  }

  updateStride (type, size) {
    let numBytes
    switch (type) {
      case AttributeType.BYTE:
      case AttributeType.UNSIGNED_BYTE:
        numBytes = 1
        break
      case AttributeType.SHORT:
      case AttributeType.UNSIGNED_SHORT:
        numBytes = 2
        break
      case AttributeType.FLOAT:
        numBytes = 4
        break
      default:
        throw new Error(`"${type}" is not a valid attribute type.`)
    }

    this.stride += numBytes * size
  }

  updateLength () {
    if (this.stride > 0) {
      this.length = this.byteLength / this.stride
    }
  }

  dispose () {
    if (this.buffer) {
      this.gl.deleteBuffer(this.buffer)
      this.buffer = null
    }
  }
}


text:
*Author: @JensLincke*

So it can be used in scripts....

```javascript
fetch("http://localhost:9006/test/b", {
  method: "MOVE",
  headers: {
    destination: "http://localhost:9006/test/c"
  }
}).then(r => r.text())
```

## Some Files Cleanup #Delete

```javascript
var files;
var base = "http://localhost:9005/Dropbox/Thesis/Literature/";
fetch(base, {
  method: "OPTIONS",
  headers: {
    "filelist": true
  }
}).then(r => r.json()).then(obj => files=obj.contents)

var toDelete = files.filter(ea => ea.name.match(/\.note$/)).sortBy(ea => ea.size).filter(ea => ea.size ==  1).map(ea => base + ea.name)

var value;
(async () => {
  for(var ea of toDelete) {
    await fetch(ea, {method: "DELETE"})
    lively.notify("deleted " + ea)
  }
})()
```

## New Literature Overview Page

Given, that the lively4 FileIndex contains bibliographies and PDF files, those are now printed nicely on <browse://doc/files/literature.md>:

![](literature_overview.png)

## Script Augmented Interactive Workflows #ScriptingWorkflows

Using Lively it is possible to hook into very manual workflows and start to script. This is similar to the capabilities of AppleScript, but with Halos it is much easier to actually get the elements that contain the interesting content.

```javascript
import Strings from 'src/client/strings.js'

var input = document.querySelector("lively-dialog").get("input");

var ignore = new Set(["A"]);

input.value = input.value.split(" ").filter(ea => ea.length > 0).map(ea => Strings.toUpperCaseFirst(ea.replace(/[,:;]/,""))).filter(ea => !ignore.has(ea)).join("")
```

![](scriptaugmented_interactive_workflows.png)


text:
// Copyright 2022 Google LLC
//
// 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.

/**
 * Technology.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis 1.4 Mar 02, 2009 (07:08:06 PST) WSDL2Java emitter.
 */

package com.google.api.ads.admanager.axis.v202211;

public class Technology  implements java.io.Serializable {
    private java.lang.Long id;

    private java.lang.String name;

    public Technology() {
    }

    public Technology(
           java.lang.Long id,
           java.lang.String name) {
           this.id = id;
           this.name = name;
    }

    @Override
    public String toString() {
        return com.google.common.base.MoreObjects.toStringHelper(this.getClass())
            .omitNullValues()
            .add("id", getId())
            .add("name", getName())
            .toString();
    }

    /**
     * Gets the id value for this Technology.
     *
     * @return id
     */
    public java.lang.Long getId() {
        return id;
    }

    /**
     * Sets the id value for this Technology.
     *
     * @param id
     */
    public void setId(java.lang.Long id) {
        this.id = id;
    }

    /**
     * Gets the name value for this Technology.
     *
     * @return name
     */
    public java.lang.String getName() {
        return name;
    }

    /**
     * Sets the name value for this Technology.
     *
     * @param name
     */
    public void setName(java.lang.String name) {
        this.name = name;
    }

    private java.lang.Object __equalsCalc = null;
    public synchronized boolean equals(java.lang.Object obj) {
        if (!(obj instanceof Technology)) return false;
        Technology other = (Technology) obj;
        if (obj == null) return false;
        if (this == obj) return true;
        if (__equalsCalc != null) {
            return (__equalsCalc == obj);
        }
        __equalsCalc = obj;
        boolean _equals;
        _equals = true &&
            ((this.id==null && other.getId()==null) ||
             (this.id!=null &&
              this.id.equals(other.getId()))) &&
            ((this.name==null && other.getName()==null) ||
             (this.name!=null &&
              this.name.equals(other.getName())));
        __equalsCalc = null;
        return _equals;
    }

    private boolean __hashCodeCalc = false;
    public synchronized int hashCode() {
        if (__hashCodeCalc) {
            return 0;
        }
        __hashCodeCalc = true;
        int _hashCode = 1;
        if (getId() != null) {
            _hashCode += getId().hashCode();
        }
        if (getName() != null) {
            _hashCode += getName().hashCode();
        }
        __hashCodeCalc = false;
        return _hashCode;
    }

    // Type metadata
    private static org.apache.axis.description.TypeDesc typeDesc =
        new org.apache.axis.description.TypeDesc(Technology.class, true);

    static {
        typeDesc.setXmlType(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v202211", "Technology"));
        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("id");
        elemField.setXmlName(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v202211", "id"));
        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "long"));
        elemField.setMinOccurs(0);
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);
        elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("name");
        elemField.setXmlName(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v202211", "name"));
        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
        elemField.setMinOccurs(0);
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);
    }

    /**
     * Return type metadata object
     */
    public static org.apache.axis.description.TypeDesc getTypeDesc() {
        return typeDesc;
    }

    /**
     * Get Custom Serializer
     */
    public static org.apache.axis.encoding.Serializer getSerializer(
           java.lang.String mechType,
           java.lang.Class _javaType,
           javax.xml.namespace.QName _xmlType) {
        return
          new  org.apache.axis.encoding.ser.BeanSerializer(
            _javaType, _xmlType, typeDesc);
    }

    /**
     * Get Custom Deserializer
     */
    public static org.apache.axis.encoding.Deserializer getDeserializer(
           java.lang.String mechType,
           java.lang.Class _javaType,
           javax.xml.namespace.QName _xmlType) {
        return
          new  org.apache.axis.encoding.ser.BeanDeserializer(
            _javaType, _xmlType, typeDesc);
    }

}