text:
/**CFile****************************************************************

  FileName    [ftFactor.c]

  PackageName [MVSIS 2.0: Multi-valued logic synthesis system.]

  Synopsis    [Procedures for algebraic factoring.]

  Author      [MVSIS Group]

  Affiliation [UC Berkeley]

  Date        [Ver. 1.0. Started - February 1, 2003.]

  Revision    [$Id: ftFactor.c,v 1.3 2003/09/01 04:56:43 alanmi Exp $]

***********************************************************************/

#include "abc.h"
#include "main.h"
#include "mvc.h"
#include "dec.h"

////////////////////////////////////////////////////////////////////////
///                        DECLARATIONS                              ///
////////////////////////////////////////////////////////////////////////

static Dec_Edge_t       Dec_Factor_rec( Dec_Graph_t * pFForm, Mvc_Cover_t * pCover );
static Dec_Edge_t       Dec_FactorLF_rec( Dec_Graph_t * pFForm, Mvc_Cover_t * pCover, Mvc_Cover_t * pSimple );
static Dec_Edge_t       Dec_FactorTrivial( Dec_Graph_t * pFForm, Mvc_Cover_t * pCover );
static Dec_Edge_t       Dec_FactorTrivialCube( Dec_Graph_t * pFForm, Mvc_Cover_t * pCover, Mvc_Cube_t * pCube, Vec_Int_t * vEdgeLits );
static Dec_Edge_t       Dec_FactorTrivialTree_rec( Dec_Graph_t * pFForm, Dec_Edge_t * peNodes, int nNodes, int fNodeOr );
static int              Dec_FactorVerify( char * pSop, Dec_Graph_t * pFForm );
static Mvc_Cover_t *    Dec_ConvertSopToMvc( char * pSop );

////////////////////////////////////////////////////////////////////////
///                     FUNCTION DEFINITIONS                         ///
////////////////////////////////////////////////////////////////////////

/**Function*************************************************************

  Synopsis    [Factors the cover.]

  Description []

  SideEffects []

  SeeAlso     []

***********************************************************************/
Dec_Graph_t * Dec_Factor( char * pSop )
{
    Mvc_Cover_t * pCover;
    Dec_Graph_t * pFForm;
    Dec_Edge_t eRoot;

    // derive the cover from the SOP representation
    pCover = Dec_ConvertSopToMvc( pSop );

    // make sure the cover is CCS free (should be done before CST)
    Mvc_CoverContain( pCover );
    // check for trivial functions
    if ( Mvc_CoverIsEmpty(pCover) )
    {
        Mvc_CoverFree( pCover );
        return Dec_GraphCreateConst0();
    }
    if ( Mvc_CoverIsTautology(pCover) )
    {
        Mvc_CoverFree( pCover );
        return Dec_GraphCreateConst1();
    }

    // perform CST
    Mvc_CoverInverse( pCover ); // CST
    // start the factored form
    pFForm = Dec_GraphCreate( Abc_SopGetVarNum(pSop) );
    // factor the cover
    eRoot = Dec_Factor_rec( pFForm, pCover );
    // finalize the factored form
    Dec_GraphSetRoot( pFForm, eRoot );
    // complement the factored form if SOP is complemented
    if ( Abc_SopIsComplement(pSop) )
        Dec_GraphComplement( pFForm );
    // verify the factored form
//    if ( !Dec_FactorVerify( pSop, pFForm ) )
//        printf( "Verification has failed.\n" );
//    Mvc_CoverInverse( pCover ); // undo CST
    Mvc_CoverFree( pCover );
    return pFForm;
}

/**Function*************************************************************

  Synopsis    [Internal recursive factoring procedure.]

  Description []

  SideEffects []

  SeeAlso     []

***********************************************************************/
Dec_Edge_t Dec_Factor_rec( Dec_Graph_t * pFForm, Mvc_Cover_t * pCover )
{
    Mvc_Cover_t * pDiv, * pQuo, * pRem, * pCom;
    Dec_Edge_t eNodeDiv, eNodeQuo, eNodeRem;
    Dec_Edge_t eNodeAnd, eNode;

    // make sure the cover contains some cubes
    assert( Mvc_CoverReadCubeNum(pCover) );

    // get the divisor
    pDiv = Mvc_CoverDivisor( pCover );
    if ( pDiv == NULL )
        return Dec_FactorTrivial( pFForm, pCover );

    // divide the cover by the divisor
    Mvc_CoverDivideInternal( pCover, pDiv, &pQuo, &pRem );
    assert( Mvc_CoverReadCubeNum(pQuo) );

    Mvc_CoverFree( pDiv );
    Mvc_CoverFree( pRem );

    // check the trivial case
    if ( Mvc_CoverReadCubeNum(pQuo) == 1 )
    {
        eNode = Dec_FactorLF_rec( pFForm, pCover, pQuo );
        Mvc_CoverFree( pQuo );
        return eNode;
    }

    // make the quotient cube free
    Mvc_CoverMakeCubeFree( pQuo );

    // divide the cover by the quotient
    Mvc_CoverDivideInternal( pCover, pQuo, &pDiv, &pRem );

    // check the trivial case
    if ( Mvc_CoverIsCubeFree( pDiv ) )
    {
        eNodeDiv = Dec_Factor_rec( pFForm, pDiv );
        eNodeQuo = Dec_Factor_rec( pFForm, pQuo );
        Mvc_CoverFree( pDiv );
        Mvc_CoverFree( pQuo );
        eNodeAnd = Dec_GraphAddNodeAnd( pFForm, eNodeDiv, eNodeQuo );
        if ( Mvc_CoverReadCubeNum(pRem) == 0 )
        {
            Mvc_CoverFree( pRem );
            return eNodeAnd;
        }
        else
        {
            eNodeRem = Dec_Factor_rec( pFForm, pRem );
            Mvc_CoverFree( pRem );
            return Dec_GraphAddNodeOr( pFForm, eNodeAnd, eNodeRem );
        }
    }

    // get the common cube
    pCom = Mvc_CoverCommonCubeCover( pDiv );
    Mvc_CoverFree( pDiv );
    Mvc_CoverFree( pQuo );
    Mvc_CoverFree( pRem );

    // solve the simple problem
    eNode = Dec_FactorLF_rec( pFForm, pCover, pCom );
    Mvc_CoverFree( pCom );
    return eNode;
}

/**Function*************************************************************

  Synopsis    [Internal recursive factoring procedure for the leaf case.]

  Description []

  SideEffects []

  SeeAlso     []

***********************************************************************/
Dec_Edge_t Dec_FactorLF_rec( Dec_Graph_t * pFForm, Mvc_Cover_t * pCover, Mvc_Cover_t * pSimple )
{
    Dec_Man_t * pManDec = Abc_FrameReadManDec();
    Vec_Int_t * vEdgeLits  = pManDec->vLits;
    Mvc_Cover_t * pDiv, * pQuo, * pRem;
    Dec_Edge_t eNodeDiv, eNodeQuo, eNodeRem;
    Dec_Edge_t eNodeAnd;

    // get the most often occurring literal
    pDiv = Mvc_CoverBestLiteralCover( pCover, pSimple );
    // divide the cover by the literal
    Mvc_CoverDivideByLiteral( pCover, pDiv, &pQuo, &pRem );
    // get the node pointer for the literal
    eNodeDiv = Dec_FactorTrivialCube( pFForm, pDiv, Mvc_CoverReadCubeHead(pDiv), vEdgeLits );
    Mvc_CoverFree( pDiv );
    // factor the quotient and remainder
    eNodeQuo = Dec_Factor_rec( pFForm, pQuo );
    Mvc_CoverFree( pQuo );
    eNodeAnd = Dec_GraphAddNodeAnd( pFForm, eNodeDiv, eNodeQuo );
    if ( Mvc_CoverReadCubeNum(pRem) == 0 )
    {
        Mvc_CoverFree( pRem );
        return eNodeAnd;
    }
    else
    {
        eNodeRem = Dec_Factor_rec( pFForm, pRem );
        Mvc_CoverFree( pRem );
        return Dec_GraphAddNodeOr( pFForm,  eNodeAnd, eNodeRem );
    }
}

/**Function*************************************************************

  Synopsis    [Factoring the cover, which has no algebraic divisors.]

  Description []

  SideEffects []

  SeeAlso     []

***********************************************************************/
Dec_Edge_t Dec_FactorTrivial( Dec_Graph_t * pFForm, Mvc_Cover_t * pCover )
{
    Dec_Man_t * pManDec = Abc_FrameReadManDec();
    Vec_Int_t * vEdgeCubes = pManDec->vCubes;
    Vec_Int_t * vEdgeLits  = pManDec->vLits;
    Mvc_Manager_t * pMem = pManDec->pMvcMem;
    Dec_Edge_t eNode;
    Mvc_Cube_t * pCube;
    // create the factored form for each cube
    Vec_IntClear( vEdgeCubes );
    Mvc_CoverForEachCube( pCover, pCube )
    {
        eNode = Dec_FactorTrivialCube( pFForm, pCover, pCube, vEdgeLits );
        Vec_IntPush( vEdgeCubes, Dec_EdgeToInt_(eNode) );
    }
    // balance the factored forms
    return Dec_FactorTrivialTree_rec( pFForm, (Dec_Edge_t *)vEdgeCubes->pArray, vEdgeCubes->nSize, 1 );
}

/**Function*************************************************************

  Synopsis    [Factoring the cube.]

  Description []

  SideEffects []

  SeeAlso     []

***********************************************************************/
Dec_Edge_t Dec_FactorTrivialCube( Dec_Graph_t * pFForm, Mvc_Cover_t * pCover, Mvc_Cube_t * pCube, Vec_Int_t * vEdgeLits )
{
    Dec_Edge_t eNode;
    int iBit, Value;
    // create the factored form for each literal
    Vec_IntClear( vEdgeLits );
    Mvc_CubeForEachBit( pCover, pCube, iBit, Value )
        if ( Value )
        {
            eNode = Dec_EdgeCreate( iBit/2, iBit%2 ); // CST
            Vec_IntPush( vEdgeLits, Dec_EdgeToInt_(eNode) );
        }
    // balance the factored forms
    return Dec_FactorTrivialTree_rec( pFForm, (Dec_Edge_t *)vEdgeLits->pArray, vEdgeLits->nSize, 0 );
}

/**Function*************************************************************

  Synopsis    [Create the well-balanced tree of nodes.]

  Description []

  SideEffects []

  SeeAlso     []

***********************************************************************/
Dec_Edge_t Dec_FactorTrivialTree_rec( Dec_Graph_t * pFForm, Dec_Edge_t * peNodes, int nNodes, int fNodeOr )
{
    Dec_Edge_t eNode1, eNode2;
    int nNodes1, nNodes2;

    if ( nNodes == 1 )
        return peNodes[0];

    // split the nodes into two parts
    nNodes1 = nNodes/2;
    nNodes2 = nNodes - nNodes1;
//    nNodes2 = nNodes/2;
//    nNodes1 = nNodes - nNodes2;

    // recursively construct the tree for the parts
    eNode1 = Dec_FactorTrivialTree_rec( pFForm, peNodes,           nNodes1, fNodeOr );
    eNode2 = Dec_FactorTrivialTree_rec( pFForm, peNodes + nNodes1, nNodes2, fNodeOr );

    if ( fNodeOr )
        return Dec_GraphAddNodeOr( pFForm, eNode1, eNode2 );
    else
        return Dec_GraphAddNodeAnd( pFForm, eNode1, eNode2 );
}

/**Function*************************************************************

  Synopsis    [Converts SOP into MVC.]

  Description []

  SideEffects []

  SeeAlso     []

***********************************************************************/
Mvc_Cover_t * Dec_ConvertSopToMvc( char * pSop )
{
    Dec_Man_t * pManDec = Abc_FrameReadManDec();
    Mvc_Manager_t * pMem = pManDec->pMvcMem;
    Mvc_Cover_t * pMvc;
    Mvc_Cube_t * pMvcCube;
    char * pCube;
    int nVars, Value, v;

    // start the cover
    nVars = Abc_SopGetVarNum(pSop);
    pMvc = Mvc_CoverAlloc( pMem, nVars * 2 );
    // check the logic function of the node
    Abc_SopForEachCube( pSop, nVars, pCube )
    {
        // create and add the cube
        pMvcCube = Mvc_CubeAlloc( pMvc );
        Mvc_CoverAddCubeTail( pMvc, pMvcCube );
        // fill in the literals
        Mvc_CubeBitFill( pMvcCube );
        Abc_CubeForEachVar( pCube, Value, v )
        {
            if ( Value == '0' )
                Mvc_CubeBitRemove( pMvcCube, v * 2 + 1 );
            else if ( Value == '1' )
                Mvc_CubeBitRemove( pMvcCube, v * 2 );
        }
    }
    return pMvc;
}

/**Function*************************************************************

  Synopsis    [Verifies that the factoring is correct.]

  Description []

  SideEffects []

  SeeAlso     []

***********************************************************************/
int Dec_FactorVerify( char * pSop, Dec_Graph_t * pFForm )
{
    DdManager * dd = Abc_FrameReadManDd();
    DdNode * bFunc1, * bFunc2;
    int RetValue;
    bFunc1 = Abc_ConvertSopToBdd( dd, pSop );    Cudd_Ref( bFunc1 );
    bFunc2 = Dec_GraphDeriveBdd( dd, pFForm );   Cudd_Ref( bFunc2 );
//Extra_bddPrint( dd, bFunc1 ); printf("\n");
//Extra_bddPrint( dd, bFunc2 ); printf("\n");
    RetValue = (bFunc1 == bFunc2);
    if ( bFunc1 != bFunc2 )
    {
        int s;
        Extra_bddPrint( dd, bFunc1 ); printf("\n");
        Extra_bddPrint( dd, bFunc2 ); printf("\n");
        s  = 0;
    }
    Cudd_RecursiveDeref( dd, bFunc1 );
    Cudd_RecursiveDeref( dd, bFunc2 );
    return RetValue;
}

////////////////////////////////////////////////////////////////////////
///                       END OF FILE                                ///
////////////////////////////////////////////////////////////////////////


text:
#pragma once
#include <aws/ce/CostExplorer_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>

namespace Aws
{
namespace Utils
{
namespace Json
{
  class JsonValue;
  class JsonView;
} // namespace Json
} // namespace Utils
namespace CostExplorer
{
namespace Model
{

  /**
   *
Details on termination recommendation.

See Also:
   AWS
   * API Reference

   */
  class AWS_COSTEXPLORER_API TerminateRecommendationDetail
  {
  public:
    TerminateRecommendationDetail();
    TerminateRecommendationDetail(Aws::Utils::Json::JsonView jsonValue);
    TerminateRecommendationDetail& operator=(Aws::Utils::Json::JsonView jsonValue);
    Aws::Utils::Json::JsonValue Jsonize() const;

    /**
     *
The estimated savings that result from modification, on a monthly basis.

     */
    inline const Aws::String& GetEstimatedMonthlySavings() const{ return m_estimatedMonthlySavings; }

    /**
     *
The estimated savings that result from modification, on a monthly basis.

     */
    inline bool EstimatedMonthlySavingsHasBeenSet() const { return m_estimatedMonthlySavingsHasBeenSet; }

    /**
     *
The estimated savings that result from modification, on a monthly basis.

     */
    inline void SetEstimatedMonthlySavings(const Aws::String& value) { m_estimatedMonthlySavingsHasBeenSet = true; m_estimatedMonthlySavings = value; }

    /**
     *
The estimated savings that result from modification, on a monthly basis.

     */
    inline void SetEstimatedMonthlySavings(Aws::String&& value) { m_estimatedMonthlySavingsHasBeenSet = true; m_estimatedMonthlySavings = std::move(value); }

    /**
     *
The estimated savings that result from modification, on a monthly basis.

     */
    inline void SetEstimatedMonthlySavings(const char* value) { m_estimatedMonthlySavingsHasBeenSet = true; m_estimatedMonthlySavings.assign(value); }

    /**
     *
The estimated savings that result from modification, on a monthly basis.

     */
    inline TerminateRecommendationDetail& WithEstimatedMonthlySavings(const Aws::String& value) { SetEstimatedMonthlySavings(value); return *this;}

    /**
     *
The estimated savings that result from modification, on a monthly basis.

     */
    inline TerminateRecommendationDetail& WithEstimatedMonthlySavings(Aws::String&& value) { SetEstimatedMonthlySavings(std::move(value)); return *this;}

    /**
     *
The estimated savings that result from modification, on a monthly basis.

     */
    inline TerminateRecommendationDetail& WithEstimatedMonthlySavings(const char* value) { SetEstimatedMonthlySavings(value); return *this;}

    /**
     *
The currency code that Amazon Web Services used to calculate the costs for
     * this instance.

     */
    inline const Aws::String& GetCurrencyCode() const{ return m_currencyCode; }

    /**
     *
The currency code that Amazon Web Services used to calculate the costs for
     * this instance.

     */
    inline bool CurrencyCodeHasBeenSet() const { return m_currencyCodeHasBeenSet; }

    /**
     *
The currency code that Amazon Web Services used to calculate the costs for
     * this instance.

     */
    inline void SetCurrencyCode(const Aws::String& value) { m_currencyCodeHasBeenSet = true; m_currencyCode = value; }

    /**
     *
The currency code that Amazon Web Services used to calculate the costs for
     * this instance.

     */
    inline void SetCurrencyCode(Aws::String&& value) { m_currencyCodeHasBeenSet = true; m_currencyCode = std::move(value); }

    /**
     *
The currency code that Amazon Web Services used to calculate the costs for
     * this instance.

     */
    inline void SetCurrencyCode(const char* value) { m_currencyCodeHasBeenSet = true; m_currencyCode.assign(value); }

    /**
     *
The currency code that Amazon Web Services used to calculate the costs for
     * this instance.

     */
    inline TerminateRecommendationDetail& WithCurrencyCode(const Aws::String& value) { SetCurrencyCode(value); return *this;}

    /**
     *
The currency code that Amazon Web Services used to calculate the costs for
     * this instance.

     */
    inline TerminateRecommendationDetail& WithCurrencyCode(Aws::String&& value) { SetCurrencyCode(std::move(value)); return *this;}

    /**
     *
The currency code that Amazon Web Services used to calculate the costs for
     * this instance.

     */
    inline TerminateRecommendationDetail& WithCurrencyCode(const char* value) { SetCurrencyCode(value); return *this;}

  private:

    Aws::String m_estimatedMonthlySavings;
    bool m_estimatedMonthlySavingsHasBeenSet = false;

    Aws::String m_currencyCode;
    bool m_currencyCodeHasBeenSet = false;
  };

} // namespace Model
} // namespace CostExplorer
} // namespace Aws

redpajama_set_name: RedPajamaGithub


text:
package com.siyeh.igtest.security.deserializable_class_in_secure_context;

import java.io.ObjectInputStream;
import java.io.Serializable;

public class DeserializableClass implements Serializable {
  private void readObject(ObjectInputStream in) {

  }
}
class NonDeserializableClass implements Serializable {
  private void readObject(ObjectInputStream in) {
    throw new Error();
  }
}
interface Event extends Serializable {

}
class EventListener<E  extends Event> {

}
class MyException extends Exception {}


text:
"""
Created by @dtheodor at 2015-09-06
"""
from properconfig import ConfigParser

if __name__ == "__main__":
    with open("config.conf") as f:
        parser = ConfigParser(description="test")\
            .enable_environ(prefix="LOL")\
            .enable_cli_conf_file()\
            .enable_local_conf_file(fp=f)
    parser.add_argument('-v', '--verbose',
                        action="count",
                        required=True,
                        #type=int,
                        #default=2
                        )

    in_args = "-conf other_config.conf".split()

    args = parser.parse_known_args(in_args)
    print parser.option_sources
    print args


text:
#ifndef _paintown_ast_keyword_h_
#define _paintown_ast_keyword_h_

#include "Value.h"
#include <string>

namespace Ast{

class Keyword: public Value {
public:
    /* do not pass in a dynamically allocated string!!! */
    Keyword(int line, int column, std::string str):
    Value(line, column),
    str(str){
    }

    class KeywordView: public ViewImplementation {
    public:
        KeywordView(const Keyword * keyword):
        keyword(keyword){
        }

        const Keyword * keyword;

        using ViewImplementation::operator>>;
        virtual const KeywordView & operator>>(std::string & str) const {
            str = keyword->str;
            return *this;
        }

        virtual std::string getType() const {
            return keyword->getType();
        }

        virtual const Value * self() const {
            return keyword;
        }

        virtual std::string toString() const {
            return keyword->toString();
        }
    };

    using Value::view;
    virtual View view() const {
        return View(Util::ReferenceCount<ViewImplementation>(new KeywordView(this)));
    }

    virtual void walk(Walker & walker) const {
        walker.onKeyword(*this);
    }

    virtual Element * copy() const {
        return new Keyword(getLine(), getColumn(), str);
    }

    using Element::operator==;
    bool operator==(const Value & him) const {
        return him == *this;
    }

    bool operator==(const Keyword & him) const {
        return str == him.str;
    }

    bool operator==(const std::string & str) const {
        return downcase(toString()) == downcase(str);
    }

    static int lowerCase( int c ){
        return tolower(c);
    }

    Token * serialize() const {
        Token * token = new Token();
        *token << SERIAL_KEYWORD << getLine() << getColumn() << toString();
        return token;
    }

    static Keyword * deserialize(const Token * token){
        std::string name;
        int line, column;
        token->view() >> line >> column >> name;
        return new Keyword(line, column, name);
    }

    static std::string downcase(std::string str){
        std::transform(str.begin(), str.end(), str.begin(), lowerCase);
        return str;
    }

    virtual std::string getType() const {
        return "string";
    }

    virtual std::string toString() const {
        return str;
    }

    virtual ~Keyword(){
        /* don't delete str */
    }

protected:
    std::string str;
};

}

#endif


text:
import PyQt5
import sys
import os
import platform
import re
import shlex
import signal
from PyQt5 import uic
from PyQt5 import QtCore
from PyQt5.QtCore import QModelIndex, pyqtSignal, pyqtSlot
from PyQt5.QtGui import QColor, QFont
from PyQt5.QtWidgets import (QApplication, QMainWindow, QTableWidgetItem,
                             QTableWidget, QVBoxLayout, QFileSystemModel)
from ziphandle import ZipHandle
from autocompiler import CCompiler, MATCompiler
from subprocess import Popen
from operator import methodcaller
from IPython import embed

class MyTable(QTableWidget):
    dropped_trigger = QtCore.pyqtSignal(str)

    def __init__(self, parent):
        QTableWidget.__init__(self, parent)
        self.setAcceptDrops(True)

    def dragMoveEvent(self, event):
        event.accept()

    def dragEnterEvent(self, event):
        event.accept()

    def dropEvent(self, event):
        self.dropped_trigger(event.mimeData().text())
        event.accept()

Form = uic.loadUiType('gui.ui')[0]  # Load ui

class MyWindow(QMainWindow, Form):
    def __init__(self):
        Form.__init__(self)
        QMainWindow.__init__(self)
        self.setupUi(self)

        self.setWindowTitle("Automated Homework Correction")

        # Initializations for the student table on the left
        self.st_table = MyTable(self)
        self.st_tab_ind = None  # stores the table col. index/text
        self.persian_font = QFont()  # Holds the persian font for the table
        self.setup_st_table()
        QVBoxLayout(self.table_frame).addWidget(self.st_table)

        # Initializations for the Terminal in Terminal tab
        self.setup_terminal()

        # Initializations for the part below terminal
        self.open_code_push_button.clicked.connect(self.open_code)
        self.open_report_push_button.clicked.connect(self.open_report)
        self.compile_push_button.clicked.connect(self.compile_hw)
        self.run_push_button.clicked.connect(self.run_hw)
        self.prog_type_combo.activated.connect(self.prog_type_changed)
        self.sel_prog_type = self.prog_type_combo.currentText()

        # Initializations for the Folder Tree in Folder Tab
        self.folder_model = QFileSystemModel()
        self.setup_folder_tree_view()

        # Miscellaneous initializations
        self.command = ""  # holds the text in console textbox
        self.hw_path = ""  # holds the dropped hw folder path
        self.sel_hw_path = ""  # path of selected hw in the student table
        self.sel_cn = ""  # Selected course name in the cell
        self.sel_hw_num = 0  # hw num of selected cell
        self.sel_st_num = 0  # student number of selected cell
        self.hw_folders = []  # proper and valid homework folders
        self.prev_row = -1  # holds the previous selected row of table
        self.sep = "----------------------------------------------------"
        self.hw_re = re.compile(r"\A(\w{2})[-_](HW(\d+)[-_](\d{7}))\Z",
                                re.IGNORECASE)
        self.sel_folder_index = None  # index of the folder model for treeView

        self.zip_thread = None  # will hold the ZipHandle Thread

        # Compiler initializations
        self.c_comp = CCompiler(None)   # will hold the C Compiler handle
        self.c_comp.log_trigger.connect(self.compile_box_update)
        self.mat_compiler = MATCompiler(None)
        self.mat_compiler.log_trigger.connect(self.compile_box_update)

        # OS Specific Initializations
        self._processes = []  # holds all active processes for Popen
        self._plat = platform.system()  # Linux or Windows
        self.system_arch = platform.machine()  # x86_64 or i386

        if "Windows" in self._plat:
            self.is_linux = False   # Used later to know if on linux
            self.is_windows = True
            # Windows code editor
            self.editor = "\"C:\\Program Files\\Sublime Text 3\\subl.exe\" --wait"
            self.terminal_cmd = r"C:\Windows\System32\cmd.exe /k"
            self.pdf_viewer = "\"C:\Program Files (x86)\Adobe\Acrobat DC\Acrobat\Acrobat.exe\""

        elif "Linux" in self._plat:
            self.is_linux = True
            self.is_windows = False
            self.editor = "/usr/bin/subl --wait"
            self.pdf_viewer = "/usr/bin/evince"
            self.terminal_cmd = None
        else:
            print("Not a standard OS: use Windows or Linux.")

    def setup_st_table(self):
        """ This function is for setting up the table on the left
            of the dialogue. All initializations are made here."""
        self.st_table.dropped_trigger = self.process_hw  # file/folder dropped
        self.st_table.cellClicked.connect(self.hw_clicked)  # a cell is clicked

        self.st_table.setSelectionMode(PyQt5.QtWidgets.QAbstractItemView.
                                       SingleSelection)
        self.st_table.setSelectionBehavior(PyQt5.QtWidgets.QAbstractItemView.
                                           SelectRows)
        # start out with 5 columns
        self.st_tab_ind = {"CN": 0, "HW_Num": 1, "St_Num": 2, "St_Name": 3,
                           "Folders": 4, "Report": 5}
        self.st_table.setColumnCount(len(self.st_tab_ind))
        # Now put text for the columns and set width if required
        self.st_table.setHorizontalHeaderItem(self.st_tab_ind["CN"],
                                              QTableWidgetItem("CN"))
        self.st_table.setColumnWidth(self.st_tab_ind["CN"], 30)
        self.st_table.setHorizontalHeaderItem(self.st_tab_ind["HW_Num"],
                                              QTableWidgetItem("HW"))
        self.st_table.setColumnWidth(self.st_tab_ind["HW_Num"], 31)
        self.st_table.setHorizontalHeaderItem(self.st_tab_ind["St_Num"],
                                              QTableWidgetItem("St. Num"))
        self.st_table.setColumnWidth(self.st_tab_ind["St_Num"], 70)
        self.st_table.setHorizontalHeaderItem(self.st_tab_ind["St_Name"],
                                              QTableWidgetItem("St. Name"))
        self.st_table.setColumnWidth(self.st_tab_ind["St_Name"], 105)
        self.st_table.setHorizontalHeaderItem(self.st_tab_ind["Folders"],
                                              QTableWidgetItem("Folders"))
        self.st_table.setColumnWidth(self.st_tab_ind["Folders"], 100)
        self.st_table.setHorizontalHeaderItem(self.st_tab_ind["Report"],
                                              QTableWidgetItem("Report"))
        self.st_table.setColumnWidth(self.st_tab_ind["Report"], 100)

        self.persian_font.setFamily("XW Zar")  # Persian font setup for the table
        self.persian_font.setPointSize(11)

    def setup_terminal(self):
        self.compile_box.setTextColor(QColor(237, 238, 240))
        self.compile_box.setText("Drag your folder to the table ...")

    def setup_folder_tree_view(self):
        self.folder_tree_view.setModel(self.folder_model)
        self.folder_tree_view.doubleClicked.connect(self.open_file_folder)
        self.folder_tree_view.expanded.connect(self.expanded)
        self.folder_tree_view.setColumnWidth(0, 350)
        self.folder_tree_view.setColumnWidth(1, 50)
        self.folder_tree_view.setColumnWidth(2, 50)
        self.folder_tree_view.hideColumn(3)

    def enable_config(self, yes):
        """ This functions enables the config part if yes is true """
        items = [self.open_code_push_button, self.run_push_button,
                 self.open_report_push_button, self.compile_push_button,
                 self.prog_type_combo]
        if yes:
            method = methodcaller('setEnabled', True)
        else:
            method = methodcaller('setEnabled', False)
        list(map(method, items))  # Runs setEnabled on all of the items

    @pyqtSlot(str)
    def process_hw(self, path):  # path is DROPPED into the table
        self.hw_path = path.strip()  # removes \n etc
        # a little clean up is necessary for the path
        self.hw_path = os.path.normpath(self.hw_path).lstrip("file:")
        if self.is_linux:
            self.hw_path = os.path.join('/', self.hw_path)  # put a / at start
        elif self.is_windows:  # / should be \
            self.hw_path = self.hw_path.replace('/', os.sep).lstrip(os.sep)

        # Update the folder tree table
        self.folder_model.setRootPath(self.hw_path)
        self.folder_tree_view.setRootIndex(self.folder_model.index(self.hw_path))

        self.hw_folders.clear()  # clear previous homework folders(if any)
        self.st_table.clearContents()  # table contents(if any) not col. headers
        self.command = ""  # reset the console output

        if os.path.isfile(path): # TODO: single file HW
            print("Single File is not yet implemented")
        self.compile_box_update(self.hw_path)  # put folder path in terminal

        # Retrieve the zip files only and sort them
        files = os.listdir(self.hw_path)
        files = [f for f in files if f.lower().endswith(".zip")]
        files.sort()

        # Setting up the zip thread
        self.zip_thread = ZipHandle(self.hw_path, files, self.hw_re)
        self.zip_thread.log_trigger.connect(self.compile_box_update)
        self.zip_thread.hw_add_trigger.connect(self.table_hw_add)
        self.zip_thread.start()

    @pyqtSlot(int, int)
    def hw_clicked(self, row, _):
        """ A Cell is clicked, row, col is also passed in here """
        if row == self.prev_row:  # if double selecting a row, deselect
            self.st_table.clearSelection()
            self.prev_row = -1
            self.enable_config(False)
            return
        else:
            self.prev_row = row

        # We use this event handler since it does similar thing
        self.closeEvent(None)

        # Retrieve other information of the hw from different columns
        self.sel_cn = self.st_table.item(row, self.st_tab_ind["CN"]).text()
        self.sel_hw_num = self.st_table.item(row, self.st_tab_ind["HW_Num"]).text()
        self.sel_st_num = self.st_table.item(row, self.st_tab_ind["St_Num"]).text()

        # This part updates the folder tree
        self.sel_hw_path = os.path.join(self.hw_path, "{}-HW{}-{}".format(
            self.sel_cn, self.sel_hw_num, self.sel_st_num))
        folder_index = self.folder_model.index(self.sel_hw_path)
        self.folder_tree_view.collapseAll()
        self.folder_tree_view.expand(folder_index)  # triggers expanded

        # Enabling the buttons below terminal
        self.enable_config(True)

    @pyqtSlot()
    def open_code(self):
        """ This event handler is run whenever user clicks open code button"""
        # TODO: Add support for the editor if in other directories
        p = Popen(shlex.split(self.editor + ' "' + self.sel_hw_path + '"'),
                  shell=False, start_new_session=True)  # open code editor
        self._processes.append(p)

    @pyqtSlot()
    def open_report(self):
        row = self.st_table.currentRow()
        sel_rep_name = self.st_table.item(row, self.st_tab_ind["Report"]).text()
        if sel_rep_name == "N/A":
            self.compile_box_update("Can not find report file.")
            return
        sel_report_path = os.path.join(self.sel_hw_path, sel_rep_name)
        pdf_cmd = shlex.split(self.pdf_viewer)
        pdf_cmd.extend([sel_report_path])
        p = Popen(pdf_cmd, shell=False, start_new_session=True)  # open pdf
        self._processes.append(p)

    @pyqtSlot(int)
    def prog_type_changed(self, index):
        self.sel_prog_type = self.prog_type_combo.currentText()
        if self.sel_prog_type != "C++":  # No compilation step except C++
            self.compile_push_button.setVisible(False)
        else:
            self.compile_push_button.setVisible(True)

    @pyqtSlot()
    def compile_hw(self):  # Compile push button is clicked
        """ In this function the selected hw path is compiled. """
        if self.sel_prog_type == "C++":
            self.c_comp.change_root(self.sel_hw_path)
            self.compile_box_update("{}: C++".format(os.path.basename(
                self.sel_hw_path)))
            self.compile_box_update("Generating Makefile if needed ...")
            self.c_comp.generate_makefiles()
            self.compile_box_update("\nCompiling the Questions, Wait ...")
            self.c_comp.compile()  # compiles all the folders with proper C++
        elif self.sel_prog_type == "Matlab":
            pass
        elif self.sel_prog_type == "Python":
            pass

    @pyqtSlot()
    def run_hw(self):
        """ This function is run when user clicks on Run button """
        if self.sel_prog_type == "C++":
            comp = self.c_comp
        elif self.sel_prog_type == "Python": # comp = self.py_comp
            pass
        elif self.sel_prog_type == "Matlab":
            comp = self.mat_compiler
            comp.change_root(self.sel_hw_path)
            script_files = self.mat_compiler.search_scripts()
            if len(script_files) == 0:
                self.compile_box_update("Did not find any script to run.")
                return

        self.compile_box_update("{}: Execute".format(self.sel_prog_type))
        comp.exec()  # execute proper compiler
        self.compile_box_update("{0}\n{0}".format(self.sep))

    @pyqtSlot(QModelIndex)
    def expanded(self, index):  # Tree view is expanded at one of the indexes
        # Disable this line, since it decreases the width, 1 level is only open
        # self.folder_tree_view.resizeColumnToContents(0)
        if index != None:
            self.folder_tree_view.setCurrentIndex(index)
            self.folder_tree_view.scrollTo(index)

    @pyqtSlot(QModelIndex)
    def open_file_folder(self, index):  # double clicked on something
        """ This function can open certian filetypes. A handler needs to open the
            file. For the moment only pdf files are opened."""
        path = self.folder_model.fileInfo(index).absoluteFilePath()
        if os.path.isdir(path): # No need to do anything
            return
        if self.is_linux:
            if path.lower().endswith(".pdf"):
                p = Popen(shlex.split(self.pdf_viewer + "\"" + path + "\""),
                          shell=False, start_new_session=True)
                self._processes.append(p)

    def table_hw_add(self, hw_folder):
        self.hw_folders.append(hw_folder)
        hw_ls = os.listdir(os.path.join(self.hw_path, hw_folder))
        hw_dirs = [item for item in hw_ls if
                   os.path.isdir(os.path.join(self.hw_path, hw_folder, item))]
        hw_files = [item for item in hw_ls if
                   os.path.isfile(os.path.join(self.hw_path, hw_folder, item))]
        course_name, file_name, hw_num, st_num = self.hw_re.match(
            hw_folder).groups()

        cur_row = len(self.hw_folders) - 1
        self.st_table.insertRow(cur_row)
        self.st_table.setItem(cur_row, self.st_tab_ind["CN"],
                              QTableWidgetItem(course_name))  # hw_num
        self.st_table.item(cur_row, self.st_tab_ind["CN"]).\
            setTextAlignment(QtCore.Qt.AlignCenter)
        self.st_table.setItem(cur_row, self.st_tab_ind["HW_Num"],
                              QTableWidgetItem(hw_num))  # hw_num
        self.st_table.item(cur_row, self.st_tab_ind["HW_Num"]).\
            setTextAlignment(QtCore.Qt.AlignCenter)
        self.st_table.setItem(cur_row, self.st_tab_ind["St_Num"],
                              QTableWidgetItem(st_num))  # st_num
        self.st_table.item(cur_row, self.st_tab_ind["St_Num"]). \
            setTextAlignment(QtCore.Qt.AlignCenter)
        st_name_item = QTableWidgetItem("وارد نشده است")
        st_name_item.setFont(self.persian_font)
        self.st_table.setItem(cur_row, self.st_tab_ind["St_Name"], st_name_item)
        self.st_table.item(cur_row, self.st_tab_ind["St_Name"]). \
            setTextAlignment(QtCore.Qt.AlignHCenter)

        # ignore chars from the homework folder names in the table,
        # e.g.: Q1, Q2 -> 1, 2
        if len(hw_dirs) > 0:
            hw_dirs_str = ' '.join(hw_dirs)
            hw_dirs_str = [c for c in hw_dirs_str if not c.isalpha()]
            hw_dirs_str.sort()
            hw_dirs_str = ' '.join(hw_dirs_str)  # convert back to str
        else:
            hw_dirs_str = "N/A"
        self.st_table.setItem(cur_row, self.st_tab_ind["Folders"],
                              QTableWidgetItem(hw_dirs_str)) # hw folders

        # Finding the report file name and store in report_file variable
        if len(hw_files) > 0:
            # filter out non pdf files
            hw_files = [f for f in hw_files if f.lower().endswith(".pdf")]
            if len(hw_files) > 1:
                self.compile_box_update("{}: multiple PDFs".format(hw_folder))
            if len(hw_files) > 0:  # can be greater than 1, only output one
                report_file = hw_files[0]
            else:
                report_file = "N/A"
        else:   # No report file available
            report_file = "N/A"
        self.st_table.setItem(cur_row, self.st_tab_ind["Report"],
                              QTableWidgetItem(report_file))
        #QApplication.instance().processEvents()

    def compile_box_update(self, text):
        if text == "":  # Ignore input
            return
        self.command += text + "\n"
        self.compile_box.setText(self.command)
        self.compile_box.moveCursor(PyQt5.QtGui.QTextCursor.End)
        QApplication.instance().processEvents()

    # This is called wihen the dialog is closed by pressing x
    def closeEvent(self, event):
        self.c_comp.kill_windows()
        self.mat_compiler.kill_windows()
        if self.is_linux:
            for p in self._processes:
                os.killpg(os.getpgid(p.pid), signal.SIGTERM)
            self._processes.clear()
        elif self.is_windows: # TODO: Add support for windows
            pass
        # TODO: delete folders created in the program, only keep zip files

app = QApplication(sys.argv)
window = MyWindow()
window.show()
sys.exit(app.exec_())


text:
<?php
namespace SONUser\Entity;

use Doctrine\ORM\EntityRepository;

class UserRepository extends EntityRepository
{
    public function findByEmailAndPassword($email, $password)
    {
        $user = $this->findOneByEmail($email);

        if($user){
            $hashSenha = $user->encryptPassword($password);
            if ($hashSenha == $user->getPassword()) {
                return $user;
            } else {
                return false;
            }
        }else{
            return false;
        }
    }

    public function findArray()
    {
        $users = $this->findAll();
        $a = array();
        foreach ($users as $user){
            $a[$user->getId()]['id'] = $user->getId();
            $a[$user->getNome()]['nome'] = $user->getNome();
            $a[$user->getEmail()]['email'] = $user->getEmail();
        }

        return $a;
    }
}


text:
<?php
/**
 * Created by PhpStorm.
 * User: gseidel
 * Date: 2020-06-04
 * Time: 10:22
 */

namespace Enhavo\Bundle\AppBundle\Tests\Action\Type;

use Enhavo\Bundle\AppBundle\Action\Action;
use Enhavo\Bundle\AppBundle\Action\ActionLanguageExpression;
use Enhavo\Bundle\AppBundle\Action\Type\DeleteActionType;
use Enhavo\Bundle\AppBundle\Tests\Mock\ResourceMock;
use Enhavo\Bundle\AppBundle\Tests\Mock\RouterMock;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Security\Csrf\CsrfTokenManager;
use Symfony\Contracts\Translation\TranslatorInterface;

class DeleteActionTypeTest extends TestCase
{
    private function createDependencies()
    {
        $dependencies = new DeleteActionTypeDependencies();
        $dependencies->translator = $this->getMockBuilder(TranslatorInterface::class)->getMock();
        $dependencies->actionLanguageExpression = $this->getMockBuilder(ActionLanguageExpression::class)->disableOriginalConstructor()->getMock();
        $dependencies->router = new RouterMock();
        $dependencies->tokenManager = $this->getMockBuilder(CsrfTokenManager::class)->getMock();
        return $dependencies;
    }

    private function createInstance(DeleteActionTypeDependencies $dependencies)
    {
        return new DeleteActionType(
            $dependencies->translator,
            $dependencies->actionLanguageExpression,
            $dependencies->router,
            $dependencies->tokenManager
        );
    }

    public function testCreateViewData()
    {
        $dependencies = $this->createDependencies();
        $dependencies->translator->method('trans')->willReturnCallback(function ($value) {return $value;});
        $dependencies->tokenManager->method('getToken')->willReturn(new TestCsrfToken());
        $type = $this->createInstance($dependencies);

        $action = new Action($type, [
            'route' => 'delete_route'
        ]);

        $viewData = $action->createViewData(new ResourceMock());

        $this->assertEquals('delete-action', $viewData['component']);
        $this->assertEquals('label.delete', $viewData['label']);
        $this->assertEquals('csrfTok3n', $viewData['token']);
        $this->assertEquals('/delete_route?id=1', $viewData['url']);
    }

    public function testType()
    {
        $dependencies = $this->createDependencies();
        $type = $this->createInstance($dependencies);
        $this->assertEquals('delete', $type->getType());
    }
}

class DeleteActionTypeDependencies
{
    /** @var TranslatorInterface|\PHPUnit_Framework_MockObject_MockObject */
    public $translator;
    /** @var ActionLanguageExpression|\PHPUnit_Framework_MockObject_MockObject */
    public $actionLanguageExpression;
    /** @var RouterInterface|\PHPUnit_Framework_MockObject_MockObject */
    public $router;
    /** @var CsrfTokenManager|\PHPUnit_Framework_MockObject_MockObject */
    public $tokenManager;
}

class TestCsrfToken
{
    public function getValue()
    {
        return 'csrfTok3n';
    }
}


text:
#include "mqsProvider/TreeClient.h"
#include <appUtil/JJJException.h>
#include <appUtil/Shortcuts.h>
namespace mqsProvider
{
	TreeClient::TreeClient(void)
	{
		appUtil::initPointer( m_treePtr );
		appUtil::initPointer( m_buffer );
	}
	TreeClient::TreeClient(
			TreePtr* a_treePtr,
			void* a_buffer )
	{
		appUtil::initPointer( m_treePtr );
		appUtil::initPointer( m_buffer );
		this->setTreePtr( a_treePtr );
		this->setBuffer( a_buffer );
	}
	TreeClient::~TreeClient(void)
	{
	}
	void TreeClient::setTreePtr(
			TreePtr* a_treePtr )
	{
		m_treePtr = a_treePtr;
	}
	void TreeClient::setBuffer(
			void* a_buffer )
	{
		m_buffer = reinterpret_cast<char*>(a_buffer);
	}
	bool TreeClient::isLeaf( unsigned int a_node )
	{
		bool l_isLeaf = NODE_LEFT(m_buffer,a_node) == INDEX_NULL && NODE_RIGHT(m_buffer,a_node) == INDEX_NULL;
		return l_isLeaf;
	}
	bool TreeClient::isLeftChild(
			unsigned int a_node )
	{
		bool l_isLeftChild = NODE_PARENT_LEFT(m_buffer,a_node) == a_node;
		return l_isLeftChild;
	}
	bool TreeClient::isRightChild(
			unsigned int a_node )
	{
		bool l_isRightChild = NODE_PARENT_RIGHT(m_buffer,a_node) == a_node;
		return l_isRightChild;
	}
	bool TreeClient::hasBothChilds(
			unsigned int a_node )
	{
		bool l_hasBothChilds =
			NODE_RIGHT(m_buffer,a_node) != INDEX_NULL &&
			NODE_LEFT(m_buffer,a_node) != INDEX_NULL;
		return l_hasBothChilds;
	}
	bool TreeClient::hasOnlyLeftChild(
			unsigned int a_node )
	{
		bool l_hasOnlyLeftChild =
			NODE_RIGHT(m_buffer,a_node) == INDEX_NULL &&
			NODE_LEFT(m_buffer,a_node) != INDEX_NULL;
		return l_hasOnlyLeftChild;
	}
	bool TreeClient::hasOnlyRightChild(
			unsigned int a_node )
	{
		bool l_hasOnlyRightChild =
			NODE_RIGHT(m_buffer,a_node) != INDEX_NULL &&
			NODE_LEFT(m_buffer,a_node) == INDEX_NULL;
		return l_hasOnlyRightChild;
	}
	bool TreeClient::isRoot(
			unsigned int a_node )
	{
		bool l_isRoot = a_node == m_treePtr->root;
		return l_isRoot;
	}
	void TreeClient::removeRoot( void )
	{
		unsigned int l_leavingRoot = m_treePtr->root;

		if( this->isLeaf( l_leavingRoot ) ){
			m_treePtr->root			= INDEX_NULL;
		} else if( this->hasOnlyLeftChild( l_leavingRoot ) ){
			NODE_LEFT_PARENT(m_buffer,l_leavingRoot) = INDEX_NULL;
			m_treePtr->root = NODE_LEFT(m_buffer,l_leavingRoot);
		} else if( this->hasOnlyRightChild( l_leavingRoot ) ){
			NODE_RIGHT_PARENT(m_buffer,l_leavingRoot) = INDEX_NULL;
			m_treePtr->root = NODE_RIGHT(m_buffer,l_leavingRoot);
		} else if( this->hasBothChilds( l_leavingRoot ) ){
			unsigned int sl_newLeftParent = this->minor( NODE_RIGHT(m_buffer,l_leavingRoot) );
			NODE_LEFT(m_buffer,sl_newLeftParent) = NODE_LEFT(m_buffer,l_leavingRoot);
			NODE_LEFT_PARENT(m_buffer,l_leavingRoot) = sl_newLeftParent;
			m_treePtr->root = NODE_RIGHT(m_buffer,l_leavingRoot);
		}
		NODE_LEFT(m_buffer,l_leavingRoot)		= INDEX_NULL;
		NODE_RIGHT(m_buffer,l_leavingRoot)		= INDEX_NULL;
		NODE_PARENT(m_buffer,l_leavingRoot)		= INDEX_NULL;
	}
	void TreeClient::removeNotRootLeaf(
			unsigned int a_leavingNode )
	{
		if( this->isLeftChild( a_leavingNode ) ){
			NODE_PARENT_LEFT(m_buffer,a_leavingNode)= INDEX_NULL;
			NODE_LEFT(m_buffer,a_leavingNode)		= INDEX_NULL;
			NODE_RIGHT(m_buffer,a_leavingNode)		= INDEX_NULL;
			NODE_PARENT(m_buffer,a_leavingNode)		= INDEX_NULL;
		} else if( this->isRightChild( a_leavingNode ) ){
			NODE_PARENT_RIGHT(m_buffer,a_leavingNode)	= INDEX_NULL;
			NODE_LEFT(m_buffer,a_leavingNode)			= INDEX_NULL;
			NODE_RIGHT(m_buffer,a_leavingNode)			= INDEX_NULL;
			NODE_PARENT(m_buffer,a_leavingNode)			= INDEX_NULL;
		}
	}
	void TreeClient::removeCommon(
			unsigned int a_leavingNode )
	{
		if( this->hasBothChilds( a_leavingNode ) ){

			unsigned int sl_newLeftParent =
					this->minor( NODE_RIGHT(m_buffer,a_leavingNode) );

			if( this->isLeftChild( a_leavingNode ) ){
				NODE_PARENT_LEFT(m_buffer,a_leavingNode) = NODE_RIGHT(m_buffer,a_leavingNode);
				NODE_RIGHT_PARENT(m_buffer,a_leavingNode) = NODE_PARENT(m_buffer,a_leavingNode);
				NODE_LEFT(m_buffer,sl_newLeftParent) = NODE_LEFT(m_buffer,a_leavingNode);
				NODE_LEFT_PARENT(m_buffer,a_leavingNode) = sl_newLeftParent;

			} else if( this->isRightChild( a_leavingNode ) ){
				NODE_PARENT_RIGHT(m_buffer,a_leavingNode) = NODE_RIGHT(m_buffer,a_leavingNode);
				NODE_RIGHT_PARENT(m_buffer,a_leavingNode) = NODE_PARENT(m_buffer,a_leavingNode);
				NODE_LEFT(m_buffer,sl_newLeftParent) = NODE_LEFT(m_buffer,a_leavingNode);
				NODE_LEFT_PARENT(m_buffer,a_leavingNode) = sl_newLeftParent;
			}
		} else if( this->hasOnlyLeftChild( a_leavingNode ) ){
			if( this->isLeftChild( a_leavingNode ) ){
				NODE_LEFT_PARENT(m_buffer,a_leavingNode) = NODE_PARENT(m_buffer,a_leavingNode);
				NODE_PARENT_LEFT(m_buffer,a_leavingNode) = NODE_LEFT(m_buffer,a_leavingNode);
			} else if( this->isRightChild( a_leavingNode ) ){
				NODE_LEFT_PARENT(m_buffer,a_leavingNode) = NODE_PARENT(m_buffer,a_leavingNode);
				NODE_PARENT_RIGHT(m_buffer,a_leavingNode) = NODE_LEFT(m_buffer,a_leavingNode);
			}
		} else if( this->hasOnlyRightChild( a_leavingNode ) ){
			if( this->isLeftChild( a_leavingNode ) ){
				NODE_RIGHT_PARENT(m_buffer,a_leavingNode) = NODE_PARENT(m_buffer,a_leavingNode);
				NODE_PARENT_LEFT(m_buffer,a_leavingNode) = NODE_RIGHT(m_buffer,a_leavingNode);
			} else if( this->isRightChild( a_leavingNode ) ){
				NODE_RIGHT_PARENT(m_buffer,a_leavingNode) = NODE_PARENT(m_buffer,a_leavingNode);
				NODE_PARENT_RIGHT(m_buffer,a_leavingNode) = NODE_RIGHT(m_buffer,a_leavingNode);
			}
		}
		NODE_LEFT(m_buffer,a_leavingNode)	= INDEX_NULL;
		NODE_RIGHT(m_buffer,a_leavingNode)	= INDEX_NULL;
		NODE_PARENT(m_buffer,a_leavingNode)	= INDEX_NULL;
	}

	bool TreeClient::remove(
			unsigned int a_leavingNode )
	{
		appUtil::assertPointer( m_treePtr );
		appUtil::assertPointer( m_buffer );
		RETURN_IF( a_leavingNode == INDEX_NULL, false );

		if( this->isRoot( a_leavingNode ) ){		//Removing ROOT Node
			this->removeRoot();
		} else if( this->isLeaf( a_leavingNode ) ){	//Removing a Leaf (except if it is a root node)
			this->removeNotRootLeaf( a_leavingNode );
		} else {
			this->removeCommon( a_leavingNode );
		}
		m_treePtr->countElements--;

		return true;
	}
	bool TreeClient::insert(
			unsigned int a_newNode,
			const trn_key_t& a_key,
			unsigned int a_attach )
	{
		appUtil::assertPointer( m_treePtr );
		appUtil::assertPointer( m_buffer );
		RETURN_IF( a_newNode == INDEX_NULL, false );

		INIT_TREE_NODE(m_buffer,a_newNode);
		NODE_ATTACH(m_buffer,a_newNode)	= a_attach;
		memcpy( NODE_KEY(m_buffer,a_newNode), a_key, sizeof a_key );

		if( m_treePtr->root == INDEX_NULL ){
			NODE_PARENT(m_buffer,a_newNode)	= INDEX_NULL;
			m_treePtr->root					= a_newNode;
		} else {
			unsigned int l_current	= m_treePtr->root;
			unsigned int l_parent	= INDEX_NULL;
			while(true){
				l_parent = l_current;
				if( strcmp( NODE_KEY(m_buffer,a_newNode), NODE_KEY(m_buffer,l_current) ) < 0 )
				{
					l_current = NODE_LEFT(m_buffer,l_current);
					if( l_current == INDEX_NULL ){
						NODE_LEFT(m_buffer,l_parent)	= a_newNode;
						NODE_PARENT(m_buffer,a_newNode)	= l_parent;
						break;
					}
				} else {
					l_current = NODE_RIGHT(m_buffer,l_current);
					if( l_current == INDEX_NULL ){
						NODE_RIGHT(m_buffer,l_parent)	= a_newNode;
						NODE_PARENT(m_buffer,a_newNode)	= l_parent;
						break;
					}
				}
			}
		}

		m_treePtr->countElements++;
		return true;
	}
	unsigned int TreeClient::minor(
			unsigned int a_startNode )
	{
		unsigned int l_current	= a_startNode;
		unsigned int l_minor = INDEX_NULL;

		while( l_current != INDEX_NULL ){
			l_minor		= l_current;
			l_current	= NODE_LEFT(m_buffer,l_current);
		}

		return l_minor;
	}
	unsigned int TreeClient::find(
			const char* a_key )
	{
		appUtil::assertPointer( m_treePtr );
		appUtil::assertPointer( m_buffer );

		unsigned int l_current	= m_treePtr->root;
		RETURN_IF( l_current == INDEX_NULL, INDEX_NULL );

		const char* l_currentNodeKey = NODE_KEY(m_buffer,l_current);
		int l_comparing = strcmp( a_key, l_currentNodeKey );
		while( l_comparing != 0 ){
			if( l_comparing < 0 ){
				l_current = NODE_LEFT(m_buffer,l_current);
			} else {
				l_current = NODE_RIGHT(m_buffer,l_current);
			}
			if( l_current == INDEX_NULL ){
				break;
			}
			l_currentNodeKey = NODE_KEY(m_buffer,l_current);
			l_comparing = strcmp( a_key, l_currentNodeKey );
		}

		return l_current;
	}
	unsigned int TreeClient::root(void) const
	{
		appUtil::assertPointer( m_treePtr );
		return m_treePtr->root;
	}
	unsigned int TreeClient::count(void) const
	{
		RETURN_IF( m_treePtr == NULL, 0 );

		return m_treePtr->countElements;
	}

	bool TreeClient::scanValidation(void) const
	{
		appUtil::assertPointer( m_treePtr );
		appUtil::assertPointer( m_buffer );

		unsigned int l_root	= m_treePtr->root;
		unsigned int l_countElements = this->scanAndValidate( INDEX_NULL, l_root );
		RETURN_IF( l_countElements == INDEX_NULL || l_countElements != m_treePtr->countElements, false );

		return true;
	}
	unsigned int  TreeClient::scanAndValidate( unsigned int a_parent, unsigned int a_node ) const
	{
		unsigned int l_countElements = 0;
		RETURN_IF( a_node == INDEX_NULL, 0 );
		RETURN_IF( !IS_TREE_NODE_VALID(m_buffer,a_node), INDEX_NULL );
		RETURN_IF( NODE_PARENT(m_buffer,a_node) != a_parent, INDEX_NULL );

		unsigned int l_ret;

		l_ret = scanAndValidate( a_node, NODE_LEFT(m_buffer,a_node) );
		RETURN_IF( l_ret == INDEX_NULL, INDEX_NULL );
		l_countElements += l_ret;
		l_ret = scanAndValidate( a_node, NODE_RIGHT(m_buffer,a_node) );
		RETURN_IF( l_ret == INDEX_NULL, INDEX_NULL );
		l_countElements += l_ret;
		++l_countElements;

		return l_countElements;
	}
}//namespace mqsProvider


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.petslive.repositorios.implementacoes;

import br.com.petslive.repositorios.interfaces.RepositorioGenerico;

/**
 *
 * @author Erick
 */
public class FabricaRepositorio {
    public static final int DB = 1;
    public static final int ANIMAL = 1;
    public static final int CLIENTE = 2;

    public static RepositorioGenerico criarRepositorio (int tipoNegocio, int tipoPersistencia){
        if(tipoPersistencia == DB){
            if(tipoNegocio == ANIMAL){
                return new RepositorioAnimalImplDB();
            }
            if(tipoNegocio == CLIENTE){
                return new RepositorioClienteImplDB();
            }
        }
    return null;
    }

}


text:
package synchronizeds;

/**
 * Created by 李恒名 on 2017/6/14.
 */
public class SynchronizedTest {

    public synchronized void method1(){
        System.out.println("Hello World!");
    }

    public  void method2(){
        synchronized (this){
            System.out.println("Hello World!");
        }
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>Scissorhands.NET</title>
  <subtitle>Static Blogging Engine in ASP.NET Core</subtitle>
  <link href="/atom.xml" rel="self"/>

  <link href="http://getscissorhands.net/"/>
  <updated>2017-01-09T11:01:34.349Z</updated>
  <id>http://getscissorhands.net/</id>

  <author>
    <name>getscissorhands.net</name>

  </author>

  <generator uri="http://hexo.io/">Hexo</generator>

  <entry>
    <title>Re-Engineering</title>
    <link href="http://getscissorhands.net/2017/01/09/re-engineering/"/>
    <id>http://getscissorhands.net/2017/01/09/re-engineering/</id>
    <published>2017-01-09T05:33:12.000Z</published>
    <updated>2017-01-09T11:01:34.349Z</updated>

    <content type="html"><![CDATA[
Since Scissorhands.NET was initially released its alpha version in January, 2016, it hasn't got updated so far because of various reasons. The initial release was written in ASP.NET Core RC1. Now ASP.NET Core has released 1.0.1. It's time to rewrite the code. Actually most bits and pieces can be reused but I wouldn't hurry.

Slow and steady wins the race.

]]></content>

      <p>Since <a href="http://getscissorhands.net">Scissorhands.NET</a> was initially released its <a href="https://www.nuget.org/packages/Scisso

      <category term="wip" scheme="http://getscissorhands.net/tags/wip/"/>

  </entry>

</feed>


text:
package cct.chart;

import org.jfree.data.xy.XYSeriesCollection;

public class DataSet {
  private double y_Min, y_Max;
  private XYSeriesCollection xySC;

  public DataSet(double y_min, double y_max, XYSeriesCollection xySeries) {
    this.y_Min = y_min;
    this.y_Max = y_max;
    xySC = xySeries;
  }

  public XYSeriesCollection getDataCollection() {
    return xySC;
  }

  public double getYMin() {
    return this.y_Min;
  }

  public double getYMax() {
    return this.y_Max;
  }
}


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

namespace Roguelike
{
	abstract class Class
	{
		public string id;

		public int max_strength;
		public int max_wisdom;
		public int max_stealth;
		public int max_charisma;
		public int max_defense;
		public int max_dexterity;
		public int max_willpower;
		public int max_perception;
		public int max_luck;

		ClassStats stats;
	}
	class Warrior : Class
	{
		public int max_strength = 40;
		public int max_wisdom = 20;
		public int max_stealth = 18;
		public int max_charisma = 31;
		public int max_defense = 32;
		public int max_dexterity = 21;
		public int max_willpower = 19;
		public int max_perception = 25;
		public int max_luck = 23;
	}
	class Wizard : Class
	{
		public int max_strength = 21;
		public int max_wisdom = 40;
		public int max_stealth = 23;
		public int max_charisma = 26;
		public int max_defense = 16;
		public int max_dexterity = 29;
		public int max_willpower = 37;
		public int max_perception = 29;
		public int max_luck = 31;
	}
	class Rogue : Class
	{
		public int max_strength = 27;
		public int max_wisdom = 19;
		public int max_stealth = 40;
		public int max_charisma = 16;
		public int max_defense = 14;
		public int max_dexterity = 30;
		public int max_willpower = 21;
		public int max_perception = 32;
		public int max_luck = 28;
	}
	class Archer : Class
	{
		public int max_strength = 25;
		public int max_wisdom = 20;
		public int max_stealth = 34;
		public int max_charisma = 20;
		public int max_defense = 23;
		public int max_dexterity = 25;
		public int max_willpower = 28;
		public int max_perception = 23;
		public int max_luck = 25;
	}
	class Paladin : Class
	{
		public int max_strength = 34;
		public int max_wisdom = 35;
		public int max_stealth = 18;
		public int max_charisma = 31;
		public int max_defense = 32;
		public int max_dexterity = 21;
		public int max_willpower = 24;
		public int max_perception = 25;
		public int max_luck = 28;
	}
	class Beastlord : Class
	{
		public int max_strength = 31;
		public int max_wisdom = 28;
		public int max_stealth = 20;
		public int max_charisma = 18;
		public int max_defense = 30;
		public int max_dexterity = 20;
		public int max_willpower = 28;
		public int max_perception = 29;
		public int max_luck = 27;
	}
}


text:
class CreateSpreeStoreCredits < ActiveRecord::Migration
  def change
    create_table :spree_store_credits do |t|
      t.references :user
      t.references :category
      t.references :created_by
      t.decimal :amount, precision: 8, scale: 2, default: 0.0, null: false
      t.decimal :amount_used, precision: 8, scale: 2, default: 0.0, null: false
      t.decimal :amount_authorized, precision: 8, scale: 2, default: 0.0, null: false
      t.string :currency
      t.text :memo
      t.datetime :spree_store_credits, :deleted_at
      t.timestamps null: true
    end

    add_index :spree_store_credits, :deleted_at
    add_index :spree_store_credits, :user_id
  end
end


text:
create table ACT_RE_DEPLOYMENT (
    ID_ varchar(64),
    NAME_ varchar(255),
    CATEGORY_ varchar(255),
    KEY_ varchar(255),
    TENANT_ID_ varchar(255) default '',
    DEPLOY_TIME_ timestamp,
    ENGINE_VERSION_ varchar(255),
    primary key (ID_)
);

create table ACT_RE_MODEL (
    ID_ varchar(64) not null,
    REV_ integer,
    NAME_ varchar(255),
    KEY_ varchar(255),
    CATEGORY_ varchar(255),
    CREATE_TIME_ timestamp,
    LAST_UPDATE_TIME_ timestamp,
    VERSION_ integer,
    META_INFO_ varchar(4000),
    DEPLOYMENT_ID_ varchar(64),
    EDITOR_SOURCE_VALUE_ID_ varchar(64),
    EDITOR_SOURCE_EXTRA_VALUE_ID_ varchar(64),
    TENANT_ID_ varchar(255) default '',
    primary key (ID_)
);

create table ACT_RU_EXECUTION (
    ID_ varchar(64),
    REV_ integer,
    PROC_INST_ID_ varchar(64),
    BUSINESS_KEY_ varchar(255),
    PARENT_ID_ varchar(64),
    PROC_DEF_ID_ varchar(64),
    SUPER_EXEC_ varchar(64),
    ROOT_PROC_INST_ID_ varchar(64),
    ACT_ID_ varchar(255),
    IS_ACTIVE_ boolean,
    IS_CONCURRENT_ boolean,
    IS_SCOPE_ boolean,
    IS_EVENT_SCOPE_ boolean,
    IS_MI_ROOT_ boolean,
    SUSPENSION_STATE_ integer,
    CACHED_ENT_STATE_ integer,
    TENANT_ID_ varchar(255) default '',
    NAME_ varchar(255),
    START_ACT_ID_ varchar(255),
    START_TIME_ timestamp,
    START_USER_ID_ varchar(255),
    LOCK_TIME_ timestamp,
    IS_COUNT_ENABLED_ boolean,
    EVT_SUBSCR_COUNT_ integer,
    TASK_COUNT_ integer,
    JOB_COUNT_ integer,
    TIMER_JOB_COUNT_ integer,
    SUSP_JOB_COUNT_ integer,
    DEADLETTER_JOB_COUNT_ integer,
    VAR_COUNT_ integer,
    ID_LINK_COUNT_ integer,
    CALLBACK_ID_ varchar(255),
    CALLBACK_TYPE_ varchar(255),
    primary key (ID_)
);

create table ACT_RE_PROCDEF (
    ID_ varchar(64) NOT NULL,
    REV_ integer,
    CATEGORY_ varchar(255),
    NAME_ varchar(255),
    KEY_ varchar(255) NOT NULL,
    VERSION_ integer NOT NULL,
    DEPLOYMENT_ID_ varchar(64),
    RESOURCE_NAME_ varchar(4000),
    DGRM_RESOURCE_NAME_ varchar(4000),
    DESCRIPTION_ varchar(4000),
    HAS_START_FORM_KEY_ boolean,
    HAS_GRAPHICAL_NOTATION_ boolean,
    SUSPENSION_STATE_ integer,
    TENANT_ID_ varchar(255) default '',
    ENGINE_VERSION_ varchar(255),
    primary key (ID_)
);

create table ACT_RU_EVENT_SUBSCR (
    ID_ varchar(64) not null,
    REV_ integer,
    EVENT_TYPE_ varchar(255) not null,
    EVENT_NAME_ varchar(255),
    EXECUTION_ID_ varchar(64),
    PROC_INST_ID_ varchar(64),
    ACTIVITY_ID_ varchar(64),
    CONFIGURATION_ varchar(255),
    CREATED_ timestamp not null,
    PROC_DEF_ID_ varchar(64),
    TENANT_ID_ varchar(255) default '',
    primary key (ID_)
);

create table ACT_EVT_LOG (
    LOG_NR_ SERIAL PRIMARY KEY,
    TYPE_ varchar(64),
    PROC_DEF_ID_ varchar(64),
    PROC_INST_ID_ varchar(64),
    EXECUTION_ID_ varchar(64),
    TASK_ID_ varchar(64),
    TIME_STAMP_ timestamp not null,
    USER_ID_ varchar(255),
    DATA_ bytea,
    LOCK_OWNER_ varchar(255),
    LOCK_TIME_ timestamp null,
    IS_PROCESSED_ smallint default 0
);

create table ACT_PROCDEF_INFO (
	ID_ varchar(64) not null,
    PROC_DEF_ID_ varchar(64) not null,
    REV_ integer,
    INFO_JSON_ID_ varchar(64),
    primary key (ID_)
);

create index ACT_IDX_EXEC_BUSKEY on ACT_RU_EXECUTION(BUSINESS_KEY_);
create index ACT_IDX_EXE_ROOT on ACT_RU_EXECUTION(ROOT_PROC_INST_ID_);
create index ACT_IDX_EVENT_SUBSCR_CONFIG_ on ACT_RU_EVENT_SUBSCR(CONFIGURATION_);
create index ACT_IDX_VARIABLE_TASK_ID on ACT_RU_VARIABLE(TASK_ID_);

create index ACT_IDX_BYTEAR_DEPL on ACT_GE_BYTEARRAY(DEPLOYMENT_ID_);
alter table ACT_GE_BYTEARRAY
    add constraint ACT_FK_BYTEARR_DEPL
    foreign key (DEPLOYMENT_ID_)
    references ACT_RE_DEPLOYMENT (ID_);

alter table ACT_RE_PROCDEF
    add constraint ACT_UNIQ_PROCDEF
    unique (KEY_,VERSION_, TENANT_ID_);

create index ACT_IDX_EXE_PROCINST on ACT_RU_EXECUTION(PROC_INST_ID_);
alter table ACT_RU_EXECUTION
    add constraint ACT_FK_EXE_PROCINST
    foreign key (PROC_INST_ID_)
    references ACT_RU_EXECUTION (ID_);

create index ACT_IDX_EXE_PARENT on ACT_RU_EXECUTION(PARENT_ID_);
alter table ACT_RU_EXECUTION
    add constraint ACT_FK_EXE_PARENT
    foreign key (PARENT_ID_)
    references ACT_RU_EXECUTION (ID_);

create index ACT_IDX_EXE_SUPER on ACT_RU_EXECUTION(SUPER_EXEC_);
alter table ACT_RU_EXECUTION
    add constraint ACT_FK_EXE_SUPER
    foreign key (SUPER_EXEC_)
    references ACT_RU_EXECUTION (ID_);

create index ACT_IDX_EXE_PROCDEF on ACT_RU_EXECUTION(PROC_DEF_ID_);
alter table ACT_RU_EXECUTION
    add constraint ACT_FK_EXE_PROCDEF
    foreign key (PROC_DEF_ID_)
    references ACT_RE_PROCDEF (ID_);

create index ACT_IDX_TSKASS_TASK on ACT_RU_IDENTITYLINK(TASK_ID_);
alter table ACT_RU_IDENTITYLINK
    add constraint ACT_FK_TSKASS_TASK
    foreign key (TASK_ID_)
    references ACT_RU_TASK (ID_);

create index ACT_IDX_ATHRZ_PROCEDEF on ACT_RU_IDENTITYLINK(PROC_DEF_ID_);
alter table ACT_RU_IDENTITYLINK
    add constraint ACT_FK_ATHRZ_PROCEDEF
    foreign key (PROC_DEF_ID_)
    references ACT_RE_PROCDEF (ID_);

create index ACT_IDX_IDL_PROCINST on ACT_RU_IDENTITYLINK(PROC_INST_ID_);
alter table ACT_RU_IDENTITYLINK
    add constraint ACT_FK_IDL_PROCINST
    foreign key (PROC_INST_ID_)
    references ACT_RU_EXECUTION (ID_);

create index ACT_IDX_TASK_EXEC on ACT_RU_TASK(EXECUTION_ID_);
alter table ACT_RU_TASK
    add constraint ACT_FK_TASK_EXE
    foreign key (EXECUTION_ID_)
    references ACT_RU_EXECUTION (ID_);

create index ACT_IDX_TASK_PROCINST on ACT_RU_TASK(PROC_INST_ID_);
alter table ACT_RU_TASK
    add constraint ACT_FK_TASK_PROCINST
    foreign key (PROC_INST_ID_)
    references ACT_RU_EXECUTION (ID_);

create index ACT_IDX_TASK_PROCDEF on ACT_RU_TASK(PROC_DEF_ID_);
alter table ACT_RU_TASK
  add constraint ACT_FK_TASK_PROCDEF
  foreign key (PROC_DEF_ID_)
  references ACT_RE_PROCDEF (ID_);

create index ACT_IDX_VAR_EXE on ACT_RU_VARIABLE(EXECUTION_ID_);
alter table ACT_RU_VARIABLE
    add constraint ACT_FK_VAR_EXE
    foreign key (EXECUTION_ID_)
    references ACT_RU_EXECUTION (ID_);

create index ACT_IDX_VAR_PROCINST on ACT_RU_VARIABLE(PROC_INST_ID_);
alter table ACT_RU_VARIABLE
    add constraint ACT_FK_VAR_PROCINST
    foreign key (PROC_INST_ID_)
    references ACT_RU_EXECUTION(ID_);

create index ACT_IDX_JOB_EXECUTION_ID on ACT_RU_JOB(EXECUTION_ID_);
alter table ACT_RU_JOB
    add constraint ACT_FK_JOB_EXECUTION
    foreign key (EXECUTION_ID_)
    references ACT_RU_EXECUTION (ID_);

create index ACT_IDX_JOB_PROCESS_INSTANCE_ID on ACT_RU_JOB(PROCESS_INSTANCE_ID_);
alter table ACT_RU_JOB
    add constraint ACT_FK_JOB_PROCESS_INSTANCE
    foreign key (PROCESS_INSTANCE_ID_)
    references ACT_RU_EXECUTION (ID_);

create index ACT_IDX_JOB_PROC_DEF_ID on ACT_RU_JOB(PROC_DEF_ID_);
alter table ACT_RU_JOB
    add constraint ACT_FK_JOB_PROC_DEF
    foreign key (PROC_DEF_ID_)
    references ACT_RE_PROCDEF (ID_);

create index ACT_IDX_TIMER_JOB_EXECUTION_ID on ACT_RU_TIMER_JOB(EXECUTION_ID_);
alter table ACT_RU_TIMER_JOB
    add constraint ACT_FK_TIMER_JOB_EXECUTION
    foreign key (EXECUTION_ID_)
    references ACT_RU_EXECUTION (ID_);

create index ACT_IDX_TIMER_JOB_PROCESS_INSTANCE_ID on ACT_RU_TIMER_JOB(PROCESS_INSTANCE_ID_);
alter table ACT_RU_TIMER_JOB
    add constraint ACT_FK_TIMER_JOB_PROCESS_INSTANCE
    foreign key (PROCESS_INSTANCE_ID_)
    references ACT_RU_EXECUTION (ID_);

create index ACT_IDX_TIMER_JOB_PROC_DEF_ID on ACT_RU_TIMER_JOB(PROC_DEF_ID_);
alter table ACT_RU_TIMER_JOB
    add constraint ACT_FK_TIMER_JOB_PROC_DEF
    foreign key (PROC_DEF_ID_)
    references ACT_RE_PROCDEF (ID_);

create index ACT_IDX_SUSPENDED_JOB_EXECUTION_ID on ACT_RU_SUSPENDED_JOB(EXECUTION_ID_);
alter table ACT_RU_SUSPENDED_JOB
    add constraint ACT_FK_SUSPENDED_JOB_EXECUTION
    foreign key (EXECUTION_ID_)
    references ACT_RU_EXECUTION (ID_);

create index ACT_IDX_SUSPENDED_JOB_PROCESS_INSTANCE_ID on ACT_RU_SUSPENDED_JOB(PROCESS_INSTANCE_ID_);
alter table ACT_RU_SUSPENDED_JOB
    add constraint ACT_FK_SUSPENDED_JOB_PROCESS_INSTANCE
    foreign key (PROCESS_INSTANCE_ID_)
    references ACT_RU_EXECUTION (ID_);

create index ACT_IDX_SUSPENDED_JOB_PROC_DEF_ID on ACT_RU_SUSPENDED_JOB(PROC_DEF_ID_);
alter table ACT_RU_SUSPENDED_JOB
    add constraint ACT_FK_SUSPENDED_JOB_PROC_DEF
    foreign key (PROC_DEF_ID_)
    references ACT_RE_PROCDEF (ID_);

create index ACT_IDX_DEADLETTER_JOB_EXECUTION_ID on ACT_RU_DEADLETTER_JOB(EXECUTION_ID_);
alter table ACT_RU_DEADLETTER_JOB
    add constraint ACT_FK_DEADLETTER_JOB_EXECUTION
    foreign key (EXECUTION_ID_)
    references ACT_RU_EXECUTION (ID_);

create index ACT_IDX_DEADLETTER_JOB_PROCESS_INSTANCE_ID on ACT_RU_DEADLETTER_JOB(PROCESS_INSTANCE_ID_);
alter table ACT_RU_DEADLETTER_JOB
    add constraint ACT_FK_DEADLETTER_JOB_PROCESS_INSTANCE
    foreign key (PROCESS_INSTANCE_ID_)
    references ACT_RU_EXECUTION (ID_);

create index ACT_IDX_DEADLETTER_JOB_PROC_DEF_ID on ACT_RU_DEADLETTER_JOB(PROC_DEF_ID_);
alter table ACT_RU_DEADLETTER_JOB
    add constraint ACT_FK_DEADLETTER_JOB_PROC_DEF
    foreign key (PROC_DEF_ID_)
    references ACT_RE_PROCDEF (ID_);

create index ACT_IDX_EVENT_SUBSCR on ACT_RU_EVENT_SUBSCR(EXECUTION_ID_);
alter table ACT_RU_EVENT_SUBSCR
    add constraint ACT_FK_EVENT_EXEC
    foreign key (EXECUTION_ID_)
    references ACT_RU_EXECUTION(ID_);

create index ACT_IDX_MODEL_SOURCE on ACT_RE_MODEL(EDITOR_SOURCE_VALUE_ID_);
alter table ACT_RE_MODEL
    add constraint ACT_FK_MODEL_SOURCE
    foreign key (EDITOR_SOURCE_VALUE_ID_)
    references ACT_GE_BYTEARRAY (ID_);

create index ACT_IDX_MODEL_SOURCE_EXTRA on ACT_RE_MODEL(EDITOR_SOURCE_EXTRA_VALUE_ID_);
alter table ACT_RE_MODEL
    add constraint ACT_FK_MODEL_SOURCE_EXTRA
    foreign key (EDITOR_SOURCE_EXTRA_VALUE_ID_)
    references ACT_GE_BYTEARRAY (ID_);

create index ACT_IDX_MODEL_DEPLOYMENT on ACT_RE_MODEL(DEPLOYMENT_ID_);
alter table ACT_RE_MODEL
    add constraint ACT_FK_MODEL_DEPLOYMENT
    foreign key (DEPLOYMENT_ID_)
    references ACT_RE_DEPLOYMENT (ID_);

create index ACT_IDX_PROCDEF_INFO_JSON on ACT_PROCDEF_INFO(INFO_JSON_ID_);
alter table ACT_PROCDEF_INFO
    add constraint ACT_FK_INFO_JSON_BA
    foreign key (INFO_JSON_ID_)
    references ACT_GE_BYTEARRAY (ID_);

create index ACT_IDX_PROCDEF_INFO_PROC on ACT_PROCDEF_INFO(PROC_DEF_ID_);
alter table ACT_PROCDEF_INFO
    add constraint ACT_FK_INFO_PROCDEF
    foreign key (PROC_DEF_ID_)
    references ACT_RE_PROCDEF (ID_);

alter table ACT_PROCDEF_INFO
    add constraint ACT_UNIQ_INFO_PROCDEF
    unique (PROC_DEF_ID_);

insert into ACT_GE_PROPERTY
values ('schema.version', '6.2.1.0', 1);

insert into ACT_GE_PROPERTY
values ('schema.history', 'create(6.2.1.0)', 1);


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_name">moreneuron</string>
</resources>


text:
package de.fruitfly.ovr;

public class SensorInfo {
	// Not implemented yet
}


text:
How can I update my nodeJS to the latest version

I prefer using [NVM](https://github.com/nvm-sh/nvm) to manage different. Once you [install nvm](https://github.com/nvm-sh/nvm#install-script), you can easily use it in two ways:

```bash
nvm install 12.3
nvm system use 12.3
```

To install a stable release
```bash
nvm install stable
```
For a more direct installation approach you can use the step outlined below

**Node.js v5.x:**

NOTE: If you are using Ubuntu Precise or Debian Wheezy, you might want to read about [running Node.js >= 5.x on older distros.](https://github.com/nodesource/distributions/blob/master/OLDER_DISTROS.md)

	# Using Ubuntu
	curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
	sudo apt-get install -y nodejs

	# Using Debian, as root
	curl -sL https://deb.nodesource.com/setup_5.x | bash -
	apt-get install -y nodejs

**Node.js v4.x:**

NOTE: If you are using Ubuntu Precise or Debian Wheezy, you might want to read about [running Node.js >= 4.x on older distros.](https://github.com/nodesource/distributions/blob/master/OLDER_DISTROS.md)

	# Using Ubuntu
	curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
	sudo apt-get install -y nodejs

	# Using Debian, as root
	curl -sL https://deb.nodesource.com/setup_4.x | bash -
	apt-get install -y nodejs


text:
namespace Mono.Cecil {

	using System;
	using System.IO;
	using System.Reflection;
	using System.Security;
	using SSP = System.Security.Permissions;
	using System.Text;

	using Mono.Cecil.Metadata;
	using Mono.Cecil.Signatures;
	using Mono.Xml;

	internal class SecurityDeclarationReader {

		private SecurityParser m_parser;
		private SignatureReader sr;

		public SecurityDeclarationReader (MetadataRoot root, ReflectionReader reader)
		{
			sr = new SignatureReader (root, reader);
		}

		public SecurityParser Parser {
			get {
				if (m_parser == null)
					m_parser = new SecurityParser ();
				return m_parser;
			}
		}

		public SecurityDeclaration FromByteArray (SecurityAction action, byte [] declaration)
		{
			return FromByteArray (action, declaration, false);
		}

		public SecurityDeclaration FromByteArray (SecurityAction action, byte [] declaration, bool resolve)
		{
			SecurityDeclaration dec = new SecurityDeclaration (action);
#if !CF_1_0 && !CF_2_0
			dec.PermissionSet = new PermissionSet (SSP.PermissionState.None);

			if (declaration == null || declaration.Length == 0)
				return dec;

			if (declaration[0] == 0x2e) {
				// new binary format introduced in 2.0
				int pos = 1;
				int start;
				int numattr = Utilities.ReadCompressedInteger (declaration, pos, out start);
				if (numattr == 0)
					return dec;

				BinaryReader br = new BinaryReader (new MemoryStream (declaration));
				for (int i = 0; i < numattr; i++) {
					pos = start;
					SSP.SecurityAttribute sa = CreateSecurityAttribute (action, br, declaration, pos, out start, resolve);
					if (sa == null) {
						dec.Resolved = false;
						dec.Blob = declaration;
						return dec;
					}

					IPermission p = sa.CreatePermission ();
					dec.PermissionSet.AddPermission (p);
				}
			} else {
				Parser.LoadXml (Encoding.Unicode.GetString (declaration));
				try {
					dec.PermissionSet.FromXml (Parser.ToXml ());
					dec.PermissionSet.ToXml ();
				} catch {
					dec.Resolved = false;
					dec.Blob = declaration;
				}
			}
#endif
			return dec;
		}

#if !CF_1_0 && !CF_2_0
		private SSP.SecurityAttribute CreateSecurityAttribute (SecurityAction action, BinaryReader br, byte [] permset, int pos, out int start, bool resolve)
		{
			string cname = SignatureReader.ReadUTF8String (permset, pos, out start);
			Type secattr = null;

			// note: the SecurityAction parameter isn't important to generate the XML
			SSP.SecurityAttribute sa = null;
			try {
				secattr = Type.GetType (cname, false);
				if (secattr == null)
					return null;

				sa = Activator.CreateInstance (secattr, new object [] {(SSP.SecurityAction) action}) as SSP.SecurityAttribute;
			} catch {}

			if (sa == null)
				return null;

			// encoded length of all parameters (we don't need the value - except the updated pos)
			Utilities.ReadCompressedInteger (permset, start, out pos);
			int numparams = Utilities.ReadCompressedInteger (permset, pos, out start);
			if (numparams == 0)
				return sa;

			br.BaseStream.Position = start;
			for (int j = 0; j < numparams; j++) {
				bool read = false;
				CustomAttrib.NamedArg na = sr.ReadNamedArg (permset, br, ref read, resolve);
				if (!read)
					return null;

				if (na.Field) {
					FieldInfo fi = secattr.GetField (na.FieldOrPropName);
					fi.SetValue (sa, na.FixedArg.Elems[0].Value);
				} else if (na.Property) {
					PropertyInfo pi = secattr.GetProperty (na.FieldOrPropName);
					pi.SetValue (sa, na.FixedArg.Elems[0].Value, null);
				}
			}

			return sa;
		}
#endif
	}
}


text:
class IsUp
    include Cinch::Plugin
    include UtilityFunctions
    require 'uri'
    require 'net/http'

	match /isup (.+)/i, method: :isup

	def isup(m, word)
		return unless ignore_nick(m.user.nick).nil?

		begin
			#url = CGI.escape(word)
			#isup = Nokogiri::HTML(open(url))
			#resp = Net::HTTP.get_response(URI.parse(word))

			response = nil
            Net::HTTP.start(word, 80) {|http|
             response = http.head(word)
            }
            resp = response.code

			if resp == '200'
			    m.reply "IsUp | #{word} | Seems up to me! Sucks to be you."
			else
			    m.reply "IsUp | #{word} | Seems down to me"
			end
		rescue
			m.reply "IsUp | #{word} | Seems down to me"
		end
	end
end


text:
UNIX_AdapterActiveConnectionProvider::UNIX_AdapterActiveConnectionProvider()
{
}

UNIX_AdapterActiveConnectionProvider::~UNIX_AdapterActiveConnectionProvider()
{
}

CIMInstance UNIX_AdapterActiveConnectionProvider::constructInstance(
	const CIMName &className,
	const CIMNamespaceName &nameSpace,
	const UNIX_AdapterActiveConnection &_p)
{
	CIMProperty p;

	CIMInstance inst(className);

	// Set path
	inst.setPath(CIMObjectPath(String(""), // hostname
			nameSpace,
			CIMName("UNIX_AdapterActiveConnection"),
			constructKeyBindings(_p)));

	//CIM_Dependency Properties
	if (_p.getAntecedent(p)) inst.addProperty(p);
	if (_p.getDependent(p)) inst.addProperty(p);

	//CIM_AdapterActiveConnection Properties

	return inst;
}

Array<CIMKeyBinding> UNIX_AdapterActiveConnectionProvider::constructKeyBindings(const UNIX_AdapterActiveConnection& _p)

{

	Array<CIMKeyBinding> keys;

	keys.append(CIMKeyBinding(
		PROPERTY_ANTECEDENT,
		CIMValue(_p.getAntecedent()).toString(),
		CIMKeyBinding::REFERENCE));
	keys.append(CIMKeyBinding(
		PROPERTY_DEPENDENT,
		CIMValue(_p.getDependent()).toString(),
		CIMKeyBinding::REFERENCE));

	return keys;
}

#define UNIX_PROVIDER UNIX_AdapterActiveConnectionProvider
#define UNIX_PROVIDER_NAME "UNIX_AdapterActiveConnectionProvider"
#define CLASS_IMPLEMENTATION UNIX_AdapterActiveConnection
#define CLASS_IMPLEMENTATION_NAME "UNIX_AdapterActiveConnection"
#define BASE_CLASS_NAME "CIM_AdapterActiveConnection"
#define NUMKEYS_CLASS_IMPLEMENTATION 0

#include "UNIXProviderBase.hpp"


text:
"use strict";
/**
 * Injectable completer that allows signaling completion of an asynchronous test. Used internally.
 */
var AsyncTestCompleter = (function () {
    function AsyncTestCompleter() {
        var _this = this;
        this._promise = new Promise(function (res, rej) {
            _this._resolve = res;
            _this._reject = rej;
        });
    }
    AsyncTestCompleter.prototype.done = function (value) { this._resolve(value); };
    AsyncTestCompleter.prototype.fail = function (error, stackTrace) { this._reject(error); };
    Object.defineProperty(AsyncTestCompleter.prototype, "promise", {
        get: function () { return this._promise; },
        enumerable: true,
        configurable: true
    });
    return AsyncTestCompleter;
}());
exports.AsyncTestCompleter = AsyncTestCompleter;
//# sourceMappingURL=async_test_completer.js.map


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <name>Testing utilities for Asakusa DSL Compiler API</name>
  <artifactId>asakusa-compiler-api-testing</artifactId>
  <parent>
    <artifactId>project</artifactId>
    <groupId>com.asakusafw.lang.compiler</groupId>
    <version>0.4.0-SNAPSHOT</version>
  </parent>

  <packaging>jar</packaging>

  <dependencies>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>asakusa-compiler-api</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>com.asakusafw</groupId>
      <artifactId>asakusa-dsl-vocabulary</artifactId>
      <version>${asakusafw.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.asakusafw</groupId>
      <artifactId>asakusa-runtime</artifactId>
      <version>${asakusafw.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-simple</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>jcl-over-slf4j</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-client</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-library</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>


text:
package com.maxplus1.test.utils;

import java.util.UUID;

/**
 * Created by qxloo on 2016/12/13.
 */
public class UUIDUtils {

    public static String getUUID() {
        UUID uuid = UUID.randomUUID();
        String str = uuid.toString();
        // 去掉"-"符号
        String temp = str.substring(0, 8) + str.substring(9, 13) + str.substring(14, 18) + str.substring(19, 23) + str.substring(24);
        return temp;
    }
}


text:
package fm.audiobox.core.models;

import com.google.api.client.util.Key;
import fm.audiobox.core.utils.ModelUtil;

import java.util.List;

/**
 * Albums wrapper model.
 * <p>
 * This is a simple wrapper model to handle album-grouped media files.
 */
public class Albums extends Model {

  private static final String PATH = "/api/v1/playlists/" + ModelUtil.TOKEN_PLACEHOLDER + "/media_files/albums.json";

  @Key
  protected List<? extends Album> albums;

  /**
   * Use this method to get the unique path of the album.
   *
   * @param playlistToken the token of the playlist to query for the album.
   *
   * @return the path of the albums of this playlist
   */
  public static String getPath(String playlistToken) {
    return ModelUtil.interpolate( PATH, playlistToken );
  }

  /**
   * Gets albums.
   *
   * @return the albums
   */
  public List<? extends Album> getAlbums() {
    return this.albums;
  }

}


text:
require 'wargaming_api/world_of_tanks_blitz/clans'

module WargamingApi
  class WargamingApi::WorldOfTanksBlitz::Clans
    class WargamingApi::WorldOfTanksBlitz::Clans::ClanDetails < WargamingApi::WorldOfTanksBlitz::Clans

      attr_accessor :clan_id, :extra

      def initialize
        @application_id = WargamingApi::APP_TOKEN
        @language = 'en'
        @link = 'api.wotblitz.eu/wotb/clans/info'
        @clan_id = 16516
        @extra = ''
      end

      puts 'WorldOfTanksBlitz => Clans -> ClanDetails loaded.'
    end
  end
end


text:
-- phpMyAdmin SQL Dump
-- version 4.7.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Sep 07, 2017 at 04:07 AM
-- Server version: 10.1.25-MariaDB
-- PHP Version: 7.1.7

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `generate_lead`
--

-- --------------------------------------------------------

--
-- Table structure for table `leads`
--

CREATE TABLE `leads` (
  `id` int(11) NOT NULL,
  `first_name` varchar(255) NOT NULL,
  `last_name` varchar(255) NOT NULL,
  `email_address` varchar(255) NOT NULL,
  `phone_number` varchar(255) NOT NULL,
  `address` text NOT NULL,
  `home_sqf` int(11) NOT NULL,
  `date_added` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `leads`
--

INSERT INTO `leads` (`id`, `first_name`, `last_name`, `email_address`, `phone_number`, `address`, `home_sqf`, `date_added`) VALUES
(1, 'test@gmail.com', 'test1', 'test@gmail.com', '232323 2323', 'fdfd dfdfd', 121, 0);

--
-- Indexes for dumped tables
--

--
-- Indexes for table `leads`
--
ALTER TABLE `leads`
  ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `leads`
--
ALTER TABLE `leads`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;


text:
package br.com.oncast.cieloacquirer.bean.transaction.payment;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

import br.com.oncast.cieloacquirer.bean.payment.OrderData;
import br.com.oncast.cieloacquirer.bean.payment.PaymentData;
import br.com.oncast.cieloacquirer.bean.transaction.CieloTransactionResponse;

import com.google.common.base.Objects;

@XmlRootElement(name = "transacao")
@XmlAccessorType(XmlAccessType.NONE)
public class PaymentTransactionResponse implements CieloTransactionResponse {

	private static final long serialVersionUID = 1L;

	@XmlAttribute(name = "id")
	private String id;

	@XmlAttribute(name = "versao")
	private String version;

	@XmlElement(name = "tid")
	private String tid;

	@XmlElement(name = "pan")
	private String pan;

	@XmlElement(name = "dados-pedido")
	private OrderData orderData;

	@XmlElement(name = "forma-pagamento")
	private PaymentData paymentData;

	@XmlElement(name = "status")
	private TransactionStatus status;

	@XmlElement(name = "autenticacao")
	private AuthenticationData authenticationData;

	@XmlElement(name = "autorizacao")
	private AuthorizationData authorizationData;

	public PaymentTransactionResponse() {}

	public String getId() {
		return id;
	}

	public String getVersion() {
		return version;
	}

	public String getTid() {
		return tid;
	}

	public String getPan() {
		return pan;
	}

	public OrderData getOrderData() {
		return orderData;
	}

	public PaymentData getPaymentData() {
		return paymentData;
	}

	public TransactionStatus getTransactionStatus() {
		return status;
	}

	public AuthenticationData getAuthenticationData() {
		return authenticationData;
	}

	public AuthorizationData getAuthorizationData() {
		return authorizationData;
	}

	@Override
	public String toString() {
		return Objects.toStringHelper(this)
				.add("id", id)
				.add("tid", tid)
				.add("pan", pan)
				.add("orderData", orderData)
				.add("paymentData", paymentData)
				.add("status", status)
				.add("authenticationData", authenticationData)
				.add("authorizationData", authorizationData)
				.toString();
	}

}


text:
// This file is part of MOS, the MANTIS Operating System
// See http://mantis.cs.colorado.edu/
//
// Copyright (c) 2007 STMicroelectronics and Politecnico di Torino, Italy
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of the MANTIS Project nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

/** @file mos/dev/msp430-i2c.c
 * @brief I2C BUS driver for MSP430.
 * @author Mohammad Mostafizur Rahman Mozumdar
 * @email  mohammad.mozumdar@polito.it
 * @date Created: 07/03/2007
 */

#ifdef PLATFORM_TELOSB

#include "mutex.h"
#include <msp430x16x.h>
#include "msp430-i2c.h"

static uint8_t* m_buf;
static uint8_t m_len;
static uint8_t m_pos;
static uint8_t m_flags;
static uint8_t readDone=0;
static uint8_t readBuffer=0;
static uint8_t status=0;
mos_mutex_t i2c_mutex;

void nextWrite();
void nextRead();
void processingDone( uint8_t st);

/**
  * Initialize UART0 for I2C .
  *
  * @param config contains all the configuration data (DMA access,addressing mode,Listen mode,
  *        Word mode,Clock source select ..
  */

void msp430_i2c_setModeI2C( msp430_i2c_config_t* config ) {
   // call SIMO.makeInput();// p31
  P3DIR &= ~(0x1 << 1);
  // call SIMO.selectModuleFunc();
  P3SEL |= (0x1 << 1);
  // call UCLK.makeInput(); //p33
  P3DIR &= ~(0x1 << 3);
  // call UCLK.selectModuleFunc();
  P3SEL |= (0x1 << 3);

  U0CTL &= ~(I2C | I2CEN | SYNC);
  U0CTL = SWRST;
  U0CTL |= SYNC | I2C;
  U0CTL &= ~I2CEN;

  U0CTL |= ( ( config->rxdmaen << 7 ) |
             ( config->txdmaen << 6 ) |
             ( config->xa << 4 ) |
             ( config->listen << 3 ) );
  I2CTCTL = 0;
  I2CTCTL = ( ( config->i2cword << 7 ) |
	      ( config->i2crm << 6 )   |
	      ( config->i2cssel << 4 ) );
  I2CPSC = config->i2cpsc;
  I2CSCLH = config->i2csclh;
  I2CSCLL = config->i2cscll;
  I2COA = config->i2coa;
  U0CTL |= I2CEN;
}

/**
  * Get Shift clock
  *
  * @return shift clock which is 16 bits where most significat 8 bits are the value of I2CSCLH and
  *         the least significant bits  are the value of I2CSCLL
  */
uint16_t msp430_i2c_getShiftClock() {
    uint16_t shift;
    shift = I2CSCLH;
    shift <<= 8;
    shift |= I2CSCLL;
    return shift;
}

/**
  * Set Shift clock
  *
  * @param shift clock which is 16 bits where most significat 8 bits are the value of I2CSCLH and
  *         the least significant bits  are the value of I2CSCLL
  */
void  msp430_i2c_setShiftClock( uint16_t shift ) {
    I2CSCLH = shift >> 8;
    I2CSCLL = shift;
}

/**
  * Interrupt sub-routine tracing signal UART0TX_VECTOR
  *
  * The value of the I2CIV
  *    0x04  No acknowledgement
  *    0x8h  Register access ready
  *    0xAh  Receive data ready
  *    0xCh  Transmit data ready
  *
  */

interrupt (UART0TX_VECTOR) uart0_tx_int(void) {

  int i = 0;
  if (msp430_i2c_isI2C())
  switch( I2CIV ) {

    case 0x04:
      if ( I2CDCTL & I2CBB )
	  msp430_i2c_setStopBit();
      while( I2CDCTL & I2CBUSY );
      processingDone( 0 );
      break;

    case 0x08:
      while( (I2CDCTL & I2CBUSY) ) {
	if ( i++ >= TIMEOUT )
	  processingDone( 0 );
      }

      processingDone( 1 );
      break;

    case 0x0A:
      readBuffer= msp430_i2c_getData();
      if (!readDone) nextRead();
      break;

    case 0x0C:
      nextWrite();
      break;

    default:
      break;
   }
}

/**
  * Writing the next byte to the I2C bus from buffer. When I2RM=1, I2CSTP must be set
  * before the last I2CDR value is written. Othwerwise, correct STOP generation will not occur.
  *
  */

void nextWrite() {
  if ( ( m_pos == m_len - 1 ) && ( m_flags & I2C_STOP ) ) {
     msp430_i2c_setStopBit();      // I2CSTP
  }
  else if ( m_pos == m_len ) {
     processingDone( 3 );
     return;
  }
  msp430_i2c_setData( m_buf[ m_pos++ ] ); // writing data to the I2C bus
}

/**
  * Reading received data byte which is stored at I2CDR register and when
  * reading is done send a I2CSTP to stop the transmission
  */
void nextRead() {
  m_buf[ m_pos++ ] = readBuffer; // Reading I2CDR
  if ( m_pos == m_len ) {
    readDone=1;
    if ( m_flags & I2C_STOP )
	{
          msp430_i2c_setStopBit(); //I2CSTP
        }
    else
	{
          processingDone( 2 );
        }
  }
}
/**
  * This function is called when sending/receiving is done, it clears the I2C interrupt
  * flags(I2CIE) and unlock the BUS (i2c_metex)for others who are waiting to use the BUS.
  *
  *@param st contains the status of the operation 0=FAILURE , 0> SUCCESS
  */
void  processingDone( uint8_t st) {
   status=st;
   I2CIE = 0;
  //UNLOCK THE ACCESS OF THE BUS
   mos_mutex_unlock(&i2c_mutex);
}
/**
  *Reading certain amount of bytes from a Device
  *
  *
  *@param flags defines whether it is a repeated start and stop mode (I2C_START|I2C_STOP) or others
  *@param addr  contains the register value from where the reading will start
  *@param len contains the number of bytes to be read from the device
  *@param buf is the buffer to store the receiving bytes
  *@return the value of the processing status 0: Failure , 0> Success
  */
uint8_t msp430_i2c_read (uint8_t flags, uint16_t addr, uint8_t len, uint8_t* buf ) {

  //LOCK THE ACCESS OF THE BUS
  mos_mutex_lock (&i2c_mutex);

  m_buf = buf;
  m_len = len;
  m_flags = flags;
  m_pos = 0;

  readDone=0;
  status=0;

  _DINT();
  msp430_i2c_setMasterMode();
  msp430_i2c_setReceiveMode();

  msp430_i2c_setSlaveAddress( addr );
  msp430_i2c_enableReceiveReady();
  msp430_i2c_enableAccessReady();
  msp430_i2c_enableNoAck();
  if ( flags & I2C_START )
    {
      msp430_i2c_setStartBit();
     _EINT();

   }
  else
    {
      nextRead();
    }

 while (I2CIE !=0);
 return status;

}
/**
  * Writing certain amount of bytes to a Device
  *
  *
  *@param flags defines whether it is a start(I2C_START) or stop(I2C_STOP) mode or both
  *@param addr  contains the address of the slave device
  *@param len contains the number of bytes to be written
  *@para buf buffer that stores the transmition bytes
  *@return the value of the processing status 0: Failure , 0> Success
  */
uint8_t msp430_i2c_write(uint8_t flags, uint16_t addr, uint8_t len,uint8_t *buf ) {

  //LOCK THE ACCESS OF THE BUS
  mos_mutex_lock (&i2c_mutex);

  m_buf = buf;
  m_len = len;
  m_flags = flags;
  m_pos = 0;

  status=0;
  _DINT();
  msp430_i2c_setMasterMode();

  msp430_i2c_setTransmitMode();

  msp430_i2c_setSlaveAddress( addr );

  msp430_i2c_enableTransmitReady();
  msp430_i2c_enableAccessReady();
  msp430_i2c_enableNoAck();

  if ( flags & I2C_START )
     {
        _EINT();
        msp430_i2c_setStartBit();
     }
  else
    {
       nextWrite();
       _EINT();
    }
 while (I2CIE !=0);
 return status;
}
/**
  * Initialize the I2C Bus
  *
  *
  *@param flags contains the configuration data for the I2C bus
  */
void mps430_i2c_init(msp430_i2c_config_t* config)
{
   mos_mutex_init(&i2c_mutex); // Initialize the mutex for the access control of I2C
   msp430_i2c_setModeI2C(config);
}

#endif


text:
name 'nodesource'
license 'MIT Licence'
description 'Installs nodejs from nodesource'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version          '2.4.2'

maintainer 'Gavin Staniforth'
maintainer_email 'gavin@usemarkup.com'

source_url 'https://github.com/usemarkup/chef-node'

supports 'centos'
supports 'debian'
supports 'ubuntu'

chef_version '>= 12.6' if respond_to?(:chef_version)

depends 'compat_resource'


text:
@import HerowConnection;
@import HerowLocationDetection;
@import UserNotifications;
@interface AppDelegate : UIResponder <UIApplicationDelegate, HerowReceiveNotificationContentDelegate,UNUserNotificationCenterDelegate> {
}

@property (strong, nonatomic) UIWindow *window;

@end


text:
extern NSString *kErrorDomain;

// For instantiating a new object
typedef id (^createObjectBlock)(Class class, id value);

@protocol FADescription <NSObject>

@property (nonatomic, copy) Class destinationClass;
@property (nonatomic, copy) NSString *property;
@property (nonatomic) BOOL isRequired;

- (id)mapValue:(id)value error:(NSError **)error;

@end

@interface FADescription : NSObject <FADescription> {
    id (^_creator)(Class class, id value);
}

+ (instancetype)descriptionWithProperty:(NSString *)property;

+ (instancetype)descriptionWithProperty:(NSString *)property class:(Class)destClass;

@property (nonatomic, copy, readonly) FADescription * (^create)(id (^creator)(Class class, id value));
@property (nonatomic, copy, readonly) FADescription * (^map)(NSString *property);
@property (nonatomic, copy, readonly) FADescription * (^required)(BOOL required);

@property (nonatomic, copy) NSString *property;
@property (nonatomic) BOOL isRequired;

@end


text:
import java.io.*;
import java.util.*;

public class AutoComplete {

    static LinkedList<String> sentences = new LinkedList<String>();

    public static void main(String[] args) throws FileNotFoundException {
        /* Define Variables */
        int n = 3;
        Hashtable<String, Hashtable<String, Double>> nGram = new Hashtable<String, Hashtable<String, Double>>();
        Scanner inFile = new Scanner(new File("searchterms.txt"));
        Scanner input = new Scanner(System.in);

        /* Output for progress tracking */
        System.out.println("Reading in search data...");

        /* Populate the LinkedList sentences with data from AOL search dataset */
        while (inFile.hasNext()) {
            String unparsed = inFile.nextLine().intern();
            String[] parsed = unparsed.split("\t");
            sentences.add("<S> " + parsed[1] + " </S>");
        }
        inFile.close();

        /* Output for progress tracking */
        System.out.println("Successfully archived searches.");
        System.out.println("Creating 3 grams...");

        /* Split sentences into words */
        for (String s : sentences) {
            String[] words = s.split("[\\s]");
            for (int i = 0; i <= words.length - n; i++) {
                if (nGram.containsKey(words[i] + " " + words[i + 1])) {
                    //Output for testing
                    //System.out.println("MATCH FOUND! ("+ words[i+2]+") Incrementing...");
                    if (nGram.get(words[i] + " " + words[i + 1]).containsKey(words[i + 2])) {
                        double v = nGram.get(words[i] + " " + words[i + 1]).get(words[i + 2]);
                        v++;
                        nGram.get(words[i] + " " + words[i + 1]).put(words[i + 2], v);
                    } else {
                        nGram.get(words[i] + " " + words[i + 1]).put(words[i + 2], 1.0);
                    }
                } else {
                    //Output for testing
                    //System.out.println("No match found. Adding..." + words[i+2]);
                    nGram.put(words[i] + " " + words[i + 1], createResult(words[i + 2]));
                }
            }
        }

        /* Output for progress tracking */
        System.out.println("Successfully created 3 grams.");

        /* Loop so you can play with this forever */
        String sTerm = "";
        while (true) {
            /* Request User Input */
            System.out.println("Please enter your search terms (or type /q to quit):");
            sTerm = input.nextLine();
            if (sTerm.equalsIgnoreCase("/q")) {
                break;
            }
            /* Format user input */
            String[] terms = sTerm.split("[\\s]");
            if (terms.length < 2) {
                sTerm = "<S> " + terms[0];
                //Output for testing
                //System.out.println(sTerm);
            } else {
                sTerm = terms[terms.length - 2] + " " + terms[terms.length - 1];
                //Output for testing
                //System.out.println(sTerm);
            }

            /* Normalize to percent values */
            double sum = 0;
            try {
                for (String s : nGram.get(sTerm).keySet()) {
                    sum += nGram.get(sTerm).get(s);
                }
                for (String s : nGram.get(sTerm).keySet()) {
                    nGram.get(sTerm).put(s, nGram.get(sTerm).get(s) / sum);
                }
            } catch (Exception NullPointerException) {
                System.out.println("Search query not found in database.");
            }
            /* Give prediction */
            try {
                System.out.println("Prediction: " + prediction(nGram.get(sTerm)) + " (" + Math.round(predValue(nGram.get(sTerm)) * 100) + "%)");
            } catch (Exception NullPointerException) {
                System.out.println("Cannot make a prediction.");
            }

            /* Testing block */
            //System.out.println(nGram.get(sTerm).keySet());
            //System.out.println(nGram.get(sTerm).values());
        }
        input.close();
    }

    /* Needed for scope */
    static final Hashtable<String, Double> createResult(String s) {
        Hashtable<String, Double> result = new Hashtable<String, Double>();
        result.put(s, 1.0);
        return result;
    }

    /* Prediction methods */
    static final String prediction(Hashtable<String, Double> h) {
        String key = "";
        double max = 0;
        for (String s : h.keySet()) {
            if (h.get(s) > max) {
                max = h.get(s);
                key = s;
            }
        }
        return key;
    }

    static final double predValue(Hashtable<String, Double> h) {
        double max = 0;
        for (String s : h.keySet()) {
            if (h.get(s) > max) {
                max = h.get(s);
            }
        }
        return max;
    }
}