text:
var User = React.createClass({
    _handleShowPass: function () {
        this.props.handleShowPass();
    },
    _handleMainAction: function (action, index) {
        this.props.handleMainAction(action, index);
    },
    _handleChooseAction: function (user, doAction, action) {
        this.props.handleChooseAction(user, doAction, action);
    },
    _handleUsername: function (index, event) {
        this.props.handleField("username", event.target.value, index);
    },
    _handlePassword: function (index, event) {
        this.props.handleField("password", event.target.value, index);
    },
    _handleFullName: function (index, event) {
        this.props.handleField("fullname", event.target.value, index);
    },
    _handleEmail: function (index, event) {
        this.props.handleField("email", event.target.value, index);
    },
    _handleRole: function (index, event) {
        this.props.handleField("role", event.target.value, index);
    },
    _handleStatus: function (index, event) {
        this.props.handleField("status", event.target.value, index);
    },
    //handle sort
    _handleSortField: function (field, value) {
        if (field == "username") {
            this.props.handleSortField("username", value);
        } else if (field == "fullname") {
            this.props.handleSortField("fullname", value);
        } else if (field == "email") {
            this.props.handleSortField("email", value);
        }
    },
    _processSortClass: function (value) {
        var className = '';
        if (value === 1) {
            className = "fa fa-sort-asc fa-fw";
        } else if (value === -1) {
            className = "fa fa-sort-desc fa-fw";
        } else {
            className = "fa fa-sort fa-fw";
        }
        return className;
    },
    render: function () {
        var self = this;
        var rows = [];
        var pageSize = this.props.pageSize;
        var currentPage = this.props.currentPage;
        var maxNumberPage = this.props.maxNumberPage;

        var rowFilter = [];
        var keyword = this.props.keyword;
        var status = this.props.status;
        //controller action add edit delete
        var action = this.props.selectAction.action;
        var indexSelected = this.props.selectAction.indexSelected;
        var isShow = this.props.selectAction.isShow;
        var isDisplayShow = this.props.selectAction.isDisplayShow;
        this.props.users.map(function (user, index) {
            if (
                (keyword != "" && user.username.toLowerCase().indexOf(keyword.toLowerCase()) === -1) ||
                (status != "" && user.status != status)) {
            } else {
                rowFilter.push(user);
            }
        });
        rowFilter.map(function (user, index) {
            if (((currentPage - 1) * pageSize <= index) && (index < (currentPage * pageSize))) {
                rows.push(user);
            }
        });
        var userCount = rowFilter.length;
        var totalPage = parseInt((userCount / pageSize)) + 1;
        if (userCount >= pageSize && userCount % pageSize == 0) {
            totalPage = totalPage - 1;
        }
        var userdetail = rows.map(function (user, index) {
            var displayLabel = "";
            var displayInput = "none";
            var displayMainController = "";
            var displayChooseController = "none";
            var displayDivInputPass = "none";
            var poiterEventMainController = "";
            var poiterChooseController = "";

            //custom display admin
            var displayDeleteAdmin = '';
            var displayStatusAdminInput = 'none';
            var displayStatusAdminLabel = '';

            if (action !== "") {
                if (indexSelected == index) {
                    if (action == "delete") {
                        displayLabel = "";
                        displayInput = "none";
                        displayStatusAdminLabel = "";
                        displayStatusAdminInput = "none"
                    } else if (action == "add" || action == "edit") {
                        displayLabel = "none";
                        displayInput = "";
                        displayStatusAdminLabel = "none";
                        displayStatusAdminInput = "";
                        displayDivInputPass = "inline-block";
                    }
                    displayMainController = "none";
                    displayChooseController = "";
                    poiterEventMainController = "";
                    poiterChooseController = "";
                } else {
                    displayLabel = "";
                    displayInput = "none";
                    displayStatusAdminLabel = "";
                    displayStatusAdminInput = "none";
                    displayMainController = "";
                    displayChooseController = "none";
                    poiterEventMainController = "none";
                    poiterChooseController = "none";
                }
            }

            if (user.role == "ADMIN") {
                displayDeleteAdmin = "hidden";
                displayStatusAdminInput = 'none';
                displayStatusAdminLabel = '';
            }

            return (

                    {index + 1}

{user.username}

                        <input type="text"
                               className="fieldinput1"
                               style={{display: displayInput}}
                               value={user.usernameTmp}
                               onChange={self._handleUsername.bind(null, index)}
                        />

{user.password}

                            <input type={isShow ? "text" : "password"}
                                   className="fieldinput2"
                                   style={{
                                       display: displayInput,
                                       maxWidth: '100px',
                                       padding: '0',
                                       border: 'none',
                                       borderRadius: '0'
                                   }}
                                   value={user.passwordTmp}
                                   onChange={self._handlePassword.bind(null, index)}
                            />

{user.fullname}

                        <input type="text"
                               className="fieldinput3"
                               style={{display: displayInput}}
                               value={user.fullnameTmp}
                               onChange={self._handleFullName.bind(null, index)}
                        />

{user.email}

                        <input type="text"
                               className="fieldinput4"
                               style={{display: displayInput}}
                               value={user.emailTmp}
                               onChange={self._handleEmail.bind(null, index)}
                        />

{user.role}

                        <select className="fieldinput5"
                                style={{display: 'none'}}
                                value={user.roleTmp}
                                onChange={self._handleRole.bind(null, index)}
                        >
                            <option value="ADMIN">ADMIN</option>
                            <option value="HR">HR</option>
                        </select>

{user.status == "0" ? 'Active' : 'Inactive'}

                        <select className="fieldinput6"
                                style={{display: displayStatusAdminInput}}
                                value={user.statusTmp}
                                onChange={self._handleStatus.bind(null, index)}
                        >
                            <option value="0">Active</option>
                            <option value="1">Inactive</option>
                        </select>

            )
        });
        return (

                                STT

                                Username

                            Password
                            FullName

                            E-Mail

                            Role
                            Status
                            Action

                        {userdetail}

                    <Pagination
                        className="pagination pull-right"
                        currentPage={currentPage}
                        totalPage={totalPage}
                        maxNumberPage={maxNumberPage}
                        handleChangePage={this.props.handleChangePage}
                    />

        )
    }
});
var UserList = React.createClass({
    getInitialState: function () {
        return ({
            users: [],
            pageSize: 10,
            currentPage: 1,
            maxNumberPage: 5,
            keyword: '',
            status: '',
            selectAction: {
                action: '',
                indexSelected: -1,
                isShow: false,
                isDisplayShow: 'none'
            },
            sortAction: {
                sortUsername: 0,
                sortFullname: 0,
                sortEmail: 0
            }
        });
    },
    componentWillMount: function () {
        var data = {
            action: 'init'
        };
        this.loadUsers(data);
    },
    loadUsers: function (data) {
        var self = this;
        $.ajax
        ({
            type: "POST",
            url: self.props.url,
            data: data,
            datatype: 'json',
            success: function (data) {
                var userTmp = JSON.parse(data);
                //add default value for input field
                var users = [];
                userTmp.forEach(function (user) {
                    user.usernameTmp = user.username;
                    user.passwordTmp = "";
                    user.fullnameTmp = user.fullname;
                    user.emailTmp = user.email;
                    user.roleTmp = user.role;
                    user.statusTmp = user.status;
                    users.push(user);
                });
                //get info from first element
                var action = users[0].action;
                var statusProcess = users[0].statusProcess;
                var msg;
                if (action != "init") {
                    msg = action.charAt(0).toUpperCase() + action.slice(1) + " Record " + (statusProcess === "1" ? "Success" : "Fail") + "!!!";
                    this.handleMsgInfo(msg, statusProcess);
                }
                //delete first element
                users.shift();
                self.setState({
                    users: users,
                    selectAction: {
                        action: '',
                        indexSelected: -1,
                        isShow: false,
                        isDisplayShow: 'none'
                    }
                });
            }.bind(this),
            error: function (xhr, status, err) {
                console.error(url, status, err.toString());
            }.bind(this)
        });
    },
    handleChangePage: function (key, totalPage) {
        var currentPage = this.state.currentPage;
        if (key == "next") {
            if (currentPage == totalPage) {
                currentPage = totalPage
            } else {
                currentPage = currentPage + 1;
            }
        } else if (key == "prev") {
            if (currentPage == 1) {
                currentPage = 1;
            } else {
                currentPage = currentPage - 1;
            }
        }
        else if (key == "first") {
            currentPage = 1;
        } else if (key == "last") {
            currentPage = totalPage;
        } else {
            currentPage = key;
        }
        this.setState({
            currentPage: currentPage
        });
    },
    handleKeyWord: function (keyword) {
        this.setState({keyword: keyword});
    },
    handleStatus: function (status) {
        this.setState({status: status});
    },
    handleAdd: function () {
        var users = this.state.users;
        var newUser = {
            id: 0,
            username: '',
            password: '',
            fullname: '',
            email: '',
            role: 'HR',
            status: '0',
            usernameTmp: '',
            passwordTmp: '',
            fullnameTmp: '',
            emailTmp: '',
            roleTmp: 'HR',
            statusTmp: '0',
        };
        users.unshift(newUser);
        this.setState({
            users: users,
            selectAction: {
                action: 'add',
                indexSelected: 0,
                isShow: false,
                isDisplayShow: 'none'
            }
        });
    },
    handleMsgInfo: function (msg, statusProcess) {
        var msgInfo = $(".msgInfo");
        var className = statusProcess == "1" ? "label-success msgInfo" : "label-warning msgInfo";
        msgInfo.html(msg);
        msgInfo.attr("class", className);
        var delayTime = 1000;
        if (msg !== "" && statusProcess !== "") {
            delayTime = 3000;
        }
        msgInfo.fadeIn();
        msgInfo.delay(delayTime).fadeOut('slow');
    },
    handleMainAction: function (action, index, isShow) {
        this.setState({
            selectAction: {
                action: action,
                indexSelected: index,
                isShow: isShow,
                isDisplayShow: 'none'
            }
        });
    },
    handleChooseAction: function (user, doAction, action) {
        var selectAction = {
            action: '',
            indexSelected: -1,
            isShow: false,
            isDisplayShow: 'none'
        };
        if (doAction === 0) {
            if (action == "add") {
                var users = this.state.users;
                users.shift();
                this.setState({
                    users: users,
                    selectAction: selectAction
                });
            } else {
                this.setState({selectAction: selectAction});
            }
        } else if (action == "add") {
            var msg = '';
            var data = {};
            var statusProcess = 1;
            if (user.usernameTmp !== "" && user.passwordTmp !== "") {
                user.username = user.usernameTmp;
                user.password = user.passwordTmp;
                user.fullname = user.fullnameTmp;
                user.email = user.emailTmp;
                user.role = user.roleTmp;
                user.status = user.statusTmp;
                data = {
                    action: 'add',
                    user: user,
                };
                this.loadUsers(data);
            } else {
                msg = "Please Fill Fields: " + (user.usernameTmp == "" ? "Username" : "") + (user.passwordTmp == "" ? ", Password" : "");
                statusProcess = 0;
                this.handleMsgInfo(msg, statusProcess);
            }
        } else if (action == "edit") {
            if (user.usernameTmp !== "") {
                if (
                    user.username == user.usernameTmp &&
                    user.passwordTmp == "" &&
                    user.fullname == user.fullnameTmp &&
                    user.email == user.emailTmp &&
                    user.role == user.roleTmp &&
                    user.status == user.statusTmp) {
                    msg = "No Thing To Change !!!";
                    this.setState({selectAction: selectAction});
                    statusProcess = 1;
                    this.handleMsgInfo(msg, statusProcess);
                } else {
                    user.username = user.usernameTmp;
                    user.password = user.passwordTmp;
                    user.fullname = user.fullnameTmp;
                    user.email = user.emailTmp;
                    user.role = user.roleTmp;
                    user.status = user.statusTmp;
                    data = {
                        action: 'edit',
                        user: user,
                    };
                    this.loadUsers(data);
                }
            }
            else {
                msg = "Please Fill Fields: " + (user.usernameTmp == "" ? "Username" : "");
                statusProcess = 0;
                this.handleMsgInfo(msg, statusProcess)
            }
        } else if (action == "delete") {
            data = {
                action: 'delete',
                user: user,
            };
            this.loadUsers(data);
        }

    },
    handleField: function (field, value, index) {
        var users = this.state.users;
        var selectAction = this.state.selectAction;
        if (field == "username") {
            users[index].usernameTmp = value;
        } else if (field == "password") {
            users[index].passwordTmp = value;
            if (value.length > 0) {
                selectAction.isDisplayShow = 'inline';
            } else {
                selectAction.isDisplayShow = 'none';
            }
        } else if (field == "fullname") {
            users[index].fullnameTmp = value;
        } else if (field == "email") {
            users[index].emailTmp = value;
        } else if (field == "role") {
            users[index].roleTmp = value;
        } else if (field == "status") {
            users[index].statusTmp = value;
        }
        this.setState({
            users: users,
            selectAction: selectAction
        })
    },
    handleShowPass: function () {
        var selectAction = this.state.selectAction;
        selectAction.isShow = !selectAction.isShow;
        this.setState({
            selectAction: selectAction
        });
    },
    handleSortField: function (field, value) {
        var users = this.state.users;
        var sortAction = {
            sortUsername: 0,
            sortFullname: 0,
            sortEmail: 0
        };
        var val = 0;
        var orderBy = "";
        var sortType = 0;
        if (value == 0) {
            val = -1;
            sortType = "desc";
        } else if (value == -1) {
            val = 1;
            sortType = "asc";
        }
        if (field == "username") {
            sortAction.sortUsername = val;
        } else if (field == "fullname") {
            sortAction.sortFullname = val;
        } else if (field == "email") {
            sortAction.sortEmail = val;
        }

        if (val != 0) {
            users = users.sort(function (a, b) {
                var fieldA = "";
                var fieldB = "";

                if (field == "username") {
                    fieldA = a.username.toLowerCase();
                    fieldB = b.username.toLowerCase();
                    sortAction.username = val;
                } else if (field == "fullname") {
                    fieldA = a.fullname.toLowerCase();
                    fieldB = b.fullname.toLowerCase();
                    sortAction.sortFullname = val;
                } else if (field == "email") {
                    fieldA = a.email.toLowerCase();
                    fieldB = b.email.toLowerCase();
                    sortAction.sortEmail = val;
                }
                if (sortType == "asc") {
                    if (fieldA < fieldB)
                        return -1;
                    if (fieldA > fieldB)
                        return 1;
                } else if (sortType == "desc") {
                    if (fieldA < fieldB)
                        return 1;
                    if (fieldA > fieldB)
                        return -1;
                }
                return 0;
            });
        } else {
            users = users.sort(function (a, b) {
                var fieldA = a.role.toLowerCase();
                var fieldB = b.role.toLowerCase();
                if (fieldA < fieldB)
                    return -1;
                if (fieldA > fieldB)
                    return 1;
                return 0;
            });
        }
        this.setState({
            sortAction: sortAction,
            users: users
        })
    },
    render: function () {
        return (

                                <Filter
                                    headerFilter={this.props.headerFilter}
                                    handleKeyWord={this.handleKeyWord}
                                    handleStatus={this.handleStatus}
                                    keyword={this.state.keyword}
                                    status={this.state.status}
                                    handleAdd={this.handleAdd}
                                    selectAction={this.state.selectAction}
                                />

                                <User users={this.state.users}
                                      pageSize={this.state.pageSize}
                                      currentPage={this.state.currentPage}
                                      maxNumberPage={this.state.maxNumberPage}
                                      handleChangePage={this.handleChangePage}
                                      keyword={this.state.keyword}
                                      status={this.state.status}
                                      handleAdd={this.handleAdd}

                                      selectAction={this.state.selectAction}
                                      handleMainAction={this.handleMainAction}
                                      handleChooseAction={this.handleChooseAction}
                                      handleField={this.handleField}
                                      handleShowPass={this.handleShowPass}
                                      handleSortField={this.handleSortField}
                                      sortAction={this.state.sortAction}
                                />

        );
    }
});
window.Pagination;
//Division
var Division = React.createClass({
    _handleShowPass: function () {
        this.props.handleShowPass();
    },
    _handleMainAction: function (action, index) {
        this.props.handleMainAction(action, index);
    },
    _handleChooseAction: function (division, doAction, action) {
        this.props.handleChooseAction(division, doAction, action);
    },
    _handleName: function (index, event) {
        this.props.handleField("name", event.target.value, index);
    },
    _handleDescription: function (index, event) {
        this.props.handleField("description", event.target.value, index);
    },
    _handleLink: function (index, event) {
        this.props.handleField("link", event.target.value, index);
    },
    _handleLogo: function (action, index, event) {
        var reader = new FileReader();
        var self = this;
        reader.onload = function () {
            self.props.handleField("logo", reader.result, index);
        };
        if (action == "add") {
            reader.readAsDataURL(event.target.files[0]);
        } else if (action == "delete") {
            self.props.handleField("logo", '', index);
        }
    },
    _handleStatus: function (index, event) {
        this.props.handleField("status", event.target.value, index);
    },
    //handle sort
    _handleSortField: function (field, value) {
        if (field == "name") {
            this.props.handleSortField("name", value);
        } else if (field == "description") {
            this.props.handleSortField("description", value);
        } else if (field == "link") {
            this.props.handleSortField("link", value);
        }
    },
    _processSortClass: function (value) {
        var className = '';
        if (value === 1) {
            className = "fa fa-sort-asc fa-fw";
        } else if (value === -1) {
            className = "fa fa-sort-desc fa-fw";
        } else {
            className = "fa fa-sort fa-fw";
        }
        return className;
    },
    render: function () {
        var self = this;
        var rows = [];
        var pageSize = this.props.pageSize;
        var currentPage = this.props.currentPage;
        var maxNumberPage = this.props.maxNumberPage;

        var rowFilter = [];
        var keyword = this.props.keyword;
        var status = this.props.status;
        //controller action add edit delete
        var action = this.props.selectAction.action;
        var indexSelected = this.props.selectAction.indexSelected;
        this.props.divisions.map(function (division, index) {
            if (
                (keyword != "" && division.name.toLowerCase().indexOf(keyword.toLowerCase()) === -1) ||
                (status != "" && division.status != status)) {
            } else {
                rowFilter.push(division);
            }
        });
        rowFilter.map(function (division, index) {
            if (((currentPage - 1) * pageSize <= index) && (index < (currentPage * pageSize))) {
                rows.push(division);
            }
        });
        var divisionCount = rowFilter.length;
        var totalPage = parseInt((divisionCount / pageSize)) + 1;
        if (divisionCount >= pageSize && divisionCount % pageSize == 0) {
            totalPage = totalPage - 1;
        }
        var divisiondetail = rows.map(function (division, index) {
            var displayLabel = "";
            var displayInput = "none";
            var displayMainController = "";
            var displayChooseController = "none";
            var poiterEventMainController = "";
            var poiterChooseController = "";

            if (action !== "") {
                if (indexSelected == index) {
                    if (action == "delete") {
                        displayLabel = "";
                        displayInput = "none";
                    } else if (action == "add" || action == "edit") {
                        displayLabel = "none";
                        displayInput = "";
                    }
                    displayMainController = "none";
                    displayChooseController = "";
                    poiterEventMainController = "";
                    poiterChooseController = "";
                } else {
                    displayLabel = "";
                    displayInput = "none";
                    displayMainController = "";
                    displayChooseController = "none";
                    poiterEventMainController = "none";
                    poiterChooseController = "none";
                }
            }
            var displayImg = (division.logoTmp == 'data:image/jpeg;base64,\r\n') ? "none" : "";
            return (

                    {index + 1}

{division.name}

                        <input type="text"
                               style={{display: displayInput, width: '60px'}}
                               value={division.nameTmp}
                               onChange={self._handleName.bind(null, index)}
                        />

{division.description}

                        <input type="text"
                               style={{display: displayInput, width: '130px'}}
                               value={division.descriptionTmp}
                               onChange={self._handleDescription.bind(null, index)}
                        />

{division.linkSite}

                        <input type="text"
                               style={{display: displayInput, width: '330px'}}
                               value={division.linkSiteTmp}
                               onChange={self._handleLink.bind(null, index)}
                        />

                        <input type="file" accept="image/*"
                               style={{display: displayInput, marginTop: '0px'}}
                               onChange={self._handleLogo.bind(null, "add", index)}
                        />

{division.status == "0" ? 'Active' : 'Inactive'}

                        <select
                            style={{display: displayInput}}
                            value={division.statusTmp}
                            onChange={self._handleStatus.bind(null, index)}
                        >
                            <option value="0">Active</option>
                            <option value="1">Inactive</option>
                        </select>

            )
        });
        return (

                                STT

                                Name

                            Description

                            Link

                            Logo
                            Status
                            Action

                        {divisiondetail}

                    <Pagination
                        className="pagination pull-right"
                        currentPage={currentPage}
                        totalPage={totalPage}
                        maxNumberPage={maxNumberPage}
                        handleChangePage={this.props.handleChangePage}
                    />

        )
    }
});
var DivisionList = React.createClass({
        getInitialState: function () {
            return ({
                divisions: [],
                pageSize: 10,
                currentPage: 1,
                maxNumberPage: 5,
                keyword: '',
                status: '',
                selectAction: {
                    action: '',
                    indexSelected: -1,
                },
                sortAction: {
                    sortName: 0,
                    sortDescription: 0,
                    sortLink: 0
                }
            });
        },
        componentWillMount: function () {
            var data = {action: 'init'};
            this.loadDivisions(data);
        },
        loadDivisions: function (data) {
            var self = this;
            $.ajax
            ({
                type: "POST",
                url: self.props.url,
                data: data,
                datatype: 'json',
                success: function (data) {
                    var divisionTmp = JSON.parse(data);
                    //add default value for input field
                    var divisions = [];
                    divisionTmp.forEach(function (division) {
                        division.nameTmp = division.name;
                        division.descriptionTmp = division.description;
                        division.linkSiteTmp = division.linkSite;
                        division.logoTmp = "data:image/jpeg;base64," + division.logo;
                        division.statusTmp = division.status;
                        divisions.push(division);
                    });
                    //get info from first element
                    var action = divisions[0].action;
                    var statusProcess = divisions[0].statusProcess;
                    var msg;
                    if (action != "init") {
                        msg = action.charAt(0).toUpperCase() + action.slice(1) + " Record " + (statusProcess === "1" ? "Success" : "Fail") + "!!!";
                        this.handleMsgInfo(msg, statusProcess);
                    }
                    //delete first element
                    divisions.shift();
                    self.setState({
                        divisions: divisions,
                        selectAction: {
                            action: '',
                            indexSelected: -1
                        }
                    });
                }.bind(this),
                error: function (xhr, status, err) {
                    console.error(xhr, status, err.toString());
                }.bind(this)
            });
        },
        handleChangePage: function (key, totalPage) {
            var currentPage = this.state.currentPage;
            if (key == "next") {
                if (currentPage == totalPage) {
                    currentPage = totalPage
                } else {
                    currentPage = currentPage + 1;
                }
            } else if (key == "prev") {
                if (currentPage == 1) {
                    currentPage = 1;
                } else {
                    currentPage = currentPage - 1;
                }
            }
            else if (key == "first") {
                currentPage = 1;
            } else if (key == "last") {
                currentPage = totalPage;
            } else {
                currentPage = key;
            }
            this.setState({
                currentPage: currentPage
            });
        },
        handleKeyWord: function (keyword) {
            this.setState({keyword: keyword});
        },
        handleStatus: function (status) {
            this.setState({status: status});
        },
        handleAdd: function () {
            var divisions = this.state.divisions;
            var newDivision = {
                id: 0,
                name: '',
                description: '',
                linkSite: '',
                logo: '',
                status: '0',
                nameTmp: '',
                descriptionTmp: '',
                linkSiteTmp: '',
                logoTmp: '',
                statusTmp: '0',
            };
            divisions.unshift(newDivision);
            this.setState({
                divisions: divisions,
                selectAction: {
                    action: 'add',
                    indexSelected: 0,
                }
            });
        },
        handleMsgInfo: function (msg, statusProcess) {
            var msgInfo = $(".msgInfo");
            var className = statusProcess == "1" ? "label-success msgInfo" : "label-warning msgInfo";
            msgInfo.html(msg);
            msgInfo.attr("class", className);
            var delayTime = 1000;
            if (msg !== "" && statusProcess !== "") {
                delayTime = 3000;
            }
            msgInfo.fadeIn();
            msgInfo.delay(delayTime).fadeOut('slow');
        },
        handleMainAction: function (action, index) {
            this.setState({
                selectAction: {
                    action: action,
                    indexSelected: index,
                }
            });
        },
        handleChooseAction: function (division, doAction, action) {
            var selectAction = {
                action: '',
                indexSelected: -1,
            };
            var data = {};
            if (doAction === 0) {
                if (action == "add") {
                    var divisions = this.state.divisions;
                    divisions.shift();
                    this.setState({
                        divisions: divisions,
                        selectAction: selectAction
                    });
                } else {
                    this.setState({selectAction: selectAction});
                }
            } else if (action == "add") {
                var msg = '';
                var statusProcess = 1;
                if (division.nameTmp !== "") {
                    division.name = division.nameTmp;
                    division.description = division.descriptionTmp;
                    division.linkSite = division.linkSiteTmp;
                    division.logo = division.logoTmp;
                    division.status = division.statusTmp;
                    data = {
                        action: 'add',
                        division: division
                    };
                    this.loadDivisions(data);
                } else {
                    msg = "Please Fill Fields: " + (division.nameTmp == "" ? "Name Division" : "");
                    statusProcess = 0;
                    this.handleMsgInfo(msg, statusProcess);
                }
            } else if (action == "edit") {
                if (division.nameTmp !== "") {
                    division.name = division.nameTmp;
                    division.description = division.descriptionTmp;
                    division.linkSite = division.linkSiteTmp;
                    division.logo = division.logoTmp;
                    division.status = division.statusTmp;
                    data = {
                        action: 'edit',
                        division: division
                    };
                    this.loadDivisions(data);
                }
                else {
                    msg = "Please Fill Fields: " + (division.nameTmp == "" ? "Name Division" : "");
                    statusProcess = 0;
                    this.handleMsgInfo(msg, statusProcess)
                }
            } else if (action == "delete") {
                data = {
                    action: 'delete',
                    division: division
                };
                this.loadDivisions(data);
            }

        },
        handleField: function (field, value, index) {
            var divisions = this.state.divisions;
            if (field == "name") {
                divisions[index].nameTmp = value;
            } else if (field == "description") {
                divisions[index].descriptionTmp = value;
            } else if (field == "logo") {
                divisions[index].logoTmp = value;
            } else if (field == "link") {
                divisions[index].linkSiteTmp = value;
            } else if (field == "status") {
                divisions[index].statusTmp = value;
            }
            this.setState({
                divisions: divisions,
            })
        }
        ,
        handleSortField: function (field, value) {
            var divisions = this.state.divisions;
            var sortAction = {
                sortName: 0,
                sortDescription: 0,
                sortLink: 0
            };
            var val = 0;
            var sortType = '';
            if (value == 0) {
                val = -1;
                sortType = "desc";
            } else if (value == -1) {
                val = 1;
                sortType = "asc";
            }
            if (field == "name") {
                sortAction.sortName = val;
            } else if (field == "description") {
                sortAction.sortDescription = val;
            } else if (field == "link") {
                sortAction.sortLink = val;
            }

            if (val != 0) {
                divisions = divisions.sort(function (a, b) {
                    var fieldA = "";
                    var fieldB = "";

                    if (field == "name") {
                        fieldA = a.name.toLowerCase();
                        fieldB = b.name.toLowerCase();
                        sortAction.sortName = val;
                    } else if (field == "description") {
                        fieldA = a.description.toLowerCase();
                        fieldB = b.description.toLowerCase();
                        sortAction.sortDescription = val;
                    } else if (field == "link") {
                        fieldA = a.linkSite.toLowerCase();
                        fieldB = b.linkSite.toLowerCase();
                        sortAction.sortLink = val;
                    }
                    if (sortType == "asc") {
                        if (fieldA < fieldB)
                            return -1;
                        if (fieldA > fieldB)
                            return 1;
                    } else if (sortType == "desc") {
                        if (fieldA < fieldB)
                            return 1;
                        if (fieldA > fieldB)
                            return -1;
                    }
                    return 0;
                });
            } else {
                divisions = divisions.sort(function (a, b) {
                    var fieldA = a.id;
                    var fieldB = b.id;
                    if (fieldA < fieldB)
                        return -1;
                    if (fieldA > fieldB)
                        return 1;
                    return 0;
                });
            }
            this.setState({
                sortAction: sortAction,
                divisions: divisions
            })
        }
        ,
        render: function () {
            return (

                                    <Filter
                                        headerFilter={this.props.headerFilter}
                                        handleKeyWord={this.handleKeyWord}
                                        handleStatus={this.handleStatus}
                                        keyword={this.state.keyword}
                                        status={this.state.status}
                                        handleAdd={this.handleAdd}
                                        selectAction={this.state.selectAction}
                                    />

                                    <Division divisions={this.state.divisions}
                                              pageSize={this.state.pageSize}
                                              currentPage={this.state.currentPage}
                                              maxNumberPage={this.state.maxNumberPage}
                                              handleChangePage={this.handleChangePage}
                                              keyword={this.state.keyword}
                                              status={this.state.status}
                                              handleAdd={this.handleAdd}

                                              selectAction={this.state.selectAction}
                                              handleMainAction={this.handleMainAction}
                                              handleChooseAction={this.handleChooseAction}
                                              handleField={this.handleField}
                                              handleSortField={this.handleSortField}
                                              sortAction={this.state.sortAction}
                                    />

            );
        }
    })
    ;
//Division end

//login start
var Login = React.createClass({
    getInitialState: function () {
        return ({
            username: '',
            password: '',
            msg: ''
        });
    },
    _handleUsername: function (event) {
        this.setState({username: event.target.value})
    },
    _handlePassword: function (event) {
        this.setState({password: event.target.value})
    },
    _handleCookie: function (isLogin, role) {
        if (isLogin) {
            var username = this.state.username;
            this.props.handleCookie(isLogin, username, role);
        } else {
            var info = $(".info");
            info.fadeIn();
            info.delay(2000).fadeOut('slow');
            this.setState({msg: "Invalid Username or Password"})
        }
    },
    handleLogin: function (event) {
        event.preventDefault();
        var username = this.state.username;
        var password = this.state.password;
        var data = {
            username: username,
            password: password
        };
        var self = this;
        $.ajax
        ({
            type: "POST",
            url: self.props.url,
            data: data,
            datatype: 'json',
            success: function (role) {
                if (role != "") {
                    this._handleCookie(true, role);
                } else {
                    this._handleCookie(false, role);
                }
            }.bind(this),
            error: function (xhr, status, err) {
                console.error(url, status, err.toString());
            }.bind(this)
        });
    },
    render: function () {
        var self = this;
        return (

                                Login Adminisrator

{self.state.msg}

                                    <input type="text" className="form-control" value={self.state.username}
                                           onChange={this._handleUsername}
                                           placeholder="Username"/>

                                    <input type="password" name="pass" className="form-control"
                                           value={self.state.password}
                                           onChange={this._handlePassword}
                                           placeholder="Password"/>

                                    <button className="btn btn-primary form-control" onClick={this.handleLogin}>
                                        Login
                                    </button>

        )
    }
});

//login end

var Menu = React.createClass({
    _handleMenuSelected: function (selected) {
        "use strict";
        this.props.handleMenuSelected(selected);
    },
    _handleLogout: function () {
        this.props.handleLogout();
    },
    render: function () {
        var self = this;
        var menuPage = [];
        var role = this.props.role;
        var username = this.props.username;
        this.props.pageMenu.map(function (menu, index) {
            var className = "";
            var classSelect = "";
            if (menu == "Main") {
                className = "fa fa-dashboard fa-fw";
            } else if (menu == "Users Manager" && role == "ADMIN") {
                className = "fa fa-users fa-fw";
            } else if (menu == "Division Manager") {
                className = "fa fa-list-alt fa-fw";
            }
            if (index === self.props.selected) {
                classSelect = "active open";
            }
            if (menu != "Users Manager" || (menu == "Users Manager" && role == "ADMIN")) {
                menuPage.push(

                            {menu}

                );
            }
        });
        return (

                                {"Hi "}{username}{" !"}Logout

                            {menuPage}

        );
    }
});

var PAGEMENU = ["Users Manager", "Division Manager"];
var Page = React.createClass({
    getInitialState: function () {
        return ({
            selected: 0,
            isLogin: false,
            role: '',
            username : ''
        });
    },
    componentWillMount: function () {
        var isLogin = false;
        var username = this.getCookie("username");
        var role = this.getCookie("role");
        var selected = 0;
        if (username != "") {
            if (role == "HR") {
                selected = 1;
            }
            this.setCookie("username", username, 5);
            this.setCookie("role", role, 5);
            isLogin = true;
        }
        this.setState({isLogin: isLogin, role: role, selected: selected,username:username});
    },
    handleMenuSelected: function (selected) {
        var username = this.getCookie("username");
        var role = this.getCookie("role");
        if (username == "") {
            this.setState({isLogin: false});
        } else {
            this.setCookie("username", username, 5);
            this.setCookie("role", role, 5);
            this.setState({
                selected: selected,
            });
        }
    },
    handleCookie: function (isLogin, username, role) {
        if (isLogin) {
            var selected = 0;
            if (role == "HR") {
                selected = 1;
            }
            this.setState({
                isLogin: isLogin,
                role: role,
                selected: selected,
                username:username
            });
            this.setCookie("username", username, 5);
            this.setCookie("role", role, 5);
        }
    },
    setCookie: function (cname, cvalue, exminutes) {
        var d = new Date();
        d.setTime(d.getTime() + (exminutes * 60 * 1000));
        var expires = "expires=" + d.toUTCString();
        document.cookie = cname + "=" + cvalue + "; " + expires;
    },
    getCookie: function (cname) {
        var name = cname + "=";
        var ca = document.cookie.split(';');
        for (var i = 0; i < ca.length; i++) {
            var c = ca[i];
            while (c.charAt(0) == ' ') {
                c = c.substring(1);
            }
            if (c.indexOf(name) == 0) {
                return c.substring(name.length, c.length);
            }
        }
        return "";
    },
    handleLogout: function () {
        var username = this.getCookie("username");
        var role = this.getCookie("role");
        if (username != "") {
            this.setCookie("username", username, -5);
            this.setCookie("role", role, -5);
        }
        this.setState({
            isLogin:false,
            username:''
        });
    },
    render: function () {
        var component = [];
        if (!this.state.isLogin) {
            $("body").css("background", "url(img/bg2.jpg) #0F1F2D no-repeat center center fixed");
            component.push(<Login
                key="-1"
                url="/authenlogin"
                handleCookie={this.handleCookie}
            />);
        } else {
            $("body").css("background", "none");
            component.push(<Menu
                key="0"
                pageMenu={PAGEMENU}
                selected={this.state.selected}
                handleMenuSelected={this.handleMenuSelected}
                role={this.state.role}
                handleLogout={this.handleLogout}
                username ={this.state.username}
            />);
            if (this.state.selected === 0) {
                component.push(<UserList
                    key="1"
                    url="/ajaxuser"
                    headerFilter="user"
                />)
            } else if (this.state.selected === 1) {
                component.push(<DivisionList
                    key="2"
                    url="/ajaxdivision"
                    headerFilter="division"
                />)
            }
        }
        return (

                {component}

        )
    }
});

var Filter = React.createClass({
    _handleKeyWord: function (event) {
        this.props.handleKeyWord(event.target.value);
    },
    _handleStatus: function (event) {
        this.props.handleStatus(event.target.value);
    },
    _handleAdd: function () {
        this.props.handleAdd();
    },
    render: function () {
        var pointerEvent = "";
        if (this.props.selectAction.action != '') {
            pointerEvent = 'none';
        }
        var filterName = '';
        if (this.props.headerFilter == "user") {
            filterName = 'username';
        } else if (this.props.headerFilter == "division") {
            filterName = 'division';
        }
        return (

MANAGER {this.props.headerFilter.toUpperCase()}

                            Add {this.props.headerFilter.toUpperCase()}

                            <input type="text" name="keyword" id="keyword" placeholder={"Nhập " + filterName}
                                   onChange={this._handleKeyWord} value={this.props.keyword}/>

                                <select className="search_status" style={{border: '0'}}
                                        onChange={this._handleStatus}
                                        value={this.props.status}>
                                    <option value="" disabled="disabled" hidden="hidden">
                                        Choose status
                                    </option>
                                    <option value=""></option>
                                    <option value="0">Active</option>
                                    <option value="1">Deactive</option>
                                </select>

        );
    }
});

var Pagination = React.createClass({
    _handleChangePage: function (key) {
        var totalPage = this.props.totalPage;
        this.props.handleChangePage(key, totalPage)
    },
    render: function () {
        var self = this;
        var currentPage = this.props.currentPage;
        var totalPage = this.props.totalPage;
        var maxNumberPage = this.props.maxNumberPage;
        var rows = [];

        var style = {
            pointerEvents: currentPage == 1 ? "none" : ""
        };
        rows.push(

                «

);
        rows.push(

                ‹

);

        // process phan trang
        var diff = Math.floor(maxNumberPage / 2);
        var start = Math.max(currentPage - diff, 1);
        var end = 0;
        if (start == 1) {
            end = Math.min(totalPage, maxNumberPage);
        } else {
            end = Math.min(totalPage, start + maxNumberPage - 1);
        }
        for (var i = start; i <= end; i++) {
            rows.push(

                    {i}

);
        }
        rows.push(

                ›

);
        rows.push(

                »

);
        return (

                {rows}

        )
    }
});

ReactDOM.render(
    <Page
    />
    ,
    document.getElementById("container")
);


text:
@*
 * Copyright 2022 HM Revenue & Customs
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *@

@import config.FrontendAppConfig
@import controllers.PlaLanguageController
@import helpers.templates.formInlineDateInput
@import play.api.Application
@import uk.gov.hmrc.play.views.html.{helpers => govHelpers}
@import config.FrontendAppConfig
@import common.Dates._

@this(mainTemplate:main_template)

@(withdrawDate: String, protectionType: String, status: String)(implicit request: Request[_], messages: Messages, application: Application, context: config.PlaContext, partialRetriever: uk.gov.hmrc.play.partials.FormPartialRetriever,  templateRenderer: uk.gov.hmrc.renderer.TemplateRenderer, appConfig: FrontendAppConfig, lang: Lang, form: uk.gov.hmrc.play.views.html.helpers.FormWithCSRF)

@lc = @{
    Application.instanceCache[PlaLanguageController].apply(application)
}

@scriptElement = {

}

@mainTemplate(title = Messages("pla.withdraw.what-happens.info-heading"), scriptElem = Some(scriptElement), bodyClasses = None) {

    @form(action = routes.WithdrawProtectionController.displayWithdrawConfirmation(withdrawDate)) {

        Back

@Messages(s"pla.withdraw.what-happens.info-heading")

@Html(Messages("pla.withdraw.protection.what-happens.info.1", withDrawDateString(withdrawDate)))

@Messages("pla.withdraw.protection.what-happens.info.2",Messages(s"pla.withdraw.protection.${protectionType}.label"),Messages(s"pla.withdraw.protection.${protectionType}.label"))

@Messages("pla.withdraw.protection.what-happens.info.3",withDrawDateString(withdrawDate))

@Messages("pla.withdraw.protection.what-happens.info.4",withDrawDateString(withdrawDate))

@Messages("pla.withdraw.protection.what-happens.info.5")

        <button class="button" type="submit" id="submit">@Messages("pla.withdraw.implications.submit")</button>

    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php if(is_active_sidebar('main-sidebar')):?>
        <?php dynamic_sidebar('main-sidebar'); ?>
<?php endif;?>


text:
<ECF>
	<Algorithm>
        	<SteadyStateTournament>
                	<Entry key="tsize">3</Entry>              <!-- tournament size. def 3 -->
        	</SteadyStateTournament>
	</Algorithm>

	<Genotype>
		<FloatingPoint>
			<Entry key="lbound">-15</Entry>
			<Entry key="ubound">90</Entry>
			<Entry key="dimension">15</Entry>
		</FloatingPoint>
	</Genotype>
	<Registry>
		<Entry key="population.size">50</Entry>
		<Entry key="mutation.indprob">0.6</Entry> <!-- individual mutation probability (default: 0.3) -->
		<Entry key="log.level">1</Entry>
		<Entry key="log.filename">HallOfFame.xml</Entry>
		<Entry key="term.fitnessval">20</Entry> <!-- value for termination -->
	</Registry>
</ECF>


text:
class WuozRegion < ActiveRecord::Base
  attr_accessible :district_id, :wuoz_agency_id
  belongs_to :district
  belongs_to :wuoz_agency
end


text:
package com.stratuscom.harvester.hsm;

/**
 Interface for an object that evaluates "something" against a set of arguments.
 * @author trasukg
 */
interface Operation {

    /**
     Run the operation against a set of arguments.
     @param args The set of arguments.
     */
    void eval(StateMachineExecutor exec, Object[] args);

}


text:
=head1 LICENSE

See the NOTICE file distributed with this work for additional information
regarding copyright ownership.

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

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

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

=cut

=pod

=head1 NAME

Bio::EnsEMBL::Compara::RunnableDB::StableIdMapper

=cut

=head1 SYNOPSIS

        # compute and store the stable_id mapping between trees of rel.63 and trees of rel.64:

    time standaloneJob.pl Bio::EnsEMBL::Compara::RunnableDB::StableIdMapper \
        -compara_db "mysql://ensadmin:${ENSADMIN_PSW}@compara3/mm14_compara_homology_64" \
        -master_db "mysql://ensadmin:${ENSADMIN_PSW}@compara1/mm14_ensembl_compara_master" \
        -prev_rel_db "mysql://ensro@compara1/lg4_ensembl_compara_63" -type t

=cut

=head1 DESCRIPTION

This RunnableDB computes and stores stable_id mapping of either for ProteinTrees or Families between releases.

=cut

=head1 CONTACT

Contact anybody in Compara.

=cut

package Bio::EnsEMBL::Compara::RunnableDB::StableIdMapper;

use strict;
use warnings;

use Bio::EnsEMBL::Compara::StableId::Adaptor;
use Bio::EnsEMBL::Compara::StableId::NamedClusterSetLink;
use Scalar::Util qw(looks_like_number);

use base ('Bio::EnsEMBL::Compara::RunnableDB::BaseRunnable');

sub fetch_input {
  my $self = shift @_;

  my $prev_rel_db  = $self->param('prev_rel_db');
  if(! $prev_rel_db) {
    $self->complete_early("Not running as 'prev_rel_db' not given in parameters\n");
  }

  $self->param_required('master_db');
  my $type         = $self->param_required('type');     # must be 't' or 'f'
  my $curr_release = $self->param('release')      || $self->compara_dba->get_MetaContainer->get_schema_version;
  my $prev_rel_dba = $self->get_cached_compara_dba('prev_rel_db');
  my $prev_release = $self->param('prev_release') || $prev_rel_dba->get_MetaContainer->get_schema_version;

  my $adaptor   = Bio::EnsEMBL::Compara::StableId::Adaptor->new();
  my $from_ncs  = $adaptor->fetch_ncs($prev_release, $type, $prev_rel_dba->dbc());
  my $to_ncs    = $adaptor->fetch_ncs($curr_release, $type, $self->compara_dba->dbc());
  my $ncsl      = Bio::EnsEMBL::Compara::StableId::NamedClusterSetLink->new(-FROM => $from_ncs, -TO => $to_ncs);

  $self->param('adaptor', $adaptor);
  $self->param('ncsl', $ncsl);
  $self->param('prev_release', $prev_release); #replace it with whatever it is now
}

sub run {
  my $self = shift @_;

  $self->compara_dba()->dbc()->disconnect_if_idle();

  my $ncsl = $self->param('ncsl');
  my $postmap = $ncsl->maximum_name_reuse();
  $ncsl->to->apply_map($postmap);
}

sub write_output {
  my $self = shift @_;

  my $adaptor   = $self->param('adaptor');
  my $ncsl      = $self->param('ncsl');

  my $master_dbc = $self->get_cached_compara_dba('master_db')->dbc();
  $self->elevate_privileges($master_dbc);
  my $time_when_started_storing = time();
  eval {
    $adaptor->store_map($ncsl->to, $self->compara_dba()->dbc());
    $adaptor->store_history($ncsl, $self->compara_dba()->dbc(), $time_when_started_storing, $master_dbc);
  };
  if($@) {
    die "Detected error during store. Check your database settings are correct for the master database (read/write): $@";
  }
}

1;


text:
namespace tower {
    TowerFactory::TowerFactory(void) {

    }

    TowerFactory::~TowerFactory(void) {

    }

    void TowerFactory::initialise(const std::string& _name, const std::string& _resourcePath) {

    }
    void TowerFactory::initialise(const std::string& _name, asc::XML _resource) {
        if (isTowerInitialised(_name)) {
            return;
        }

        m_Resources.push_back(std::pair<std::string, asc::XML>(_name, _resource));
    }
    bool TowerFactory::isTowerInitialised(const std::string& _name) {
        for (auto& pair : m_Resources) {
            if (pair.first == _name) {
                return true;
            }
        }
        return false;
    }
    Tower *TowerFactory::createTowerInstance(const std::string& _name) {
        return nullptr;
    }

    std::vector<std::string> TowerFactory::getInitialisedTowers(void) const {
        std::vector<std::string> towerNames;

        for (auto& pair : m_Resources) {
            towerNames.push_back(pair.first);
        }

        return towerNames;
    }
}


text:
import { bootstrap } from 'angular2/platform/browser'
import { Component, View, provide, Input } from 'angular2/core';
import { Router, ROUTER_PROVIDERS, LocationStrategy, HashLocationStrategy, RouteConfig, Route, ROUTER_DIRECTIVES, APP_BASE_HREF } from 'angular2/router';
import { HomeComponent } from './components/home/home';
import { Navbar } from './components/navbar/index';
import { SignIn } from './components/signin/signin';
import { SignUp } from './components/signup/signup';
import { Action } from './components/action/action';
import { Participate } from './components/participate/participate';
import { PollsList } from './components/pollslist/pollslist';
import { PollEditor } from './components/polleditor/index';
import { Stats } from './components/stats/stats';

@Component({
	selector: 'app'
	// providers: [SignIn]
	// directives: [SignIn]
})
@View({
	template: `
	<navbar [username]="username"></navbar>
	<div class="main">
    	<router-outlet></router-outlet>
	</div>`,
	// template: '<router-outlet></router-outlet>',
	directives: [Navbar, HomeComponent, SignIn, SignUp, ROUTER_DIRECTIVES]
})
@RouteConfig([
	{ path: '/', component: HomeComponent, name: 'Home' },
	{ path: '/signin', component: SignIn, name: 'SignIn' },
	{ path: '/signup', component: SignUp, name: 'SignUp' },
	{ path: '/action', component: Action, name: 'Action' },
	{ path: '/pollslist', component: PollsList, name: 'PollsList' },
	{ path: '/editor/:id', component: PollEditor, name: 'PollEditor' },
	{ path: '/participate', component: Participate, name: 'Participate' },
	{ path: '/stats/:id', component: Stats, name: 'Stats' },
])
export class App {
	public username;

	constructor(private router: Router) {
		this.router = router;
	}

	ngOnInit() {
		// document.addEventListener('storage', function(event) {
		// 	var key = event.key;
		// 	var newValue = event.newValue;
		// 	var oldValue = event.oldValue;
		// 	var url = event.url;
		// 	var storageArea = event.storageArea;

		// 	console.log('STORAGE');
		// 	console.log(oldValue);
		// 	console.log(newValue);

		// 	// handle the event
		// });

		if (localStorage && localStorage.getItem('username')) {
			// logged
			this.username = localStorage.getItem('username');
			this.router.navigate(['Action']);
		}
		// this.username = 'test_from_app';
		console.log('[Component] app running');
	}

	ngOnChanges(a) {
		console.info(a)
        console.log('[Component] app onChanges');
    }
}

bootstrap(App, [
	ROUTER_PROVIDERS,
	provide(APP_BASE_HREF, { useValue: '/' }),
	provide(LocationStrategy, { useClass: HashLocationStrategy })
]);


text:
<?php

/**
 * Document: RoutesActivation
 *
 *
 * @author Roland W. <roland.wassinger@gmail.com>
 *
 * @version 1.0.0  09.08.2013 - 09:34:04
 * UTF-8
 *
 * @package Croogo.Routes
 * @project
 */
/*
 * Copyright (C) 2013 Roland Wassinger <roland.wassinger@gmail.com>
 *
 * @license http://www.opensoure.org/licenses/mit-license.php The MIT License
 */
class RoutesActivation{
/**
 * onActviate will be called if this return true
 *
 * @param  object $controller Controller
 * @return boolean
 */
	public function beforeActivation(&$controller){
		$sql = file_get_contents(APP.'Plugin'.DS.'Routes'.DS.'Config'.DS.'Schema'.DS.'routes.sql');

		if(!empty($sql)){
			$db = $this->_connect();

			$prefix = $db->config['prefix'];

			$sql = str_replace('routes', $prefix.'routes' , $sql);
			$statements = explode(';', $sql);

			foreach ($statements as $statement) {
				if(trim($statement) != ''){
					$db->query($statement);
				}
			}
		}
		return true;
	}
/**
 * Called after activating the plugin
 *
 * @param object $controller Controller
 * @return void
 */
	public function onActivation(&$controller){
		$controller->Croogo->addAco('Routes/Routes/admin_index'); //RoutesController::admin_index
		$controller->Croogo->addAco('Routes/Routes/admin_add');
		$controller->Croogo->addAco('Routes/Routes/admin_edit');
		$controller->Croogo->addAco('Routes/Routes/admin_delete');

//		$controller->Setting->write('Route.tab_node', 1, array(
//			'title' => 'Route Tab active',
//			'description' => 'View Route Tab by Link add and edit',
//			'input_type' => 'checkbox',
//			'editable' => 1,
//
//		));

//		App::uses('CroogoPlugin', 'Extensions.Lib');
//		$CroogoPlugin = new CroogoPlugin();
//		$CroogoPlugin->migrate('Routes');
	}

/**
 * onDeactivate will be called if this returns true
 *
 * @param  object $controller Controller
 * @return boolean
 */
	public function beforeDeactivation($controller){
		$db = $this->_connect();
		$prefix = $db->config['prefix'];
		$db->query('DROP TABLE IF EXISTS '.$prefix.'routes');
		return true;
	}

/**
* Called after deactivating the plugin in ExtensionsPluginsController::admin_toggle()
 *
 * @param object $controller Controller
 * @return void
 */
	public function onDeactivation(&$controller) {
		$controller->Croogo->removeAco('Routes');
		#$controller->Setting->deleteKey('Route.tab_node');
	}

	private function _connect(){
		App::import('Core', 'File');
		App::import('Model', 'ConnectionManager');
		$db = ConnectionManager::getDataSource('default');

		return $db;
	}
}
?>


text:
<!DOCTYPE html>
<!--
Copyright 2015 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->

<link rel="import" href="/tracing/core/scripting_controller.html">
<link rel="import" href="/tracing/extras/tquery/filter.html">

<script>
'use strict';

tr.exportTo('tr.e.tquery', function() {
  function FilterHasTitle(expected) {
    tr.e.tquery.Filter.call(this);
    this.expected = expected;
  }

  FilterHasTitle.prototype = {
    __proto__: tr.e.tquery.Filter.prototype,

    evaluate(context) {
      return this.matchValue_(context.event.title, this.expected);
    }
  };
  tr.c.ScriptingObjectRegistry.register(
      function(expected) {
        const filter = new tr.e.tquery.FilterHasTitle(expected);
        return filter;
      },
      {
        name: 'hasTitle'
      }
  );

  return {
    FilterHasTitle,
  };
});
</script>


text:
<html ⚡ i-amphtml-layout i-amphtml-no-boilerplate>
  <head>
    <style amp-runtime></style>
    <script async src=https://cdn.ampproject.org/v0.js></script>
    <script async custom-element=amp-experiment src=https://cdn.ampproject.org/v0/amp-experiment-0.1.js></script>
    <link href=https://example.com/favicon.ico rel=icon>
  </head>
  <body>
    Hello World
  </body>
</html>


text:
package io.rong.app.activity;

import android.annotation.SuppressLint;
import android.app.ProgressDialog;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import io.rong.app.R;

/**
 * Created by Administrator on 2015/3/20.
 */
@SuppressLint("SetJavaScriptEnabled")
public class FunctionIntroducedActivity extends BaseActionBarActivity {

    private WebView mWebView = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.de_ac_function_introduced);
        initView();

    }

    protected void initView() {
        getSupportActionBar().setTitle(R.string.function_introduce);

        mWebView = (WebView) findViewById(R.id.function_introdiced_webview);
        mWebView.getSettings().setJavaScriptEnabled(true);
        mWebView.getSettings().setUseWideViewPort(true);
        mWebView.getSettings().setLoadWithOverviewMode(true);
        mWebView.getSettings().setBuiltInZoomControls(true);
        mWebView.getSettings().setSupportZoom(true);

        MyWebViewClient mMyWebViewClient = new MyWebViewClient();
        mMyWebViewClient.onPageFinished(mWebView, "http://rongcloud.cn/features");
        mMyWebViewClient.shouldOverrideUrlLoading(mWebView, "http://rongcloud.cn/features");
        mMyWebViewClient.onPageFinished(mWebView, "http://rongcloud.cn/features");
        mWebView.setWebViewClient(mMyWebViewClient);
    }

    class MyWebViewClient extends WebViewClient {

        ProgressDialog progressDialog;

        @Override
        public void onPageStarted(WebView view, String url, Bitmap favicon) {//网页页面开始加载的时候
            if (progressDialog == null) {
                progressDialog = new ProgressDialog(FunctionIntroducedActivity.this);
                progressDialog.setMessage("Please wait...");
                progressDialog.show();
                mWebView.setEnabled(false);// 当加载网页的时候将网页进行隐藏
            }
            super.onPageStarted(view, url, favicon);
        }

        @Override
        public void onPageFinished(WebView view, String url) {//网页加载结束的时候
            //super.onPageFinished(view, url);
            if (progressDialog != null && progressDialog.isShowing()) {
                progressDialog.dismiss();
                progressDialog = null;
                mWebView.setEnabled(true);
            }
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) { //网页加载时的连接的网址
            view.loadUrl(url);
            return false;
        }
    }

}


text:
<?php

namespace Gtt\ThriftGenerator\Tests\Fixtures\ContainerTypes\PHP\DTO;

/**
 * Data transfer object used to test container types support
 *
 * @author fduch <alex.medwedew@gmail.com>
 */
class DTO2
{
    /**
     * First property with folded complex type
     *
     * @var \Gtt\ThriftGenerator\Tests\Fixtures\ContainerTypes\PHP\DTO\DTO2[]
     */
    public $one;
}


text:
package io.silverware.providers.camel;

import io.silverware.microservices.annotations.Microservice;
import io.silverware.microservices.providers.camel.CamelMicroserviceProvider;
import io.silverware.microservices.providers.cdi.CdiMicroserviceProvider;
import io.silverware.microservices.providers.cdi.MicroservicesStartedEvent;
import io.silverware.microservices.silver.CdiSilverService;
import io.silverware.microservices.util.BootUtil;
import io.silverware.microservices.util.Utils;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.testng.Assert;
import org.testng.annotations.Test;

import javax.annotation.PostConstruct;
import javax.enterprise.event.Observes;
import javax.enterprise.inject.spi.BeanManager;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;

/**
 * @author Martin Večeřa
 */
public class CamelCdiIntegrationTest {

   private static final Semaphore semaphore = new Semaphore(0);

   @Test
   public void testHello() throws Exception {
      final BootUtil bootUtil = new BootUtil();
      final Thread platform = bootUtil.getMicroservicePlatform(this.getClass().getPackage().getName(), CdiMicroserviceProvider.class.getPackage().getName(), CamelMicroserviceProvider.class.getPackage().getName());
      platform.start();

      BeanManager beanManager = null;
      while (beanManager == null) {
         beanManager = (BeanManager) bootUtil.getContext().getProperties().get(CdiSilverService.BEAN_MANAGER);
         Thread.sleep(200);
      }

      Assert.assertTrue(semaphore.tryAcquire(10, TimeUnit.MINUTES), "Timed-out while waiting for platform startup.");

      Thread.sleep(500);

      platform.interrupt();
      platform.join();
   }

   @Microservice("camelCdiMicroservice")
   public static class CamelCdiMicroservice {

      private final Logger log = LogManager.getLogger(CamelCdiMicroservice.class);

      public CamelCdiMicroservice() {
         log.info("CamelCdiMicroservice constructor");
      }

      @PostConstruct
      public void onInit() {
         log.info("CamelCdiMicroservice PostConstruct " + this.getClass().getName());
      }

      public void hello() {
         log.info("CamelCdiMicroservice Hello");
      }

      public String sayHello(final String msg) {
         semaphore.release();
         return "Answering '" + msg + "' with 'How do you do!'";
      }

      public void eventObserver(@Observes MicroservicesStartedEvent event) {
         log.info("CamelCdiMicroservice MicroservicesStartedEvent");
      }
   }
}


text:
FROM node
EXPOSE 80
ADD . /
RUN npm install
CMD npm start


text:
  name:
  <input type="text" [(ngModel)]="task.name" (ngModelChange)="setUpdatedAt($event)" #name="ngModel" required minlength="3" maxlength="10">

    Name is required

    Name must be at least 2 characters long.

    Name cannot be more than 10 characters long.

タスク

タスク名:{{task.name}}

最終更新:{{task.updatedAt | date: 'MM/dd hh:mm:ss'}}


text:
module Hughes

  class Maybe

    def initialize(value)
      @value = value
    end

    def method_missing(name, *args, &block)
      if @value.respond_to?(name)
        Maybe[@value.send(name, *args, &block)]
      else
        Nothing[]
      end
    end

    def respond_to?(method_name, include_private = false)
      true
    end

    def &
      @value
    end

    def self.[](value)
      Maybe.new(value)
    end

  end

end


text:
CREATE database dependencycheck;
USE dependencycheck;

DROP TABLE IF EXISTS software;
DROP TABLE IF EXISTS cpeEntry;
DROP TABLE IF EXISTS reference;
DROP TABLE IF EXISTS vulnerability;
DROP TABLE IF EXISTS properties;

CREATE TABLE properties (id varchar(50) PRIMARY KEY, value varchar(500));

CREATE TABLE vulnerability (id int auto_increment PRIMARY KEY, cve VARCHAR(20) UNIQUE,
	description VARCHAR(8000), cwe VARCHAR(10), cvssScore DECIMAL(3,1), cvssAccessVector VARCHAR(20),
	cvssAccessComplexity VARCHAR(20), cvssAuthentication VARCHAR(20), cvssConfidentialityImpact VARCHAR(20),
	cvssIntegrityImpact VARCHAR(20), cvssAvailabilityImpact VARCHAR(20));

CREATE TABLE reference (cveid INT, name VARCHAR(1000), url VARCHAR(1000), source VARCHAR(255),
	CONSTRAINT fkReference FOREIGN KEY (cveid) REFERENCES vulnerability(id) ON DELETE CASCADE);

CREATE TABLE cpeEntry (id INT auto_increment PRIMARY KEY, cpe VARCHAR(250), vendor VARCHAR(255), product VARCHAR(255));

CREATE TABLE software (cveid INT, cpeEntryId INT, previousVersion VARCHAR(50)
    , CONSTRAINT fkSoftwareCve FOREIGN KEY (cveid) REFERENCES vulnerability(id) ON DELETE CASCADE
    , CONSTRAINT fkSoftwareCpeProduct FOREIGN KEY (cpeEntryId) REFERENCES cpeEntry(id));

CREATE INDEX idxVulnerability ON vulnerability(cve);
CREATE INDEX idxReference ON reference(cveid);
CREATE INDEX idxCpe ON cpeEntry(cpe);
CREATE INDEX idxCpeEntry ON cpeEntry(vendor, product);
CREATE INDEX idxSoftwareCve ON software(cveid);
CREATE INDEX idxSoftwareCpe ON software(cpeEntryId);

INSERT INTO properties(id,value) VALUES ('version','2.9');

CREATE USER 'dcuser' IDENTIFIED BY 'DC-Pass1337!';
GRANT SELECT, INSERT, DELETE, UPDATE ON dependencycheck.* TO 'dcuser';


text:
package com.parse4cn1;

/**
 * An exception class for the library.
 */
public class ParseException extends Exception {

    private static final long serialVersionUID = 1L;

    public static final int OTHER_CAUSE = -1;
    public static final int INTERNAL_SERVER_ERROR = 1;
    public static final int CONNECTION_FAILED = 100;
    public static final int OBJECT_NOT_FOUND = 101;
    public static final int INVALID_QUERY = 102;
    public static final int INVALID_CLASS_NAME = 103;
    public static final int MISSING_OBJECT_ID = 104;
    public static final int INVALID_KEY_NAME = 105;
    public static final int INVALID_POINTER = 106;
    public static final int INVALID_JSON = 107;
    public static final int COMMAND_UNAVAILABLE = 108;
    public static final int NOT_INITIALIZED = 109;
    public static final int INCORRECT_TYPE = 111;
    public static final int INVALID_CHANNEL_NAME = 112;
    public static final int PUSH_MISCONFIGURED = 115;
    public static final int OBJECT_TOO_LARGE = 116;
    public static final int OPERATION_FORBIDDEN = 119;
    public static final int CACHE_MISS = 120;
    public static final int INVALID_NESTED_KEY = 121;
    public static final int INVALID_FILE_NAME = 122;
    public static final int INVALID_ACL = 123;
    public static final int TIMEOUT = 124;
    public static final int INVALID_EMAIL_ADDRESS = 125;
    public static final int DUPLICATE_VALUE = 137;
    public static final int INVALID_ROLE_NAME = 139;
    public static final int EXCEEDED_QUOTA = 140;
    public static final int CLOUD_ERROR = 141;
    public static final int USERNAME_MISSING = 200;
    public static final int PASSWORD_MISSING = 201;
    public static final int USERNAME_TAKEN = 202;
    public static final int EMAIL_TAKEN = 203;
    public static final int EMAIL_MISSING = 204;
    public static final int EMAIL_NOT_FOUND = 205;
    public static final int SESSION_MISSING = 206;
    public static final int MUST_CREATE_USER_THROUGH_SIGNUP = 207;
    public static final int ACCOUNT_ALREADY_LINKED = 208;
    public static final int LINKED_ID_MISSING = 250;
    public static final int INVALID_LINKED_SESSION = 251;
    public static final int UNSUPPORTED_SERVICE = 252;

    public static final String ERR_PROCESSING_RESPONSE = "An error occurred while processing response from server.";
    public static final String ERR_PREPARING_REQUEST = "An error occurred while preparing request to server.";
    public static final String ERR_INVALID_RESPONSE = "Invalid response from backend.";
    public static final String ERR_INTERNAL = "An internal error occurred.";
    public static final String ERR_NETWORK = "A network error occurred.";

    private int code;
    private Throwable cause;

    /**
     * Creates an exception with the specified error code, message and cause.
     *
     * @param code The error code associated with this exception.
     * @param message The end-user directed, human-readable error message.
     * @param cause The cause of the exception.
     */
    public ParseException(int code, String message,
            Throwable cause) {
        super(message);
        this.cause = cause;
        this.code = code;
    }

    /**
     * Creates an exception with the specified error code and message.
     *
     * @param code The error code associated with this exception.
     * @param message The end-user directed, human-readable error message.
     */
    public ParseException(int code, String message) {
        super(message);
        this.code = code;
    }

    /**
     * Creates an exception with the specified message and cause.
     *
     * @param message The end-user directed, human-readable error message.
     * @param cause The cause of the exception.
     */
    public ParseException(String message, Throwable cause) {
        this(OTHER_CAUSE, message, cause);
    }

    /**
     *
     * @return The error code associated with this exception
     * (defaults to -1 if none is specified).
     */
    public int getCode() {
        return this.code;
    }

    /**
     *
     * @return The cause of the exception if specified; otherwise null.
     */
    public Throwable getCause() {
        return this.cause;
    }

    @Override
    public String toString() {
        return "ParseException [code=" + code + ", msg=" + getMessage() + ", cause=" + getCause() + "]";
    }
}


text:
namespace EntityFramework.Functions.Tests.Examples
{
    using System.Data.Entity;

    using EntityFramework.Functions.Tests.Properties;

    public partial class AdventureWorks : DbContext
    {
        static AdventureWorks()
        {
            Database.SetInitializer<AdventureWorks>(null);
            // Equivalent to: Database.SetInitializer(new NullDatabaseInitializer<AdventureWorks>());
        }

        public AdventureWorks()
            : base(Settings.Default.AdventureWorksConnectionString)
        {
        }
    }
}


text:
import os
import sys
import numpy

sys.path.append('./code')
sys.path.append('./code/cmt')

from distutils.core import setup, Extension
from distutils.ccompiler import CCompiler, get_default_compiler
from utils import parallelCCompiler
from numpy.distutils.intelccompiler import IntelCCompiler
from numpy import any
from python import __version__

INTEL_PATH = '/opt/intel/'

# heuristic for figuring out which compiler is being used (icc, gcc)
if any(['intel' in arg for arg in sys.argv]) or 'intel' in get_default_compiler():
	# icc-specific options
	include_dirs=[
		os.path.join(INTEL_PATH, 'mkl/include')]
	library_dirs=[
		os.path.join(INTEL_PATH, 'mkl/lib'),
		os.path.join(INTEL_PATH, 'lib')]
	libraries = [
		'mkl_intel_lp64',
		'mkl_intel_thread',
		'mkl_core',
		'mkl_def',
		'iomp5']
	extra_compile_args = [
		'-DEIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS',
		'-DEIGEN_USE_MKL_ALL',
		'-Wno-deprecated',
		'-wd1224',
		'-openmp',
		'-std=c++0x']
	extra_link_args = []

	for path in [os.path.join(INTEL_PATH, 'mkl/lib/intel64'), os.path.join(INTEL_PATH, 'lib/intel64')]:
		if os.path.exists(path):
			library_dirs += [path]

elif sys.platform == 'darwin':
	# clang-specific options
	include_dirs = []
	library_dirs = []
	libraries = []
	extra_compile_args = [
		'-std=c++0x',
		'-Wno-deprecated-register',
		'-Wno-#warnings']
	extra_link_args = []

	if 'CC' not in os.environ:
		os.environ['CC'] = 'clang++'
	if 'CXX' not in os.environ:
		os.environ['CXX'] = 'clang++'
		extra_compile_args.append('-stdlib=libc++')
	if 'MACOSX_DEPLOYMENT_TARGET' not in os.environ:
		os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.7'

else:
	# gcc-specific options
	include_dirs = []
	library_dirs = []
	libraries = ['gomp']
	extra_compile_args = [
		'-std=c++0x',
		'-Wno-cpp',
		'-Wno-unused-local-typedefs',
		'-fopenmp']
	extra_link_args = []

modules = [
	Extension('_cmt',
		language='c++',
		sources=[
			'code/cmt/python/src/callbackinterface.cpp',
			'code/cmt/python/src/conditionaldistributioninterface.cpp',
			'code/cmt/python/src/distributioninterface.cpp',
			'code/cmt/python/src/fvbninterface.cpp',
			'code/cmt/python/src/glminterface.cpp',
			'code/cmt/python/src/gsminterface.cpp',
			'code/cmt/python/src/mcbminterface.cpp',
			'code/cmt/python/src/mcgsminterface.cpp',
			'code/cmt/python/src/module.cpp',
			'code/cmt/python/src/mixtureinterface.cpp',
			'code/cmt/python/src/mlrinterface.cpp',
			'code/cmt/python/src/nonlinearitiesinterface.cpp',
			'code/cmt/python/src/patchmodelinterface.cpp',
			'code/cmt/python/src/preconditionerinterface.cpp',
			'code/cmt/python/src/pyutils.cpp',
			'code/cmt/python/src/stminterface.cpp',
			'code/cmt/python/src/toolsinterface.cpp',
			'code/cmt/python/src/trainableinterface.cpp',
			'code/cmt/python/src/univariatedistributionsinterface.cpp',
			'code/cmt/src/affinepreconditioner.cpp',
			'code/cmt/src/affinetransform.cpp',
			'code/cmt/src/binningtransform.cpp',
			'code/cmt/src/conditionaldistribution.cpp',
			'code/cmt/src/distribution.cpp',
			'code/cmt/src/glm.cpp',
			'code/cmt/src/gsm.cpp',
			'code/cmt/src/mcbm.cpp',
			'code/cmt/src/mcgsm.cpp',
			'code/cmt/src/mixture.cpp',
			'code/cmt/src/mlr.cpp',
			'code/cmt/src/nonlinearities.cpp',
			'code/cmt/src/patchmodel.cpp',
			'code/cmt/src/pcapreconditioner.cpp',
			'code/cmt/src/pcatransform.cpp',
			'code/cmt/src/preconditioner.cpp',
			'code/cmt/src/regularizer.cpp',
			'code/cmt/src/stm.cpp',
			'code/cmt/src/tools.cpp',
			'code/cmt/src/trainable.cpp',
			'code/cmt/src/utils.cpp',
			'code/cmt/src/univariatedistributions.cpp',
			'code/cmt/src/whiteningpreconditioner.cpp',
			'code/cmt/src/whiteningtransform.cpp'],
		include_dirs=[
			'code',
			'code/cmt/include',
			'code/cmt/python/include',
			'code/liblbfgs/include',
			os.path.join(numpy.__path__[0], 'core/include/numpy')] + include_dirs,
		library_dirs=[] + library_dirs,
		libraries=[] + libraries,
		extra_link_args=[
			'-fPIC',
			'code/liblbfgs/lib/.libs/liblbfgs.a'] + extra_link_args,
		extra_compile_args=[
			'-DEIGEN_NO_DEBUG',
			'-Wno-sign-compare',
			'-Wno-int-in-bool-context',
			'-Wno-parentheses',
			'-Wno-write-strings'] + extra_compile_args)]

if 'CC_PARALLEL' in os.environ and os.environ['CC_PARALLEL'] == '1':
	# enable parallel compilation
	CCompiler.compile = parallelCCompiler

setup(
	name='cmt',
	version=__version__,
	author='Lucas Theis',
	author_email='lucas@theis.io',
	description='Fast implementations of different probabilistic models.',
	url='http://github.com/lucastheis/cmt',
	license='MIT',
	ext_modules=modules,
	package_dir={'cmt': 'code/cmt/python'},
	packages=[
		'cmt',
		'cmt.models',
		'cmt.transforms',
		'cmt.tools',
		'cmt.utils',
		'cmt.nonlinear'])


text:
<?php
class CI_inicio extends CI_Controller {

		public function __construct()
       {
            parent::__construct();

		$this->load->model('M_geral');
		$this->load->model('M_configuracoes');
		$this->load->model('M_usuarios');
		$this->load->model('M_perfisusuarios');
            $this->load->model('M_usuarios');
			$this->M_geral->verificaSessao();
			if ($this->session->userdata('usuario_id') != 0 && $this->session->userdata('usuario_id') != ""){
				$this->dados['isLoged'] = true;
				$this->dados['usuario_logado'] = $this->session->userdata('nome');
			}else
				$this->dados['isLoged'] = false;
       }

	function index()
	{
		if ($this->session->userdata('usuario_id') != null && $this->M_usuarios->selecionar($this->session->userdata('usuario_id'))->result_array()[0]["website_titulo"] != ""){
			$this->dados['title'] = $this->M_usuarios->selecionar($this->session->userdata('usuario_id'))->result_array()[0]["website_titulo"];
		}else{
			$this->dados['title'] = $this->M_configuracoes->selecionar('titulo')->result_array()[0]["value"];
		}
		$this->dados['usuario_logado'] = $this->session->userdata('nome');
		$this->load->view('inc/topo',$this->dados);
		$this->load->view('inc/menu');
		$this->load->view('saudacao');
		$this->load->view('inc/rodape');
	}
}
?>


text:
#include "common/goopy_utils.h"

#include <atlbase.h>
#include <atlwin.h>
#include <shlobj.h>
#include <psapi.h>

#include "base/stringprintf.h"
#include "common/app_const.h"
#include "common/app_utils.h"
#include "common/install_tools.h"
#include "common/registry.h"
#include "common/shellutils.h"

namespace ime_goopy {

const wchar_t kOemName[] = L"OEM";
// {BF9994A8-1840-47b2-9B14-4EF7C51F183E}
const GUID kOptionsElevationPolicyGuid =
{0xbf9994a8, 0x1840, 0x47b2, {0x9b, 0x14, 0x4e, 0xf7, 0xc5, 0x1f, 0x18, 0x3e}};
// {2AAEEAC6-B521-49c2-AC05-CEF715924F79}
const GUID kDashboardElevationPolicyGuid =
{0x2aaeeac6, 0xb521, 0x49c2, {0xac, 0x5, 0xce, 0xf7, 0x15, 0x92, 0x4f, 0x79}};
const wchar_t kUninstallKey[] =
  L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\GooglePinyin2";
const wchar_t kAutoRunRegistryKey[] =
  L"Software\\Microsoft\\Windows\\CurrentVersion\\Run";
const wchar_t kAutoRunRegistryName[] = L"Google Pinyin 2 Autoupdater";
const wchar_t kTextServiceRegistryKey[] =
  L"CLSID\\{4966A555-1B67-45c0-B82F-627FD19AAD22}";

static const wchar_t kElevationPolicyRegsitryKey[] =
  L"Software\\Microsoft\\Internet Explorer\\Low Rights\\ElevationPolicy\\";
static const wchar_t kEmptyValueName[] = L"";
static const wchar_t kKeyDefaultIcon[] = L"DefaultIcon";
static const wchar_t kKeyShell[] = L"shell";
static const wchar_t kKeyOpen[] = L"open";
static const wchar_t kKeyCommand[] = L"command";
static const wchar_t kLuaFileExt[] = L".lua";
static const wchar_t kLuaFileIdentifier[] = L"GooglePinyinIME.Extension.Lua";
static const wchar_t kLuaFileDescription[] = L"Google Pinyin IME extension";

// Windows Explorer requires an English string as the key name with the Chinese
// string as the default value. Otherwise, the Windows XP Chinese version will
// mistakenly add an underline to the first character of the Chinese command
// name.
static const wchar_t kInstallToGoopyActionKey[] = L"Install to Google IME";
static const wchar_t kInstallToGoopyAction[] =
    L"Install to Google Input Tools";

CPath GoopyUtils::GetTargetFolder(TargetFolder target) {
  switch (target) {
    case TARGET_SYSTEM_X86:
      if (ShellUtils::Is64BitOS())
        return installer::FileUtils::GetShellSubFolder(CSIDL_SYSTEMX86, L"");
      else
        return installer::FileUtils::GetShellSubFolder(CSIDL_SYSTEM, L"");
      break;
    case TARGET_SYSTEM_X64:
      if (ShellUtils::Is64BitOS()) {
        return installer::FileUtils::GetShellSubFolder(CSIDL_SYSTEM, L"");
      } else {
        DCHECK("0");
        return L"";
      }
      break;
    case TARGET_BINARY:
      return installer::FileUtils::GetShellSubFolder(CSIDL_PROGRAM_FILES,
                                                     kInputToolsSubFolder);
      break;
    case TARGET_SYSTEM_DATA:
      return installer::FileUtils::GetShellSubFolder(CSIDL_COMMON_APPDATA,
                                                     kInputToolsSubFolder);
      break;
    case TARGET_USER_DATA:
      return installer::FileUtils::GetShellSubFolder(CSIDL_APPDATA,
                                                     kInputToolsSubFolder);
      break;
  };
  return L"";
}

CPath GoopyUtils::GetTargetPath(TargetFolder target, const CString& filename) {
  CPath path = GetTargetFolder(target);
  path.Append(filename);
  return path;
}

// Associates a file extension with commands. extension should be something like
// ".ext", file_type is the identifier of the file type. specific_action_key,
// specific_action_name, and specific_action_command are used to register a new
// command other than the default "open" command, e.g., "install into IME".
//
// The current logic is a bit conservative: if the file extension is already
// registered, do not change the existing file type identifer, do not change the
// existing open command - only add the specific action into the registry.
static bool InternalAssociateFile(const wchar_t* extension,
                                  const wchar_t* file_type,
                                  const wchar_t* file_description,
                                  const wchar_t* icon_path,
                                  const wchar_t* open_command,
                                  const wchar_t* specific_action_key,
                                  const wchar_t* specific_action_name,
                                  const wchar_t* specific_action_command) {
  bool existed = false;
  wstring previous_value;
  if (!RegistryKey::CreateAndSetStringValueIfNotExisted(
          HKEY_CLASSES_ROOT, extension,
          kEmptyValueName, file_type,
          &existed, &previous_value)) {
    return false;
  }
  wstring new_file_type = existed ? previous_value : file_type;
  if (!RegistryKey::CreateAndSetStringValueIfNotExisted(
          HKEY_CLASSES_ROOT, new_file_type,
          kEmptyValueName, file_description,
          NULL, NULL)) {
    return false;
  }
  wstring key = WideStringPrintf(L"%s\\%s",
                                 new_file_type.c_str(),
                                 kKeyDefaultIcon);
  if (!RegistryKey::CreateAndSetStringValueIfNotExisted(
          HKEY_CLASSES_ROOT, key,
          kEmptyValueName, icon_path,
          NULL, NULL)) {
    return false;
  }
  key = WideStringPrintf(L"%s\\%s\\%s\\%s",
                         new_file_type.c_str(),
                         kKeyShell,
                         kKeyOpen,
                         kKeyCommand);
  if (!RegistryKey::CreateAndSetStringValueIfNotExisted(
          HKEY_CLASSES_ROOT, key,
          kEmptyValueName, open_command,
          NULL, NULL)) {
    return false;
  }
  key = WideStringPrintf(L"%s\\%s\\%s",
                         new_file_type.c_str(),
                         kKeyShell,
                         specific_action_key);
  if (!RegistryKey::CreateAndSetStringValueIfNotExisted(
          HKEY_CLASSES_ROOT, key,
          kEmptyValueName, specific_action_name,
          NULL, NULL)) {
    return false;
  }
  key = WideStringPrintf(L"%s\\%s\\%s\\%s",
                         new_file_type.c_str(),
                         kKeyShell,
                         specific_action_key,
                         kKeyCommand);
  if (!RegistryKey::CreateAndSetStringValueIfNotExisted(
          HKEY_CLASSES_ROOT, key,
          kEmptyValueName, specific_action_command,
          NULL, NULL)) {
    return false;
  }
  return true;
}

// Removes the association of a particular file extension. If the extension is
// associated to a different file type identifier(i.e., it's registered by other
// applications), only locates then removes the specific action registered by
// Goopy.
static bool InternalDissociateFile(const wchar_t* extension,
                                   const wchar_t* file_type,
                                   const wchar_t* specific_action_key,
                                   const wchar_t* specific_action) {
  LONG ret = 0;
  RegistryKey registry;
  ret = registry.Open(HKEY_CLASSES_ROOT, extension,
                      KEY_READ | KEY_WRITE | KEY_WOW64_64KEY);
  if (ret != ERROR_SUCCESS)
    return false;
  wstring previous_file_type;
  ret = registry.QueryStringValue(kEmptyValueName, &previous_file_type);
  if (ret != ERROR_SUCCESS)
    return false;
  if (previous_file_type == file_type) {
    RegistryKey::RecurseDeleteKey(HKEY_CLASSES_ROOT, extension, 0);
    RegistryKey::RecurseDeleteKey(HKEY_CLASSES_ROOT, file_type, 0);
  } else {
    ret = registry.Open(HKEY_CLASSES_ROOT, previous_file_type.c_str());
    if (ret != ERROR_SUCCESS)
      return false;
    wstring key = WideStringPrintf(L"%s\\%s",
                                   kKeyShell,
                                   specific_action_key);
    RegistryKey::RecurseDeleteKey(registry.m_hKey, key, 0);
    // Also deletes the Chinese action name which was used by old version as the
    // action key, so that the new logic can cover the old installs.
    key = WideStringPrintf(L"%s\\%s",
                           kKeyShell,
                           specific_action);
    RegistryKey::RecurseDeleteKey(registry.m_hKey, key, 0);
  }
  return true;
}

bool GoopyUtils::AreFileExtensionsAssociated() {
  // Only check if the IME-specific action of the lua file extension exists.
  LONG ret = 0;
  RegistryKey registry;
  ret = registry.Open(HKEY_CLASSES_ROOT, kLuaFileExt,
                      KEY_READ | KEY_WOW64_64KEY);
  if (ret != ERROR_SUCCESS)
    return false;
  wstring file_type;
  ret = registry.QueryStringValue(kEmptyValueName, &file_type);
  if (ret != ERROR_SUCCESS)
    return false;
  wstring key = WideStringPrintf(L"%s\\%s\\%s",
                                 file_type.c_str(),
                                 kKeyShell,
                                 kInstallToGoopyActionKey);
  ret = registry.Open(HKEY_CLASSES_ROOT, key.c_str(),
                      KEY_READ  | KEY_WOW64_64KEY);
  if (ret == ERROR_SUCCESS)
    return true;
  // Also checks the Chinese action name which was used by old version as the
  // action key, so that the new logic can cover the old installs.
  key = WideStringPrintf(L"%s\\%s\\%s",
                         file_type.c_str(),
                         kKeyShell,
                         kInstallToGoopyAction);
  ret = registry.Open(HKEY_CLASSES_ROOT, key.c_str(),
                      KEY_READ | KEY_WOW64_64KEY);
  return (ret == ERROR_SUCCESS);
}

bool GoopyUtils::AssociateFileExtensions() {
  CString command = GetTargetPath(TARGET_BINARY, kOptionsFilename);
  command = L"\"" + command + L"\" --import_ext_file=\"%1\"";
  CString icon_path = GetTargetPath(TARGET_SYSTEM_X86, kImeFilename);
  return InternalAssociateFile(
      kLuaFileExt,
      kLuaFileIdentifier,
      kLuaFileDescription,
      icon_path,
      command,
      kInstallToGoopyActionKey,
      kInstallToGoopyAction,
      command);
}

bool GoopyUtils::DissociateFileExtensions() {
  return InternalDissociateFile(
      kLuaFileExt,
      kLuaFileIdentifier,
      kInstallToGoopyActionKey,
      kInstallToGoopyAction);
}

bool GoopyUtils::ExtractBrandCodeFromFileName(CString* brand) {
  CPath path(AppUtils::GetBinaryFileName().c_str());
  path.StripPath();
  path.RemoveExtension();
  CString suffix = path;
  static const int kSuffixLength = 5;
  suffix = suffix.Right(kSuffixLength);
  if (suffix.GetLength() != kSuffixLength || suffix[0] != L'_')
    return false;
  *brand = suffix.Right(kSuffixLength - 1).MakeUpper();
  return true;
}

}  // namespace ime_goopy


text:
#import "PFTextButton.h"

@implementation PFTextButton

#pragma mark -
#pragma mark Init

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (!self) return nil;

    self.titleLabel.font = [UIFont systemFontOfSize:16.0f];
    [self setTitleColor:[UIColor colorWithRed:82.0f/255.0f
                                        green:152.0f/255.0f
                                         blue:252.0f/255.0f
                                        alpha:1.0f]
               forState:UIControlStateNormal];

    return self;
}

#pragma mark -
#pragma mark UIView

- (CGSize)sizeThatFits:(CGSize)boundingSize {
    CGSize size = [super sizeThatFits:boundingSize];
    size.width = MAX(32.0f, boundingSize.width);
    size.height = MIN(32.0f, boundingSize.height);
    return size;
}

@end


text:
namespace HolisticWare.Ph4ct3x.DiagnosticTests.Morphological.SomatoTypes.ML.Evaluation.Core
{
    public class SomatotypeOutputtData : SomatotypeInputData
    {
        public SomatotypeOutputtData(SomatotypeInputData stid)
            : base(stid)
        {

        }

        public double Endomorphic
        {
            get;
            set;
        }

        public double Mesomorphic
        {
            get;
            set;
        }

        public double EctoMorphic
        {
            get;
            set;
        }

    }
}


text:
require 'spec_helper'
require 'page-object/elements'

describe PageObject::Elements::ListItem do
  let(:list_item) { PageObject::Elements::ListItem }

  describe "when mapping how to find an element" do
    it "should map watir types to same" do
      [:class, :id, :index, :text, :xpath].each do |t|
        identifier = list_item.watir_identifier_for t => 'value'
        expect(identifier.keys.first).to eql t
      end
    end

    it "should map selenium types to same" do
      [:class, :id, :index, :name, :text, :xpath].each do |t|
        key, value = list_item.selenium_identifier_for t => 'value'
        expect(key).to eql t
      end
    end

    describe "interface" do
      it "should register as tag_name :li" do
        expect(::PageObject::Elements.element_class_for(:li)).to eql ::PageObject::Elements::ListItem
      end
    end
  end
end