text:
/**
 * This class is used as a mixin.
 *
 * This class is to be used to provide basic methods for binding/unbinding stores to other
 * classes.
 *
 * This class is not intended for direct use but rather internally by those classes that
 * manage a Store.
 * @private
 */
Ext.define('Ext.util.StoreHolder', {
    requires: [
        'Ext.data.StoreManager'
    ],
    mixinId: 'storeholder',

    /**
     * @property {Boolean} [autoDestroyBoundStore] This property allows the object
     * to destroy bound stores that have {@link #Ext.data.AbstractStore#autoDestroy}
     * option set to `true`.
     */
    autoDestroyBoundStore: false,

    /**
     * Binds a store to this instance.
     * @param {Ext.data.AbstractStore/String} [store] The store to bind or ID of the store.
     * When no store given (or when `null` or `undefined` passed), unbinds the existing store.
     */
    bindStore: function(store, initial, propertyName) {
        // Private params
        // @param {Boolean} [initial=false] True to not remove listeners from existing store.
        // @param {String} [propertyName="store"] The property in this object under which to cache the passed Store.
        propertyName = propertyName || 'store';

        var me = this,
            oldStore = initial ? null : me[propertyName];

        if (store !== oldStore) {
            if (oldStore) {
                // Perform implementation-specific unbinding operations *before*
                // possible Store destruction.
                if (!me.onUnbindStore.$emptyFn) {
                    me.onUnbindStore(oldStore, initial, propertyName);
                }

                // autoDestroy is only intended for when it is unbound from a component,
                // and the store could have been already destroyed upstream
                if (!oldStore.destroyed) {
                    if (me.autoDestroyBoundStore && propertyName === 'store' && oldStore.autoDestroy) {
                        oldStore.destroy();
                    }
                    else {
                        me.unbindStoreListeners(oldStore);
                    }
                }
            }

            if (store) {
                me[propertyName] = store = Ext.data.StoreManager.lookup(store);
                me.bindStoreListeners(store);

                if (!me.onBindStore.$emptyFn) {
                    me.onBindStore(store, oldStore, initial);
                }
            }
            else {
                me[propertyName] = null;
            }

            if (me.fireEvent) {
                me.fireEvent('storechange', me, store, oldStore);
            }
        }

        return me;
    },

    /**
     * Gets the current store instance.
     * @return {Ext.data.AbstractStore} The store, null if one does not exist.
     */
    getStore: function () {
        return this.store;
    },

    /**
     * Sets the store to the specified store.
     * @param store
     * @since 5.0.0
     */
    setStore: function (store) {
        this.bindStore(store);
    },

    /**
     * Unbinds listeners from this component to the store. By default it will remove
     * anything bound by the bindStoreListeners method, however it can be overridden
     * in a subclass to provide any more complicated handling.
     * @protected
     * @param {Ext.data.AbstractStore} store The store to unbind from
     */
    unbindStoreListeners: function(store) {
        // Can be overridden in the subclass for more complex removal
        var listeners = this.storeListeners;
        if (listeners) {
            store.un(listeners);
        }
    },

    /**
     * Binds listeners for this component to the store. By default it will add
     * anything bound by the getStoreListeners method, however it can be overridden
     * in a subclass to provide any more complicated handling.
     * @protected
     * @param {Ext.data.AbstractStore} store The store to bind to
     */
    bindStoreListeners: function(store) {
        // Can be overridden in the subclass for more complex binding
        var listeners = this.getStoreListeners(store);

        if (listeners) {
            listeners = Ext.apply({}, listeners);
            if (!listeners.scope) {
                listeners.scope = this;
            }
            this.storeListeners = listeners;
            store.on(listeners);
        }
    },

    /**
     * @method
     * Gets the listeners to bind to a new store.
     * @protected
     * @param {Ext.data.Store} store The Store which is being bound to for which a listeners object should be returned.
     * @return {Object} The listeners to be bound to the store in object literal form. The scope
     * may be omitted, it is assumed to be the current instance.
     */
    getStoreListeners: Ext.emptyFn,

    /**
     * @method
     * Template method, it is called when an existing store is unbound
     * from the current instance.
     * @protected
     * @param {Ext.data.AbstractStore} store The store being unbound
     * @param {Boolean} initial True if this store is being bound as initialization of the instance.
     */
    onUnbindStore: Ext.emptyFn,

    /**
     * @method
     * Template method, it is called when a new store is bound
     * to the current instance.
     * @protected
     * @param {Ext.data.AbstractStore} store The store being bound
     * @param {Boolean} initial True if this store is being bound as initialization of the instance.
     */
    onBindStore: Ext.emptyFn
});


text:
package com.netflix.priam.defaultimpl;

import com.google.common.collect.Lists;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.Module;
import com.google.inject.servlet.GuiceServletContextListener;
import com.google.inject.servlet.ServletModule;
import com.netflix.priam.PriamServer;
import com.netflix.priam.config.IConfiguration;
import com.sun.jersey.api.core.PackagesResourceConfig;
import com.sun.jersey.guice.spi.container.servlet.GuiceContainer;
import com.sun.jersey.spi.container.servlet.ServletContainer;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletContextEvent;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.SchedulerFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class InjectedWebListener extends GuiceServletContextListener {
    protected static final Logger logger = LoggerFactory.getLogger(InjectedWebListener.class);
    private Injector injector;

    @Override
    protected Injector getInjector() {
        List<Module> moduleList = Lists.newArrayList();
        moduleList.add(new JaxServletModule());
        moduleList.add(new PriamGuiceModule());
        injector = Guice.createInjector(moduleList);
        try {
            injector.getInstance(IConfiguration.class).initialize();
            injector.getInstance(PriamServer.class).scheduleService();
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
            throw new RuntimeException(e.getMessage(), e);
        }
        return injector;
    }

    @Override
    public void contextDestroyed(ServletContextEvent servletContextEvent) {
        try {
            for (Scheduler scheduler :
                    injector.getInstance(SchedulerFactory.class).getAllSchedulers()) {
                scheduler.shutdown();
            }
        } catch (SchedulerException e) {
            throw new RuntimeException(e);
        }
        super.contextDestroyed(servletContextEvent);
    }

    public static class JaxServletModule extends ServletModule {
        @Override
        protected void configureServlets() {
            Map<String, String> params = new HashMap<>();
            params.put(PackagesResourceConfig.PROPERTY_PACKAGES, "unbound");
            params.put("com.sun.jersey.config.property.packages", "com.netflix.priam.resources");
            params.put(ServletContainer.PROPERTY_FILTER_CONTEXT_PATH, "/REST");
            serve("/REST/*").with(GuiceContainer.class, params);
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
package pl.snowdog.dzialajlokalnie;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.TextInputLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.TextView;

import com.facebook.CallbackManager;
import com.facebook.FacebookCallback;
import com.facebook.FacebookException;
import com.facebook.GraphRequest;
import com.facebook.GraphResponse;
import com.facebook.Profile;
import com.facebook.ProfileTracker;
import com.facebook.login.LoginResult;
import com.facebook.login.widget.LoginButton;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.OptionsItem;
import org.androidannotations.annotations.TextChange;
import org.androidannotations.annotations.ViewById;
import org.json.JSONObject;

import de.greenrobot.event.EventBus;
import pl.snowdog.dzialajlokalnie.events.CreateNewObjectEvent;
import pl.snowdog.dzialajlokalnie.events.ObjectAddedEvent;
import pl.snowdog.dzialajlokalnie.fragment.ApiActionDialogFragment;
import pl.snowdog.dzialajlokalnie.fragment.ApiActionDialogFragment_;
import pl.snowdog.dzialajlokalnie.model.Login;
import pl.snowdog.dzialajlokalnie.model.Session;
import pl.snowdog.dzialajlokalnie.model.User;
import pl.snowdog.dzialajlokalnie.util.PasswordValidator;
import retrofit.Callback;
import retrofit.RetrofitError;
import retrofit.client.Response;

/**
 * Created by chomi3 on 2015-07-23.
 */
@EActivity(R.layout.activity_login)
public class LoginActivity extends BaseActivity {
    private static final String TAG = "LoginActivity";

    protected ApiActionDialogFragment mApiActionDialogFragment;

    @ViewById(R.id.etEmail)
    EditText etEmail;

    @ViewById(R.id.etPassword)
    EditText etPassword;

    @ViewById(R.id.etEmailWrapper)
    TextInputLayout etEmailWrapper;

    @ViewById(R.id.etPasswordWrapper)
    TextInputLayout etPasswordWrapper;

    @ViewById(R.id.btnLoginFacebook)
    LoginButton btnFacebookLogin;

    CallbackManager callbackManager;
    private ProfileTracker profileTracker;

    private Login.Facebook mFacebookLogin;

    @Click(R.id.btnLogin)
    void onLoginClicked() {
        if(validateInput()) {
            toggleProgressWheel(true);
            login(etEmail.getText().toString(), etPassword.getText().toString());
        }
    }

    @Click(R.id.btnRegister)
    void onRegisterClicked() {
        AddUserActivity_.intent(this).start();
        /*AddUserFacebookActivity_.intent(LoginActivity.this).start();
        hideKeyboard();*/
        this.finish();
    }

    @Click(R.id.btnLoginFacebook)
    void onFacebookLoginClicked() {

    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void loginResult(Session session) {
        toggleProgressWheel(false);
        super.loginResult(session);
        if(session != null) {
            this.finish();
        }
    }

    @Override
    protected void afterView() {
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        final ActionBar ab = getSupportActionBar();
        ab.setHomeAsUpIndicator(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
        ab.setDisplayHomeAsUpEnabled(true);

        btnFacebookLogin.setReadPermissions("public_profile");
        btnFacebookLogin.setReadPermissions("email");
        callbackManager = CallbackManager.Factory.create();
        btnFacebookLogin.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
            @Override
            public void onSuccess(final LoginResult loginResult) {
                profileTracker.startTracking();

                GraphRequest request = GraphRequest.newMeRequest(
                        loginResult.getAccessToken(),
                        new GraphRequest.GraphJSONObjectCallback() {
                            @Override
                            public void onCompleted(
                                    JSONObject object,
                                    GraphResponse response) {
                                // Application code
                                toggleProgressWheel(true);
                                Log.d(TAG, "fbdbg: " + response.toString() + " object: " + object.toString() + " accessToken: " + loginResult.getAccessToken().getToken());

                                GsonBuilder gsonBuilder = new GsonBuilder();
                                Gson gson = gsonBuilder.create();
                                mFacebookLogin = gson.fromJson(object.toString(), Login.Facebook.class);
                                mFacebookLogin.setAccessToken(loginResult.getAccessToken().getToken());
                                loginWithFacebook(mFacebookLogin);

                            }
                        });
                Bundle parameters = new Bundle();
                parameters.putString("fields", "id,name,email,gender, birthday");
                request.setParameters(parameters);
                request.executeAsync();

            }

            @Override
            public void onCancel() {

            }

            @Override
            public void onError(FacebookException e) {

            }
        });

        profileTracker = new ProfileTracker() {
            @Override
            protected void onCurrentProfileChanged(
                    Profile oldProfile,
                    Profile currentProfile) {

                //Profile profile = Profile.getCurrentProfile();
                if(currentProfile != null) {
                    Log.d(TAG, "fbdbg profile: " + currentProfile.getName() + " " + currentProfile.getLastName());
                }
                // App code
            }
        };
    }

    public void onEvent(CreateNewObjectEvent event) {
        switch (event.getType()) {
            case facebook:
                if(mFacebookLogin != null) {
                    loginWithFacebook(mFacebookLogin);
                }

        }
    }

    @Override
    protected void getUserById(int userId) {
        DlApplication.userApi.getUserById(userId, new Callback<User>() {
            @Override
            public void success(User user, Response response) {
                toggleProgressWheel(false);
                user.save();
                EventBus.getDefault().post(new ObjectAddedEvent(ObjectAddedEvent.Type.user));
                finish();
            }

            @Override
            public void failure(RetrofitError error) {
                finish();
                toggleProgressWheel(false);
            }
        });
    }

    private void loginWithFacebook(Login.Facebook login) {
        DlApplication.userApi.loginFb(login, new Callback<Login.Facebook>() {
            @Override
            public void success(Login.Facebook user, Response response) {

                Log.d(TAG, "fbdbg facebookLogin user post success: " + response);// + " user: " + user.toString());
                if(user != null) {
                    if (user.getSession() != null && user.getUser() == null) {
                        //Consecutive facebook login, user was already created - store session
                        //and start regular app usage
                        Log.d(TAG, "fbdbg facebookLogin SESSION RECEIVED "+user.getSession());
                        try {
                            user.getSession().save();
                            DlApplication.refreshCurrentSession();
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                        getUserById(user.getSession().getUserID());
                        /*EventBus.getDefault().post(new ObjectAddedEvent(ObjectAddedEvent.Type.user));
                        finish();*/

                    }
                    if (user.getSession() != null && user.getUser() != null) {
                        //First user login by facebook, we need to get his location to update account
                        //if no location will be provided - log user out
                        Log.d(TAG, "fbdbg facebookLogin USER RECEIVED");
                        try {
                            user.getSession().save();
                            DlApplication.refreshCurrentSession();
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                        toggleProgressWheel(false);
                        hideKeyboard();
                        AddUserFacebookActivity_.intent(LoginActivity.this).userID(user.getUser().getUserID()).start();
                        finish();
                    }
                }

            }

            @Override
            public void failure(RetrofitError error) {
                Log.d(TAG, "userApi.postNewUser post error: " + error);
                toggleProgressWheel(false);
            }
        });
    }

    @TextChange(R.id.etEmail)
    void onTextChangeEmail(TextView tv, CharSequence text) {
        if(text.length() > 0) {
            validateEmail();
        }
    }

    @TextChange(R.id.etPassword)
    void onTextChangePassword(TextView tv, CharSequence text) {
        if(text.length() > 0) {
            validatePassword();
        }
    }

    boolean validateInput() {
        boolean validEmail = validateEmail();
        boolean validPassword = validatePassword();

        if(validEmail && validPassword) {
            return true;
        } else {
            return false;
        }
    }

    private boolean validateEmail() {
        boolean isInputValid = true;
        if(!android.util.Patterns.EMAIL_ADDRESS.matcher(etEmail.getText().toString()).matches()) {
            etEmailWrapper.setErrorEnabled(true);
            etEmailWrapper.setError(getString(R.string.warning_fill_email));
            isInputValid = false;
        } else {
            etEmailWrapper.setErrorEnabled(false);
        }
        return isInputValid;
    }

    private boolean validatePassword() {
        boolean isInputValid = true;
        if(etPassword.getText().toString().trim().length() == 0
                || new PasswordValidator().validate(etPassword.getText().toString()) == false) {
            etPasswordWrapper.setErrorEnabled(true);
            etPasswordWrapper.setError(getString(R.string.warning_fill_password));
            isInputValid = false;
        } else {
            etPasswordWrapper.setErrorEnabled(false);
        }
        return isInputValid;
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        profileTracker.stopTracking();
    }

    private void hideKeyboard() {
        // Check if no view has focus:
        View view = this.getCurrentFocus();
        if (view != null) {
            InputMethodManager inputManager = (InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE);
            inputManager.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
        }
    }

    protected void toggleProgressWheel(boolean show) {
        if(show) {
            if(mApiActionDialogFragment == null) {
                mApiActionDialogFragment = ApiActionDialogFragment_.builder().build();
            }
            mApiActionDialogFragment.show(getSupportFragmentManager(), ApiActionDialogFragment.TAG);
        } else {
            mApiActionDialogFragment.dismiss();
        }
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        callbackManager.onActivityResult(requestCode, resultCode, data);
    }

    @OptionsItem(android.R.id.home)
    void homeSelected() {
        this.finish();
    }
}


text:
/**
 * @Author: Li'Zhuo
 * @Date:   2016-04-16 19:05:13
 * @Email:  topgrd@outlook.com
 * @Project: ES6
 * @Last modified by:   Li'Zhuo
 * @Last modified time: 2016-05-24 19:07:03
 */

angular.module('app')
    .controller('AllItemsCtrl', ['DataService', '$scope', '$q', '$interval', '$mdIcon', function(DataService, $scope, $q, $interval, $mdIcon) {
        var self = this;
        self.activated = true;
        self.determinateValue = 30;
        // Iterate every 100ms, non-stop and increment
        // the Determinate loader.
        $interval(function() {
            self.determinateValue += 1;
            if (self.determinateValue > 100) {
                self.determinateValue = 30;
            }
        }, 100);

        var options = {
            url: 'https://api.douban.com/v2/movie/in_theaters?count=50',
            headers: {
                'User-agent': 'request'
            }
        };

        DataService.getHotMovies(options)
            .then(function(data) {
                self.activated = false;
                $scope.allItems = data;
            });

        $scope.renderRating = function(item) {
            if (item.render === undefined && item.render !== true) {
                var renderTarget = event.currentTarget.children[0].children[0].children[0];
                var rate = Math.round((item.rating.average) / 2);
                var len = 0;
                var urls = [
                    'img/icons/star.svg',
                    'img/icons/half-star.svg',
                    'img/icons/star_border.svg'
                ];

                for (var i = 0; i < rate; i++) {
                    $mdIcon(urls[0]).then(function(iconEle) {
                        renderTarget.appendChild(iconEle);
                    });
                }

                if (rate * 2 < item.rating.average) {
                    $mdIcon(urls[1]).then(function(iconEle) {
                        renderTarget.appendChild(iconEle);
                        len = 5 - rate - 1;
                        while (len > 0) {
                            $mdIcon(urls[2]).then(function(iconEle) {
                                renderTarget.appendChild(iconEle);
                            });
                            len--;
                        }
                    });
                } else {
                    len = 5 - rate;
                    while (len > 0) {
                        $mdIcon(urls[2]).then(function(iconEle) {
                            renderTarget.appendChild(iconEle);
                        });
                        len--;
                    }
                }

                item.render = true;
            } else {
                return;
            }

        };

    }]);


text:
#pragma once
#include "watchman_system.h"

#include <string>
#include <unordered_map>
#include "ChildProcess.h"
#include "FileInformation.h"
#include "SCM.h"
#include "watchman_synchronized.h"

namespace watchman {

class Mercurial : public SCM {
 public:
  Mercurial(w_string_piece rootPath, w_string_piece scmRoot);
  w_string mergeBaseWith(w_string_piece commitId) const override;
  std::vector<w_string> getFilesChangedSinceMergeBaseWith(
      w_string_piece commitId) const override;
  SCM::StatusResult getFilesChangedBetweenCommits(
      w_string_piece commitA,
      w_string_piece commitB) const override;

 private:
  // Returns options for invoking hg
  ChildProcess::Options makeHgOptions() const;

  struct infoCache {
    std::string dirStatePath;
    FileInformation dirstate;
    std::unordered_map<std::string, w_string> mergeBases;

    explicit infoCache(std::string path);
    bool dotChanged();

    w_string lookupMergeBase(const std::string& commitId);
  };
  mutable Synchronized<infoCache> cache_;
};
}


text:
package com.intellij.plugins.haxe.ide.annotator;

import com.intellij.lang.annotation.Annotation;
import com.intellij.lang.annotation.AnnotationHolder;
import com.intellij.lang.annotation.Annotator;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.util.TextRange;
import com.intellij.plugins.haxe.HaxeBundle;
import com.intellij.plugins.haxe.lang.lexer.HaxeTokenTypes;
import com.intellij.plugins.haxe.lang.psi.*;
import com.intellij.plugins.haxe.model.*;
import com.intellij.plugins.haxe.model.fixer.HaxeFixer;
import com.intellij.plugins.haxe.model.fixer.HaxeModifierAddFixer;
import com.intellij.plugins.haxe.model.fixer.HaxeModifierRemoveFixer;
import com.intellij.plugins.haxe.model.fixer.HaxeModifierReplaceVisibilityFixer;
import com.intellij.plugins.haxe.model.type.HaxeTypeCompatible;
import com.intellij.plugins.haxe.model.type.HaxeTypeResolver;
import com.intellij.plugins.haxe.model.type.ResultHolder;
import com.intellij.plugins.haxe.util.HaxeResolveUtil;
import com.intellij.plugins.haxe.util.PsiFileUtils;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiTreeUtil;
import org.apache.commons.lang.StringUtils;
import org.jetbrains.annotations.NotNull;

import java.util.*;

public class HaxeSemanticAnnotator implements Annotator {
  @Override
  public void annotate(PsiElement element, AnnotationHolder holder) {
    analyzeSingle(element, holder);
  }

  static void analyzeSingle(final PsiElement element, AnnotationHolder holder) {
    if (element instanceof HaxePackageStatement) {
      PackageChecker.check((HaxePackageStatement)element, holder);
    }
    else if (element instanceof HaxeMethod) {
      MethodChecker.check((HaxeMethod)element, holder);
    }
    else if (element instanceof HaxeClass) {
      ClassChecker.check((HaxeClass)element, holder);
    }
    else if (element instanceof HaxeType) {
      TypeChecker.check((HaxeType)element, holder);
    }
    else if (element instanceof HaxeVarDeclaration) {
      FieldChecker.check((HaxeVarDeclaration)element, holder);
    }
  }
}

class TypeTagChecker {
  public static void check(
    final PsiElement erroredElement,
    final HaxeTypeTag tag,
    final HaxeVarInit initExpression,
    boolean requireConstant,
    final AnnotationHolder holder
  ) {
    final ResultHolder type1 = HaxeTypeResolver.getTypeFromTypeTag(tag, erroredElement);
    final ResultHolder type2 = HaxeTypeResolver.getPsiElementType(initExpression);
    final HaxeDocumentModel document = HaxeDocumentModel.fromElement(tag);
    if (!type1.canAssign(type2)) {
      // @TODO: Move to bundle
      Annotation annotation =
        holder.createErrorAnnotation(erroredElement, "Incompatible type " + type1 + " can't be assigned from " + type2);
      annotation.registerFix(new HaxeFixer("Change type") {
        @Override
        public void run() {
          document.replaceElementText(tag, ":" + type2.toStringWithoutConstant());
        }
      });
      annotation.registerFix(new HaxeFixer("Remove init") {
        @Override
        public void run() {
          document.replaceElementText(initExpression, "", StripSpaces.BEFORE);
        }
      });
    }
    else if (requireConstant && type2.getType().getConstant() == null) {
      // @TODO: Move to bundle
      holder.createErrorAnnotation(erroredElement, "Parameter default type should be constant but was " + type2);
    }
  }
}

class FieldChecker {
  public static void check(final HaxeVarDeclaration var, final AnnotationHolder holder) {
    HaxeFieldModel field = new HaxeFieldModel(var);
    if (field.isProperty()) {
      checkProperty(field, holder);
    }
    if (field.hasInitializer() && field.hasTypeTag()) {
      TypeTagChecker.check(field.getPsi(), field.getTypeTagPsi(), field.getInitializerPsi(), false, holder);
    }
  }

  public static void checkProperty(final HaxeFieldModel field, final AnnotationHolder holder) {
    final HaxeDocumentModel document = field.getDocument();

    if (field.getGetterPsi() != null && !field.getGetterType().isValidGetter()) {
      holder.createErrorAnnotation(field.getGetterPsi(), "Invalid getter accessor");
    }

    if (field.getSetterPsi() != null && !field.getSetterType().isValidSetter()) {
      holder.createErrorAnnotation(field.getSetterPsi(), "Invalid setter accessor");
    }

    if (field.getGetterType() == HaxeAccessorType.GET) {
      final String methodName = "get_" + field.getName();
      HaxeMethodModel method = field.getDeclaringClass().getMethod(methodName);
      if (method == null) {
        Annotation annotation = holder.createErrorAnnotation(field.getGetterPsi(), "Can't find method " + methodName);
        annotation.registerFix(new HaxeFixer("Add method") {
          @Override
          public void run() {
            field.getDeclaringClass().addMethod(methodName);
          }
        });
      }
    }

    if (field.getSetterType() == HaxeAccessorType.SET) {
      final String methodName = "set_" + field.getName();
      HaxeMethodModel method = field.getDeclaringClass().getMethod(methodName);
      if (method == null) {
        Annotation annotation = holder.createErrorAnnotation(field.getSetterPsi(), "Can't find method " + methodName);
        annotation.registerFix(new HaxeFixer("Add method") {
          @Override
          public void run() {
            field.getDeclaringClass().addMethod(methodName);
          }
        });
      }
    }

    if (field.isProperty() && !field.isRealVar() && field.hasInitializer()) {
      final HaxeVarInit psi = field.getInitializerPsi();
      Annotation annotation = holder.createErrorAnnotation(
        field.getInitializerPsi(),
        "This field cannot be initialized because it is not a real variable"
      );
      annotation.registerFix(new HaxeFixer("Remove init") {
        @Override
        public void run() {
          document.replaceElementText(psi, "", StripSpaces.BEFORE);
        }
      });
      annotation.registerFix(new HaxeFixer("Add @:isVar") {
        @Override
        public void run() {
          field.getModifiers().addModifier(HaxeModifierType.IS_VAR);
        }
      });
      if (field.getSetterPsi() != null) {
        annotation.registerFix(new HaxeFixer("Make setter null") {
          @Override
          public void run() {
            document.replaceElementText(field.getSetterPsi(), "null");
          }
        });
      }
    }
  }
}

class TypeChecker {
  static public void check(final HaxeType type, final AnnotationHolder holder) {
    if (true) {
      // HACK - Find the identifier manually, rather than just getting it from the reference.
      // There is an error in the BNF that maps a number of reference types to HaxeReferenceExpression
      // even though the types do not necessarily have one.  If an identifier doesn't exist,
      // HaxeReferenceExpression.getIdentifier() will throw a NotNull exception; searching the
      // children doesn't.
      HaxeReferenceExpression expression = type.getReferenceExpression();
      HaxeIdentifier identifier = PsiTreeUtil.getChildOfType(expression, HaxeIdentifier.class);
      check(identifier, holder);
    } else {
      check(type.getReferenceExpression().getIdentifier(), holder);
    }
  }

  static public void check(final PsiIdentifier identifier, final AnnotationHolder holder) {
    if (identifier == null) return;
    final String typeName = identifier.getText();
    if (!HaxeClassModel.isValidClassName(typeName)) {
      Annotation annotation = holder.createErrorAnnotation(identifier, "Type name must start by upper case");
      annotation.registerFix(new HaxeFixer("Change name") {
        @Override
        public void run() {
          HaxeDocumentModel.fromElement(identifier).replaceElementText(
            identifier,
            typeName.substring(0, 1).toUpperCase() + typeName.substring(1)
          );
        }
      });
    }
  }
}

class ClassChecker {
  static public void check(final HaxeClass clazzPsi, final AnnotationHolder holder) {
    HaxeClassModel clazz = clazzPsi.getModel();
    checkDuplicatedFields(clazz, holder);
    checkClassName(clazz, holder);
    checkInterfaces(clazz, holder);
    checkExtends(clazz, holder);
    checkInterfacesMethods(clazz, holder);
  }

  static private void checkDuplicatedFields(final HaxeClassModel clazz, final AnnotationHolder holder) {
    Map<String, HaxeMemberModel> map = new HashMap<String, HaxeMemberModel>();
    Set<HaxeMemberModel> repeatedMembers = new HashSet<HaxeMemberModel>();
    for (HaxeMemberModel member : clazz.getMembersSelf()) {
      final String memberName = member.getName();
      HaxeMemberModel repeatedMember = map.get(memberName);
      if (repeatedMember != null) {
        repeatedMembers.add(member);
        repeatedMembers.add(repeatedMember);
      }
      else {
        map.put(memberName, member);
      }
    }

    for (HaxeMemberModel member : repeatedMembers) {
      holder.createErrorAnnotation(member.getNameOrBasePsi(), "Duplicate class field declaration : " + member.getName());
    }

    //Duplicate class field declaration
  }

  static private void checkClassName(final HaxeClassModel clazz, final AnnotationHolder holder) {
    TypeChecker.check(clazz.getNamePsi(), holder);
  }

  static public void checkExtends(final HaxeClassModel clazz, final AnnotationHolder holder) {
    HaxeClassReferenceModel reference = clazz.getParentClassReference();
    if (reference != null) {
      HaxeClassModel aClass1 = reference.getHaxeClass();
      if (aClass1 != null && !aClass1.isClass()) {
        // @TODO: Move to bundle
        holder.createErrorAnnotation(reference.getPsi(), "Not a class");
      }
    }
  }

  static public void checkInterfaces(final HaxeClassModel clazz, final AnnotationHolder holder) {
    for (HaxeClassReferenceModel interfaze : clazz.getImplementingInterfaces()) {
      if (interfaze.getHaxeClass() == null || !interfaze.getHaxeClass().isInterface()) {
        // @TODO: Move to bundle
        holder.createErrorAnnotation(interfaze.getPsi(), "Not an interface");
      }
    }
  }

  static public void checkInterfacesMethods(final HaxeClassModel clazz, final AnnotationHolder holder) {
    for (HaxeClassReferenceModel reference : clazz.getImplementingInterfaces()) {
      checkInterfaceMethods(clazz, reference, holder);
    }
  }

  static public void checkInterfaceMethods(
    final HaxeClassModel clazz,
    final HaxeClassReferenceModel intReference,
    final AnnotationHolder holder
  ) {
    final List<HaxeMethodModel> missingMethods = new ArrayList<HaxeMethodModel>();
    final List<String> missingMethodsNames = new ArrayList<String>();

    if (intReference.getHaxeClass() != null) {
      for (HaxeMethodModel intMethod : intReference.getHaxeClass().getMethods()) {
        if (!intMethod.isStatic()) {
          HaxeMethodModel selfMethod = clazz.getMethodSelf(intMethod.getName());
          if (selfMethod == null) {
            missingMethods.add(intMethod);
            missingMethodsNames.add(intMethod.getName());
          }
          else {
            MethodChecker.checkMethodsSignatureCompatibility(selfMethod, intMethod, holder);
          }
        }
      }
    }

    if (missingMethods.size() > 0) {
      // @TODO: Move to bundle
      Annotation annotation = holder.createErrorAnnotation(
        intReference.getPsi(),
        "Not implemented methods: " + StringUtils.join(missingMethodsNames, ", ")
      );
      annotation.registerFix(new HaxeFixer("Implement methods") {
        @Override
        public void run() {
          clazz.addMethodsFromPrototype(missingMethods);
        }
      });
    }
  }
}

class MethodChecker {
  static public void check(final HaxeMethod methodPsi, final AnnotationHolder holder) {
    final HaxeMethodModel currentMethod = methodPsi.getModel();
    checkTypeTagInInterfacesAndExternClass(currentMethod, holder);
    checkMethodArguments(currentMethod, holder);
    checkOverride(methodPsi, holder);
    if (HaxeSemanticAnnotatorConfig.ENABLE_EXPERIMENTAL_BODY_CHECK) {
      MethodBodyChecker.check(methodPsi, holder);
    }
    //currentMethod.getBodyPsi()
  }

  static public void checkTypeTagInInterfacesAndExternClass(final HaxeMethodModel currentMethod, final AnnotationHolder holder) {
    HaxeClassModel currentClass = currentMethod.getDeclaringClass();
    if (currentClass.isExtern() || currentClass.isInterface()) {
      if (currentMethod.getReturnTypeTagPsi() == null) {
        holder.createErrorAnnotation(currentMethod.getNameOrBasePsi(), HaxeBundle.message("haxe.semantic.type.required"));
      }
      for (final HaxeParameterModel param : currentMethod.getParameters()) {
        if (param.getTypeTagPsi() == null) {
          holder.createErrorAnnotation(param.getNameOrBasePsi(), HaxeBundle.message("haxe.semantic.type.required"));
        }
      }
    }
  }

  static public void checkMethodArguments(final HaxeMethodModel currentMethod, final AnnotationHolder holder) {
    boolean hasOptional = false;
    HashMap<String, PsiElement> argumentNames = new HashMap<String, PsiElement>();
    for (final HaxeParameterModel param : currentMethod.getParameters()) {
      String paramName = param.getName();

      if (param.hasOptionalPsi() && param.getVarInitPsi() != null) {
        // @TODO: Move to bundle
        holder.createWarningAnnotation(param.getOptionalPsi(), "Optional not needed when specified an init value");
      }
      if (param.getVarInitPsi() != null && param.getTypeTagPsi() != null) {
        TypeTagChecker.check(
          param.getPsi(),
          param.getTypeTagPsi(),
          param.getVarInitPsi(),
          true,
          holder
        );
      }
      if (param.isOptional()) {
        hasOptional = true;
      }
      else if (hasOptional) {
        // @TODO: Move to bundle
        holder.createWarningAnnotation(param.getPsi(), "Non-optional argument after optional argument");
      }

      if (argumentNames.containsKey(paramName)) {
        // @TODO: Move to bundle
        holder.createWarningAnnotation(param.getNameOrBasePsi(), "Repeated argument name '" + paramName + "'");
        holder.createWarningAnnotation(argumentNames.get(paramName), "Repeated argument name '" + paramName + "'");
      }
      else {
        argumentNames.put(paramName, param.getNameOrBasePsi());
      }
    }
  }

  static public void checkOverride(final HaxeMethod methodPsi, final AnnotationHolder holder) {
    final HaxeMethodModel currentMethod = methodPsi.getModel();
    final HaxeClassModel currentClass = currentMethod.getDeclaringClass();
    final HaxeModifiersModel currentModifiers = currentMethod.getModifiers();

    final HaxeClassReferenceModel parentClass = (currentClass != null) ? currentClass.getParentClassReference() : null;
    final HaxeMethodModel parentMethod =
      ((parentClass != null) && parentClass.getHaxeClass() != null) ? parentClass.getHaxeClass().getMethod(currentMethod.getName()) : null;
    final HaxeModifiersModel parentModifiers = (parentMethod != null) ? parentMethod.getModifiers() : null;

    boolean requiredOverride = false;

    if (currentMethod.isConstructor()) {
      requiredOverride = false;
      if (currentModifiers.hasModifier(HaxeModifierType.STATIC)) {
        // @TODO: Move to bundle
        holder.createErrorAnnotation(currentMethod.getNameOrBasePsi(), "Constructor can't be static").registerFix(
          new HaxeModifierRemoveFixer(currentModifiers, HaxeModifierType.STATIC)
        );
      }
    }
    else if (currentMethod.isStaticInit()) {
      requiredOverride = false;
      if (!currentModifiers.hasModifier(HaxeModifierType.STATIC)) {
        holder.createErrorAnnotation(currentMethod.getNameOrBasePsi(), "__init__ must be static").registerFix(
          new HaxeModifierAddFixer(currentModifiers, HaxeModifierType.STATIC)
        );
      }
    }
    else if (parentMethod != null) {
      requiredOverride = true;

      if (parentModifiers.hasAnyModifier(HaxeModifierType.INLINE, HaxeModifierType.STATIC, HaxeModifierType.FINAL)) {
        Annotation annotation =
          holder.createErrorAnnotation(currentMethod.getNameOrBasePsi(), "Can't override static, inline or final methods");
        for (HaxeModifierType mod : new HaxeModifierType[]{HaxeModifierType.FINAL, HaxeModifierType.INLINE, HaxeModifierType.STATIC}) {
          if (parentModifiers.hasModifier(mod)) {
            annotation.registerFix(
              new HaxeModifierRemoveFixer(parentModifiers, mod, "Remove " + mod.s + " from " + parentMethod.getFullName())
            );
          }
        }
      }

      if (currentModifiers.getVisibility().hasLowerVisibilityThan(parentModifiers.getVisibility())) {
        Annotation annotation = holder.createErrorAnnotation(
          currentMethod.getNameOrBasePsi(),
          "Field " +
          currentMethod.getName() +
          " has less visibility (public/private) than superclass one"
        );
        annotation.registerFix(
          new HaxeModifierReplaceVisibilityFixer(currentModifiers, parentModifiers.getVisibility(), "Change current method visibility"));
        annotation.registerFix(
          new HaxeModifierReplaceVisibilityFixer(parentModifiers, currentModifiers.getVisibility(), "Change parent method visibility"));
      }
    }

    //System.out.println(aClass);
    if (currentModifiers.hasModifier(HaxeModifierType.OVERRIDE) && !requiredOverride) {
      holder.createErrorAnnotation(currentModifiers.getModifierPsi(HaxeModifierType.OVERRIDE), "Overriding nothing").registerFix(
        new HaxeModifierRemoveFixer(currentModifiers, HaxeModifierType.OVERRIDE)
      );
    }
    else if (requiredOverride) {
      if (!currentModifiers.hasModifier(HaxeModifierType.OVERRIDE)) {
        holder.createErrorAnnotation(currentMethod.getNameOrBasePsi(), "Must override").registerFix(
          new HaxeModifierAddFixer(currentModifiers, HaxeModifierType.OVERRIDE)
        );
      }
      else {
        // It is rightly overriden. Now check the signature.
        checkMethodsSignatureCompatibility(currentMethod, parentMethod, holder);
      }
    }
  }

  static public void checkMethodsSignatureCompatibility(
    @NotNull final HaxeMethodModel currentMethod,
    @NotNull final HaxeMethodModel parentMethod,
    final AnnotationHolder holder
  ) {
    final HaxeDocumentModel document = currentMethod.getDocument();

    List<HaxeParameterModel> currentParameters = currentMethod.getParameters();
    final List<HaxeParameterModel> parentParameters = parentMethod.getParameters();
    int minParameters = Math.min(currentParameters.size(), parentParameters.size());

    if (currentParameters.size() > parentParameters.size()) {
      for (int n = minParameters; n < currentParameters.size(); n++) {
        final HaxeParameterModel currentParam = currentParameters.get(n);
        holder.createErrorAnnotation(currentParam.getPsi(), "Unexpected argument").registerFix(
          new HaxeFixer("Remove argument") {
            @Override
            public void run() {
              currentParam.remove();
            }
          });
      }
    }
    else if (currentParameters.size() != parentParameters.size()) {
      holder.createErrorAnnotation(
        currentMethod.getNameOrBasePsi(),
        "Not matching arity expected " +
        parentParameters.size() +
        " arguments but found " +
        currentParameters.size()
      );
    }

    for (int n = 0; n < minParameters; n++) {
      final HaxeParameterModel currentParam = currentParameters.get(n);
      final HaxeParameterModel parentParam = parentParameters.get(n);
      if (!HaxeTypeCompatible.canAssignToFrom(currentParam.getType(), parentParam.getType())) {
        holder.createErrorAnnotation(
          currentParam.getPsi(),
          "Type " + currentParam.getType() + " is not compatible with " + parentParam.getType()).registerFix
          (
            new HaxeFixer("Change type") {
              @Override
              public void run() {
                document.replaceElementText(currentParam.getTypeTagPsi(), parentParam.getTypeTagPsi().getText());
              }
            }
          )
        ;
      }
    }

    ResultHolder currentResult = currentMethod.getResultType();
    ResultHolder parentResult = parentMethod.getResultType();
    if (!currentResult.canAssign(parentResult)) {
      PsiElement psi = currentMethod.getReturnTypeTagOrNameOrBasePsi();
      holder.createErrorAnnotation(psi, "Not compatible return type " + currentResult + " != " + parentResult);
    }
  }
}

class PackageChecker {
  static public void check(final HaxePackageStatement element, final AnnotationHolder holder) {
    final HaxeReferenceExpression expression = element.getReferenceExpression();
    String packageName = (expression != null) ? expression.getText() : "";
    PsiDirectory fileDirectory = element.getContainingFile().getParent();
    List<PsiFileSystemItem> fileRange = PsiFileUtils.getRange(PsiFileUtils.findRoot(fileDirectory), fileDirectory);
    fileRange.remove(0);
    String actualPath = PsiFileUtils.getListPath(fileRange);
    final String actualPackage = actualPath.replace('/', '.');
    final String actualPackage2 = HaxeResolveUtil.getPackageName(element.getContainingFile());
    // @TODO: Should use HaxeResolveUtil

    for (String s : StringUtils.split(packageName, '.')) {
      if (!s.substring(0, 1).toLowerCase().equals(s.substring(0, 1))) {
        //HaxeSemanticError.addError(element, new HaxeSemanticError("Package name '" + s + "' must start with a lower case character"));
        // @TODO: Move to bundle
        holder.createErrorAnnotation(element, "Package name '" + s + "' must start with a lower case character");
      }
    }

    if (!packageName.equals(actualPackage)) {
      holder.createErrorAnnotation(
        element,
        "Invalid package name! '" + packageName + "' should be '" + actualPackage + "'").registerFix(
        new HaxeFixer("Fix package") {
          @Override
          public void run() {
            Document document =
              PsiDocumentManager.getInstance(element.getProject()).getDocument(element.getContainingFile());

            if (expression != null) {
              TextRange range = expression.getTextRange();
              document.replaceString(range.getStartOffset(), range.getEndOffset(), actualPackage);
            }
            else {
              int offset =
                element.getNode().findChildByType(HaxeTokenTypes.OSEMI).getTextRange().getStartOffset();
              document.replaceString(offset, offset, actualPackage);
            }
          }
        }
      );
    }
  }
}

class MethodBodyChecker {
  public static void check(HaxeMethod psi, AnnotationHolder holder) {
    final HaxeMethodModel method = psi.getModel();
    HaxeTypeResolver.getPsiElementType(method.getBodyPsi(), holder);
  }
}


text:
<?php

require_once KS_GIVEAWAYS_PLUGIN_INCLUDES_DIR . DIRECTORY_SEPARATOR . 'wordpress-common' . DIRECTORY_SEPARATOR . 'class-ks-database.php';
require_once KS_GIVEAWAYS_PLUGIN_INCLUDES_DIR . DIRECTORY_SEPARATOR . 'class-entry-db.php';
require_once KS_GIVEAWAYS_PLUGIN_INCLUDES_DIR . DIRECTORY_SEPARATOR . 'class-helper.php';

class KS_Winner_DB extends KS_Database_Table
{
    protected static $table_name = 'ks_giveaways_winner';

    public static function install_table()
    {
        $table = self::get_tablename();

        $sql = "CREATE TABLE {$table} (
  ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  contest_id bigint(20) unsigned NOT NULL,
  contestant_id bigint(20) unsigned NOT NULL,
  email_address varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',
  date_drawn TIMESTAMP NULL,
  date_notified TIMESTAMP NULL,
  winner_name varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',
  winner_avatar varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '',
  status ENUM('unconfirmed','confirmed','notified') DEFAULT 'unconfirmed',
  PRIMARY KEY  (ID),
  KEY winner_contest_id (contest_id)
) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;";

        dbDelta($sql);
    }

    public static function get_results($contest_id, $offset = null, $per_page = null)
    {
        global $wpdb;

        $table = self::get_tablename();

        $entry_table = KS_Entry_DB::get_tablename();
        $query = $wpdb->prepare("SELECT * FROM {$table} WHERE `contest_id` = %d", $contest_id);

        if ($offset !== null) {
            $query .= $wpdb->prepare(" LIMIT %d", $offset);
        }

        if ($per_page !== null) {
            $query .= $wpdb->prepare(",%d", $per_page);
        }

        return $wpdb->get_results($query, ARRAY_A);
    }

    public static function remove($winner_id)
    {
        global $wpdb;

        $table = self::get_tablename();

        $data = array('ID' => $winner_id);
        $format = array('%d');
        $wpdb->delete($table, $data, $format);
    }

    public static function get_total($contest_id)
    {
        global $wpdb;

        $table = self::get_tablename();

        $query = $wpdb->prepare("SELECT COUNT(*) FROM {$table} WHERE `contest_id` = %d", $contest_id);

        return (int) $wpdb->get_var($query);
    }

    public static function replace_winner($contest_id, $winner_id, $contestant)
    {
        global $wpdb;

        $table = self::get_tablename();

        $data = array(
            'ID' => $winner_id,
            'contest_id' => $contest_id,
            'contestant_id' => $contestant->ID,
            'email_address' => $contestant->email_address,
            'winner_name' => '',
            'winner_avatar' => '',
            'date_drawn' => gmdate('c'),
            'status' => 'unconfirmed'
        );
        $format = array('%d','%d','%d','%s','%s','%s','%s','%s');
        $wpdb->replace($table, $data, $format);
    }

    public static function insert_winner($contest_id, $contestant)
    {
        global $wpdb;

        $table = self::get_tablename();

        $wpdb->insert($table, array(
            'contest_id' => $contest_id,
            'contestant_id' => $contestant->ID,
            'email_address' => $contestant->email_address,
            'date_drawn' => current_time('mysql', true)
        ), array('%d', '%d', '%s', '%s'));
    }

    public static function update_status($winner_id, $status = 'confirmed')
    {
        global $wpdb;

        $table = self::get_tablename();

        $data = array('status' => $status);
        $where = array('ID' => $winner_id);
        $format = array('%s');
        $where_format = array('%d');
        $wpdb->update($table, $data, $where, $format, $where_format);
    }

    public static function update_name($winner_id, $name = '')
    {
        global $wpdb;

        $table = self::get_tablename();

        $data = array('winner_name' => $name);
        $where = array('ID' => $winner_id);
        $format = array('%s');
        $where_format = array('%d');
        $wpdb->update($table, $data, $where, $format, $where_format);
    }

    public static function update_avatar($winner_id, $url = '')
    {
        global $wpdb;

        $table = self::get_tablename();

        $data = array('winner_avatar' => $url);
        $where = array('ID' => $winner_id);
        $format = array('%s');
        $where_format = array('%d');
        $wpdb->update($table, $data, $where, $format, $where_format);
    }
    public static function get($winner_id, $contest_id = null)
    {
        global $wpdb;

        $table = self::get_tablename();

        if (null == $contest_id) {
            $query = $wpdb->prepare("SELECT * FROM {$table} WHERE `ID` = %d", $winner_id);
        } else {
            $query = $wpdb->prepare("SELECT * FROM {$table} WHERE `ID` = %d AND `contest_id` = %d", $winner_id, $contest_id);
        }

        return $wpdb->get_row($query);
    }

    public static function notify($winner_id)
    {
        $winner = self::get($winner_id);

        KS_Helper::send_winner_email($winner);

        global $wpdb;

        $table = self::get_tablename();

        $data = array('date_notified' => current_time('mysql', true));
        $where = array('ID' => $winner_id);
        $format = array('%s');
        $where_format = array('%d');
        $wpdb->update($table, $data, $where, $format, $where_format);

        self::update_status($winner_id, 'notified');
    }

    public static function output_csv($contest_id)
    {
        $use_mysqli = function_exists('mysqli_init') ? true : false;

        if ($use_mysqli) {
            $port = null;
            $socket = null;
            $host = DB_HOST;
            $port_or_socket = strstr($host, ':');
            if (!empty($port_or_socket)) {
                $host = substr($host, 0, strpos($host, ':'));
                $port_or_socket = substr($port_or_socket, 1);
                if (0 !== strpos($port_or_socket, '/')) {
                    $port = intval($port_or_socket);
					          $maybe_socket = strstr($port_or_socket, ':');
					          if (!empty($maybe_socket)) {
						            $socket = substr($maybe_socket, 1);
                    }
                } else {
                    $socket = $port_or_socket;
                }
            }

            $dbh = mysqli_init();
            if (!$dbh->real_connect($host, DB_USER, DB_PASSWORD, DB_NAME, $port, $socket)) {
                wp_die('Error connecting to MySQL server: ' . $dbh->connect_error);
            }

        } else {
            $dbh = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD, true);
            if (!$dbh) {
                wp_die('Error connecting to MySQL server: ' . mysql_error());
            }

            if (!mysql_select_db(DB_NAME, $dbh)) {
                $error = mysql_error($dbh);
                mysql_close($dbh);
                wp_die('Error selecting MySQL database: ' . $error);
            }
        }

        global $wpdb;

        $table = self::get_tablename();
        $query = $wpdb->prepare("SELECT * FROM {$table} WHERE `contest_id` = %d ORDER BY `date_drawn` ASC", $contest_id);

        if ($use_mysqli) {
            $result = $dbh->query($query, MYSQLI_USE_RESULT);
            if (!$result) {
                $error = $dbh->error;
                $dbh->close();
                wp_die('Error executing query: ' . $error);
            }
        } else {
            $result = mysql_query($query, $dbh);
            if (!$result) {
                $error = mysql_error($dbh);
                mysql_close($dbh);
                wp_die('Error executing query: ' . $error);
            }
        }

        $row = array(
            'Email Address',
            'Winner Name',
            'Date Drawn',
            'Date Notified',
            'Status'
        );

        header('Content-Type: text/csv');
        header('Content-Disposition: attachment; filename="winners.csv"');
        echo implode(',', $row);
        echo "\r\n";

        while ($winner = ($use_mysqli ? $result->fetch_object() : mysql_fetch_object($result))) {
            $row = array(
                $winner->email_address,
                $winner->winner_name,
                get_date_from_gmt($winner->date_drawn),
                $winner->date_notified ? get_date_from_gmt($winner->date_notified) : '',
                $winner->status
            );

            echo implode(',', $row);
            echo "\r\n";
        }

        if ($use_mysqli) {
            $result->close();
            $dbh->close();
        } else {
            mysql_free_result($result);
            mysql_close($dbh);
        }

        exit;
    }
}


text:
$.fn.cellCoordinates = function () {
    return {
        colIndex: $(this[0]).index(),
        rowIndex: $(this[0]).closest('tr').index()
    }
};

$.fn.bottomCell = function () {
    var coord = this.cellCoordinates();
    return this.closest('tr').parent().find('tr').eq(coord.rowIndex + 1).find('td,th').eq(coord.colIndex);
};

$.fn.bottomLeftCell = function(){
    return this.bottomCell().leftCell();
};

$.fn.bottomRightCell = function(){
    return this.bottomCell().rightCell();
};

$.fn.topCell = function () {
    var coord = this.cellCoordinates();
    return this.closest('tr').parent().find('tr').eq(coord.rowIndex - 1).find('td,th').eq(coord.colIndex);
};

$.fn.topLeftCell = function(){
    return this.topCell().leftCell();
};

$.fn.topRightCell = function(){
    return this.topCell().rightCell();
};

$.fn.leftCell = function () {
    var coord = this.cellCoordinates();
    return this.closest('tr').find('td,th').eq(coord.colIndex - 1);
};

$.fn.rightCell = function () {
    var coord = this.cellCoordinates();
    return this.closest('tr').find('td,th').eq(coord.colIndex + 1);
};

$.fn.cellsInCol = function () {
    var cells = [], coord;
    this.each(function () {
        coord = $(this).cellCoordinates();
        if (coord) {
            $(this).closest('tr').parent().find('tr').each(function () {
                cells.push($(this).find('td, th').eq(coord.colIndex)[0]);
            });
        }
    });
    return $(cells);
};

$.fn.cellsInRow = function () {
    var cells = [];
    this.each(function () {
        $(this).closest('tr').find('td, th').each(function () {
            cells.push(this);
        })
    });
    return $(cells);
};

$.fn.cellsTo = function ($targetCell) {
    var minRowIndex,
        maxRowIndex,
        minColIndex,
        maxColIndex,
        thisCoord = this.cellCoordinates(),
        targetCoord = $targetCell.cellCoordinates(),
        cells = [];

    if (thisCoord.rowIndex < targetCoord.rowIndex) {
        minRowIndex = thisCoord.rowIndex;
        maxRowIndex = targetCoord.rowIndex;
    } else {
        minRowIndex = targetCoord.rowIndex;
        maxRowIndex = thisCoord.rowIndex;
    }
    if (thisCoord.colIndex < targetCoord.colIndex) {
        minColIndex = thisCoord.colIndex;
        maxColIndex = targetCoord.colIndex;
    } else {
        minColIndex = targetCoord.colIndex;
        maxColIndex = thisCoord.colIndex;
    }

    this.closest('tr').parent().find('tr').each(function (rowIndex, row) {
        $(row).find('th, td').each(function (colIndex, cell) {
            if (rowIndex >= minRowIndex && rowIndex <= maxRowIndex && colIndex >= minColIndex && colIndex <= maxColIndex) {
                cells.push(cell);
            }
        });
    });

    return $(cells);
};


text:
/**
 * Created by phoehne on 3/27/14.
 */

var Achelous = require('../achelous');
var should = require('should');

describe("achelous", function() {
  describe("Basic response", function() {
    it("should create a basic entity with classes", function() {
      var ach = new Achelous("Foo");
      ach.class.length.should.equal(1);
      ach.class[0].should.equal("Foo");
    });

    it("should take an array of class names", function() {
      var ach = new Achelous(["foo", "bar"]);
      ach.class.length.should.equal(2);
      ach.class[0].should.equal("foo");
      ach.class[1].should.equal("bar");
    });
  });

  describe("Properties", function() {
    it("should take a property object as the second parameter", function() {
      var ach = new Achelous("foo", {bar: "baz"});
      ach.class.length.should.equal(1);
      ach.class[0].should.equal("foo");
      ach.properties.bar.should.equal("baz");
    })
  });

  describe("Entities", function() {
    var ach;

    beforeEach(function() {
      ach = new Achelous("foo", {bar: "baz"});
    });

    it("should allow adding entities with required fields", function() {
      ach.addEntity("http://mydomain.com/relationship", "http://mydomain.com/foo/1234");
      ach.entities[0].rel[0].should.equal("http://mydomain.com/relationship");
      ach.entities[0].href.should.equal("http://mydomain.com/foo/1234");
    });

    it("should allow adding entities with a map of fields", function() {
      ach.addEntity({
        class: ['foo', 'bar'],
        rel: ["http://foo.bar.com/myrelation"],
        properties: {
          propOne: "boo"
        },
        links: [
          { rel: ["self"], href: "http//foo.bar.com/foo/1234" }
        ]
      });
      ach.entities[0].class[0].should.equal('foo');
      ach.entities[0].class[1].should.equal('bar');
      ach.entities[0].rel[0].should.equal("http://foo.bar.com/myrelation");
      ach.entities[0].properties.propOne.should.equal("boo")
      ach.entities[0].links[0].rel[0].should.equal("self");
      ach.entities[0].links[0].href.should.equal("http//foo.bar.com/foo/1234");
    });

    it("should allow you to add links to a an entity", function() {
      ach.addEntity({
        class: ['foo', 'bar'],
        rel: ["http://foo.bar.com/myrelation"],
        properties: {
          propOne: "boo"
        },
        links: [
          { rel: ["self"], href: "http//foo.bar.com/foo/1234" }
        ]
      });
      ach.entities[0].addLink(["other", "foo"], "http://foo.bar.com/bar/1235");
      ach.entities[0].addLink("bar", "http://foo.bar.com/bar/1235", "title");

      ach.entities[0].links[1].rel[0].should.equal("other");
      ach.entities[0].links[1].rel[1].should.equal("foo");
      ach.entities[0].links[1].href.should.equal("http://foo.bar.com/bar/1235");

      ach.entities[0].links[2].rel[0].should.equal("bar");
      ach.entities[0].links[2].href.should.equal("http://foo.bar.com/bar/1235");
      ach.entities[0].links[2].title.should.equal("title");
    });

    it("should return the root object for message chaining", function() {
      var result = ach.addEntity("http://mydomain.com/relationship", "http://mydomain.com/foo/1234");
      result.should.equal(ach);
    });

    it("should allow you to add entities to an entity", function() {
      ach.addEntity({
        class: ['foo', 'bar'],
        rel: ["http://foo.bar.com/myrelation"],
        properties: {
          propOne: "boo"
        },
        links: [
          { rel: ["self"], href: "http//foo.bar.com/foo/1234" }
        ]
      });
      ach.entities[0].addEntity("able", "http://foo.bar.com/able/baker");
      ach.entities[0].entities[0].rel[0].should.equal("able");
      ach.entities[0].entities[0].href.should.equal("http://foo.bar.com/able/baker");
    });

    it("should allow you add an action to an entity", function() {
      ach.addEntity({
        class: ['foo', 'bar'],
        rel: ["http://foo.bar.com/myrelation"],
        properties: {
          propOne: "boo"
        },
        links: [
          { rel: ["self"], href: "http//foo.bar.com/foo/1234" }
        ]
      });

      ach.entities[0].addAction({
        name: "foobar",
        title: "This is a title",
        method: "POST",
        href: "http://foo.bar.com/bar/1",
        type: "application/x-www-form-urlencoded",
        fields: [
          { name: "age", type: "number", value: 5 }
        ]
      });
      ach.entities[0].actions[0].name.should.equal("foobar");
      ach.entities[0].actions[0].method.should.equal("POST");
    });

    it("should have a make function that returns the new entity", function() {
      var newEntity = ach.makeEntity({
        class: ['foo', 'bar'],
        rel: ["http://foo.bar.com/myrelation"],
        properties: {
          propOne: "boo"
        },
        links: [
          { rel: ["self"], href: "http//foo.bar.com/foo/1234" }
        ]
      });
      newEntity.should.equal(ach.entities[0]);
      newEntity.class[0].should.equal("foo");
      newEntity.rel[0].should.equal("http://foo.bar.com/myrelation")
    });

    it("should have a function that creates a minimal entity", function() {
      var newEntity = ach.makeEntity("foo", "http://foo.bar.com/foo/1234");
      newEntity.should.equal(ach.entities[0]);
      newEntity.rel[0].should.equal("foo");
      newEntity.href.should.equal("http://foo.bar.com/foo/1234")
    });
  });

  describe("Actions", function() {
    var ach;

    beforeEach(function() {
      ach = new Achelous("foo", {bar: "baz"});
    });

    it("should allow us to add an action", function() {
      ach.addAction("foo", "http://foo.bar.com/action/1");

      ach.actions.length.should.equal(1);
      ach.actions[0].name.should.equal("foo");
      ach.actions[0].href.should.equal("http://foo.bar.com/action/1")
    });

    it("should allow us to add an action object", function() {
      ach.addAction({
        name: "foobar",
        title: "This is a title",
        method: "POST",
        href: "http://foo.bar.com/bar/1",
        type: "application/x-www-form-urlencoded",
        fields: [
          { name: "age", type: "number", value: 5 }
        ]
      });

      ach.actions[0].name.should.equal("foobar");
      ach.actions[0].title.should.equal("This is a title");
      ach.actions[0].method.should.equal("POST")
      ach.actions[0].fields[0].name.should.equal("age");
      ach.actions[0].fields[0].type.should.equal("number");
      ach.actions[0].fields[0].value.should.equal(5);
    });

    it("should return the root object for method chaining", function() {
      var result = ach.addAction("foo", "http://foo.bar.com/action/1");
      result.should.equal(ach);
    });

    it("should have a makeAction funciton that returns the action", function() {
      var newAction = ach.makeAction("foo", "http://foo.bar.com/action/1");
      newAction.should.equal(ach.actions[0]);

      ach.actions[0].name.should.equal('foo');
    });

    describe("Action Methods", function() {
      var newAction;

      beforeEach(function() {
        newAction = ach.makeAction("foo", "http://foo.bar.com/action/1");
      })

      it("should have a method to add fields", function() {
        newAction.addField("fullField", "email", "bar", "This is the foo");
        newAction.addField("partialField");
        newAction.addField("partial2", "number");
        newAction.addField("partial3", "tel", "7035551212");

        newAction.fields.length.should.equal(4);
        newAction.fields[0].name.should.equal("fullField");
        newAction.fields[0].type.should.equal("email");
        newAction.fields[0].value.should.equal("bar");
        newAction.fields[0].title.should.equal("This is the foo");
        newAction.fields[1].name.should.equal("partialField");
        newAction.fields[1].type.should.equal("text");
        newAction.fields[2].name.should.equal("partial2");
        newAction.fields[2].type.should.equal("number");
        newAction.fields[3].name.should.equal("partial3");
        newAction.fields[3].type.should.equal("tel");

      });
    });
  });

  describe("Links", function() {
    var ach;

    beforeEach(function() {
      ach = new Achelous("foo", {bar: "baz"});
    });

    it("should allow you to add a link", function() {
      ach.addLink("self", "http://foo.bar.com/bar/1");

      ach.links[0].rel[0].should.equal("self");
      ach.links[0].href.should.equal("http://foo.bar.com/bar/1");

      ach.addLink("self", "http://foo.bar.com/bar/1", "Some link");
      ach.links[1].title.should.equal("Some link");
    });

    it("should take an array as the first argument", function() {
      ach.addLink(["foo", "bar"], "http://foo.bar.com/bar/1");

      ach.links[0].rel[0].should.equal("foo");
      ach.links[0].rel[1].should.equal("bar");
      ach.links[0].href.should.equal("http://foo.bar.com/bar/1");
    });

    it("should take an object", function() {
      ach.addLink({ rel: ["foo"], href: 'http://foo.bar.com/bar/1', title: "bar" });
      ach.links[0].rel[0].should.equal("foo");
      ach.links[0].href.should.equal("http://foo.bar.com/bar/1");
      ach.links[0].title.should.equal("bar");
    });

    it("should return itself for method chaining", function() {
      var result = ach.addLink({ rel: ["foo"], href: 'http://foo.bar.com/bar/1', name: "bar" });
      result.should.equal(ach);
    });
  });
});


text:
using Core;
using FluentNHibernate.Mapping;

namespace Infrastructure
{
    public class ApplicantMap : ClassMap<Applicant>
    {
        public ApplicantMap()
        {
            Not.LazyLoad();
            Table("Applicant");
            Id(x => x.Id).GeneratedBy.GuidComb();
            Map(x => x.PathAndQuerystring).Length(4000).Not.Nullable();
            Map(x => x.LoginName).Length(255).Not.Nullable();
            Map(x => x.Browser).Length(4000).Not.Nullable();
            Map(x => x.VisitDate).Not.Nullable();
            Map(x => x.IpAddress).Not.Nullable();
            Map(x => x.FirstName);

            Map(x => x.CreditCardApplicationId);
            Map(x => x.LastName);
            Map(x => x.SocialSecurityNumber);
            Map(x => x.CardNumberIssued);
        }
    }
}

/*<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xml'ns="urn:nhibernate-mapping-2.2"
									namespace="Core"
									assembly="Core">

	<class name="Applicant" table="Visitors" >
		<id name="Id" column="Id" type="Guid">
			<generator class="guid.comb"/>
		</id>
		<property name="PathAndQuerystring" length="4000"
							not-null="true"/>
		<property name="LoginName" length="255" not-null="true"/>
		<property name="Browser" length="4000" not-null="true"/>
		<property name="VisitDate" not-null="true"/>
		<property name="IpAddress" not-null="true"/>
	</class>
</hibernate-mapping>*/


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

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Doxygen Demo App: DoxygenDemoApplication.FilterConfig Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

Doxygen Demo App
    1

A little test

DoxygenDemoApplication

FilterConfig

Static Public Member Functions |
List of all members

DoxygenDemoApplication.FilterConfig Class Reference

Static Public Member Functions

static void 	RegisterGlobalFilters (GlobalFilterCollection filters)

Detailed Description

Definition at line 6 of file FilterConfig.cs.

Member Function Documentation

◆ RegisterGlobalFilters()

          static void DoxygenDemoApplication.FilterConfig.RegisterGlobalFilters
          (
          GlobalFilterCollection
          filters	)

static

Definition at line 8 of file FilterConfig.cs.

The documentation for this class was generated from the following file:

DoxygenDemoApplication/App_Start/FilterConfig.cs

<address class="footer">
Generated by

 1.8.14
</address>


text:
// Check if already included
#ifndef _WIN_L_WINDOWMENU_
#define _WIN_L_WINDOWMENU_

#include <_lua/lua.lunar.h>
#include <_lua/lua.class.gadget.h>
#include <_gadget/gadget.window.menu.h>

/**
 * Proxy Class
 */
class _lua_windowmenu : public _lua_gadget
{
	public:

		//! Lua-Ctor
		_lua_windowmenu( lua_State* L );

		//! C-Ctor
		_lua_windowmenu( _windowMenu* m ) : _lua_gadget( m , false )
		{ }

		//! getStandardMenu
		static int getStandardMenu( lua_State* L );

		//! Lunar !//
		static const char className[];
		static Lunar<_lua_windowmenu>::FunctionType methods[];
		static Lunar<_lua_windowmenu>::PropertyType properties[];
		static Lunar<_lua_windowmenu>::StaticType	staticmethods[];
		using baseclasses = Lunar<_lua_windowmenu>::BaseClassType<_lua_gadget>;
};

#endif


text:
var expect = require('chai').expect;
var slackWrapi = require('../index');
var packageJson = require('../package.json')

describe("API Test", function() {
  var token = process.env.SLACK_API_TOKEN;
  before(function() {
    this.slack = new slackWrapi(token);
  });

  after(function() {
  });

  describe("Endpoints", function() {
    it("simple", function(done) {
      this.slack.api.test(function(err, data) {
        expect(err).to.equal(null);
        expect(data).to.deep.equal({ ok: true, args: {token: token} });
        done();
      });
    });

    it("args", function(done) {
      this.slack.api.test({client: packageJson.name, version:packageJson.version}, function(err, data) {
        expect(err).to.equal(null);
        expect(data).to.deep.equal({ ok: true, args: { token: token, client: packageJson.name, version: packageJson.version } });
        done();
      });
    });

  });
});


text:
========
Security
========

Security Group
===============

.. toctree::
   :maxdepth: 1

   security-group-overview.md
   default-security-groups-and-security-group-rules.md
   security-group-configuration-examples.md
   creating-a-security-group.md
   adding-a-security-group-rule.md
   fast-adding-security-group-rules.md
   replicating-a-security-group-rule.md
   modifying-a-security-group-rule.md
   deleting-a-security-group-rule.md
   importing-and-exporting-security-group-rules.md
   deleting-a-security-group.md
   adding-instances-to-and-removing-them-from-a-security-group.md
   modifying-a-security-group.md
   viewing-the-security-group-of-an-ecs.md
   changing-the-security-group-of-an-ecs.md

Firewall
=========

.. toctree::
   :maxdepth: 1

   firewall-overview.md
   firewall-configuration-examples.md
   creating-a-firewall.md
   adding-a-firewall-rule.md
   associating-subnets-with-a-firewall.md
   disassociating-a-subnet-from-a-firewall.md
   changing-the-sequence-of-a-firewall-rule.md
   modifying-a-firewall-rule.md
   enabling-or-disabling-a-firewall-rule.md
   deleting-a-firewall-rule.md
   viewing-a-firewall.md
   modifying-a-firewall.md
   enabling-or-disabling-a-firewall.md
   deleting-a-firewall.md

Differences Between Security Groups and Firewalls
==================================================

.. toctree::
   :maxdepth: 1

   differences-between-security-groups-and-firewalls.md


text:
<?php

  include_once('inc/OSFInstaller.php');

  class OSFInstaller_Ubuntu_14_04 extends OSFInstaller
  {

    /**
     * Prepare the distribution with the minimum requirements
     */
    public function prepareDistro()
    {
      $this->h1("Installing prerequisites");

      if($this->upgrade_distro) {
        updateDistro();
      }

      $this->span("Installing required general packages...");
      $this->exec('apt-get install -y \
        curl vim ftp-upload \
        gcc gawk \
        openssl libssl-dev');
    }

    /**
     * Update the distribution packages
     */
    public function updateDistro()
    {
      $this->span("Updating the package registry...");
      $this->exec('apt-get update -y');

      $this->span("Upgrading the server...");
      $this->exec('apt-get upgrade -y');
    }

    /**
     * Install PHP as required by OSF and OSF-Drupal
     */
    public function installPHP()
    {
      $this->h1("Installing PHP");

      $this->span("Installing PHP5...");
      passthru('apt-get install -y \
        php5-dev php-pear \
        php5-cli libphp5-embed php5-cgi \
        php5-curl php5-mcrypt \
        php5-gd php5-imap \
        php5-mysqlnd php5-odbc');

      $this->span("Enabling mysql extension...");
      $this->exec('php5enmod mysql');
    }

    /**
     * Install Java as required by Tomcat, Solr, Owl and Scones
     */
    public function installJava()
    {
      $this->h1("Installing Java");

      $this->span("Installing Java6/7...");
      $this->exec('apt-get install -y \
        default-jdk \
        openjdk-6-jdk openjdk-7-jdk;');
    }

    /**
     * Install Apache as required by OSF/OSF-Drupal
     */
    public function installApache()
    {
      $this->h1("Installing Apache");

      $this->span("Installing Apache2...");
      $this->exec('apt-get install -y \
        apache2 apache2-utils \
        apache2-mpm-prefork \
        libapache2-mod-php5');

      $this->span("Enabling mod-rewrite...");
      $this->exec('a2enmod rewrite');

      $this->span("Restarting Apache2...");
      $this->exec('service apache2 restart');

      $this->span("Performing some tests on the new Apache2 instance...");
      $this->span("Checking if the Apache2 instance is up and running...");

      if(strpos(shell_exec('curl -s http://localhost'), 'It works!') === FALSE) {
        $this->span("[Error] Apache2 is not currently running...", 'warn');
      }
    }

    /**
     * Install Tomcat as required by Solr, Owl and Scones
     */
    public function installTomcat()
    {
      $this->h1("Installing Tomcat");

      $this->span("Installing Tomcat6...");
      $this->exec('apt-get install -y \
        tomcat6 \
        tomcat6-admin tomcat6-user');

      $this->span("Restarting Tomcat6...");
      $this->exec('service tomcat6 restart');
    }

    /**
     * Install MySQL as required by OSF-Drupal
     */
    public function installMySQL($mode = 'server')
    {
      switch($mode) {

        // MySQL client installation
        case 'client':
          $this->h1("Installing MySQL client");

          $this->span("Installing MySQL5 client...");
          // Need to use passthru because the installer prompts the user
          // with screens requiring input.
          // This command cannot be captured in the log.
          passthru('apt-get install -y \
            mysql-client');
          break;

        // MySQL server installation
        case 'server':
          $this->h1("Installing MySQL server");

          $this->span("Installing MySQL5 server...");
          // Need to use passthru because the installer prompts the user
          // with screens requiring input.
          // This command cannot be captured in the log.
          passthru('apt-get install -y \
            mysql-server');
          break;

      }
    }

    /**
    * Install PHPUnit as required by OSF
    */
    public function installPHPUnit()
    {
      $this->h1("Installing PHPUnit");

      // Get name, version and paths
      $pkgName = "PHPUnit";
      $installPath = "/usr/local/bin";
      $tmpPath = "/tmp/osf/phpunit";

      // Download
      $this->span("Downloading...");
      $this->mkdir("{$tmpPath}/");
      $this->wget("https://phar.phpunit.de/phpunit-old.phar", "{$tmpPath}/");

      // Install
      $this->span("Installing...");
      $this->cp("{$tmpPath}/phpunit-old.phar", "{$installPath}/phpunit", FALSE);
      $this->chmod("{$installPath}/phpunit", "+x");

      // Cleanup
      $this->span("Cleaning...");
      $this->rm("{$tmpPath}/", TRUE);
    }

    /**
    * Install ARC2 as required by OSF
    */
    public function installARC2()
    {
      $this->h1("Installing ARC2");

      $this->span("Installing ARC2...");

      $this->chdir("{$this->osf_web_services_folder}/{$this->osf_web_services_ns}/framework/arc2/");

      $this->wget('https://github.com/semsol/arc2/archive/v2.1.1.zip');

      $this->exec('unzip v2.1.1.zip');

      $this->chdir("{$this->osf_web_services_folder}/{$this->osf_web_services_ns}/framework/arc2/arc2-2.1.1/");

      $this->mv('*', '../');

      $this->chdir("{$this->osf_web_services_folder}/{$this->osf_web_services_ns}/framework/arc2/");

      $this->rm('arc2-2.1.1', TRUE);

      $this->rm('v*.zip*');

      $this->chdir($this->currentWorkingDirectory);
    }

    /**
    * Install OWLAPI as required by OSF
    */
    public function installOWLAPI()
    {
      $this->h1("Installing OWLAPI");

      $this->span("Downloading OWLAPI...");

      $this->chdir('/var/lib/tomcat6/webapps/');

      $this->wget('http://wiki.opensemanticframework.org/files/OWLAPI.war');

      $this->span("Starting Tomcat6 to install the OWLAPI war installation file...");

      $this->exec('service tomcat6 restart');

      // wait 20 secs to make sure Tomcat6 had the time to install the OWLAPI webapp
      sleep(20);

      $this->span("Configuring PHP for the OWLAPI...");

      $this->sed('allow_url_include = Off', 'allow_url_include = On', '/etc/php5/apache2/php.ini');
      $this->sed('allow_url_include = Off', 'allow_url_include = On', '/etc/php5/cli/php.ini');

      $this->sed('allow_call_time_pass_reference = Off', 'allow_call_time_pass_reference = On', '/etc/php5/apache2/php.ini');
      $this->sed('allow_call_time_pass_reference = Off', 'allow_call_time_pass_reference = On', '/etc/php5/cli/php.ini');

      $this->span("Restart Apache2...");
      $this->exec('service apache2 restart');
    }

    /**
    * Install OSFvhost as required by OSF
    */
    public function install_OSF_vhost()
    {
      $this->h1("Installing OSF vhost");

      $this->span("Configure Apache2 for the OSF Web Services...");

      $this->cp('resources/osf-web-services/osf-web-services', '/etc/apache2/sites-available/osf-web-services.conf');

      $this->ln('/etc/apache2/sites-available/osf-web-services.conf', '/etc/apache2/sites-enabled/osf-web-services.conf');

      // Fix the OSF Web Services path in the apache config file
      $this->sed('/usr/share/osf', "{$this->osf_web_services_folder}/{$this->osf_web_services_ns}", '/etc/apache2/sites-available/osf-web-services.conf');

      $this->span("Restarting Apache2...");

      $this->exec('service apache2 restart');

      $this->span("Configure the osf.ini configuration file...");

      $this->span("Make sure the OSF Web Services are aware of themselves by changing the hosts file...");

      if(stripos(file_get_contents('/etc/hosts'), 'OSF-Installer') == FALSE)
      {
        file_put_contents('/etc/hosts', "\n\n# Added by the OSF-Installer to make the OSF Web Services are aware of themselves\n127.0.0.1 ".$this->osf_web_services_domain, FILE_APPEND);
      }
    }

    /**
    * Install Virtuoso as required by OSF
    */
    public function installVirtuoso()
    {

      $this->h1("Installing Virtuoso 7 from .deb file....");

      $this->wget('https://github.com/structureddynamics/OSF-Installer-Ext/raw/3.3/virtuoso-opensource/virtuoso-opensource_7.1_amd64.deb');
      $this->exec('dpkg -i virtuoso-opensource_7.1_amd64.deb');

      $this->mv('/etc/init.d/virtuoso-opensource', '/etc/init.d/virtuoso');

      $this->span("Installing odbc.ini and odbcinst.ini files...");

      $this->cp('resources/virtuoso/odbc.ini', '/etc/odbc.ini');
      $this->cp('resources/virtuoso/odbcinst.ini', '/etc/odbcinst.ini');

      $this->span("Test Virtuoso startup...");

      $this->exec('service virtuoso stop');

      sleep(20);

      $this->exec('service virtuoso start');

      $isVirtuosoRunning = shell_exec('ps aux | grep virtuoso');

      if(strpos($isVirtuosoRunning, '/usr/bin/virtuoso') === FALSE)
      {
        $this->span('Virtuoso is not running. Check the logs, something went wrong.', 'error');
      }
      else
      {
        $this->span("Register Virtuoso to automatically start at the system's startup...");
        $this->exec('sudo update-rc.d virtuoso defaults');

        if(!$this->change_password($this->sparql_password))
        {
          $this->sparql_password = 'dba';
          $this->span("\n\nThe Virtuoso admin password was not changed. Use the default and change it after this installation process...\n", 'warn');
        }

        $this->span("Grant the SPARQL_UPDATE role to the SPARQL user...");

        if(!$this->update_sparql_roles($this->sparql_password))
        {
          $this->span("\n\nCouldn't grant the SPARQL_UPDATE role to the SPARQL user automcatilly. Log into Conductor to add that role to that user otherwise the OSF instance won't be operational...\n", 'error');
        }
      }

      // Configuring Virtuoso to be able to access the files from the DMT tool
      $this->span("Configuring virtuoso.ini...");

      $this->sed('DirsAllowed.*= ., /usr/share/virtuoso/vad', 'DirsAllowed = ., /usr/share/virtuoso/vad, /usr/share/datasets-management-tool/data', '/var/lib/virtuoso/db/virtuoso.ini');

      $this->span("Restarting Virtuoso...");

      $this->exec('service virtuoso stop');

      sleep(20);

      $this->exec('service virtuoso start');

      $this->span("You can start Virtuoso using this command: service virtuoso start", 'debug');
    }

    /**
    * Setup Virtuoso as required by OSF
    */
    public function setupVirtuoso()
    {
      $this->h1("Setting up Virtuoso");

      $this->span("Create the WSF Network...");

      $this->chdir($this->currentWorkingDirectory);

      $this->sed("server_address = \"\"", "server_address = \"http://{$this->osf_web_services_domain}\"", 'resources/virtuoso/initialize_osf_web_services_network.php');
      $this->sed("appID = \"administer\"", "appID = \"{$this->application_id}\"", 'resources/virtuoso/initialize_osf_web_services_network.php');

      $errors = shell_exec('php resources/virtuoso/initialize_osf_web_services_network.php');

      if(!$this->init_osf($this->sparql_password))
      {
        $this->span("\n\nThe OSF Web Services Network couldn't be created. Major Error.\n", 'error');
      }

      $this->span("Commit transactions to Virtuoso...");

      if(!$this->commit($this->sparql_password))
      {
        $this->span("Couldn't commit triples to the Virtuoso triples store...", 'warn');
      }
    }

    /**
    * Install Solr as required by OSF
    */
    public function installSolr()
    {
      $this->h1("Installing Solr");

      $this->span("Preparing installation...");

      $this->mkdir('/tmp/solr-install/');

      $this->chdir('/tmp/solr-install/');

      $this->span("Downloading Solr...");

      $this->wget('http://archive.apache.org/dist/lucene/solr/3.6.0/apache-solr-3.6.0.tgz');

      $this->span("Installing Solr...");

      $this->exec('tar -xzvf apache-solr-3.6.0.tgz');

      $this->mkdir('/usr/share/solr');

      $this->cp('/tmp/solr-install/apache-solr-3.6.0/*', '/usr/share/solr/');

      $this->span("Configuring Solr...");

      $this->chdir($this->currentWorkingDirectory);

      $this->cp('resources/solr/solr', '/etc/init.d/');

      $this->chmod('/etc/init.d/solr', '755');

      $this->mv('/usr/share/solr/example/', '/usr/share/solr/osf-web-services/');

      $this->span("Installing SOLR-2155...");

      $this->chdir('/usr/share/solr/dist/');

      $this->wget('https://github.com/downloads/dsmiley/SOLR-2155/Solr2155-1.0.5.jar');

      $this->chdir($this->currentWorkingDirectory);

      $this->cp('resources/solr/solrconfig.xml', '/usr/share/solr/osf-web-services/solr/conf/');

      $this->span("Starting Solr...");

      $this->exec('service solr start');

      $this->span('Register Solr to automatically start at the system\'s startup...');

      $this->exec('sudo update-rc.d solr defaults');

      $this->span("You can start Solr using this command: service solr start", 'notice');
    }

    /**
    * Setup Solr as required by OSF
    */
    public function setupSolr()
    {
      $this->h1("Setting up Solr");

      $this->span("Install the Solr schema for the OSF Web Services...");

      if(!file_exists('/usr/share/solr/osf-web-services/solr/conf/schema.xml'))
      {
        $this->span("Solr is not yet installed. Install Solr using this --install-solr option and then properly configure its schema by hand.");
      }
      else
      {
        $this->cp("{$this->osf_web_services_folder}/{$this->osf_web_services_ns}/framework/solr_schema_v1_3_2.xml", '/usr/share/solr/osf-web-services/solr/conf/schema.xml');

        $this->span("Restarting Solr...");
        $this->exec('service solr stop');
        $this->exec('service solr start');
      }
    }

    /**
    * Install MySQL as required by OSF
    */
    public function installPhpMyAdmin()
    {
      $this->h1("Installing PhpMyAdmin");

      $this->span("Installing PhpMyAdmin...");

      // Need to use passthru because the installer prompts the user
      // with screens requiring input.
      // This command cannot be captured in the log.
      passthru('apt-get install -y phpmyadmin');
    }

    /**
    * Install Memcached as required by OSF
    */
    public function installMemcached()
    {
      $this->h1("Installing Memcached");

      $this->span("Installing Memcached...");

      $this->exec('apt-get install -y memcached');
      $this->exec('apt-get install -y php5-memcache');

      $this->span("Restarting Apache2...");

      $this->exec('service apache2 restart');

      $this->span("Starting Memcached...");

      $this->exec('service memcached restart');

      $this->span("Installing Memcached User Interface...");

      $this->chdir('/usr/share/');

      $this->mkdir('memcached-ui');

      $this->chdir('/usr/share/memcached-ui/');

      $this->wget('http://artur.ejsmont.org/blog/misc/uploads/memcache_stats_v0.1.tgz');
      $this->exec('tar -xvf memcache_stats_v0.1.tgz');

      $this->chdir('memcache_stats_v01/');

      $this->mv('*', '../');

      $this->chdir('/usr/share/memcached-ui/');

      $this->rm('memcache_stats_v01', TRUE);
      $this->rm('*.tgz', TRUE);

      $this->mv('memcache.php', 'index.php');

      $this->sed("define('ADMIN_PASSWORD','pass');", "define('ADMIN_PASSWORD','{$this->keycache_ui_password}');", 'index.php');

      $this->span("Configuring Apache2 for the Memcached User Interface...");

      $this->chdir($this->currentWorkingDirectory);

      $this->cp('resources/memcached/memcached', '/etc/apache2/sites-available/memcached.conf');

      $this->ln('/etc/apache2/sites-available/memcached.conf', '/etc/apache2/sites-enabled/memcached.conf');

      $this->span("Restarting Apache2...");

      $this->exec('service apache2 restart');
    }

    public function install_OSF_Drupal()
    {
      // Install Pear

      // First check if Pear is installed
      if($this->exec('pear', 'ignore') === FALSE)
      {
        $this->h1("Installing Pear");

        $this->chdir('/tmp/');

        $this->wget('http://pear.php.net/go-pear.phar');

        passthru('php go-pear.phar');
      }

      // Install Drush

      // Check if Drush is installed
      if($this->exec('drush', 'ignore') === FALSE)
      {
        $this->h1("Installing Drush");

        $this->exec('pear upgrade --force Console_Getopt', 'warning');
        $this->exec('pear upgrade --force pear', 'warning');
        $this->exec('pear upgrade-all', 'warning');

        $this->exec('pear channel-discover pear.drush.org', 'warning');

        $this->exec('pear install drush/drush', 'warning');
      }

      // Install Drupal
      $this->h1("Installing Drupal & OSF Drupal");

      $this->chdir($this->currentWorkingDirectory);

      if($this->exec('dpkg-query -l git', 'ignore') === FALSE)
      {
        $this->exec('apt-get install -y git', 'error');
      }

      if($this->exec('dpkg-query -l php5-curl', 'ignore') === FALSE)
      {
        $this->exec('apt-get install -y php5-curl', 'error');
      }

      $this->exec('drush make --prepare-install resources/osf-drupal/osf_drupal.make '.$this->drupal_folder, 'error');

      $this->chdir($this->drupal_folder);

      passthru("drush site-install standard --account-name={$this->drupal_admin_username} --account-pass={$this->drupal_admin_password} --db-url=mysql://{$this->sql_app_username}:{$this->sql_app_password}@localhost/{$this->sql_app_database} -y");

      $this->cecho("\n", 'WHITE');

      $this->chdir($this->currentWorkingDirectory);

      // Configuring Apache2 for Drupal
      $this->span("Configure Apache2 for Drupal...");

      $this->cp('resources/osf-drupal/drupal', '/etc/apache2/sites-available/');

      $this->mv('/etc/apache2/sites-available/drupal', '/etc/apache2/sites-available/drupal.conf');

      $this->ln('/etc/apache2/sites-available/drupal.conf', '/etc/apache2/sites-enabled/drupal.conf');

      // Fix the OSF Web Services path in the apache config file
      $this->sed('/usr/share/drupal', $this->drupal_folder, '/etc/apache2/sites-available/drupal.conf');

      // Delete the default Apache2 enabled site file
      if(file_exists('/etc/apache2/sites-enabled/000-default.conf'))
      {
        $this->rm('/etc/apache2/sites-enabled/000-default.conf', 'warn');
      }

      $this->span("Restarting Apache2...");

      $this->exec('service apache2 restart');

      // Install required file for OSF Ontology
      $this->cp('resources/osf-drupal/new.owl', $this->data_folder.'/ontologies/files/new.owl');

      // Install the required files for the colorpicker module
      $this->chdir($this->drupal_folder.'/sites/all/libraries/');

      $this->mkdir('colorpicker');

      $this->chdir('colorpicker');

      $this->wget('http://www.eyecon.ro/colorpicker/colorpicker.zip');

      $this->exec('unzip colorpicker.zip');

      $this->rm('colorpicker.zip');

      $this->load_OSF_PermissionsManagementTool();

      // Enable OSF Drupal modules
      $this->chdir($this->drupal_folder);

      $this->span("Enable OSF Drupal modules...");
      passthru("drush en devel -y");
      passthru("drush en ctools -y");
      passthru("drush en entity -y");
      passthru("drush en entitycache -y");
      passthru("drush en entitycache -y");
      passthru("drush en features -y");
      passthru("drush en libraries -y");
      passthru("drush en jquery_colorpicker -y");
      passthru("drush en views -y");
      passthru("drush en context -y");
      passthru("drush en boxes -y");
      passthru("drush en xautoload -y");
      passthru("drush en search_api -y");
      passthru("drush en search_api_facetapi -y");
      passthru("drush en search_api_page -y");
      passthru("drush en diff -y");
      passthru("drush en entityreference -y");
      passthru("drush en revisioning -y");
      passthru("drush en osf -y");
      passthru("drush en osf_configure -y");

      $this->span("You can safely ignore the following 4 errors related to 'illegal choice detected'...", 'warn');
      passthru("drush en osf_searchapi -y");
      passthru("drush en osf_entities -y");
      passthru("drush en osf_permissions -y");
      passthru("drush en osf_fieldstorage -y");
      passthru("drush en osf_export -y");
      passthru("drush en osf_import -y");
      passthru("drush en osf_ontology -y");
      passthru("drush en osf_querybuilder -y");
      passthru("drush en osf_searchprofiles -y");
      passthru("drush en osf_field -y");
      passthru("drush dis overlay -y");

      // Create Drupal roles for OSF Drupal
      $this->span("Create Drupal roles for OSF Drupal...");

      passthru("drush role-create 'contributor' -y");
      passthru("drush role-create 'owner/curator' -y");

      // Change the namespaces.csv file permissions on the server
      $this->chmod($this->drupal_folder.'/sites/all/libraries/OSF-WS-PHP-API/StructuredDynamics/osf/framework/namespaces.csv', '777');

      // Setup OSF Ontology settings
      $this->span("Configure error level settings...");
      passthru('drush vset error_level 1');

      // Setup OSF Ontology settings
      $this->span("Configure OSF Ontology settings...");

      // Create the schemas folder used by OSF Ontology
      $this->mkdir($this->drupal_folder.'/schemas/', 'warning');
      $this->chmod($this->drupal_folder.'/schemas/', '777');
      $this->chmod($this->data_folder.'/ontologies/', '777', TRUE);

      // Configure OSF Entities
      $this->span("Configure OSF Entities settings...");

      // Configure OSF SearchAPI settings
      $this->span("Configure OSF Search API settings...");

      // Setup default interface
      passthru('drush vset osf_searchapi_settings_interface_name "DefaultSourceInterface"');
      passthru('drush vset osf_searchapi_settings_interface_version "3.0"');

      // Create the default search index, page and server
      passthru('drush sqlq \'INSERT INTO `search_api_server` (`id`, `name`, `machine_name`, `description`, `class`, `options`, `enabled`, `status`, `module`) VALUES (1, "OSF Search", "osf_search", "The server handler for OSF SearchAPI", "osf_searchapi_service", "a:1:{s:7:\"network\";s:'.strlen('http://'.$this->osf_web_services_domain.'/ws/').':\"http://'.$this->osf_web_services_domain.'/ws/\";}", 1, 1, NULL);\'');
      passthru('drush sqlq \'INSERT INTO `search_api_index` (`id`, `name`, `machine_name`, `description`, `server`, `item_type`, `options`, `enabled`, `read_only`, `status`, `module`) VALUES (2, "OSF Search Index", "osf_search_index", NULL, "osf_search", "osf", "a:3:{s:14:\"index_directly\";i:0;s:10:\"cron_limit\";s:2:\"50\";s:6:\"fields\";a:2:{s:2:\"id\";a:1:{s:4:\"type\";s:6:\"string\";}s:19:\"search_api_language\";a:1:{s:4:\"type\";s:6:\"string\";}}}", 1, 0, 1, NULL);\'');
      passthru('drush sqlq \'INSERT INTO `search_api_page` (`id`, `index_id`, `path`, `name`, `machine_name`, `description`, `options`, `enabled`, `status`, `module`) VALUES (1, "osf_search_index", "lookup", "OSF Search", "osf_search", "", "a:5:{s:4:\"mode\";s:5:\"terms\";s:6:\"fields\";a:0:{}s:8:\"per_page\";s:2:\"10\";s:12:\"get_per_page\";i:1;s:9:\"view_mode\";s:22:\"search_api_page_result\";}", 1, 1, NULL);\'');

      // Make sure the read mode is OFF
      passthru('drush vset osf_OntologySettings_read_mode 0');

      // Configure: "Ontologies Files Path folder"
      passthru('drush vset osf_OntologySettings_ontologies_files_folder "'.$this->data_folder.'/ontologies/files/"');

      // Configure: "Ontologies Cache Path folder"
      passthru('drush vset osf_OntologySettings_ontologies_cache_folder "'.$this->data_folder.'/ontologies/structure/"');

      // Configure: "Ontologies ironXML Schema Cache Path folder"
      passthru('drush vset osf_OntologySettings_ontologies_ironxml_cache_folder "'.$this->drupal_folder.'/schemas/"');

      // Configure: "Ontologies ironJSON Schema Cache Path folder"
      passthru('drush vset osf_OntologySettings_ontologies_ironjson_cache_folder "'.$this->drupal_folder.'/schemas/"');

      $this->chdir($this->currentWorkingDirectory);

      $this->span("Now that OSF for Drupal is installed, the next steps would be to follow the Initial OSF for Drupal Configuration Guide:\n\n", 'notice');
      $this->span("    http://wiki.opensemanticframework.org/index.php/Initial_OSF_for_Drupal_Configuration\n\n", 'notice');
    }

    /**
    * Validate that the OS where the script is running is a Ubuntu instance greater than supported version
    * by the script.
    */
    public static function isWorkingInstaller()
    {
      exec('cat /etc/issue', $output);

      foreach($output as $line)
      {
        if(stripos($line, 'ubuntu') !== FALSE)
        {
          // Validate version
          $version = (float) shell_exec('lsb_release -rs');

          if($version >= 14.04 && $version < 14.05)
          {
            return(TRUE);
          }
          else
          {
            return(FALSE);
          }
        }
        elseif(stripos($line, 'Linux Mint') !== FALSE)
        {
          // Validate version
          $version = (float) shell_exec('lsb_release -rs');

          if($version >= 17 && $version < 18)
          {
            return(TRUE);
          }
          else
          {
            return(FALSE);
          }
        }
        elseif(stripos($line, 'Debian') !== FALSE)
        {
          // Validate version
          $version = (float) shell_exec('cat /etc/issue | cut -d" " -f3 | cut -d " " -f1');

          if($version == 7)
          {
            return(TRUE);
          }
          else
          {
            return(FALSE);
          }
        }
      }
      return(FALSE);
    }
  }
?>


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

<title>org.jay3d.engine.core Class Hierarchy</title>
<meta name="date" content="2014-10-05">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Hierarchy For Package org.jay3d.engine.core

Package Hierarchies:

All Packages

Class Hierarchy

java.lang.Object

org.jay3d.engine.core.CoreEngine

org.jay3d.engine.core.Game

org.jay3d.engine.core.TestGame

org.jay3d.engine.core.GameObject

org.jay3d.engine.core.Input

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes