text:
<?php

/**
 * dataMigration actions.
 *
 * @package    sf_sandbox
 * @subpackage dataMigration
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 2692 2006-11-15 21:03:55Z fabien $
 */
class dataMigrationActions extends sfActions
{
    public function executeQuote()
    {
    }
    public function executeCreateBigLeg()
    {
        $physicalDirectory = sfConfig::get('sf_upload_dir') . DIRECTORY_SEPARATOR . "bigleg.xls";

        error_reporting(E_ALL ^ E_NOTICE);
        require_once 'excel_reader2.php';
        $data = new Spreadsheet_Excel_Reader($physicalDirectory);

        $totalRow = $data->rowcount($sheet_index = 0);

        for ($x = 2; $x < $totalRow; $x++) {
            print_r("total:".$totalRow."::x:".$x.":".$data->val($x, "B")."
");
            $password = "q1w2e3r4t5";
            $app_user = new AppUser();
            $app_user->setUsername($data->val($x, "B"));
            $app_user->setKeepPassword($password);
            $app_user->setUserpassword($password);
            $app_user->setKeepPassword2($password);
            $app_user->setUserpassword2($password);
            $app_user->setUserRole(Globals::ROLE_DISTRIBUTOR);
            $app_user->setStatusCode(Globals::STATUS_INACTIVE);
            $app_user->setCreatedBy($this->getUser()->getAttribute(Globals::SESSION_USERID, Globals::SYSTEM_USER_ID));
            $app_user->setUpdatedBy($this->getUser()->getAttribute(Globals::SESSION_USERID, Globals::SYSTEM_USER_ID));
            $app_user->save();

            $mlm_distributor = new MlmDistributor();
            $mlm_distributor->setDistributorCode($data->val($x, "B"));
            $mlm_distributor->setUserId($app_user->getUserId());
            $mlm_distributor->setStatusCode(Globals::STATUS_ACTIVE);

            $fullName = trim($data->val($x, "E"));
            $fullName = strtoupper($fullName);

            $mlm_distributor->setFullName($fullName);
            $mlm_distributor->setNickname($data->val($x, "F"));
            $mlm_distributor->setIc("");
            $mlm_distributor->setCountry($data->val($x, "I"));
            $mlm_distributor->setAddress($data->val($x, "J"));
            $mlm_distributor->setAddress2($data->val($x, "K"));
            $mlm_distributor->setCity($data->val($x, "L"));
            $mlm_distributor->setState($data->val($x, "M"));
            $mlm_distributor->setPostcode($data->val($x, "N"));
            $mlm_distributor->setEmail($data->val($x, "O"));
            $mlm_distributor->setAlternateEmail($data->val($x, "P"));
            $mlm_distributor->setContact($data->val($x, "Q"));
            $mlm_distributor->setGender($data->val($x, "R"));
            //$mlm_distributor->setDob($data->val($x, "S"));
            $mlm_distributor->setBankName($data->val($x, "T"));
            $mlm_distributor->setBankAccNo($data->val($x, "W"));
            $mlm_distributor->setBankHolderName($data->val($x, "X"));

            $c = new Criteria();
            $c->add(MlmDistributorPeer::DISTRIBUTOR_CODE, $data->val($x, "AI"));
            $uplineDistDB = MlmDistributorPeer::doSelectOne($c);

            if (!$uplineDistDB) {
                $c = new Criteria();
                $c->add(MlmDistributorPeer::DISTRIBUTOR_CODE, "chia_wee_keat");
                $uplineDistDB = MlmDistributorPeer::doSelectOne($c);
            }

            $mlm_distributor->setTreeLevel($uplineDistDB->getTreeLevel() + 1);
            $mlm_distributor->setUplineDistId($uplineDistDB->getDistributorId());
            $mlm_distributor->setUplineDistCode($uplineDistDB->getDistributorCode());

            //$mlm_distributor->setLeverage($this->getRequestParameter('leverage'));
            //$mlm_distributor->setSpread($this->getRequestParameter('spread'));
            //$mlm_distributor->setDepositCurrency($this->getRequestParameter('deposit_currency'));
            //$mlm_distributor->setDepositAmount($this->getRequestParameter('deposit_amount'));
            //$mlm_distributor->setSignName($this->getRequestParameter('sign_name'));
            //$mlm_distributor->setSignDate(date("Y/m/d h:i:s A"));
            //$mlm_distributor->setTermCondition($this->getRequestParameter('term_condition'));

            $packageDB = MlmPackagePeer::retrieveByPK($data->val($x, "AP"));
            if (!$packageDB) {
                $packageDB = MlmPackagePeer::retrieveByPK(6);
            }

            $mlm_distributor->setRankId($packageDB->getPackageId());
            $mlm_distributor->setRankCode($packageDB->getPackageName());
            $mlm_distributor->setMt4RankId($packageDB->getPackageId());
            $mlm_distributor->setInitRankId($packageDB->getPackageId());
            $mlm_distributor->setInitRankCode($packageDB->getPackageName());
            $mlm_distributor->setRemark("loan account");
            $mlm_distributor->setLoanAccount("Y");
            $mlm_distributor->setPackagePurchaseFlag("N");
            $mlm_distributor->setActiveDatetime(date("Y/m/d h:i:s A"));
            $mlm_distributor->setActivatedBy($this->getUser()->getAttribute(Globals::SESSION_DISTID));
            $mlm_distributor->setProductMte("Y");
            $mlm_distributor->setProductFxgold("Y");
            $mlm_distributor->setCreatedBy($this->getUser()->getAttribute(Globals::SESSION_USERID, Globals::SYSTEM_USER_ID));
            $mlm_distributor->setUpdatedBy($this->getUser()->getAttribute(Globals::SESSION_USERID, Globals::SYSTEM_USER_ID));
            $mlm_distributor->save();

            $treeStructure = $uplineDistDB->getTreeStructure() . "|" . $mlm_distributor->getDistributorId() . "|";
            $mlm_distributor->setTreeStructure($treeStructure);
            $mlm_distributor->save();
        }
        print_r("Done");
        return sfView::HEADER_ONLY;
    }
    public function executeGenerateOctoberRoi()
    {
        $query = "UPDATE mlm_roi_dividend set status_code = 'SUCCESS' WHERE dividend_date <= '2013-09-30 23:59:59'";

        $connection = Propel::getConnection();
        $statement = $connection->prepareStatement($query);
        $resultset = $statement->executeQuery();

        print_r("+++++ ROI Dividend +++++
");
        $con = Propel::getConnection(MlmDailyBonusLogPeer::DATABASE_NAME);

        try {
            $con->begin();

            $dateUtil = new DateUtil();
            $bonusDate = "2013-11-06 23:59:59";

            $format = 'Y-m-d H:i:s';
            $date = date($format, strtotime($bonusDate));

            $c = new Criteria();
            $c->add(MlmRoiDividendPeer::STATUS_CODE, Globals::DIVIDEND_STATUS_PENDING);
            $c->add(MlmRoiDividendPeer::DIVIDEND_DATE, $date, Criteria::LESS_EQUAL);
            $mlmRoiDividendDBs = MlmRoiDividendPeer::doSelect($c);
            var_dump(count($mlmRoiDividendDBs));
            foreach ($mlmRoiDividendDBs as $mlmRoiDividend) {
                $distId = $mlmRoiDividend->getDistId();
                $mt4UserName = $mlmRoiDividend->getMt4UserName();
                $packagePrice = $mlmRoiDividend->getPackagePrice();
                $dividendDate = $mlmRoiDividend->getDividendDate();
                print_r("DistId " . $distId . "
");
                print_r("dividendDate " . $dividendDate . "
");

                //$dividendDateStr = $dateUtil->formatDate("Y-m-j", $dividendDate);
                $dividendDateStr = "2013-11-06";
                $dividendDateFrom = $dividendDateStr . " 00:00:00";
                $dividendDateTo = "2013-11-07 23:59:59";

                $dividendDateFromTS = strtotime($dividendDateFrom);
                $dividendDateToTS = strtotime($dividendDateTo);

                $query = "SELECT mt4_credit, credit_id FROM mlm_daily_dist_mt4_credit WHERE 1=1 "
                     . " AND dist_id = '" . $distId . "' AND mt4_user_name = '" . $mt4UserName . "'"
                     . " AND traded_datetime >= '" . date("Y-m-d H:i:s", $dividendDateFromTS) . "' AND traded_datetime <= '" . date("Y-m-d H:i:s", $dividendDateToTS) . "'";

                //var_dump($query);
                //exit();
                $connection = Propel::getConnection();
                $statement = $connection->prepareStatement($query);
                $resultset = $statement->executeQuery();

                if ($resultset->next()) {
                    $arr = $resultset->getRow();
                    if ($packagePrice > $arr["mt4_credit"]) {
                        $packagePrice = $arr["mt4_credit"];
                    }

                    if ($packagePrice < 0) {
                        $packagePrice = 0;
                    }

                    $dividendAmount = $packagePrice * $mlmRoiDividend->getRoiPercentage();

                    $accountBalance = $this->getAccountBalance($distId, Globals::ACCOUNT_TYPE_ECASH);

                    $mlm_account_ledger = new MlmAccountLedger();
                    $mlm_account_ledger->setDistId($distId);
                    $mlm_account_ledger->setAccountType(Globals::ACCOUNT_TYPE_ECASH);
                    $mlm_account_ledger->setTransactionType(Globals::ACCOUNT_LEDGER_ACTION_FUND_MANAGEMENT);
                    $mlm_account_ledger->setRemark(("Performance Return:".$mlmRoiDividend->getRoiPercentage() * 100)."%, Fund:".$packagePrice);
                    $mlm_account_ledger->setCredit($dividendAmount);
                    $mlm_account_ledger->setDebit(0);
                    $mlm_account_ledger->setBalance($accountBalance + $dividendAmount);
                    $mlm_account_ledger->setCreatedBy($this->getUser()->getAttribute(Globals::SESSION_USERID, Globals::SYSTEM_USER_ID));
                    $mlm_account_ledger->setUpdatedBy($this->getUser()->getAttribute(Globals::SESSION_USERID, Globals::SYSTEM_USER_ID));
                    $mlm_account_ledger->save();

                    $fundManagementBalance = $this->getCommissionBalance($distId, Globals::COMMISSION_TYPE_FUND_MANAGEMENT);

                    $sponsorDistCommissionledger = new MlmDistCommissionLedger();
                    $sponsorDistCommissionledger->setMonthTraded(date('m'));
                    $sponsorDistCommissionledger->setYearTraded(date('Y'));
                    $sponsorDistCommissionledger->setDistId($distId);
                    $sponsorDistCommissionledger->setCommissionType(Globals::COMMISSION_TYPE_FUND_MANAGEMENT);
                    $sponsorDistCommissionledger->setTransactionType(Globals::COMMISSION_LEDGER_DIVIDEND);
                    //$sponsorDistCommissionledger->setRefId($mlm_pip_csv->getPipId());
                    $sponsorDistCommissionledger->setCredit($dividendAmount);
                    $sponsorDistCommissionledger->setDebit(0);
                    $sponsorDistCommissionledger->setStatusCode(Globals::STATUS_ACTIVE);
                    $sponsorDistCommissionledger->setBalance($fundManagementBalance + $dividendAmount);
                    $sponsorDistCommissionledger->setRemark(("Performance Return:".$mlmRoiDividend->getRoiPercentage() * 100)."%, Fund:".$packagePrice);
                    $sponsorDistCommissionledger->setCreatedBy($this->getUser()->getAttribute(Globals::SESSION_USERID, Globals::SYSTEM_USER_ID));
                    $sponsorDistCommissionledger->setUpdatedBy($this->getUser()->getAttribute(Globals::SESSION_USERID, Globals::SYSTEM_USER_ID));
                    $sponsorDistCommissionledger->save();

                    $mt4Username = $mlmRoiDividend->getMt4UserName();
                    // new implement ********************************************************************
                    $c = new Criteria();
                    $c->add(MlmRoiDividendPeer::MT4_USER_NAME, $mt4Username);
                    $totalRecords = MlmRoiDividendPeer::doCount($c);

                    if ($totalRecords < Globals::DIVIDEND_TIMES_ENTITLEMENT) {
                        $c = new Criteria();
                        $c->add(MlmRoiDividendPeer::MT4_USER_NAME, $mt4Username);
                        $c->addDescendingOrderByColumn(MlmRoiDividendPeer::IDX);
                        $mlmRoiDividendDB = MlmRoiDividendPeer::doSelectOne($c);

                        if ($mlmRoiDividendDB) {
                            $idx = $mlmRoiDividendDB->getIdx() + 1;
                            for ($i = $idx; $i <= Globals::DIVIDEND_TIMES_ENTITLEMENT; $i++) {
                                $firstDividendTime = strtotime($mlmRoiDividendDB->getFirstDividendDate());

                                $monthAdded = $idx - 1;
                                $dividendDate = strtotime("+".$monthAdded." months", $firstDividendTime);

                                $mlm_roi_dividend = new MlmRoiDividend();
                                $mlm_roi_dividend->setDistId($mlmRoiDividendDB->getDistId());
                                $mlm_roi_dividend->setMt4UserName($mlmRoiDividendDB->getMt4UserName());
                                $mlm_roi_dividend->setIdx($idx);
                                //$mlm_roi_dividend->setAccountLedgerId($this->getRequestParameter('account_ledger_id'));
                                $mlm_roi_dividend->setDividendDate(date("Y-m-d h:i:s", $dividendDate));
                                $mlm_roi_dividend->setFirstDividendDate($mlmRoiDividendDB->getFirstDividendDate());
                                $mlm_roi_dividend->setPackageId($mlmRoiDividendDB->getPackageId());
                                $mlm_roi_dividend->setPackagePrice($mlmRoiDividendDB->getPackagePrice());
                                $mlm_roi_dividend->setRoiPercentage($mlmRoiDividendDB->getRoiPercentage());
                                //$mlm_roi_dividend->setDevidendAmount($this->getRequestParameter('devidend_amount'));
                                //$mlm_roi_dividend->setRemarks($this->getRequestParameter('remarks'));
                                $mlm_roi_dividend->setStatusCode($mlmRoiDividendDB->getStatusCode());
                                $mlm_roi_dividend->setCreatedBy($this->getUser()->getAttribute(Globals::SESSION_USERID, Globals::SYSTEM_USER_ID));
                                $mlm_roi_dividend->setUpdatedBy($this->getUser()->getAttribute(Globals::SESSION_USERID, Globals::SYSTEM_USER_ID));
                                $mlm_roi_dividend->save();

                                $idx = $idx + 1;
                            }
                        }
                    }
                    // new implement end ~ ********************************************************************

                    print_r($mlmRoiDividend->getMt4UserName() . ":" . $packagePrice . "
");
                    $mlmRoiDividend->setAccountLedgerId($mlm_account_ledger->getAccountId());
                    $mlmRoiDividend->setDividendAmount($dividendAmount);
                    $mlmRoiDividend->setMt4Balance($packagePrice);
                    $mlmRoiDividend->setStatusCode(Globals::DIVIDEND_STATUS_SUCCESS);
                    //$mlm_gold_dividend->setRemarks($this->getRequestParameter('remarks'));
                    $mlmRoiDividend->save();
                }
            }
            $con->commit();
        } catch (PropelException $e) {
            $con->rollback();
            throw $e;
        }

        print_r("Done");
        return sfView::HEADER_ONLY;
    }
    public function executeGenerateRoi()
    {
        print_r("executeGenerateRoi
");
        $c = new Criteria();
        $distMt4s = MlmDistMt4Peer::doSelect($c);

        $idx = 1;
        foreach ($distMt4s as $distMt4) {
            $distDB = MlmDistributorPeer::retrieveByPK($distMt4->getDistId());

            print_r($idx++.":distDB:".$distDB->getDistributorCode()."
");
            /* ****************************************************
           * ROI Divident
           * ***************************************************/
            $dateUtil = new DateUtil();
            $currentDate = $dateUtil->formatDate("Y-m-d", $distDB->getActiveDatetime()) . " 00:00:00";
            $currentDate_timestamp = strtotime($currentDate);
            //$dividendDate = $dateUtil->addDate($currentDate, 30, 0, 0);
            $firstDividendDate = strtotime("+1 months", $currentDate_timestamp);
            for ($x=1; $x <= 18; $x++) {
                $dividendDate = strtotime("+" . $x . " months", $currentDate_timestamp);

                $packageDB = MlmPackagePeer::retrieveByPK($distMt4->getRankId());

                $mlm_roi_dividend = new MlmRoiDividend();
                $mlm_roi_dividend->setDistId($distDB->getDistributorId());
                $mlm_roi_dividend->setIdx($x);
                $mlm_roi_dividend->setMt4UserName($distMt4->getMt4UserName());
                //$mlm_roi_dividend->setAccountLedgerId($this->getRequestParameter('account_ledger_id'));
                $mlm_roi_dividend->setDividendDate(date("Y-m-d h:i:s", $dividendDate));
                $mlm_roi_dividend->setFirstDividendDate(date("Y-m-d h:i:s", $firstDividendDate));
                $mlm_roi_dividend->setPackageId($packageDB->getPackageId());
                $mlm_roi_dividend->setPackagePrice($packageDB->getPrice());
                $mlm_roi_dividend->setRoiPercentage($packageDB->getMonthlyRoi());
                //$mlm_roi_dividend->setDevidendAmount($this->getRequestParameter('devidend_amount'));
                //$mlm_roi_dividend->setRemarks($this->getRequestParameter('remarks'));
                $mlm_roi_dividend->setStatusCode(Globals::DIVIDEND_STATUS_PENDING);
                $mlm_roi_dividend->setCreatedBy($this->getUser()->getAttribute(Globals::SESSION_USERID, Globals::SYSTEM_USER_ID));
                $mlm_roi_dividend->setUpdatedBy($this->getUser()->getAttribute(Globals::SESSION_USERID, Globals::SYSTEM_USER_ID));
                $mlm_roi_dividend->save();
            }
        }
        print_r("Done");
        return sfView::HEADER_ONLY;
    }
    public function executeMigradeMt4()
    {
        print_r("executeMigradeMt4
");
        $c = new Criteria();
        $dists = MlmDistributorPeer::doSelect($c);

        $idx = 1;
        foreach ($dists as $dist) {
            $mt4Username = $dist->getMt4UserName();
            $mt4Password = $dist->getMt4Password();
            $rankId = $dist->getRankId();

            print_r($idx++.":".$mt4Username."
");
            if ($mt4Username == "" || $mt4Username == null) {
                continue;
            }

            $c = new Criteria();
            $c->add(MlmDistMt4Peer::MT4_USER_NAME, $mt4Username);
            $existDistMt4 = MlmDistMt4Peer::doSelectOne($c);

            if (!$existDistMt4) {
                print_r($mt4Username."
");
                $mlmDistMt4 = new MlmDistMt4();
                $mlmDistMt4->setDistId($dist->getDistributorId());
                $mlmDistMt4->setMt4UserName($mt4Username);
                $mlmDistMt4->setMt4Password($mt4Password);
                $mlmDistMt4->setRankId($rankId);
                $mlmDistMt4->setCreatedBy($this->getUser()->getAttribute(Globals::SESSION_USERID, Globals::SYSTEM_USER_ID));
                $mlmDistMt4->setUpdatedBy($this->getUser()->getAttribute(Globals::SESSION_USERID, Globals::SYSTEM_USER_ID));
                $mlmDistMt4->save();
            }
        }

        print_r("Done");
        return sfView::HEADER_ONLY;
    }
    public function executeMigrateMt4Rank()
    {
        $query = "UPDATE mlm_distributor SET mt4_rank_id = rank_id";

        $connection = Propel::getConnection();
        $statement = $connection->prepareStatement($query);
        $resultset = $statement->executeQuery();

        print_r("Done");
        return sfView::HEADER_ONLY;
    }

    public function executeTest() {
        $c = new Criteria();
        $c->add(MlmDistributorPeer::DISTRIBUTOR_ID, 4);
        $dist = MlmDistributorPeer::doSelectOne($c);

        $uplinePackageDB = MlmPackagePeer::retrieveByPK(10);

        $upgraded = $this->doCheckingMaster($dist, $uplinePackageDB);

        if ($upgraded == false) {
            $distId = $dist->getDistributorId();
            //$upgraded = $this->doCheckingProfessional($dist, $uplinePackageDB);

            $totalStandardAccount = $this->getTotalPackage($distId, "5");
            var_dump($totalStandardAccount);
            $totalGroupSales = $this->getTotalGroupSales($distId);
            var_dump($totalGroupSales);

            exit();
        }
    }
    public function executeMigratePackage()
    {
        $c = new Criteria();
        $c->add(MlmDistributorPeer::DISTRIBUTOR_ID, 647);
        $c->addDescendingOrderByColumn(MlmDistributorPeer::TREE_LEVEL);
        $dists = MlmDistributorPeer::doSelect($c);

        $idx = 1;
        foreach ($dists as $dist) {
            print_r($idx++.":".$dist->getDistributorCode()."
");

            $distId = $dist->getDistributorId();
            $packageId = $dist->getRankId();
            $uplinePackageDB = MlmPackagePeer::retrieveByPK($packageId);

            if ($uplinePackageDB) {
                //Upgrade Conditions
                //MIRCO (1,2) TO MINI (3,4)
                //11	PROFESSIONAL ACCOUNT
                //12	MASTER ACCOUNT
                //13	GRAND MASTER ACCOUNT
                //MINI TO STANDARD (5,6,7,8,9,10)
                if ($packageId == 1 || $packageId == 2) {
                    /*$upgraded = $this->doCheckingGrandMaster($dist, $uplinePackageDB);
                    if ($upgraded == false) {
                        $upgraded = $this->doCheckingMaster($dist, $uplinePackageDB);
                    }
                    if ($upgraded == false) {
                        $upgraded = $this->doCheckingProfessional($dist, $uplinePackageDB);
                    }
                    if ($upgraded == false) {*/
                        $upgraded = $this->doCheckingStandard($dist, $uplinePackageDB);
                    //}
                    if ($upgraded == false) {
                        $upgraded = $this->doCheckingMini($dist, $uplinePackageDB);
                    }
                } else if ($packageId == 3 || $packageId == 4) {
                    /*$upgraded = $this->doCheckingGrandMaster($dist, $uplinePackageDB);
                    if ($upgraded == false) {
                        $upgraded = $this->doCheckingMaster($dist, $uplinePackageDB);
                    }
                    if ($upgraded == false) {
                        $upgraded = $this->doCheckingProfessional($dist, $uplinePackageDB);
                    }
                    if ($upgraded == false) {*/
                        $upgraded = $this->doCheckingStandard($dist, $uplinePackageDB);
                    //}
                } else if ($packageId == 5 || $packageId == 6 || $packageId == 7 || $packageId == 8 || $packageId == 9 || $packageId == 10) {
                    /*$upgraded = $this->doCheckingGrandMaster($dist, $uplinePackageDB);
                    if ($upgraded == false) {
                        $upgraded = $this->doCheckingMaster($dist, $uplinePackageDB);
                    }
                    if ($upgraded == false) {
                        $upgraded = $this->doCheckingProfessional($dist, $uplinePackageDB);
                    }*/
                } else if ($packageId == 11) {
                   /* $upgraded = $this->doCheckingGrandMaster($dist, $uplinePackageDB);
                    if ($upgraded == false) {
                        $upgraded = $this->doCheckingMaster($dist, $uplinePackageDB);
                    }*/
                } else if ($packageId == 12) {
                    //$upgraded = $this->doCheckingGrandMaster($dist, $uplinePackageDB);
                }
            } else {
                print_r("################################################### not exist");
            }
        }

        print_r("Done");
        return sfView::HEADER_ONLY;
    }
    function doCheckingMaster($dist, $uplinePackageDB)
    {
        $distId = $dist->getDistributorId();
        $totalMircoAccount = $this->getTotalPackage($distId, "1");
        $totalMiniAccount = $this->getTotalPackage($distId, "3");
        $totalStandardAccount = $this->getTotalPackage($distId, "5");
        $totalProfessionAccount = $this->getTotalPackage($distId, "11");

        if ($totalProfessionAccount >= 5) {
            $totalGroupSales = $this->getTotalGroupSales($distId);

            if ($totalGroupSales >= 500000) {
                $upgradedPackage = MlmPackagePeer::retrieveByPK(12);

                $promotePackageName = $upgradedPackage->getPackageName();
                $fromPackageName = $uplinePackageDB->getPackageName();

                $mlmPackageUpgradeHistory = new MlmPackageUpgradeHistory();
                $mlmPackageUpgradeHistory->setDistId($distId);
                $mlmPackageUpgradeHistory->setTransactionCode(Globals::ACCOUNT_LEDGER_ACTION_PACKAGE_PROMO);
                $mlmPackageUpgradeHistory->setAmount(0);
                $mlmPackageUpgradeHistory->setPackageId($upgradedPackage->getPackageId());
                $mlmPackageUpgradeHistory->setStatusCode(Globals::STATUS_COMPLETE);
                $mlmPackageUpgradeHistory->setRemarks("PACKAGE UPGRADED FROM ".$fromPackageName." => ".$promotePackageName.", PACKAGE NAME:".$promotePackageName.", TOTAL PACKAGE:".$totalProfessionAccount. ", TOTAL GROUP SALES:".$totalGroupSales);
                $mlmPackageUpgradeHistory->setCreatedBy($this->getUser()->getAttribute(Globals::SESSION_USERID, Globals::SYSTEM_USER_ID));
                $mlmPackageUpgradeHistory->setUpdatedBy($this->getUser()->getAttribute(Globals::SESSION_USERID, Globals::SYSTEM_USER_ID));
                $mlmPackageUpgradeHistory->save();

                $dist->setRankId($upgradedPackage->getPackageId());
                $dist->setRankCode($upgradedPackage->getPackageName());
                $dist->save();

                return true;
            }
        }

        return false;
    }
    function doCheckingMini($dist, $uplinePackageDB)
    {
        $distId = $dist->getDistributorId();
        $totalMircoAccount = $this->getTotalPackage($distId, "1");
        //var_dump($totalMircoAccount);
        //exit();
        if ($totalMircoAccount >= 5) {
            $upgradedPackage = MlmPackagePeer::retrieveByPK(3);

            $promotePackageName = $upgradedPackage->getPackageName();
            $fromPackageName = $uplinePackageDB->getPackageName();

            $mlmPackageUpgradeHistory = new MlmPackageUpgradeHistory();
            $mlmPackageUpgradeHistory->setDistId($distId);
            $mlmPackageUpgradeHistory->setTransactionCode(Globals::ACCOUNT_LEDGER_ACTION_PACKAGE_PROMO);
            $mlmPackageUpgradeHistory->setAmount(0);
            $mlmPackageUpgradeHistory->setPackageId($upgradedPackage->getPackageId());
            $mlmPackageUpgradeHistory->setStatusCode(Globals::STATUS_COMPLETE);
            $mlmPackageUpgradeHistory->setRemarks("PACKAGE UPGRADED FROM ".$fromPackageName." => ".$promotePackageName.", PACKAGE NAME:".$promotePackageName.", TOTAL PACKAGE:".$totalMircoAccount);
            $mlmPackageUpgradeHistory->setCreatedBy($this->getUser()->getAttribute(Globals::SESSION_USERID, Globals::SYSTEM_USER_ID));
            $mlmPackageUpgradeHistory->setUpdatedBy($this->getUser()->getAttribute(Globals::SESSION_USERID, Globals::SYSTEM_USER_ID));
            $mlmPackageUpgradeHistory->save();

            $dist->setRankId($upgradedPackage->getPackageId());
            $dist->setRankCode($upgradedPackage->getPackageName());
            $dist->save();

            return true;
        }

        return false;
    }
    function doCheckingStandard($dist, $uplinePackageDB)
    {
        $distId = $dist->getDistributorId();
        //$totalMircoAccount = $this->getTotalPackage($distId, "1");
        $totalMiniAccount = $this->getTotalPackage($distId, "3");
        var_dump($totalMiniAccount);
        exit();
        if ($totalMiniAccount >= 5) {
            $upgradedPackage = MlmPackagePeer::retrieveByPK(5);

            $promotePackageName = $upgradedPackage->getPackageName();
            $fromPackageName = $uplinePackageDB->getPackageName();

            $mlmPackageUpgradeHistory = new MlmPackageUpgradeHistory();
            $mlmPackageUpgradeHistory->setDistId($distId);
            $mlmPackageUpgradeHistory->setTransactionCode(Globals::ACCOUNT_LEDGER_ACTION_PACKAGE_PROMO);
            $mlmPackageUpgradeHistory->setAmount(0);
            $mlmPackageUpgradeHistory->setPackageId($upgradedPackage->getPackageId());
            $mlmPackageUpgradeHistory->setStatusCode(Globals::STATUS_COMPLETE);
            $mlmPackageUpgradeHistory->setRemarks("PACKAGE UPGRADED FROM ".$fromPackageName." => ".$promotePackageName.", PACKAGE NAME:".$promotePackageName.", TOTAL PACKAGE:".$totalMiniAccount);
            $mlmPackageUpgradeHistory->setCreatedBy($this->getUser()->getAttribute(Globals::SESSION_USERID, Globals::SYSTEM_USER_ID));
            $mlmPackageUpgradeHistory->setUpdatedBy($this->getUser()->getAttribute(Globals::SESSION_USERID, Globals::SYSTEM_USER_ID));
            $mlmPackageUpgradeHistory->save();

            $dist->setRankId($upgradedPackage->getPackageId());
            $dist->setRankCode($upgradedPackage->getPackageName());
            $dist->save();

            return true;
        }

        return false;
    }
    function doCheckingProfessional($dist, $uplinePackageDB)
    {
        $distId = $dist->getDistributorId();
        //$totalMircoAccount = $this->getTotalPackage($distId, "1");
        //$totalMiniAccount = $this->getTotalPackage($distId, "3");
        $totalStandardAccount = $this->getTotalPackage($distId, "5");

        if ($totalStandardAccount >= 5) {
            $totalGroupSales = $this->getTotalGroupSales($distId);

            if ($totalGroupSales >= 200000) {
                $upgradedPackage = MlmPackagePeer::retrieveByPK(11);

                $promotePackageName = $upgradedPackage->getPackageName();
                $fromPackageName = $uplinePackageDB->getPackageName();

                $mlmPackageUpgradeHistory = new MlmPackageUpgradeHistory();
                $mlmPackageUpgradeHistory->setDistId($distId);
                $mlmPackageUpgradeHistory->setTransactionCode(Globals::ACCOUNT_LEDGER_ACTION_PACKAGE_PROMO);
                $mlmPackageUpgradeHistory->setAmount(0);
                $mlmPackageUpgradeHistory->setPackageId($upgradedPackage->getPackageId());
                $mlmPackageUpgradeHistory->setStatusCode(Globals::STATUS_COMPLETE);
                $mlmPackageUpgradeHistory->setRemarks("PACKAGE UPGRADED FROM ".$fromPackageName." => ".$promotePackageName.", PACKAGE NAME:".$promotePackageName.", TOTAL PACKAGE:".$totalStandardAccount. ", TOTAL GROUP SALES:".$totalGroupSales);
                $mlmPackageUpgradeHistory->setCreatedBy($this->getUser()->getAttribute(Globals::SESSION_USERID, Globals::SYSTEM_USER_ID));
                $mlmPackageUpgradeHistory->setUpdatedBy($this->getUser()->getAttribute(Globals::SESSION_USERID, Globals::SYSTEM_USER_ID));
                $mlmPackageUpgradeHistory->save();

                $dist->setRankId($upgradedPackage->getPackageId());
                $dist->setRankCode($upgradedPackage->getPackageName());
                $dist->save();

                return true;
            }
        }

        return false;
    }
    function doCheckingGrandMaster($dist, $uplinePackageDB)
    {
        $distId = $dist->getDistributorId();
        //$totalMircoAccount = $this->getTotalPackage($distId, "1");
        //$totalMiniAccount = $this->getTotalPackage($distId, "3");
        //$totalStandardAccount = $this->getTotalPackage($distId, "5");
        //$totalProfessionAccount = $this->getTotalPackage($distId, "11");
        $totalMasterAccount = $this->getTotalPackage($distId, "12");

        if ($totalMasterAccount >= 5) {
            $totalGroupSales = $this->getTotalGroupSales($distId);

            if ($totalGroupSales >= 1000000) {
                $upgradedPackage = MlmPackagePeer::retrieveByPK(13);

                $promotePackageName = $upgradedPackage->getPackageName();
                $fromPackageName = $uplinePackageDB->getPackageName();

                $mlmPackageUpgradeHistory = new MlmPackageUpgradeHistory();
                $mlmPackageUpgradeHistory->setDistId($distId);
                $mlmPackageUpgradeHistory->setTransactionCode(Globals::ACCOUNT_LEDGER_ACTION_PACKAGE_PROMO);
                $mlmPackageUpgradeHistory->setAmount(0);
                $mlmPackageUpgradeHistory->setPackageId($upgradedPackage->getPackageId());
                $mlmPackageUpgradeHistory->setStatusCode(Globals::STATUS_COMPLETE);
                $mlmPackageUpgradeHistory->setRemarks("PACKAGE UPGRADED FROM ".$fromPackageName." => ".$promotePackageName.", PACKAGE NAME:".$promotePackageName.", TOTAL PACKAGE:".$totalMasterAccount. ", TOTAL GROUP SALES:".$totalGroupSales);
                $mlmPackageUpgradeHistory->setCreatedBy($this->getUser()->getAttribute(Globals::SESSION_USERID, Globals::SYSTEM_USER_ID));
                $mlmPackageUpgradeHistory->setUpdatedBy($this->getUser()->getAttribute(Globals::SESSION_USERID, Globals::SYSTEM_USER_ID));
                $mlmPackageUpgradeHistory->save();

                $dist->setRankId($upgradedPackage->getPackageId());
                $dist->setRankCode($upgradedPackage->getPackageName());
                $dist->save();

                return true;
            }
        }

        return false;
    }
    function getTotalGroupSales($distributorId)
    {
        $currentDate = date("Y-m-d");
        $currentDateTime = strtotime($currentDate);
        $month3Date = strtotime("-3 months", $currentDateTime);

        $dateUtil = new DateUtil();
        $dateFrom = $dateUtil->formatDate("Y-m-d", $month3Date);
        $dateTo = $dateUtil->formatDate("Y-m-d", $currentDate);

        $query = "SELECT SUM(package.price) as SUB_TOTAL
                    FROM mlm_distributor dist
                        LEFT JOIN mlm_package package ON package.package_id = dist.mt4_rank_id
                    WHERE dist.tree_structure like '%|".$distributorId."|%'
                        AND dist.status_code = '".Globals::STATUS_ACTIVE ."'
                        AND dist.distributor_id <> ".$distributorId;

        $dateFrom = $dateFrom . " 00:00:00";
        $dateTo = $dateTo . " 23:59:59";

        $query .= " AND dist.created_on >= '".$dateFrom."' AND dist.created_on <='".$dateTo."'";

        $connection = Propel::getConnection();
        $statement = $connection->prepareStatement($query);
        $resultset = $statement->executeQuery();

        if ($resultset->next()) {
            $arr = $resultset->getRow();
            if ($arr["SUB_TOTAL"] != null) {
                return $arr["SUB_TOTAL"];
            } else {
                return 0;
            }
        }
        return 0;
    }

    function executeMigrateMt4Password()
    {
        $physicalDirectory = sfConfig::get('sf_upload_dir') . DIRECTORY_SEPARATOR . "mt4_password.xls";

        error_reporting(E_ALL ^ E_NOTICE);
        require_once 'excel_reader2.php';
        $data = new Spreadsheet_Excel_Reader($physicalDirectory);

        $totalRow = $data->rowcount($sheet_index = 0);
        for ($x = $totalRow; $x > 0; $x--) {
            $mt4Username = $data->val($x, "B");
            $mt4Password = $data->val($x, "C");

            $c = new Criteria();
            $c->add(MlmDistMt4Peer::MT4_USER_NAME, $mt4Username);
            $mlmDistMt4 = MlmDistMt4Peer::doSelectOne($c);

            if ($mlmDistMt4) {
                $mlmDistMt4->setMt4Password($mt4Password);
                $mlmDistMt4->save();
            }
        }
        print_r("Done");
        return sfView::HEADER_ONLY;
    }
    function getTotalPackage($distId, $packageIdString)
    {
        $c = new Criteria();
        $c->add(MlmDistributorPeer::UPLINE_DIST_ID, $distId);
        $dists = MlmDistributorPeer::doSelect($c);

        $totalCount = 0;
        foreach ($dists as $dist)
        {
            $query = "SELECT count(rank_id) AS SUB_TOTAL
	            FROM mlm_distributor WHERE status_code = '".Globals::STATUS_ACTIVE."'
	                AND tree_structure like '%|".$dist->getDistributorId()."|%' AND rank_id >= ".$packageIdString;
//	                AND tree_structure like '%|".$dist->getDistributorId()."|%' AND rank_id IN (".$packageIdString.")";

            $connection = Propel::getConnection();
            $statement = $connection->prepareStatement($query);
            $resultset = $statement->executeQuery();

            if ($resultset->next()) {
                $arr = $resultset->getRow();

                if ($arr["SUB_TOTAL"] != null) {
                    if ($arr["SUB_TOTAL"] > 0) {
                        $totalCount += 1;
                    }
                }
            }
        }
        return $totalCount;
    }

    function getAccountBalance($distributorId, $accountType)
    {
        $query = "SELECT SUM(credit-debit) AS SUB_TOTAL FROM mlm_account_ledger WHERE dist_id = " . $distributorId . " AND account_type = '" . $accountType . "'";

        $connection = Propel::getConnection();
        $statement = $connection->prepareStatement($query);
        $resultset = $statement->executeQuery();

        if ($resultset->next()) {
            $arr = $resultset->getRow();
            if ($arr["SUB_TOTAL"] != null) {
                return $arr["SUB_TOTAL"];
            } else {
                return 0;
            }
        }
        return 0;
    }

    function getCommissionBalance($distributorId, $commissionType)
    {
        $query = "SELECT SUM(credit-debit) AS SUB_TOTAL FROM mlm_dist_commission_ledger WHERE dist_id = " . $distributorId . " AND commission_type = '" . $commissionType . "'";

        $connection = Propel::getConnection();
        $statement = $connection->prepareStatement($query);
        $resultset = $statement->executeQuery();

        if ($resultset->next()) {
            $arr = $resultset->getRow();
            if ($arr["SUB_TOTAL"] != null) {
                return $arr["SUB_TOTAL"];
            } else {
                return 0;
            }
        }
        return 0;
    }
}


text: ${current}

redpajama_set_name: RedPajamaGithub


text:
package com.huawei.streaming.cql.semanticanalyzer.parser.context;

import java.util.List;

import com.huawei.streaming.api.opereators.JoinType;
import com.huawei.streaming.cql.DriverContext;
import com.huawei.streaming.cql.exception.CQLException;
import com.huawei.streaming.cql.exception.SemanticAnalyzerException;
import com.huawei.streaming.cql.hooks.SemanticAnalyzeHook;
import com.huawei.streaming.cql.semanticanalyzer.SemanticAnalyzer;
import com.huawei.streaming.cql.semanticanalyzer.parsecontextwalker.ParseContextWalker;
import com.huawei.streaming.cql.tasks.Task;

/**
 * Join右侧内容解析结果
 *
 */
public class JoinRightBodyContext extends ParseContext
{

    private JoinType joinType;

    private FromSourceContext rightStream;

    private OnConditionContext onCondition;

    /**
     * {@inheritDoc}
     */
    @Override
    public String toString()
    {
        StringBuilder sb = new StringBuilder();
        sb.append(" " + getJoinOperator());
        sb.append(" " + rightStream.toString());
        if (onCondition != null)
        {
            sb.append(" ON " + onCondition.toString());
        }

        return sb.toString();
    }

    private String getJoinOperator()
    {
        switch (joinType)
        {
            case LEFT_OUTER_JOIN:
                return "LEFT OUTER JOIN";
            case RIGHT_OUTER_JOIN:
                return "RIGHT OUTER JOIN";
            case FULL_OUTER_JOIN:
                return "FULL OUTER JOIN";
            case NATURAL_JOIN:
                return "NATURAL JOIN";
            case CROSS_JOIN:
                return "CROSS JOIN";
            default:
                return "INNER JOIN";
        }
    }

    public JoinType getJoinType()
    {
        return joinType;
    }

    public void setJoinType(JoinType joinType)
    {
        this.joinType = joinType;
    }

    public FromSourceContext getRightStream()
    {
        return rightStream;
    }

    public void setRightStream(FromSourceContext rightStream)
    {
        this.rightStream = rightStream;
    }

    public OnConditionContext getOnCondition()
    {
        return onCondition;
    }

    public void setOnCondition(OnConditionContext onCondition)
    {
        this.onCondition = onCondition;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Task createTask(DriverContext driverContext, List<SemanticAnalyzeHook> analyzeHooks)
        throws CQLException
    {
        return null;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public SemanticAnalyzer createAnalyzer()
        throws SemanticAnalyzerException
    {
        return null;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected void walkChild(ParseContextWalker walker)
    {
        walkExpression(walker, onCondition);
        walkExpression(walker, rightStream);
    }

}


text:
const packageJson = require('package-json');
const pJson = require('../package.json');

packageJson(pJson.name.toLowerCase()).then((result) => {
  if (result.version === pJson.version) {
    console.log('This version of package has been already released');
    process.exit(1);
  } else {
    console.log(pJson.version);
    process.exit(0);
  }
}).catch((error) => {
  process.exit(0);
});


text:
var accountId = 12345

/**
 * Visitor for adding a top-level must account term to an ElasticSearch query.
 */
module.exports = {
  visitor: {
    bool: function (path) {
      // Ensure a must node exists and is an array.
      path.node.bool.must = path.node.bool.must || []
      if (!Array.isArray(path.node.bool.must)) {
        path.node.bool.must = [path.node.bool.must]
      }

      // Prepend an account term to the must.
      path.node.bool.must.unshift({ term: { account: accountId } })

      // Stop traversal. Only apply transform to the first bool traversed.
      path.stop()
    }
  }
}


text:
package com.quakearts.webapp.facelets.util;

import java.math.BigInteger;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Map;

import javax.el.ELContext;
import javax.el.ValueExpression;
import javax.faces.event.AbortProcessingException;

public class ObjectExtractor {

	public static String extractString(ValueExpression stringExpression, ELContext ctx){
		if(stringExpression==null)
			return null;

		Object stringValue = stringExpression.getValue(ctx);
		if(stringValue == null)
			return null;
		else
			return stringValue.toString();
	}

	@SuppressWarnings({ "rawtypes", "unchecked" })
	public static Collection extractCollection(ValueExpression collectionExpression, ELContext ctx){
		if(collectionExpression==null)
			return null;

		Object collectionValue = collectionExpression.getValue(ctx);
		if(collectionValue == null)
			return null;
		else{
			if(collectionValue instanceof Collection)
				return (Collection) collectionValue;
			else{
				Collection col = new ArrayList();
				col.add(collectionValue);
				return col;
			}
		}
	}

	@SuppressWarnings({ "rawtypes", "unchecked" })
	public static List extractList(ValueExpression listExpression, ELContext ctx){
		if(listExpression==null)
			return null;

		Object listValue = listExpression.getValue(ctx);
		if(listValue == null)
			return null;
		else{
			if(listValue instanceof List)
				return (List) listValue;
			else{
				List col = new ArrayList();
				col.add(listValue);
				return col;
			}
		}
	}

	@SuppressWarnings({ "rawtypes" })
	public static Map extractMap(ValueExpression mapExpression, ELContext ctx){
		if(mapExpression==null)
			return null;

		Object mapValue = mapExpression.getValue(ctx);
		if(mapValue == null)
			return null;
		else{
			if(mapValue instanceof Map)
				return (Map) mapValue;
			else{
				throw new AbortProcessingException("Value is not of type java.util.Map");
			}
		}
	}

	public static boolean extractBoolean(ValueExpression booleanExpression, ELContext ctx){
		if(booleanExpression==null)
			return false;
		Object booleanValue = booleanExpression.getValue(ctx);
		return booleanValue instanceof Boolean?((Boolean)booleanValue).booleanValue():
			(booleanValue !=null?Boolean.parseBoolean(booleanValue.toString()):false);
	}

	public static Date extractDate(ValueExpression dateExpression, ELContext ctx, String attribute, String dateFormat){
		if(dateExpression==null)
			return null;

		Object dateValue = dateExpression.getValue(ctx);
		if(dateValue!=null)
		try {
			return dateValue instanceof Date?((Date)dateValue):(new SimpleDateFormat(dateFormat)).parse(dateValue.toString());
		} catch (ParseException e) {
			throw new AbortProcessingException(e);
		}
		return null;
	}

	public static long extractLong(ValueExpression longExpression, ELContext ctx){
		if(longExpression==null)
			throw new AbortProcessingException("Value cannot be null");

		Object longValue = longExpression.getValue(ctx);
		if(longValue == null)
			throw new AbortProcessingException("Value cannot be null");

		if(longValue instanceof Long)
			return ((Long)longValue).longValue();
		else if(longValue instanceof BigInteger){
			return ((BigInteger)longValue).longValue();
		}else{
			try{
				return Long.parseLong(longValue.toString());
			}catch(Exception e){
				throw new AbortProcessingException("Value '"+longValue+"' is not a valid long integer.",e);
			}
		}
	}

	public static int extractInteger(ValueExpression intExpression, ELContext ctx){
		if(intExpression == null)
			throw new AbortProcessingException("Value cannot be null");

		Object intValue = intExpression.getValue(ctx);
		if(intValue == null)
			throw new AbortProcessingException("Value cannot be null");

		if(intValue instanceof Integer)
			return ((Integer)intValue).intValue();
		else if(intValue instanceof BigInteger){
			return ((BigInteger)intValue).intValue();
		}else{
			try{
				return Integer.parseInt(intValue.toString());
			}catch(Exception e){
				throw new AbortProcessingException("Value '"+intValue+"' is not a valid integer",e);
			}
		}
	}

	public static double extractDouble(ValueExpression doubleExpression, ELContext ctx){
		if(doubleExpression == null)
			throw new AbortProcessingException("Value cannot be null");

		Object doubleValue = doubleExpression.getValue(ctx);
		if(doubleValue == null)
			throw new AbortProcessingException("Value cannot be null");

		if(doubleValue instanceof Integer)
			return ((Integer)doubleValue).doubleValue();
		else if(doubleValue instanceof BigInteger)
			return ((BigInteger)doubleValue).doubleValue();
		else if(doubleValue instanceof Double)
			return (Double)doubleValue;
		else{
			try{
				return Double.parseDouble(doubleValue.toString());
			}catch(Exception e){
				throw new AbortProcessingException("Value '"+doubleValue+"' is not a valid integer",e);
			}
		}
	}

}


text:
<?php

class ReporteListadoGeneral {

	// VARIABLES DE ENTRADA ************************************************************************
	public $idCatEstado;

	// VARIABLES DEL REPORTE ******************************************************************************************
	public $arrJurisdicciones = array();
	public $arrPacientesReporteListadoGeneral = array();
	// VARIABLES DEL REPORTE ******************************************************************************************
	public $error = false;
	public $msgError;

	public function generarReporte() {

		if (is_null($this->idCatEstado)) {
			$this->error = true;
			$this->msgError = "El reporte requiere del identificador de estado.";
		} else {
			$sql = "SELECT * FROM [catJurisdiccion] WHERE 1 = 1 AND idCatEstado = " . $this->idCatEstado . " ORDER BY idCatJurisdiccion ASC;";
			$consulta = ejecutaQueryClases($sql);
			//echo $sql;
			if (is_string($consulta)) {
				$this->error = true;
				$this->msgError = $consulta . " SQL:" . $sql;
			} else {
				while ($tabla = devuelveRowAssoc($consulta)) $this->arrJurisdicciones[$tabla["idCatJurisdiccion"]] = $tabla["nombre"];

				$sql = "SELECT p.idPaciente, m.idCatJurisdiccion" .
					" FROM [pacientes] p, [catMunicipio] m, [diagnostico] d " .
					" WHERE m.idCatMunicipio = p.idCatMunicipio" .
					" AND d.idPaciente =  p.idPaciente " .
					" AND m.idCatEstado = p.idCatEstado " .
					" AND m.idCatEstado = " . $this->idCatEstado .
					" ORDER BY idCatJurisdiccion ASC;";
				$consulta = ejecutaQueryClases($sql);
				//echo $sql;
				if (is_string($consulta)) {
					$this->error = true;
					$this->msgError = $consulta . " SQL:" . $sql;
				} else {
					$contador = 1;
					while ($tabla = devuelveRowAssoc($consulta)) {
						$idTemp = $tabla["idPaciente"];
						$objTemp = new PacienteReporteListadoGeneral();
						$objTemp->obtenerBD($idTemp);
						$objTemp->id = $contador;
						//$this->arrPacientesReporteListadoGeneral[$tabla["idCatJurisdiccion"]] = $objTemp;
						//$this->arrPacientesReporteListadoGeneral[$tabla["idPaciente"]] = $objTemp;
						array_push($this->arrPacientesReporteListadoGeneral, $objTemp);
						$contador += 1;
					}
				}
			}
		}
	}

	public function imprimirReporte($borde = false) {

		$longitud = count($this->arrPacientesReporteListadoGeneral);
		$JurisAct = -1;
        $band = true;
		$borderTable = '';

        if($borde)
            $borderTable = 'border="1"';

		//echo '
';
		for ($i = 0; $i < $longitud; $i++) {
			$objTemp = $this->arrPacientesReporteListadoGeneral[$i];
			//var_dump($objTemp);
			if ($JurisAct != $objTemp->jurisdiccion) {
				$JurisAct = $objTemp->jurisdiccion;
				echo '

Jurisdiccion Sanitaria ' . $objTemp->jurisdiccion . ' : ' . $this->arrJurisdicciones[$objTemp->jurisdiccion] . '';
				echo '

Folio	Fecha Notificación	Fecha de Captura	Tipo Paciente
                    Forma de Detección	Nombre	Fecha de Nacimiento	Edad	Sexo	Estado	Municipio
                    Domicilio y Localidad	Tiempo de radicar	Fecha Inicio Sintomas	Fecha Diagnostico	Manchas Hipocrom.
                    Manchas Rojizas	Placas Infilt.	Nódulos	Otras	Zonas de Anestesia	Fecha de BK	IB
                    IM%	Fecha de Histo	Res	Observaciones

';
                $band = true;
			} else {
                $band = false;
            }
			echo '
'.$objTemp->folio.
				'	'.formatFechaObj($objTemp->fechaNotificacion, 'd-m-Y').
				'	'.formatFechaObj($objTemp->fechaCaptura, 'd-m-Y').
				'	'.$objTemp->idCatTipoPaciente.
				'	'.$objTemp->idCatFormaDeteccion.
				'	'.$objTemp->nombreCompleto.
				'	'.formatFechaObj($objTemp->fechaNacimiento, 'd-m-Y').
				'	'.$objTemp->edad.
				'	'.$objTemp->sexo.
				'	'.$objTemp->idCatEstado.
				'	'.$objTemp->idCatMunicipio.
				'	'.$objTemp->domicilio.
				'	A:'.$objTemp->anosRadicando.' M:'.$objTemp->mesesRadicando.
				'	'.formatFechaObj($objTemp->fechaInicioPadecimiento, 'd-m-Y').
				'	'.formatFechaObj($objTemp->fechaDiagnostico, 'd-m-Y').
				'	'.$objTemp->cuentaManchasHipocrom.
				'	'.$objTemp->cuentaManchasEritemat.
				'	'.$objTemp->cuentaPlacasInfiltrad.
				'	'.$objTemp->cuentaNodulos.
				'	'.$objTemp->cuentaOtrasLesiones.
				'	'.$objTemp->cuentaZonasAnestesia.
				'	'.formatFechaObj($objTemp->fechaBaciloscopia, 'd-m-Y').
				'	'.$objTemp->resultadoBaciloscopia.
				'	'.$objTemp->imBaciloscopia.
				'	'.formatFechaObj($objTemp->fechaHistopatologia, 'd-m-Y').
				'	'.$objTemp->resultadoHistopatologia.
				'	'.$objTemp->observaciones.
				'
';

            if($this->arrPacientesReporteListadoGeneral[$i+1]) {
                if($JurisAct != $this->arrPacientesReporteListadoGeneral[$i+1]->jurisdiccion) {
                    echo '

';
                }
            } else {
                echo '

';
            }
		}
		//echo '

';
	}
}

class PacienteReporteListadoGeneral {

	// BD ******************************************************************************************
	static $idNodulosAislados = 1;
	static $idNodulosAgrupados = 2;
	static $idManchasHipocrom = 3;
	static $idManchasEritemat = 4;
	static $idPlacasInfiltrad = 5;
	static $idZonasAnestesia = 6;
	static $idOtrasLesiones = 7;
	static $idCatTipoEstudioDia = 1;				// TABLA catTipoEstudio Diagnostico
	static $idCatTipoEstudioCon = 2;				//						Control
	// BD ******************************************************************************************

	public $idPaciente;							// idPaciente de la BD
	public $idDiagnostico;						// idDiagnostico de la BD
	// VARIABLES DEL REPORTE ******************************************************************************************
	public $id = 0;
	public $folio;								// Paciente
	public $fechaNotificacion;					// Paciente
	public $fechaCaptura;						// Diagnostico
	public $idCatTipoPaciente;					// Paciente
	public $idCatFormaDeteccion;				// Paciente
	public $nombreCompleto;
	public $fechaNacimiento;					// Paciente
	public $edad;
	public $sexo;								// Paciente
	public $idCatEstado;						// Paciente
	public $idCatMunicipio;						// Paciente
	public $jurisdiccion;
	public $domicilio;
	public $anosRadicando;						// Paciente
	public $mesesRadicando;						// Paciente
	public $fechaInicioPadecimiento;			// Paciente
	public $fechaDiagnostico;					// Paciente
	public $cuentaManchasHipocrom;
	public $cuentaManchasEritemat;
	public $cuentaPlacasInfiltrad;
	public $cuentaNodulos;
	public $cuentaOtrasLesiones;
	public $cuentaZonasAnestesia;
	public $fechaBaciloscopia;
	public $resultadoBaciloscopia;
	public $imBaciloscopia;
	public $fechaHistopatologia;
	public $resultadoHistopatologia;
	public $observaciones;
	// VARIABLES DEL REPORTE ******************************************************************************************
	public $error = false;
	public $msgError;

	public function obtenerBD($idPaciente) {

		$sql = "SELECT p.*, m.idCatJurisdiccion, d.idDiagnostico, d.fechaCaptura, ctp.descripcion as tipoPaciente, s.sexo as sexoP,  cfd.descripcion as formaDeteccion, ce.nombre as estado, cl.nombre as localidad" .
			" FROM [pacientes] p, [catMunicipio] m, [diagnostico] d, [catTipoPaciente] ctp, [catSexo] s, [catFormaDeteccion] cfd, [catEstado] ce, [catLocalidad] cl" .
			" WHERE p.idPaciente = " . $idPaciente .
			" AND d.idPaciente = p.idPaciente" .
			" AND m.idCatMunicipio = p.idCatMunicipio" .
			" AND m.idCatEstado = p.idCatEstado" .
			" AND ctp.idCatTipoPaciente = p.idCatTipoPaciente" .
			" AND s.idSexo = p.sexo" .
			" AND cfd.idCatFormaDeteccion = p.idCatFormaDeteccion" .
			" AND ce.idCatEstado = p.idCatEstado" .
			" AND cl.idCatEstado = p.idCatEstado" .
			" AND cl.idCatMunicipio = p.idCatMunicipio" .
			" AND cl.idCatLocalidad = p.idCatLocalidad;";
		$consulta = ejecutaQueryClases($sql);
		//echo $sql;
		if (is_string($consulta)) {
			$this->error = true;
			$this->msgError = $consulta . " SQL:" . $sql;
		} else {
			$tabla = devuelveRowAssoc($consulta);
			$this->idPaciente =  $tabla["idPaciente"];
			$this->idDiagnostico = $tabla["idDiagnostico"];

			$this->folio = $tabla["cveExpediente"];
			$this->fechaNotificacion =  formatFechaObj($tabla["fechaNotificacion"], 'Y-m-d');
			$this->fechaCaptura = formatFechaObj($tabla["fechaCaptura"], 'Y-m-d');
			$this->idCatTipoPaciente =  $tabla["tipoPaciente"];
			$this->idCatFormaDeteccion =  $tabla["formaDeteccion"];
			$this->nombreCompleto =  $tabla["nombre"] . ' ' . $tabla["apellidoPaterno"] . ' ' . $tabla["apellidoMaterno"];
			$this->fechaNacimiento =  formatFechaObj($tabla["fechaNacimiento"], 'Y-m-d');
			$this->edad = calEdad(formatFechaObj($this->fechaNacimiento, 'Y-m-d'));
			$this->sexo =  $tabla["sexoP"];
			$this->idCatEstado =  $tabla["estado"];
			$this->idCatMunicipio =  $tabla["localidad"];
			$this->jurisdiccion = $tabla["idCatJurisdiccion"];
			$this->domicilio = $tabla["calle"] . ' ' . $tabla["noExterior"] . ' ' . $tabla["noInterior"] . ' ' . $tabla["colonia"];
			if (!is_null($tabla["anosRadicando"])) { $this->anosRadicando =  $tabla["anosRadicando"]; }
			if (!is_null($tabla["mesesRadicando"])) { $this->mesesRadicando =  $tabla["mesesRadicando"]; }
			$this->fechaInicioPadecimiento =  formatFechaObj($tabla["fechaInicioPadecimiento"], 'Y-m-d');
			$this->fechaDiagnostico =  formatFechaObj($tabla["fechaDiagnostico"], 'Y-m-d');

			$sql = "SELECT " .
				"(SELECT COUNT(idLesion) FROM [diagramaDermatologico] WHERE idDiagnostico = " . $this->idDiagnostico . " AND idCatTipoLesion = " . self::$idManchasHipocrom . " ) AS cMH, " .
				"(SELECT COUNT(idLesion) FROM [diagramaDermatologico] WHERE idDiagnostico = " . $this->idDiagnostico . " AND idCatTipoLesion = " . self::$idManchasEritemat . " ) AS cME, " .
				"(SELECT COUNT(idLesion) FROM [diagramaDermatologico] WHERE idDiagnostico = " . $this->idDiagnostico . " AND idCatTipoLesion = " . self::$idPlacasInfiltrad . " ) AS cPI, " .
				"(SELECT COUNT(idLesion) FROM [diagramaDermatologico] WHERE idDiagnostico = " . $this->idDiagnostico . " AND (idCatTipoLesion = " . self::$idNodulosAislados . " OR idCatTipoLesion = " . self::$idNodulosAgrupados . ")) AS cNo, " .
				"(SELECT COUNT(idLesion) FROM [diagramaDermatologico] WHERE idDiagnostico = " . $this->idDiagnostico . " AND idCatTipoLesion = " . self::$idOtrasLesiones . " ) AS cOL, " .
				"(SELECT COUNT(idLesion) FROM [diagramaDermatologico] WHERE idDiagnostico = " . $this->idDiagnostico . " AND idCatTipoLesion = " . self::$idZonasAnestesia . " ) AS cZA;";

			$consulta = ejecutaQueryClases($sql);
			//echo "

" . $sql . "

";
			if (is_string($consulta)) {
				$this->error = true;
				$this->msgError = $consulta . " SQL:" . $sql;
			} else {
				$tabla = devuelveRowAssoc($consulta);
				$this->cuentaManchasHipocrom = $tabla["cMH"];
				$this->cuentaManchasEritemat = $tabla["cME"];
				$this->cuentaPlacasInfiltrad = $tabla["cPI"];
				$this->cuentaNodulos = $tabla["cNo"];
				$this->cuentaOtrasLesiones = $tabla["cOL"];
				$this->cuentaZonasAnestesia = $tabla["cZA"];
			}

			$sql = "SELECT TOP 1 muestraRechazada, fechaSolicitud, fechaResultado, bacIM, idCatBac
				FROM [estudiosBac]
				WHERE idDiagnostico = " . $this->idDiagnostico . "
				AND muestraRechazada = 0
				AND idCatTipoEstudio = " . self::$idCatTipoEstudioDia  . "
				ORDER BY fechaResultado ASC;";

			//echo $sql;
			$help = new Helpers();
			$arrIdCatBac = $help->getArrayCatBaciloscopia();
			$consulta = ejecutaQueryClases($sql);
			//echo "

" . $sql . "

";
			if (is_string($consulta)) {
				$this->error = true;
				$this->msgError = $consulta . " SQL:" . $sql;
			} else {
				$tabla = devuelveRowAssoc($consulta);
				//var_dump( $tabla);
				if (is_null($tabla)) {
					$this->fechaBaciloscopia = "-";
					$this->resultadoBaciloscopia = "Sin Estudio";
					$this->imBaciloscopia = "Sin Estudio";
				} else {
					if (!is_null($tabla["fechaResultado"])) { $this->fechaBaciloscopia =  formatFechaObj($tabla["fechaResultado"], 'Y-m-d'); } else { $this->fechaBaciloscopia =  formatFechaObj($tabla["fechaSolicitud"], 'Y-m-d'); }
					if (!is_null($tabla["idCatBac"])) {
						$this->resultadoBaciloscopia = $arrIdCatBac[$tabla["idCatBac"]];
					} else {
						$this->resultadoBaciloscopia = "Esperando Resultado";
					}
					if (!is_null($tabla["bacIM"])) { $this->imBaciloscopia = $tabla["bacIM"]; } else { $this->imBaciloscopia = "Esperando Resultado"; }
				}
			}

			$sql = "SELECT muestraRechazada, fechaSolicitud, fechaResultado, hisResultado
				FROM [estudiosHis]
				WHERE idDiagnostico = " . $this->idDiagnostico . "
				AND muestraRechazada = 0
				AND idCatTipoEstudio = " . self::$idCatTipoEstudioDia  . "
				ORDER BY fechaResultado ASC;";
			$consulta = ejecutaQueryClases($sql);
			//echo "

" . $sql . "

";
			if (is_string($consulta)) {
				$this->error = true;
				$this->msgError = $consulta . " SQL:" . $sql;
			} else {
				$tabla = devuelveRowAssoc($consulta);
				if (is_null($tabla)) {
					$this->resultadoHistopatologia = "Sin Estudio";
					$this->fechaHistopatologia =  "-";
				} else {
					if (!is_null($tabla["fechaResultado"])) { $this->fechaHistopatologia =  formatFechaObj($tabla["fechaResultado"], 'Y-m-d'); } else { $this->fechaHistopatologia =  formatFechaObj($tabla["fechaSolicitud"], 'Y-m-d'); }
					if (!is_null($tabla["hisResultado"])) { $this->resultadoHistopatologia = $tabla["hisResultado"]; } else { $this->fechaHistopatologia =  "Esperando Resultado"; }
				}

			}
			$this->observaciones;
		}
	}
}

?>


text:
#ifndef LTHREAD_POLLER_H
#define LTHREAD_POLLER_H

#if defined(__FreeBSD__) || defined(__APPLE__)
#include <sys/event.h>
#define POLL_EVENT_TYPE struct kevent
#else
#include <sys/epoll.h>
#define POLL_EVENT_TYPE struct epoll_event
#endif
#include <poll.h>

struct lthread_sched;
struct lthread;
enum lthread_event;

int _lthread_poller_create(void);
int _lthread_poller_poll(struct timespec t);
void _lthread_poller_ev_register_rd(int fd);
void _lthread_poller_ev_register_wr(int fd);
void _lthread_poller_ev_clear_wr(int fd);
void _lthread_poller_ev_clear_rd(int fd);
void _lthread_poller_ev_register_trigger(void);
void _lthread_poller_ev_trigger(struct lthread_sched *sched);
void _lthread_poller_ev_clear_trigger(void);
void _lthread_poller_set_fd_ready(struct lthread *lt, int fd,
    enum lthread_event, int is_eof);

int _lthread_poller_ev_get_event(POLL_EVENT_TYPE *ev);
int _lthread_poller_ev_get_fd(POLL_EVENT_TYPE *ev);
int _lthread_poller_ev_is_eof(POLL_EVENT_TYPE *ev);
int _lthread_poller_ev_is_read(POLL_EVENT_TYPE *ev);
int _lthread_poller_ev_is_write(POLL_EVENT_TYPE *ev);

#endif


text:
shared_examples_for "object with dimensions" do
  it "should initialize" do
    subject.left.should == left
    subject.top.should == top
    subject.width.should == width
    subject.height.should == height
  end
end

shared_examples_for "object with relative dimensions" do
  let(:relative_width) { 0.5 }
  let(:relative_height) { 0.5 }
  let(:relative_opts) { {left: left, top: top, width: relative_width, height: relative_height} }

  it "should initialize based on parent dimensions" do
    expect(subject.left).to eq left
    expect(subject.top).to eq top
    expect(subject.width).to be_within(1).of(parent.width / 2)
    expect(subject.height).to be_within(1).of(parent.height / 2)
  end
end

shared_examples_for "object with negative dimensions" do
  let(:negative_opts) { {left: left, top: top, width: -width, height: -height} }

  it "should initialize based on parent dimensions" do
    subject.left.should == left
    subject.top.should == top
    subject.width.should == parent.width - width
    subject.height.should == parent.height - height
  end
end


text:
package org.apache.jackrabbit.oak.spi.security.authorization.principalbased.impl;

import org.apache.jackrabbit.api.security.user.User;
import org.apache.jackrabbit.oak.spi.xml.ImportBehavior;
import org.junit.Test;

import javax.jcr.Node;
import javax.jcr.security.AccessControlPolicy;

import static org.apache.jackrabbit.JcrConstants.JCR_PRIMARYTYPE;
import static org.apache.jackrabbit.oak.spi.security.authorization.principalbased.impl.Constants.NT_REP_PRINCIPAL_POLICY;
import static org.apache.jackrabbit.oak.spi.security.authorization.principalbased.impl.Constants.REP_PRINCIPAL_NAME;
import static org.apache.jackrabbit.oak.spi.security.authorization.principalbased.impl.Constants.REP_PRINCIPAL_POLICY;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

public class ImportIgnoreTest extends ImportBaseTest {

    @Override
    String getImportBehavior() {
        return ImportBehavior.NAME_IGNORE;
    }

    @Test
    public void testTransientPrincipal() throws Exception {
        User transientSystemUser = getUserManager().createSystemUser("transientSystemUser", INTERMEDIATE_PATH);
        String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                "<sv:node sv:name=\""+REP_PRINCIPAL_POLICY+"\" xmlns:mix=\"http://www.jcp.org/jcr/mix/1.0\" xmlns:nt=\"http://www.jcp.org/jcr/nt/1.0\" xmlns:fn_old=\"http://www.w3.org/2004/10/xpath-functions\" xmlns:fn=\"http://www.w3.org/2005/xpath-functions\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:sv=\"http://www.jcp.org/jcr/sv/1.0\" xmlns:rep=\"internal\" xmlns:jcr=\"http://www.jcp.org/jcr/1.0\">" +
                "<sv:property sv:name=\""+JCR_PRIMARYTYPE+"\" sv:type=\"Name\"><sv:value>"+NT_REP_PRINCIPAL_POLICY+"</sv:value></sv:property>" +
                "<sv:property sv:name=\""+REP_PRINCIPAL_NAME+"\" sv:type=\"String\"><sv:value>"+transientSystemUser.getPrincipal().getName()+"</sv:value></sv:property>" +
                "</sv:node>";
        doImport(transientSystemUser.getPath(), xml);

        assertTrue(getSession().getNode(transientSystemUser.getPath()).hasNode(REP_PRINCIPAL_POLICY));
        Node policy = getSession().getNode(transientSystemUser.getPath()).getNode(REP_PRINCIPAL_POLICY);
        assertTrue(policy.hasProperty(REP_PRINCIPAL_NAME));

        // but looking up policy doesn't work because of transient principal.
        AccessControlPolicy[] policies = getAccessControlManager().getPolicies(transientSystemUser.getPrincipal());
        assertEquals(0, policies.length);
    }
}


text:
package com.aware.providers;

import java.util.HashMap;

import android.content.ContentProvider;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri;
import android.os.Environment;
import android.provider.BaseColumns;
import android.util.Log;

import com.aware.Aware;
import com.aware.utils.DatabaseHelper;

/**
 * AWARE Applications Content Provider Allows you to access all the recorded
 * applications on the database Database is located at the SDCard :
 * /AWARE/applications.db
 *
 * @author denzil
 *
 */
public class Applications_Provider extends ContentProvider {

	public static final int DATABASE_VERSION = 6;

	/**
	 * Authority of Application content provider
	 */
	public static final String AUTHORITY = "com.aware.provider.applications";

	// ContentProvider query paths
	private static final int FOREGROUND = 1;
	private static final int FOREGROUND_ID = 2;
	private static final int APPLICATIONS = 3;
	private static final int APPLICATIONS_ID = 4;
	private static final int NOTIFICATIONS = 5;
	private static final int NOTIFICATIONS_ID = 6;
	private static final int ERROR = 7;
	private static final int ERROR_ID = 8;

	/**
	 * Applications running on the foreground
	 *
	 * @author denzil
	 */
	public static final class Applications_Foreground implements BaseColumns {
		private Applications_Foreground() {
		};

		public static final Uri CONTENT_URI = Uri.parse("content://"
				+ Applications_Provider.AUTHORITY + "/applications_foreground");
		public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.aware.applications.foreground";
		public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.aware.applications.foreground";

		public static final String _ID = "_id";
		public static final String TIMESTAMP = "timestamp";
		public static final String DEVICE_ID = "device_id";
		public static final String PACKAGE_NAME = "package_name";
		public static final String APPLICATION_NAME = "application_name";
		public static final String IS_SYSTEM_APP = "is_system_app";
	}

	/**
	 * Both background and foreground applications running, use process
	 * importance to distinguish.
	 *
	 * @author denzil
	 *
	 */
	public static final class Applications_History implements BaseColumns {
		private Applications_History() {
		};

		public static final Uri CONTENT_URI = Uri.parse("content://"
				+ Applications_Provider.AUTHORITY + "/applications_history");
		public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.aware.applications.history";
		public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.aware.applications.history";

		public static final String _ID = "_id";
		public static final String TIMESTAMP = "timestamp";
		public static final String DEVICE_ID = "device_id";
		public static final String PACKAGE_NAME = "package_name";
		public static final String APPLICATION_NAME = "application_name";
		public static final String PROCESS_IMPORTANCE = "process_importance";
		public static final String PROCESS_ID = "process_id";
		public static final String END_TIMESTAMP = "double_end_timestamp";
		public static final String IS_SYSTEM_APP = "is_system_app";
	}

	/**
	 * Notifications received by any application.
	 *
	 * @author denzil
	 *
	 */
	public static final class Applications_Notifications implements BaseColumns {
		private Applications_Notifications() {
		};

		public static final Uri CONTENT_URI = Uri.parse("content://"
				+ Applications_Provider.AUTHORITY
				+ "/applications_notifications");
		public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.aware.applications.notifications";
		public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.aware.applications.notifications";

		public static final String _ID = "_id";
		public static final String TIMESTAMP = "timestamp";
		public static final String DEVICE_ID = "device_id";
		public static final String PACKAGE_NAME = "package_name";
		public static final String APPLICATION_NAME = "application_name";
		public static final String TEXT = "text";
		public static final String SOUND = "sound";
		public static final String VIBRATE = "vibrate";
		public static final String DEFAULTS = "defaults";
		public static final String FLAGS = "flags";
	}

	public static final class Applications_Crashes implements BaseColumns {
		private Applications_Crashes() {
		};

		public static final Uri CONTENT_URI = Uri.parse("content://"
				+ Applications_Provider.AUTHORITY + "/applications_crashes");
		public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.aware.applications.crashes";
		public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.aware.applications.crashes";

		public static final String _ID = "_id";
		public static final String TIMESTAMP = "timestamp";
		public static final String DEVICE_ID = "device_id";
		public static final String PACKAGE_NAME = "package_name";
		public static final String APPLICATION_NAME = "application_name";
		public static final String APPLICATION_VERSION = "application_version";
		public static final String ERROR_SHORT = "error_short";
		public static final String ERROR_LONG = "error_long";
		public static final String ERROR_CONDITION = "error_condition";
		public static final String IS_SYSTEM_APP = "is_system_app";
	}

	public static String DATABASE_NAME = Environment
			.getExternalStorageDirectory() + "/AWARE/" + "applications.db";
	public static final String[] DATABASE_TABLES = { "applications_foreground",
			"applications_history", "applications_notifications",
			"applications_crashes" };
	public static final String[] TABLES_FIELDS = {
			// Foreground
			Applications_Foreground._ID + " integer primary key autoincrement,"
					+ Applications_Foreground.TIMESTAMP + " real default 0,"
					+ Applications_Foreground.DEVICE_ID + " text default '',"
					+ Applications_Foreground.PACKAGE_NAME
					+ " text default '',"
					+ Applications_Foreground.APPLICATION_NAME
					+ " text default '',"
					+ Applications_Foreground.IS_SYSTEM_APP
					+ " integer default 0," + "UNIQUE ("
					+ Applications_Foreground.TIMESTAMP + ","
					+ Applications_Foreground.DEVICE_ID + ")",

			// Applications
			Applications_History._ID + " integer primary key autoincrement,"
					+ Applications_History.TIMESTAMP + " real default 0,"
					+ Applications_History.DEVICE_ID + " text default '',"
					+ Applications_History.PACKAGE_NAME + " text default '',"
					+ Applications_History.APPLICATION_NAME
					+ " text default '',"
					+ Applications_History.PROCESS_IMPORTANCE
					+ " integer default 0," + Applications_History.PROCESS_ID
					+ " integer default 0,"
					+ Applications_History.END_TIMESTAMP + " real default 1,"
					+ Applications_History.IS_SYSTEM_APP
					+ " integer default 0," + "UNIQUE ("
					+ Applications_History.TIMESTAMP + ","
					+ Applications_History.DEVICE_ID + ")",

			// Notifications
			Applications_Notifications._ID
					+ " integer primary key autoincrement,"
					+ Applications_Notifications.TIMESTAMP + " real default 0,"
					+ Applications_Notifications.DEVICE_ID
					+ " text default '',"
					+ Applications_Notifications.PACKAGE_NAME
					+ " text default '',"
					+ Applications_Notifications.APPLICATION_NAME
					+ " text default ''," + Applications_Notifications.TEXT
					+ " text default ''," + Applications_Notifications.SOUND
					+ " text default ''," + Applications_Notifications.VIBRATE
					+ " text default ''," + Applications_Notifications.DEFAULTS
					+ " integer default -1," + Applications_Notifications.FLAGS
					+ " integer default -1," + "UNIQUE ("
					+ Applications_Notifications.TIMESTAMP + ","
					+ Applications_Notifications.DEVICE_ID + ")",

			// Crashes
			Applications_Crashes._ID + " integer primary key autoincrement,"
					+ Applications_Crashes.TIMESTAMP + " real default 0,"
					+ Applications_Crashes.DEVICE_ID + " text default '',"
					+ Applications_Crashes.PACKAGE_NAME + " text default '',"
					+ Applications_Crashes.APPLICATION_NAME
					+ " text default '',"
					+ Applications_Crashes.APPLICATION_VERSION
					+ " real default 0," + Applications_Crashes.ERROR_SHORT
					+ " text default ''," + Applications_Crashes.ERROR_LONG
					+ " text default '',"
					+ Applications_Crashes.ERROR_CONDITION
					+ " integer default 0,"
					+ Applications_Crashes.IS_SYSTEM_APP
					+ " integer default 0," + "UNIQUE("
					+ Applications_Crashes.TIMESTAMP + ","
					+ Applications_Crashes.DEVICE_ID + ")" };

	private static UriMatcher sUriMatcher = null;
	private static HashMap<String, String> foregroundMap = null;
	private static HashMap<String, String> applicationsMap = null;
	private static HashMap<String, String> notificationMap = null;
	private static HashMap<String, String> crashesMap = null;
	private static DatabaseHelper databaseHelper = null;
	private static SQLiteDatabase database = null;

	/**
	 * Delete entry from the database
	 */
	@Override
	public int delete(Uri uri, String selection, String[] selectionArgs) {

		if (database == null || !database.isOpen())
			database = databaseHelper.getWritableDatabase();

		int count = 0;
		switch (sUriMatcher.match(uri)) {
		case FOREGROUND:
			count = database.delete(DATABASE_TABLES[0], selection,
					selectionArgs);
			break;
		case APPLICATIONS:
			count = database.delete(DATABASE_TABLES[1], selection,
					selectionArgs);
			break;
		case NOTIFICATIONS:
			count = database.delete(DATABASE_TABLES[2], selection,
					selectionArgs);
			break;
		case ERROR:
			count = database.delete(DATABASE_TABLES[3], selection,
					selectionArgs);
			break;
		default:
			throw new IllegalArgumentException("Unknown URI " + uri);
		}
		getContext().getContentResolver().notifyChange(uri, null);
		return count;
	}

	@Override
	public String getType(Uri uri) {
		switch (sUriMatcher.match(uri)) {
		case FOREGROUND:
			return Applications_Foreground.CONTENT_TYPE;
		case FOREGROUND_ID:
			return Applications_Foreground.CONTENT_ITEM_TYPE;
		case APPLICATIONS:
			return Applications_History.CONTENT_TYPE;
		case APPLICATIONS_ID:
			return Applications_History.CONTENT_ITEM_TYPE;
		case NOTIFICATIONS:
			return Applications_Notifications.CONTENT_TYPE;
		case NOTIFICATIONS_ID:
			return Applications_Notifications.CONTENT_ITEM_TYPE;
		case ERROR:
			return Applications_Crashes.CONTENT_TYPE;
		case ERROR_ID:
			return Applications_Crashes.CONTENT_ITEM_TYPE;
		default:
			throw new IllegalArgumentException("Unknown URI " + uri);
		}
	}

	/**
	 * Insert entry to the database
	 */
	@Override
	public Uri insert(Uri uri, ContentValues initialValues) {

		if (database == null || !database.isOpen())
			database = databaseHelper.getWritableDatabase();

		ContentValues values = (initialValues != null) ? new ContentValues(
				initialValues) : new ContentValues();
		switch (sUriMatcher.match(uri)) {
		case FOREGROUND:
			long foreground_id = database.insert(DATABASE_TABLES[0],
					Applications_Foreground.APPLICATION_NAME, values);
			if (foreground_id > 0) {
				Uri foregroundUri = ContentUris.withAppendedId(
						Applications_Foreground.CONTENT_URI, foreground_id);
				getContext().getContentResolver().notifyChange(foregroundUri,
						null);
				return foregroundUri;
			}
			throw new SQLException("Failed to insert row into " + uri);
		case APPLICATIONS:
			long applications_id = database.insert(DATABASE_TABLES[1],
					Applications_History.PACKAGE_NAME, values);
			if (applications_id > 0) {
				Uri applicationsUri = ContentUris.withAppendedId(
						Applications_History.CONTENT_URI, applications_id);
				getContext().getContentResolver().notifyChange(applicationsUri,
						null);
				return applicationsUri;
			}
			throw new SQLException("Failed to insert row into " + uri);
		case NOTIFICATIONS:
			long notifications_id = database.insert(DATABASE_TABLES[2],
					Applications_Notifications.PACKAGE_NAME, values);
			if (notifications_id > 0) {
				Uri notificationsUri = ContentUris.withAppendedId(
						Applications_Notifications.CONTENT_URI,
						notifications_id);
				getContext().getContentResolver().notifyChange(
						notificationsUri, null);
				return notificationsUri;
			}
			throw new SQLException("Failed to insert row into " + uri);
		case ERROR:
			long error_id = database.insert(DATABASE_TABLES[3],
					Applications_Crashes.PACKAGE_NAME, values);
			if (error_id > 0) {
				Uri errorsUri = ContentUris.withAppendedId(
						Applications_Crashes.CONTENT_URI, error_id);
				getContext().getContentResolver().notifyChange(errorsUri, null);
				return errorsUri;
			}
			throw new SQLException("Failed to insert row into " + uri);
		default:
			throw new IllegalArgumentException("Unknown URI " + uri);
		}
	}

	@Override
	public boolean onCreate() {
		if (databaseHelper == null)
			databaseHelper = new DatabaseHelper(getContext(), DATABASE_NAME,
					null, DATABASE_VERSION, DATABASE_TABLES, TABLES_FIELDS);
		database = databaseHelper.getWritableDatabase();
		return (databaseHelper != null);
	}

	static {
		sUriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
		sUriMatcher.addURI(Applications_Provider.AUTHORITY, DATABASE_TABLES[0],
				FOREGROUND);
		sUriMatcher.addURI(Applications_Provider.AUTHORITY, DATABASE_TABLES[0]
				+ "/#", FOREGROUND_ID);
		sUriMatcher.addURI(Applications_Provider.AUTHORITY, DATABASE_TABLES[1],
				APPLICATIONS);
		sUriMatcher.addURI(Applications_Provider.AUTHORITY, DATABASE_TABLES[1]
				+ "/#", APPLICATIONS_ID);
		sUriMatcher.addURI(Applications_Provider.AUTHORITY, DATABASE_TABLES[2],
				NOTIFICATIONS);
		sUriMatcher.addURI(Applications_Provider.AUTHORITY, DATABASE_TABLES[2]
				+ "/#", NOTIFICATIONS_ID);
		sUriMatcher.addURI(Applications_Provider.AUTHORITY, DATABASE_TABLES[3],
				ERROR);
		sUriMatcher.addURI(Applications_Provider.AUTHORITY, DATABASE_TABLES[3]
				+ "/#", ERROR_ID);

		foregroundMap = new HashMap<String, String>();
		foregroundMap.put(Applications_Foreground._ID,
				Applications_Foreground._ID);
		foregroundMap.put(Applications_Foreground.TIMESTAMP,
				Applications_Foreground.TIMESTAMP);
		foregroundMap.put(Applications_Foreground.DEVICE_ID,
				Applications_Foreground.DEVICE_ID);
		foregroundMap.put(Applications_Foreground.PACKAGE_NAME,
				Applications_Foreground.PACKAGE_NAME);
		foregroundMap.put(Applications_Foreground.APPLICATION_NAME,
				Applications_Foreground.APPLICATION_NAME);
		foregroundMap.put(Applications_Foreground.IS_SYSTEM_APP,
				Applications_Foreground.IS_SYSTEM_APP);

		applicationsMap = new HashMap<String, String>();
		applicationsMap.put(Applications_History._ID, Applications_History._ID);
		applicationsMap.put(Applications_History.TIMESTAMP,
				Applications_History.TIMESTAMP);
		applicationsMap.put(Applications_History.DEVICE_ID,
				Applications_History.DEVICE_ID);
		applicationsMap.put(Applications_History.PACKAGE_NAME,
				Applications_History.PACKAGE_NAME);
		applicationsMap.put(Applications_History.APPLICATION_NAME,
				Applications_History.APPLICATION_NAME);
		applicationsMap.put(Applications_History.PROCESS_IMPORTANCE,
				Applications_History.PROCESS_IMPORTANCE);
		applicationsMap.put(Applications_History.PROCESS_ID,
				Applications_History.PROCESS_ID);
		applicationsMap.put(Applications_History.END_TIMESTAMP,
				Applications_History.END_TIMESTAMP);
		applicationsMap.put(Applications_History.IS_SYSTEM_APP,
				Applications_History.IS_SYSTEM_APP);

		notificationMap = new HashMap<String, String>();
		notificationMap.put(Applications_Notifications._ID,
				Applications_Notifications._ID);
		notificationMap.put(Applications_Notifications.TIMESTAMP,
				Applications_Notifications.TIMESTAMP);
		notificationMap.put(Applications_Notifications.DEVICE_ID,
				Applications_Notifications.DEVICE_ID);
		notificationMap.put(Applications_Notifications.PACKAGE_NAME,
				Applications_Notifications.PACKAGE_NAME);
		notificationMap.put(Applications_Notifications.APPLICATION_NAME,
				Applications_Notifications.APPLICATION_NAME);
		notificationMap.put(Applications_Notifications.TEXT,
				Applications_Notifications.TEXT);
		notificationMap.put(Applications_Notifications.SOUND,
				Applications_Notifications.SOUND);
		notificationMap.put(Applications_Notifications.VIBRATE,
				Applications_Notifications.VIBRATE);
		notificationMap.put(Applications_Notifications.FLAGS,
				Applications_Notifications.FLAGS);
		notificationMap.put(Applications_Notifications.DEFAULTS,
				Applications_Notifications.DEFAULTS);

		crashesMap = new HashMap<String, String>();
		crashesMap.put(Applications_Crashes._ID, Applications_Crashes._ID);
		crashesMap.put(Applications_Crashes.TIMESTAMP,
				Applications_Crashes.TIMESTAMP);
		crashesMap.put(Applications_Crashes.DEVICE_ID,
				Applications_Crashes.DEVICE_ID);
		crashesMap.put(Applications_Crashes.PACKAGE_NAME,
				Applications_Crashes.PACKAGE_NAME);
		crashesMap.put(Applications_Crashes.APPLICATION_NAME,
				Applications_Crashes.APPLICATION_NAME);
		crashesMap.put(Applications_Crashes.APPLICATION_VERSION,
				Applications_Crashes.APPLICATION_VERSION);
		crashesMap.put(Applications_Crashes.ERROR_SHORT,
				Applications_Crashes.ERROR_SHORT);
		crashesMap.put(Applications_Crashes.ERROR_LONG,
				Applications_Crashes.ERROR_LONG);
		crashesMap.put(Applications_Crashes.ERROR_CONDITION,
				Applications_Crashes.ERROR_CONDITION);
		crashesMap.put(Applications_Crashes.IS_SYSTEM_APP,
				Applications_Crashes.IS_SYSTEM_APP);
	}

	/**
	 * Query entries from the database
	 */
	@Override
	public Cursor query(Uri uri, String[] projection, String selection,
			String[] selectionArgs, String sortOrder) {

		if (database == null || !database.isOpen())
			database = databaseHelper.getWritableDatabase();

		SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
		switch (sUriMatcher.match(uri)) {
		case FOREGROUND:
			qb.setTables(DATABASE_TABLES[0]);
			qb.setProjectionMap(foregroundMap);
			break;
		case APPLICATIONS:
			qb.setTables(DATABASE_TABLES[1]);
			qb.setProjectionMap(applicationsMap);
			break;
		case NOTIFICATIONS:
			qb.setTables(DATABASE_TABLES[2]);
			qb.setProjectionMap(notificationMap);
			break;
		case ERROR:
			qb.setTables(DATABASE_TABLES[3]);
			qb.setProjectionMap(crashesMap);
			break;
		default:
			throw new IllegalArgumentException("Unknown URI " + uri);
		}
		try {
			Cursor c = qb.query(database, projection, selection, selectionArgs,
					null, null, sortOrder);
			c.setNotificationUri(getContext().getContentResolver(), uri);
			return c;
		} catch (IllegalStateException e) {
			if (Aware.DEBUG)
				Log.e(Aware.TAG, e.getMessage());
			return null;
		}
	}

	/**
	 * Update application on the database
	 */
	@Override
	public int update(Uri uri, ContentValues values, String selection,
			String[] selectionArgs) {

		if (database == null || !database.isOpen())
			database = databaseHelper.getWritableDatabase();

		int count = 0;
		switch (sUriMatcher.match(uri)) {
		case FOREGROUND:
			count = database.update(DATABASE_TABLES[0], values, selection,
					selectionArgs);
			break;
		case APPLICATIONS:
			count = database.update(DATABASE_TABLES[1], values, selection,
					selectionArgs);
			break;
		case NOTIFICATIONS:
			count = database.update(DATABASE_TABLES[2], values, selection,
					selectionArgs);
			break;
		case ERROR:
			count = database.update(DATABASE_TABLES[3], values, selection,
					selectionArgs);
			break;
		default:
			throw new IllegalArgumentException("Unknown URI " + uri);
		}
		getContext().getContentResolver().notifyChange(uri, null);
		return count;
	}
}


text:
package net.hangyas.moss

import scala.collection.mutable

/**
 * Created by hangyas on 2015-07-13
 */
object AstBuilder {

  var tokens: List[Token] = null;
  var token: Token = null;
  var prevToken: Token = null;

  var currentVars: mutable.MutableList[String] = null;

  private def next(): Token = {
    prevToken = token;

    if (tokens.isEmpty){
      token = null;
      return null;
    }

    token = tokens.head;
    tokens = tokens.tail;
    return token;
  }

  private def next(expected: Char): Token = {
    if (next != TokenOther(expected))
      throw new NotFoundException(expected.toString);
    return token;
  }

  private def peek: Token = {
    return tokens.head;
  }

  private def peek(expected: Char): Boolean = {
    return tokens.head == TokenOther(expected);
  }

  def parse(tokens: List[Token]): AstProgram = {
    AstBuilder.tokens = tokens;
    next();

    val body = mutable.MutableList[AstFunc]();

    while (token.isInstanceOf[TokenFunc]){
      currentVars = new mutable.MutableList[String]();
      body += parseFunc();
    }

    return new AstProgram(body.toList);
  }

  private def parseFunc(): AstFunc = {
    next();//eat func
    val name = token.asInstanceOf[TokenIdentifier].identifier;
    next('('); //eat name

    val args = new mutable.MutableList[String]();

    next(); //eat (
    while (token != TokenOther(')')){
      args += token.asInstanceOf[TokenIdentifier].identifier;
      if (next() == TokenOther(','))
        next(); //eat ','
    }

    next(); //eat ")"

    return new AstFunc(name, args.toList, parseBody());
  }

  /**
   * Eats all tokens until TokenEnd
   * */
  private def parseBody(): List[AstUnit] = {
    val body = new mutable.MutableList[AstUnit]();

    while (token != TokenEnd()){
      val l: AstUnit = token match {
        case _: TokenIf => parseIf();
//        case _: TokenWhile => parseWhile();
        case _: TokenReturn => parseReturn();
        case _: TokenIdentifier if peek('=') => parseAssign();
      }
      body += l;
    }

    next(); //eat end

    return body.toList;
  }

  def parseIf(): AstIf = {
    next(); //eat 'if'
    val condition = parseExpr();
    val body = parseBody();

    return new AstIf(condition, body);
  }

  def parseAssign(): AstAssign = {
    val id = token.asInstanceOf[TokenIdentifier].identifier;
    next('='); //eat variable name
    next();    //eat '='
    val exprl = parseExpr();

    return new AstAssign(id, exprl);
  }

  private val priories = Map(
    '+' -> 1,
    '-' -> 1,
    '*' -> 2,
    '/' -> 2
  );

  /**
   * returns the expression in polish annotation
   * when the next token doesn't make sense in the expression it's handled as end of line
   * function calls handled as highest priority operators so they will be poped from the stack in the right time
   * */
  def parseExpr(): List[AstExpr] = {
    val exprl = mutable.MutableList[AstExpr]();
    val stack = mutable.Stack[AstExpr]();
    //null in the stack means '('

    do {
      token match {
        case TokenNumber(num) => exprl += new AstNumber(num.toByte);
        case TokenIdentifier(name) if peek != TokenOther('(') => exprl += new AstVar(name); // it can't be a function
        case TokenIdentifier(name) if peek == TokenOther('(') => {
          //must be a function call
          // handled as high priority operator
          while (stack.nonEmpty && stack.top != null){
            exprl += stack.top;
            stack.pop();
          }
          stack.push(new AstCall(name));
        }
        case TokenOther('(') => stack.push(null);
        case TokenOther(')') => {
          //pop out everything until the '('
          while (stack.nonEmpty && stack.top != null){
            exprl += stack.top;
            stack.pop();
          }
          stack.pop();
        }
        case TokenOther(',') => {
          while (stack.nonEmpty && stack.top != null) {
            exprl += stack.top;
            stack.pop();
          }
        }
        case TokenOther(name) => {
          val priority = priories(name);
          // pop out higher priority operators
          while (stack.nonEmpty && stack.top != null
            && (stack.top.isInstanceOf[AstCall] || priories(stack.top.asInstanceOf[AstOp].name) > priority)){
            exprl += stack.top;
            stack.pop();
          }
          stack.push(new AstOp(name));
        }
      }
      next();
    }while(!(prevToken == TokenOther(')') && token.isInstanceOf[TokenIdentifier]
      || prevToken.isInstanceOf[TokenIdentifier] && token.isInstanceOf[TokenIdentifier]
      || token.isInstanceOf[TokenKeyWord]));

    exprl ++= stack.toList.filter(_ != null);

    return exprl.toList;
  }

  def parseReturn(): AstReturn = {
    next(); //eat return

    return new AstReturn(parseExpr());
  }

  class NotFoundException(expected: String) extends Exception{
    override def getMessage = "expected: " + expected + " found: " + token;
  }

}


text:
package com.szeljic.pharmacy.DBConnections;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class ConnectionManager {

   static Connection conn;
   static String url;

   public static Connection getConnection()
   {
      try
      {
         String url = "jdbc:mysql://localhost/pharmacy";
         Class.forName("com.mysql.jdbc.Driver");

         try
         {
            conn = DriverManager.getConnection(url, "root", "stralezelja");
         }
         catch (SQLException ex)
         {
            ex.printStackTrace();
         }
      }
      catch(ClassNotFoundException e)
      {
         System.out.println(e);
      }

      return conn;
   }
}


text:
/**
 * Main package, including most user-facing classes such as the ParallelClient,
 * ParallelTask etc.
 */
package io.parallec.core;


text:
package cc.bitbank.entity.enums;

import cc.bitbank.deserializer.OrderTypeDeserializer;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;

/**
 * Created by tanaka on 2017/04/12.
 */

@JsonDeserialize(using = OrderTypeDeserializer.class)
public enum OrderType {
    LIMIT("limit"),
    MARKET("market"),
    STOP("stop"),
    STOP_LIMIT("stop_limit");

    private final String type;

    OrderType(final String type) {
        this.type = type;
    }

    public String getCode() {
        return this.type;
    }
}


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

namespace TextTool.Common.Example.BackgroundProcess
{
    class RegexReplaceTextFileItemTasksFactory : ITasksFactory<RegexReplaceTextFileItem>
    {
        private string folderPath;
        private string filePattern;

        public RegexReplaceTextFileItemTasksFactory(string folderPath, string filePattern)
        {
            this.folderPath = folderPath;
            this.filePattern = filePattern;
        }

        public List<RegexReplaceTextFileItem> GetTasks()
        {
            Dictionary<string, string> dictRegex = new Dictionary<string, string>()
            {
                { "aaaafadfa", "bsfafbb" }
            };
            var allFiles = Directory.GetFiles(folderPath, filePattern, SearchOption.AllDirectories).ToList();
            List<RegexReplaceTextFileItem> lstRegexItems = new List<RegexReplaceTextFileItem>();
            foreach (var strRegex in dictRegex.Keys)
            {
                allFiles.ForEach(file =>
                {
                    lstRegexItems.Add(new RegexReplaceTextFileItem(file, strRegex, dictRegex[strRegex]));
                });
            }

            return lstRegexItems;
        }
    }
}


text:
package org.culturegraph.mf.util.xml;

import org.w3c.dom.Node;
import org.w3c.dom.UserDataHandler;
import org.xml.sax.Locator;
import org.xml.sax.helpers.LocatorImpl;

/**
 * Stores location information about element start and element
 * end positions in a document.
 *
 * @author Christoph Böhme
 *
 */
public final class Location {

	public static final String USER_DATA_ID = "http://culturegraph.org/mf/user_data/location";

	public static final UserDataHandler USER_DATA_HANDLER = new UserDataHandler() {

		@Override
		public void handle(final short operation, final String key, final Object data,
				final Node src, final Node dst) {

			if (operation == NODE_IMPORTED || operation == NODE_CLONED) {
				if (dst != null) {
					dst.setUserData(key, data, this);
				}
			}
		}

	};

	private final Locator elementStart;
	private final Locator elementEnd;

	public Location(final Locator elementStart, final Locator elementEnd) {
		this.elementStart = new LocatorImpl(elementStart);
		this.elementEnd = new LocatorImpl(elementEnd);
	}

	public Location(final Location src) {
		elementStart = new LocatorImpl(src.elementStart);
		elementEnd = new LocatorImpl(src.elementEnd);
	}

	public Locator getElementStart() {
		return elementStart;
	}

	public Locator getElementEnd() {
		return elementEnd;
	}

	public String getSystemId() {
		return elementStart.getSystemId();
	}

	public String getPublicId() {
		return elementStart.getPublicId();
	}

	@Override
	public String toString() {
		final StringBuilder builder = new StringBuilder();
		builder.append(getSystemId());
		builder.append(':');
		builder.append(elementStart.getLineNumber());
		builder.append(':');
		builder.append(elementStart.getColumnNumber());
		builder.append(" - ");
		builder.append(elementEnd.getLineNumber());
		builder.append(':');
		builder.append(elementEnd.getColumnNumber());

		return builder.toString();
	}

}