text:
define(['require', 'jquery', 'frameworks/spine', 'frameworks/underscore', 'photo/photo', 'photo/collection', 'friendships/friend', 'frameworks/handlebars', 'plugins/masonry.jquery', 'plugins/waypoints.jquery', 'core/photobox'], function(require)
{
    var Photo = require("photo/photo");
    var Collection = require("photo/collection");
    var PhotoBox = require("core/photobox");
    var Friend = require("friendships/friend");

    var ProfileUser = Global.profile;

    var Templates = Spine.Class.sub();
    Templates.include(
    {
        photo_template: Handlebars.compile($("#photo_handlebar").html()),
        photo_menu: Handlebars.compile($("#photo_menu_handlebar").html()),
        follow_menu: Handlebars.compile($("#follow_popover_handlebar").html()),
        follow_button: Handlebars.compile($("#follow_button_handlebar").html()),
        collection_item: Handlebars.compile($("#collection_item_handlebar").html()),
        collection_toolbar: Handlebars.compile($("#collection_template_handlebar").html()),
        admin_menu: Handlebars.compile($("#admin_popover_handlebar").html())

    });

    var templates = new Templates; //Singleton pattern...
    var ProfileApp = Spine.Controller.sub(
    {
        el: $(".profile"),

        events: {
            "click .photostream_tab": "openPhotostream",
            "click .collectionstream_tab": "openCollections",
            "click .profile_tab": "openProfile",
            "click .profile_edit_button": "editProfileBannerMenu",
            "click .followers_tab": "openFollowersWindow",
            "click .following_tab": "openFollowingWindow",
            "click .edit_blrub": "editBlurb",
            "click .change_profile_button": "editProfilePhoto",
            "mouseenter .profile_header": "showOptions",
            "mouseleave .profile_header": "hideOptions",
            "mouseenter .profile_image": "showProfileEdit",
            "mouseleave .profile_image": "hideProfileEdit"
        },

        elements: {
            "ul.navigation": "tabbar",
            "ul.navigation > li": "tabbar_items",
            ".view_grid": "view_grid",
            ".collection_grid": "collection_grid",
            ".photo_grid": "photo_grid",
            ".profile_edit_button": "profile_edit_button",
            ".followers_tab": "followers_tab",
            ".following_tab": "following_tab",
            ".edit_blrub": "blurbPopup",
            ".blurb_about": "blurb_about",
            ".profile_banner_button": "profile_banner_button",
            ".edit_photo": "edit_photo_button",
            ".change_profile_button": "photo_profile_edit_button"
        },

        profile_banner_button_sticky: false,
        profile_picture_button_sticky: false,

        showOptions: function()
        {
            this.profile_banner_button.show();
        },

        hideOptions: function()
        {
            if(!this.profile_picture_button_sticky)
                this.profile_banner_button.hide();
        },

        showProfileEdit: function()
        {
            this.edit_photo_button.show();
        },

        hideProfileEdit: function()
        {
            if(!this.profile_picture_button_sticky)
                this.edit_photo_button.hide();
        },

        openProfile: function(e)
        {
            e.preventDefault();
            this.profilecontroller.active();
        },

        openPhotostream: function(e)
        {
            e.preventDefault();
            this.photostream.active();
        },

        openCollections: function(e)
        {
            e.preventDefault();
            this.collectionstream.active();
        },

        init: function()
        {
            //Preload information...
            if(Global.user.id == Global.profile.id)
            {
                Photo.fetch();
            } else {
                Photo.fetch({ data: "for="+Global.profile.id });
            }
            Collection.fetch({ data: "for="+Global.profile.id });

            //Set up views
            this.photostream = new PhotostreamController(
            {
                app: this
            });
            this.collectionstream = new CollectionController(
            {
                app: this
            });
            this.profilecontroller = new ProfileController(
            {
                app: this
            });
            this.mapscontroller = new MapsController(
            {
                app: this
            });
            this.likedcontroller = new LikedController(
            {
                app: this
            });

            //Add them to the manager
            new Spine.Manager(this.photostream, this.collectionstream, this.profilecontroller);

            //The photostream is active
            this.photostream.active();

            this.assignProfileButtonMenus();
        },

        addPhoto: function(photo)
        {
            var new_photo = new Photo(photo);
            new_photo.save(
            {
                ajax: false
            });
        },

        assignProfileButtonMenus: function()
        {
            if ($("#follow_button").length > 0)
            {
                this.followButtonController = new StreamFollowButtonController(
                {
                    el: $("#follow_button")
                });
            }

            if ($("#admin_button").length > 0)
            {
                this.adminButtonController = new StreamAdminButtonController();
            }
        },

        pressTabButton: function(child_controller)
        {
            this.tabbar_items.removeClass("pressed");
            $("." + child_controller.tab_class_name).addClass("pressed");
        },

        editProfileBannerMenu: function()
        {
            var that = this;
            if(this.profile_edit_button.data('qtip') == null) {
                var banner_controller = new ProfileBannerController({ app: this });
                this.profile_edit_button.qtip(
                {
                    content: banner_controller.el,
                    position: {
                        at: "top center",
                        my: "bottom center"
                    },
                    style: {
                        classes: 'ui-tooltip-plain ui-tooltip-shadow follow_options_tooltip',
                        width: 170,
                        tip: {
                            width: 18,
                            height: 8
                        }
                    },
                    show: {
                        event: 'click',
                        ready: true
                    },
                    hide: {
                        event: 'unfocus'
                    },
                    events: {
                        show: function()
                        {
                            that.profile_banner_button_sticky = true;
                        },
                        hidden: function(e, api)
                        {
                            $(this).qtip('destroy'); //Dispose of the tip when it's done with.
                            that.profile_banner_button_sticky = false;
                        }
                    }
                });
            }
        },

        openFollowersWindow: function()
        {
            if(this.followers_tab.data('qtip') == null) {
                $(this.followers_tab).qtip(
                {
                    content: {
                		text: '
Fetching...
',
                		ajax: {
                			url: Global.settings.rurl+'profile/'+Global.profile.url+'/pagelet/followed',
                			type: 'GET'
                		}
            		},
                    position: {
                        my: 'top center',
                        // ...at the center of the viewport
                        at: 'bottom center',
                        adjust: {
                            y: 3
                        }
                    },
                    show: {
                        solo: true,
                        event: 'click',
                        ready: true //Show when ready
                    },
                    hide: {
                        event: 'unfocus'
                    },
                    style: {
                        tip: {
                            width: 18,
                            height: 8
                        },
                        width: 300,
                        classes: 'ui-tooltip-shadow ui-tooltip-organizer-popover'
                    }
                });
            }
        },

        openFollowingWindow: function()
        {
            if(this.following_tab.data('qtip') == null) {
                $(this.following_tab).qtip(
                {
                    content: {
                		text: '
Fetching...
',
                		ajax: {
                			url: Global.settings.rurl+'profile/'+Global.profile.url+'/pagelet/following',
                			type: 'GET'
                		}
                	},
                    position: {
                        my: 'top center',
                        // ...at the center of the viewport
                        at: 'bottom center',
                        adjust: {
                            y: 3
                        }
                    },
                    show: {
                        solo: true,
                        event: 'click',
                        ready: true //Show when ready
                    },
                    hide: {
                        event: 'unfocus'
                    },
                    style: {
                        tip: {
                            width: 18,
                            height: 8
                        },
                        width: 300,
                        classes: 'ui-tooltip-shadow ui-tooltip-organizer-popover'
                    }
                });
            }
        },

        editBlurb: function(e)
        {
            e.preventDefault();
            this.blurb_editor = new BlurbEditorController({ app: this });
            this.blurb_editor.render().open();
        },

        editProfilePhoto: function(e)
        {
            var ppm = new ProfilePhotoMenuController({ app: this });
            ppm.render().open();
        }

    });

    var ProfilePhotoMenuController = Spine.Controller.sub(
    {
        events: {
            "click .remove": "remove",
            "click .upload": "upload",
            "click .adjust": "adjust",
            "change .photo_upload_input": "doUpload"
        },

        elements: {
            ".photo_upload_form": "form",
            ".photo_upload_input": "input"
        },

        init: function()
        {
            if (!this.app) throw "@app depdency";
        },

        render: function()
        {
            this.html($(".profile_photo_menu").html());
            return this;
        },

        remove: function()
        {
            window.location= Global.settings.rurl+"account/update/photo/remove";
        },

        upload: function()
        {
            console.log("Oh you want to upload a new image, huh?");
            this.input.trigger("click");
        },

        doUpload: function()
        {
            this.form.trigger("submit");
        },

        adjust: function()
        {

        },

        open: function()
        {
            var that = this;
            this.app.photo_profile_edit_button.qtip({
                content: that.el,
                position: {
                    at: "right center",
                    my: "left center"
                },
                style: {
                    classes: 'ui-tooltip-plain ui-tooltip-shadow follow_options_tooltip',
                    width: 170,
                    tip: {
                        width: 18,
                        height: 8
                    }
                },
                show: {
                    event: 'click',
                    ready: true
                },
                hide: {
                    event: 'unfocus'
                },
                events: {
                    show: function()
                    {
                        /*that.profile_banner_button_sticky = true;*/
                    },
                    hidden: function(e, api)
                    {
                        $(this).qtip('destroy'); //Dispose of the tip when it's done with.
                        //that.profile_banner_button_sticky = false;
                    }
                }
            });
        }
    });

    var BlurbEditorController = Spine.Controller.sub(
    {
        elements:
        {
            ".counter": "counter",
            ".blurblet": "blurblet",
            ".save_button": "save_button",
            ".cancel_button": "cancel_button"
        },

        events:
        {
            "keyup .blurblet": "updateCounter",
            "click .cancel_button": "close",
            "click .save_button": "save"
        },

        init: function()
        {
           if(!this.app) throw "@app dependency";
        },

        render: function()
        {
            this.html($("#profile_edit_menu").html());
            this.blurblet.val(Global.user.blurb);
            return this;
        },

        updateCounter: function()
        {
            if(this.blurblet.val().length > 160) {
                this.blurblet.val(this.blurblet.val().substr(0, 160));
            }
            this.counter.text((160-this.blurblet.val().length)+" characters left");
        },

        save: function()
        {
            var blurb = this.blurblet.val();
            var that = this;

            $.ajax({
                url: Global.settings.rurl+"profile/update/blurb",
                data: "blurb="+blurb,
                type: "POST",
                beforeSend: function()
                {
                    that.blurblet.prop("disabled", true);
                    that.save_button.html("Saving...").prop("disabled", true);
                    that.cancel_button.prop("disabled", true);
                }
            }).done(function() {
                that.app.blurb_about.html(blurb);
                Global.user.blurb = blurb; //Have to manually manage this one.
                that.close();
            });
        },

        close: function()
        {
            this.app.blurbPopup.qtip("hide");
        },

        open: function()
        {
            var that = this;
            this.app.blurbPopup.qtip(
            {
                content: that.el,
                position: {
                    at: 'bottom center',
                    my: 'top center'
                },
                style: {
                    classes: 'ui-tooltip-plain ui-tooltip-shadow follow_options_tooltip edit_dialog_tooltip',
                    tip: {
                        corner: true,
                        width: 16,
                        height: 8
                    }
                },
                show: {
                    ready: true,
                    event: "click"
                },
                hide: {
                    event: 'none'
                },
                events: {
                    hidden: function()
                    {
                        $(this).qtip("destory");
                    }
                }
            });
        }
    });

    var ProfileBannerController = Spine.Controller.sub(
    {

         el:  $('.profile_banner_menu'),

         init: function()
         {
         },

         events: {
             "click .reposition": "adjustBanner",
             "click .remove": "removeBanner",
             "click .save_reposition": "saveReposition",
             "click .cancel_reposition": "cancelReposition"
         },

         removeBanner: function()
         {
             $(".profile_banner").attr("src", "/images/linen_photoless_profile.png");
             $.post(Global.settings.rurl+"profile/update/banner", { photo: "none" });
             $(".profile_edit_button").qtip("hide");
         },

         adjustBanner: function()
         {
            $(".profile_edit_button").qtip("hide");
            $(".profile_edit_button").hide();

            require(['frameworks/jquery.ui',], function() {
                $(".profile_banner").addClass("is_repositioning");
                $(".profile_banner").draggable({
                drag: function(event, ui) {
                    if(ui.position.top>0) { ui.position.top = 0; }
                    var maxtop = ui.helper.parent().height()-ui.helper.height();
                    if(ui.position.top<maxtop) { ui.position.top = maxtop; }
                    if(ui.position.left>0) { ui.position.left = 0; }
                    var maxleft = ui.helper.parent().width()-ui.helper.width();
                    if(ui.position.left<maxleft) { ui.position.left = maxleft; }
                  }
                });

                $(".reposition_options").fadeIn();
                if(!this.c)
                {
                    this.c = new ProfileBannerController({el: $(".reposition_options") });
                }
            });
         },

         stopBannerMove: function()
         {
             $(".profile_banner").removeClass("is_repositioning");
             $(".reposition_options").hide();
             $(".profile_edit_button").show();
             $(".profile_banner").draggable("destroy");
         },

         saveReposition: function()
         {
             var offset_top = $(".profile_banner").position().top;
             this.stopBannerMove();

             Global.profile.profile_photo_offset = offset_top; //For future usage...

             $.post(Global.settings.rurl+"profile/update/banner/position", { offset: offset_top });

         },

         cancelReposition: function()
         {
            $(".profile_banner").css("top", Global.profile.profile_photo_offset);
             this.stopBannerMove();
         }
    });

    var ProfileController = Spine.Controller.sub(
    {

        tab_class_name: "profile_tab",

        el: $(".profile_grid"),

        init: function()
        {
            if (!this.app) throw "@ProfileApp dependency required.";
        },

        activate: function()
        {
            this.app.pressTabButton(this);
            this.el.addClass("active");
            return this;
        },

        deactivate: function()
        {
            this.el.removeClass("active");
            return this;
        },
    });

    var MapsController = Spine.Controller.sub(
    {

        tab_class_name: "maps_tab",

        el: $(".maps_grid"),

        activate: function()
        {
            this.app.pressTabButton(this);
            this.el.addClass("active");
            return this;
        },

        deactivate: function()
        {
            this.el.removeClass("active");
            return this;
        },
    });

    var LikedController = Spine.Controller.sub(
    {

        tab_class_name: "liked_tab",

        el: $(".liked_grid"),

        activate: function()
        {
            this.app.pressTabButton(this);
            this.el.addClass("active");
            return this;
        },

        deactivate: function()
        {
            this.el.removeClass("active");
            return this;
        },
    });

    var CollectionController = Spine.Controller.sub(
    {

        tab_class_name: "collectionstream_tab",

        default_view: "list", //list, thumbnails

        el: $(".collection_grid"),

        elements: {
            ".collection_toolbar": "toolbar",
            ".collection_stream": "stream"
        },

        events: {
            "click .view_switch": "switchView"
        },

        init: function()
        {
            if (!this.app) throw "@ProfileApp dependency required.";
            Collection.bind("refresh", this.proxy(this.addAll));
            Collection.bind("create",  this.proxy(this.addOne));

            Collection.bind("refresh change", this.proxy(this.renderToolbar));
        },

        addOne: function(item){
            var collection = new CollectionItem({item: item, collection_controller: this });
            this.append(collection.render());
        },

        addAll: function(){
            if(Collection.count() == 0) {
                $(".empty_following_collection").show();
            }
            Collection.each(this.proxy(this.addOne));
        },

        switchView: function(e)
        {
            e.preventDefault();
            if(this.default_view == "grid") { this.default_view = "list"; } else { this.default_view = "grid"; }
            this.renderToolbar();
            Collection.trigger("redraw");
        },

        renderToolbar: function()
        {
            var model = { options: { list: (this.default_view=="grid"?false:true) }, total_collections: Collection.count() }
            this.toolbar.html(this.toolbar_template(model));
        },

        toolbar_template: function(model)
        {
            return templates.collection_toolbar(model);
        },

        activate: function()
        {
            if(!this.has_been_loaded)
            {
                /*Collection.fetch({ data: "for="+Global.profile.id });*/
                this.has_been_loaded = true;
            }

            this.app.pressTabButton(this);
            this.el.addClass("active");
            return this;
        },

        deactivate: function()
        {
            this.el.removeClass("active");
            return this;
        }

    });

    var CollectionItem = Spine.Controller.sub(
    {
        attr: {
            "class" : "collection_window"
        },

        init: function()
        {
            if (!this.item) throw "@item required";
            if (!this.collection_controller) throw "@collection_controller required."
            this.item.bind("update", this.proxy(this.render));
            this.item.bind("destroy", this.proxy(this.remove));
            Collection.bind("redraw", this.proxy(this.render));
        },

        render: function(item){
        if (item) this.item = item;

          var model = { root_path: Global.settings.rurl, collection: this.item, list: (this.collection_controller.default_view=="grid"?true:false) };

          this.html(this.template(model));
          return this;
        },

        template: function(item){
          return templates.collection_item(item);
        },

        remove: function(){
          this.el.remove();
        }

    });

    var StreamFollowPopoverController = Spine.Controller.sub(
    {
        events: {
            "click .friend_selector": "toggleFriends",
            "click .family_selector": "toggleFamily",
            "click .photofeed_selector": "togglePhotofeed",
            "click .unfollow": "doUnfollow"
        },

        init: function()
        {
            if (!this.friend) throw "@Required follow context";
            if (!this.button) throw "@Required button controller";
            this.friend.bind("refresh change", this.proxy(this.render));
        },

        template: function(friend)
        {
            return templates.follow_menu(friend);
        },

        render: function(friend)
        {
            if (friend) this.friend = friend;

            this.html(this.template(this.friend));
            return this;
        },

        toggleFriends: function()
        {
            this.friend.is_friend = !this.friend.is_friend;
            this.friend.save();
        },

        toggleFamily: function()
        {
            this.friend.is_family = !this.friend.is_family;
            this.friend.save();
        },

        togglePhotofeed: function()
        {
            this.friend.is_in_photofeed = !this.friend.is_in_photofeed;
            this.friend.save();
        },

        doUnfollow: function()
        {
            this.friend.destroy();
        }

    });

    var StreamFollowButtonController = Spine.Controller.sub(
    {
        el: $("#follow_button"),

        events: {
            "click": "follow"
        },

        init: function()
        {
            Friend.bind("create", this.proxy(this.renderButtonContext));

            if (Global.profile.relationship)
            {
                this.use(Global.profile.relationship);
            }

            this.renderButtonContext(this.friend);
        },

        use: function(friend)
        {
            this.friend = new Friend(friend);
            this.friend.save(
            {
                ajax: false
            }); //This record already exists so we lie and create it in the browser but not server.
            this._bindFollow();
        },

        new: function(friend)
        {
            this.friend = friend
            this.friend.save(); //This record already exists so we lie and create it in the browser but not server.
            this._bindFollow(true);
        },

        _bindFollow: function(show)
        {
            this.friend.bind("destroy", this.proxy(this.removeFriend));
            this.cuePopover(this.friend, show);
        },

        removeFriend: function()
        {
            $("#follow_button").qtip("destroy");
            this.friend = null;
            this.renderButtonContext(null);
        },

        renderButtonContext: function(friend)
        {
            if(friend) {
                this.html(templates.follow_button(
                {
                    follow: friend
                }));
            }
        },

        cuePopover: function(friend, show)
        {
            if (!show) show = false;

            if (friend)
            {
                var menu_popover = new StreamFollowPopoverController(
                {
                    friend: friend,
                    button: this
                });

                $("#follow_button").qtip(
                {
                    content: menu_popover.render().el,
                    position: {
                        at: 'bottom center',
                        my: 'top center'
                    },
                    style: {
                        classes: 'ui-tooltip-plain ui-tooltip-shadow follow_options_tooltip',
                        tip: {
                            corner: true,
                            width: 16,
                            height: 8
                        }
                    },
                    show: {
                        ready: show
                    },
                    hide: {
                        event: 'unfocus'
                    }
                });
            }
        },

        follow: function()
        {
            if (this.friend) return; //nothing if we already follow!
            var friend = new Friend();
            friend.following = Global.profile;
            this.new(friend);
        }
    });

    var StreamAdminButtonController = Spine.Controller.sub(
    {
        el: $("#admin_button"),

        init: function()
        {
            this.cuePopover();
        },

        cuePopover: function()
        {
            this.stream_admin_window_controller = new StreamAdminPopoverController({ profile: ProfileUser });
            $("#admin_button").qtip(
            {
                content: this.stream_admin_window_controller.render().el,
                position: {
                    at: 'bottom center',
                    my: 'top center'
                },
                style: {
                    classes: 'ui-tooltip-plain ui-tooltip-shadow follow_options_tooltip',
                    tip: {
                        corner: true,
                        width: 16,
                        height: 8
                    }
                },
                show: "click",
                hide: {
                    event: 'unfocus'
                }
            });
        }
    });

    var StreamAdminPopoverController = Spine.Controller.sub(
    {
        events: {
            "click .become_selector": "becomeUser",
            "click .reset_usage_selector": "resetUsage"
        },

        init: function()
        {
            if (!this.profile) throw "@Required profile ";
        },

        template: function(profile)
        {
            return templates.admin_menu({ user: profile });
        },

        render: function(profile)
        {
            if (profile) this.profile = profile;

            this.html(this.template(this.profile));
            return this;
        },

        becomeUser: function()
        {
            window.location = document.URL+'?_switch_user='+ProfileUser.username;
        },

        resetUsage: function()
        {
            $.ajax({
                url: Global.settings.rurl+"profile/"+ProfileUser.username+"/admin/resetUsage",
                type: "POST"
            }).done(function() {
                alert("User's usage was reset");
            }).fail(function() {
                alert("An error occured and the usage wasn't reset");
            });
        }

    });

    var PhotostreamController = Spine.Controller.sub(
    {
        tab_class_name: "photostream_tab",

        count: 0,

        pending: false,

        paging: false,

        elements:
        {
            ".empty_following_photos": "empty_photos"
        },

        el: $(".photo_grid"),

        init: function()
        {
            if (!this.app) throw "@ProfileApp dependency required.";

            Photo.bind("refresh", this.proxy(this.addAll));
            Photo.bind("create", this.proxy(this.addOne));
        },

        activate: function()
        {
            this.app.pressTabButton(this);
            this.el.addClass("active");
            return this;
        },

        deactivate: function()
        {
            this.el.removeClass("active");
            return this;
        },

        watchScroll: function()
        {
            var psc = this;
            $('.photo_grid').waypoint(function(event, direction)
            {
                if (direction === 'down' && psc.isActive())
                {
                    psc.paging = true;
                    Photo.fetch(
                    {
                        data: {
                            offset: Photo.count()
                        },
                        processData: true
                    });
                }
            }, {
                offset: 'bottom-in-view',
                onlyOnScroll: true // middle of the page
            });
        },

        addOne: function(item)
        {
            this.count++;
            if (this.count == 2)
            {
                this.append($("#profile_component_collections").html());
            }
            if (this.count == 4)
            {
                this.append($("#profile_component_follow").html());
            }

            if (this.count == 9)
            {
                this.watchScroll();
            }
            var photo = new PhotoItemController(
            {
                item: item
            });
            this.empty_photos.hide();
            this.append(photo.render());
            $.waypoints("refresh");
        },

        addAll: function()
        {
            this.count = 0;
            if(this.paging==true)
            {
                this.el.html(null);
            }
            var psc = this;
            $.each(_.sortBy(Photo.For(Global.profile.id), function(photo)
            {
                return photo.created_at
            }).reverse(), function(i)
            {
                psc.addOne(this);
            });

            //var new_photo = new Photo(photo);
            //new_photo.save({ ajax: false });
        }
    });

    var PhotoMenuController = Spine.Controller.sub(
    {
        events: {
            "click .highlight_post": "highlightPhoto",
            "click .set_photo_banner": "bannerizePhoto"
        },

        init: function()
        {
            if (!this.photo_item_controller) throw "@Required photo controller";
        },

        render: function()
        {
            this.html(templates.photo_menu(
            {
                photo: this.photo_item_controller.item
            }));
            return this;
        },

        highlightPhoto: function()
        {
            var photo = this.photo_item_controller.item;
            photo.highlighted = !photo.highlighted;
            photo.save();
        },

        bannerizePhoto: function()
        {
            $('body,html').animate({
				scrollTop: 0
			}, 800);
			var photo = this.photo_item_controller.item;
			$.post(Global.settings.rurl+"profile/update/banner", { photo: photo.id });
			$(".profile_banner").attr("src", "http://photos.vinyett.com/"+photo.photo_path_width_980);
        }
    });

    var PhotoItemController = Spine.Controller.sub(
    {

        events: {
            "click .photo_wrap": "openPopup",
            "click .profile_favorite_button": "toggleFavorite",
            "click .popover_comment_number": "openPopup"
        },

        elements: {
            ".more": "more",
            ".favorited": "favorite"
        },

        init: function()
        {
            if (!this.item) throw "@photo required";
            this.item.bind("update", this.proxy(this.render));
            this.item.bind("destroy", this.proxy(this.remove));
        },

        render: function(item)
        {
            if (item) this.item = item;

            this.html(this.template(this.item));

            this.popable();

            return this;
        },

        // Use a template, in this case via jQuery.tmpl.js
        template: function(item)
        {
            return templates.photo_template(
            {
                photo_path: Global.settings.image_farm,
                photo: item
            });
        },

        popable: function()
        {
            var pop = new PhotoMenuController(
            {
                photo_item_controller: this
            })
            $(this.more).qtip(
            {
                content: pop.render().el,
                position: {
                    at: "top right",
                    my: "bottom right"
                },
                style: {
                    classes: 'ui-tooltip-plain ui-tooltip-shadow follow_options_tooltip',
                    width: 170,
                    tip: {
                        width: 18,
                        height: 8,
                        offset: 10,
                        mimic: "bottom center"
                    }
                },
                show: {
                    event: 'click',
                },
                hide: {
                    event: 'unfocus'
                }
            });
        },

        toggleFavorite: function(e)
        {
            e.preventDefault();
            var photo = this.item;

            if (this.item.is_favorited == true)
            {
                this.item.is_favorited = false;
                this.item.total_favorites = this.item.total_favorites - 1;
            }
            else
            {
                this.item.is_favorited = true;
                this.item.total_favorites = this.item.total_favorites + 1;
            }

            Spine.Ajax.queue(function()
            {
                return $.ajax(
                {
                    url: photo.url("favorite"),
                    dataType: "json",
                    type: "PATCH"
                });
            });

            this.item.save(
            {
                ajax: false
            });
        },

        openPopup: function(e)
        {
            e.preventDefault();
            PhotoBox.open(this.item.id);
        },

        // Called after an element is destroyed
        remove: function()
        {
            this.el.remove();
        }
    });

    return ProfileApp;
});


text:
A photo picker controller that resembles the style of the image picker in iOS 8's messages app.

![Screenshot](https://github.com/jacobsieradzki/JSImagePickerController/blob/master/Screenshots/imagePicker1.png)

## Installation

Just drop the two files for the JSImagePickerViewController class into your project and import them into whichever view controllers you want:

```Objective-C
#import "JSImagePickerViewController.h"
```

Next, put this code in your project to create and show the image picker:

```Objective-C
JSImagePickerViewController *imagePicker = [[JSImagePickerViewController alloc] init];
imagePicker.delegate = self;
[imagePicker showImagePickerInController:self animated:YES];
```

and add this delegate method to your code:

```Objective-C
- (void)imagePicker:(JSImagePickerController)imagePicker didSelectImage:(UIImage *)image;
```

and if you want there are a choice of different delegate methods to choose from:

```Objective-C
- (void)imagePickerDidOpen;
- (void)imagePickerWillOpen;

- (void)imagePickerWillClose;
- (void)imagePickerDidClose;

- (void)imagePickerDidCancel;
```

and for personalization you can edit the public propertys and methods of the image picker:

```Objective-C
- (void)setAnimationTime:(NSTimeInterval)timeInterval;

@property (nonatomic, strong) UICollectionView *collectionView;
@property (nonatomic, strong) UIButton *photoLibraryBtn;
@property (nonatomic, strong) UIButton *cameraBtn;
@property (nonatomic, strong) UIButton *cancelBtn;
```
## License

You can use this freely in your projects as you wish but please email me at some point at jacob.sieradzki@gmail.com just so I can see how you have used it, thanks.

```
The MIT License (MIT)

Copyright (c) 2015 jacobsieradzki

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```

redpajama_set_name: RedPajamaGithub


text:
package com.amazonaws.services.medialive.model;

import java.io.Serializable;
import javax.annotation.Generated;

/**
 * Placeholder documentation for CreateMultiplexResponse
 *
 * @see AWS API
 *      Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class CreateMultiplexResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements Serializable, Cloneable {

    /** The newly created multiplex. */
    private Multiplex multiplex;

    /**
     * The newly created multiplex.
     *
     * @param multiplex
     *        The newly created multiplex.
     */

    public void setMultiplex(Multiplex multiplex) {
        this.multiplex = multiplex;
    }

    /**
     * The newly created multiplex.
     *
     * @return The newly created multiplex.
     */

    public Multiplex getMultiplex() {
        return this.multiplex;
    }

    /**
     * The newly created multiplex.
     *
     * @param multiplex
     *        The newly created multiplex.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public CreateMultiplexResult withMultiplex(Multiplex multiplex) {
        setMultiplex(multiplex);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getMultiplex() != null)
            sb.append("Multiplex: ").append(getMultiplex());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof CreateMultiplexResult == false)
            return false;
        CreateMultiplexResult other = (CreateMultiplexResult) obj;
        if (other.getMultiplex() == null ^ this.getMultiplex() == null)
            return false;
        if (other.getMultiplex() != null && other.getMultiplex().equals(this.getMultiplex()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getMultiplex() == null) ? 0 : getMultiplex().hashCode());
        return hashCode;
    }

    @Override
    public CreateMultiplexResult clone() {
        try {
            return (CreateMultiplexResult) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }

}


text:
package org.apache.isis.viewer.scimpi.dispatcher;

import org.apache.isis.core.commons.config.ConfigurationConstants;
import org.apache.isis.core.runtime.system.context.IsisContext;
import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;

public abstract class AbstractElementProcessor implements ElementProcessor, Names {

    private static final String SHOW_ICONS_BY_DEFAULT = ConfigurationConstants.ROOT + "scimpi.show-icons";

    private final boolean showIconByDefault;

    public AbstractElementProcessor() {
        showIconByDefault = IsisContext.getConfiguration().getBoolean(SHOW_ICONS_BY_DEFAULT, false);
    }

    /**
     * Return the Class for the class specified in the type attribute.
     */
    protected Class<?> forClass(final Request request) {
        Class<?> cls = null;
        final String className = request.getOptionalProperty(TYPE);
        if (className != null) {
            try {
                cls = Class.forName(className);
            } catch (final ClassNotFoundException e) {
                throw new ScimpiException("No class for " + className, e);
            }
        }
        return cls;
    }

    protected boolean showIconByDefault() {
        return showIconByDefault;
    }
}


text:
ziggy-karma
====

[![Build Status](http://img.shields.io/travis/jarofghosts/ziggy-karma.svg?style=flat)](https://travis-ci.org/jarofghosts/ziggy-karma)
[![npm install](http://img.shields.io/npm/dm/ziggy-karma.svg?style=flat)](https://www.npmjs.org/package/ziggy-karma)

a karma plugin for [ziggy](https://github.com/jarofghosts/ziggy)

## usage

#### !m, !merit, !motivate, !thanks, !ty, !durant `<name>`

add a karma point to `<name>`

#### !highfive, !hf `<name>`

add ten karma points to `<name>`

#### !dm, !demerit, !demotivate, !boo `<name>`

remove a karma point from `<name>`

#### !flog `<name>`

remove 10 points from `<name>`

#### !k, !karma `<name>`

check the karma points for `<name>`

## license

MIT


text:
/**
 *
 */
package uk.ac.lkl.server.persistent;

//import javax.persistence.Id;
import com.googlecode.objectify.annotation.Id;

import com.googlecode.objectify.annotation.Cached;

/**
 * Associates a session guid with the most recent differences
 * created in B2CNetLogo to be processed by the Behaviour Composer
 *
 * @author Ken Kahn
 *
 */

@Cached
public class ModelDifferences {

    @Id
    private String sessionGuid;
    private String procedureDifferences;
    private String declarationDifferences;
    private String widgetDifferences;
    private String infoTab;

    public ModelDifferences(String sessionGuid, String procedureDifferences, String declarationDifferences, String widgetDifferences, String infoTab) {
	this.sessionGuid = sessionGuid;
	this.procedureDifferences = procedureDifferences;
	this.declarationDifferences = declarationDifferences;
	this.widgetDifferences = widgetDifferences;
	this.infoTab = infoTab;
    }

    public ModelDifferences() {
	// for Objectify
    }

    public String getProcedureDifferences() {
        return procedureDifferences;
    }

    public String getWidgetDifferences() {
        return widgetDifferences;
    }

    public String getDeclarationDifferences() {
        return declarationDifferences;
    }

    public String getInfoTab() {
        return infoTab;
    }

}


text:
package org.targettest.org.apache.lucene.search;

/**
 * Expert: A ScoreDoc which also contains information about
 * how to sort the referenced document.  In addition to the
 * document number and score, this object contains an array
 * of values for the document from the field(s) used to sort.
 * For example, if the sort criteria was to sort by fields
 * "a", "b" then "c", the fields object array
 * will have three elements, corresponding respectively to
 * the term values for the document in fields "a", "b" and "c".
 * The class of each element in the array will be either
 * Integer, Float or String depending on the type of values
 * in the terms of each field.
 *
 *
Created: Feb 11, 2004 1:23:38 PM
 *
 * @since   lucene 1.4
 * @see ScoreDoc
 * @see TopFieldDocs
 */
public class FieldDoc extends ScoreDoc {

  /** Expert: The values which are used to sort the referenced document.
   * The order of these will match the original sort criteria given by a
   * Sort object.  Each Object will be either an Integer, Float or String,
   * depending on the type of values in the terms of the original field.
   * @see Sort
   * @see Searcher#search(Query,Filter,int,Sort)
   */
  public Comparable[] fields;

  /** Expert: Creates one of these objects with empty sort information. */
  public FieldDoc (int doc, float score) {
    super (doc, score);
  }

  /** Expert: Creates one of these objects with the given sort information. */
  public FieldDoc (int doc, float score, Comparable[] fields) {
    super (doc, score);
    this.fields = fields;
  }

  // A convenience method for debugging.
  @Override
  public String toString() {
    // super.toString returns the doc and score information, so just add the
          // fields information
    StringBuilder sb = new StringBuilder(super.toString());
    sb.append("[");
    for (int i = 0; i < fields.length; i++) {
            sb.append(fields[i]).append(", ");
          }
    sb.setLength(sb.length() - 2); // discard last ", "
    sb.append("]");
    return sb.toString();
  }
}


text:
using System;
using System.Globalization;

namespace WpfConverters.Converters.Common
{
    /// <summary>
    /// перводит всё в нижний регистер
    /// </summary>
    public class LowerCaseConverter : BaseValueConverterExtension
    {
        public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return System.Convert.ToString(value ?? "").ToLower();
        }
    }
}


text:
describe GoodData::UserGroup do
  before(:all) do
    @bulk_size = 3

    @user_group_name = 'My Test Group'
    @user_group_description = 'My Test Description'

    @client = ConnectionHelper::create_default_connection
    @project = @client.create_project(title: 'UserGroup Testing Project', token: ConnectionHelper::GD_PROJECT_TOKEN, environment: ProjectHelper::ENVIRONMENT)
    @domain = @client.domain(ConnectionHelper::DEFAULT_DOMAIN)

    users = (1..5).to_a.map do |x|
      {
        user: ProjectHelper.create_random_user(@client),
        role: 'Admin'
      }
    end

    @project.add_users(users)
    @users = @project.users.to_a

    @group = @project.add_user_group(:name => @user_group_name, :description => @user_group_description)
  end

  after(:all) do
    @group && @group.delete
    @project && @project.delete
    @client.disconnect
  end

  describe '#[]' do
    it 'Should list user groups as Array' do
      res = GoodData::UserGroup[:all, :client => @client, :project => @project]
      expect(res).to be_kind_of(Array)
    end
  end

  describe '#add_members' do
    it 'Should add member' do
      users = @users.to_a.take(@bulk_size)

      old_count = @group.members.to_a.length
      @group.add_member(users)

      new_count = @group.members.to_a.length
      expect(new_count).to eql(old_count + 1)

      group_members = @group.members.to_a

      users.each do |user|
        res = group_members.find do |group_member|
          group_member.uri == user.uri
        end
        expect(res).to be_a_kind_of(GoodData::Profile)
      end
    end
  end

  describe '#set_members' do
    it 'Should set new members' do
      users = @users.to_a.take(@bulk_size)

      @group.set_members(users)

      group_members = @group.members.to_a
      expect(group_members.length).to eql(users.length)
    end
  end

  describe '#remove_members' do
    it 'Should remove existing members' do
      users = @users.to_a.take(@bulk_size)

      @group.set_members(users)

      group_members = @group.members.to_a
      expect(group_members.length).to eql(users.length)

      @group.remove_members(users)
      group_members = @group.members.to_a
      expect(group_members.length).to eql(0)
    end
  end

  describe '#members' do
    it 'Should return members as array' do
      expect(@group.members).to be_a_kind_of(Enumerator)

      members = @group.members.to_a
      expect(members).to be_kind_of(Array)
    end
  end

  describe '#name' do
    it 'Should return name of user group' do
      expect(@group.name).to eql(@user_group_name)
    end
  end

  describe '#name=' do
    it 'Should assign name of user group' do
      new_name = 'This is new name'
      @group.name = new_name
      expect(@group.name).to eql(new_name)
    end
  end

  describe '#description' do
    it 'Should return name of user group' do
      expect(@group.description).to eql(@user_group_description)
    end
  end

  describe '#description=' do
    it 'Should assign description of user group' do
      new_description = 'This is new description'
      @group.description = new_description
      expect(@group.description).to eql(new_description)
    end
  end
end


text:
//-----------------------------------------------
//
//	This file is part of the Siv3D Engine.
//
//	Copyright (c) 2008-2022 Ryo Suzuki
//	Copyright (c) 2016-2022 OpenSiv3D Project
//
//	Licensed under the MIT License.
//
//-----------------------------------------------

# include <Siv3D/Script.hpp>
# include <Siv3D/ColorHSV.hpp>

namespace s3d
{
	using namespace AngelScript;

	using ValueType = HSV;

	static void ConstructDefault(ValueType* self)
	{
		new(self) ValueType();
	}

	static void Construct(const HSV& hsv, ValueType* self)
	{
		new(self) ValueType(hsv);
	}

	static void ConstructDD(double h, double a, ValueType* self)
	{
		new(self) ValueType(h, a);
	}

	static void ConstructDDDD(double h, double s, double v, double a, ValueType* self)
	{
		new(self) ValueType(h, s, v, a);
	}

	static void ConstructHA(const HSV& hsv, double a, ValueType* self)
	{
		new(self) ValueType(hsv, a);
	}

	static void ConstructC(const Color& color, ValueType* self)
	{
		new(self) ValueType(color);
	}

	static void ConstructCf(const ColorF& color, ValueType* self)
	{
		new(self) ValueType(color);
	}

	static bool EqualsHSV(const HSV& other, const HSV& value)
	{
		return (value == other);
	}

	//static Color ConvToColor(const HSV& hsv)
	//{
	//	return hsv.toColor();
	//}

	//static ColorF ConvToColorF(const HSV& hsv)
	//{
	//	return hsv.toColorF();
	//}

	void RegisterHSV(asIScriptEngine* engine)
	{
		constexpr char TypeName[] = "HSV";

		[[maybe_unused]] int32 r = 0;
		r = engine->RegisterObjectProperty(TypeName, "double h", asOFFSET(HSV, h)); assert(r >= 0);
		r = engine->RegisterObjectProperty(TypeName, "double s", asOFFSET(HSV, s)); assert(r >= 0);
		r = engine->RegisterObjectProperty(TypeName, "double v", asOFFSET(HSV, v)); assert(r >= 0);
		r = engine->RegisterObjectProperty(TypeName, "double a", asOFFSET(HSV, a)); assert(r >= 0);

		//
		//	Constructor
		//
		r = engine->RegisterObjectBehaviour(TypeName, asBEHAVE_CONSTRUCT, "void f()", asFUNCTION(ConstructDefault), asCALL_CDECL_OBJLAST); assert(r >= 0);
		r = engine->RegisterObjectBehaviour(TypeName, asBEHAVE_CONSTRUCT, "void f(const HSV& in)", asFUNCTION(Construct), asCALL_CDECL_OBJLAST); assert(r >= 0);
		r = engine->RegisterObjectBehaviour(TypeName, asBEHAVE_CONSTRUCT, "void f(double h, double a = 1.0) explicit", asFUNCTION(ConstructDD), asCALL_CDECL_OBJLAST); assert(r >= 0);
		r = engine->RegisterObjectBehaviour(TypeName, asBEHAVE_CONSTRUCT, "void f(double h, double s, double v, double a = 1.0)", asFUNCTION(ConstructDDDD), asCALL_CDECL_OBJLAST); assert(r >= 0);
		r = engine->RegisterObjectBehaviour(TypeName, asBEHAVE_CONSTRUCT, "void f(const HSV& in, double a)", asFUNCTION(ConstructHA), asCALL_CDECL_OBJLAST); assert(r >= 0);
		r = engine->RegisterObjectBehaviour(TypeName, asBEHAVE_CONSTRUCT, "void f(const Color& in)", asFUNCTION(ConstructC), asCALL_CDECL_OBJLAST); assert(r >= 0);
		r = engine->RegisterObjectBehaviour(TypeName, asBEHAVE_CONSTRUCT, "void f(const ColorF& in)", asFUNCTION(ConstructCf), asCALL_CDECL_OBJLAST); assert(r >= 0);

		//
		// elem
		//
		r = engine->RegisterObjectMethod(TypeName, "double elem(size_t) const", asMETHODPR(ColorF, elem, (size_t) const noexcept, double), asCALL_THISCALL); assert(r >= 0);

		//
		//	+, -
		//
		r = engine->RegisterObjectMethod(TypeName, "HSV opAdd(const HSV& in) const", asMETHODPR(HSV, operator+, (const HSV&) const, HSV), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "HSV opSub(const HSV& in) const", asMETHODPR(HSV, operator-, (const HSV&) const, HSV), asCALL_THISCALL); assert(r >= 0);

		//
		//	==, !=
		//
		r = engine->RegisterObjectMethod(TypeName, "bool opEquals(const ColorF& in) const", asFUNCTION(EqualsHSV), asCALL_CDECL_OBJLAST); assert(r >= 0);

		//
		//	set
		//
		r = engine->RegisterObjectMethod(TypeName, "HSV& setH(double h)", asMETHODPR(HSV, setH, (double) noexcept, HSV&), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "HSV& setS(double s)", asMETHODPR(HSV, setS, (double) noexcept, HSV&), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "HSV& setV(double v)", asMETHODPR(HSV, setV, (double) noexcept, HSV&), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "HSV& setA(double a)", asMETHODPR(HSV, setA, (double) noexcept, HSV&), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "HSV& setHSV(double h, double s, double v)", asMETHODPR(HSV, setHSV, (double, double, double) noexcept, HSV&), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "HSV& set(double h, double s, double v, double a = 1.0)", asMETHODPR(HSV, set, (double, double, double, double), HSV&), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "HSV& set(const HSV& in)", asMETHODPR(HSV, set, (const HSV&), HSV&), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "HSV withAlpha(double a) const", asMETHODPR(HSV, withAlpha, (double) const noexcept, HSV), asCALL_THISCALL); assert(r >= 0);

		r = engine->RegisterObjectMethod(TypeName, "HSV lerp(const HSV& in, double) const", asMETHODPR(HSV, lerp, (const HSV&, double) const noexcept, HSV), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "size_t hash() const", asMETHODPR(HSV, hash, () const noexcept, size_t), asCALL_THISCALL); assert(r >= 0);

		r = engine->RegisterObjectMethod(TypeName, "ColorF removeSRGBCurve() const", asMETHODPR(HSV, removeSRGBCurve, () const noexcept, ColorF), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "ColorF applySRGBCurve() const", asMETHODPR(HSV, applySRGBCurve, () const noexcept, ColorF), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "Color toColor() const", asMETHODPR(HSV, toColor, () const noexcept, Color), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "Color toColor(uint32) const", asMETHODPR(HSV, toColor, (uint32) const noexcept, Color), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "ColorF toColorF() const", asMETHODPR(HSV, toColorF, () const noexcept, ColorF), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "ColorF toColorF(double) const", asMETHODPR(HSV, toColorF, (double) const noexcept, ColorF), asCALL_THISCALL); assert(r >= 0);

		r = engine->RegisterObjectMethod(TypeName, "Vec3 hsv() const", asMETHODPR(HSV, hsv, () const noexcept, Vec3), asCALL_THISCALL); assert(r >= 0);
		r = engine->RegisterObjectMethod(TypeName, "Vec4 hsva() const", asMETHODPR(HSV, hsva, () const noexcept, Vec4), asCALL_THISCALL); assert(r >= 0);

		r = engine->SetDefaultNamespace(TypeName); assert(r >= 0);
		{
			r = engine->RegisterGlobalFunction("HSV Zero()", asFUNCTION(HSV::Zero), asCALL_CDECL); assert(r >= 0);
		}
		r = engine->SetDefaultNamespace(""); assert(r >= 0);

		//r = engine->RegisterObjectMethod(TypeName, "Color opImplConv() const", asFUNCTION(ConvToColor), asCALL_CDECL_OBJLAST); assert(r >= 0);
		//r = engine->RegisterObjectMethod(TypeName, "ColorF opImplConv() const", asFUNCTION(ConvToColorF), asCALL_CDECL_OBJLAST); assert(r >= 0);

		r = engine->RegisterGlobalFunction("Color HueToColor(double)", asFUNCTION(HueToColor), asCALL_CDECL); assert(r >= 0);
		r = engine->RegisterGlobalFunction("ColorF HueToColorF(double)", asFUNCTION(HueToColorF), asCALL_CDECL); assert(r >= 0);
	}
}


text:
package com.mxgraph.swing.view;

import com.mxgraph.model.mxGeometry;
import com.mxgraph.model.mxIGraphModel;
import com.mxgraph.swing.mxGraphComponent;
import com.mxgraph.util.mxConstants;
import com.mxgraph.util.mxUtils;
import com.mxgraph.view.mxCellState;

import javax.swing.*;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import javax.swing.text.JTextComponent;
import javax.swing.text.StyledDocument;
import javax.swing.text.html.HTMLDocument;
import javax.swing.text.html.HTMLEditorKit;
import javax.swing.text.html.HTMLWriter;
import javax.swing.text.html.MinimalHTMLWriter;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.io.Writer;
import java.util.EventObject;

/**
 * To control this editor, use mxGraph.invokesStopCellEditing, mxGraph.
 * enterStopsCellEditing and mxGraph.escapeEnabled.
 */
public class mxCellEditor implements mxICellEditor {

  /**
   *
   */
  private static final String CANCEL_EDITING = "cancel-editing";

  /**
   *
   */
  private static final String INSERT_BREAK = "insert-break";

  /**
   *
   */
  private static final String SUBMIT_TEXT = "submit-text";

  /**
   *
   */
  public static int DEFAULT_MIN_WIDTH = 100;

  /**
   *
   */
  public static int DEFAULT_MIN_HEIGHT = 60;

  /**
   *
   */
  public static double DEFAULT_MINIMUM_EDITOR_SCALE = 1;

  /**
   *
   */
  protected mxGraphComponent graphComponent;

  /**
   * Defines the minimum scale to be used for the editor. Set this to
   * 0 if the font size in the editor
   */
  protected double minimumEditorScale = DEFAULT_MINIMUM_EDITOR_SCALE;

  /**
   *
   */
  protected int minimumWidth = DEFAULT_MIN_WIDTH;

  /**
   *
   */
  protected int minimumHeight = DEFAULT_MIN_HEIGHT;

  /**
   *
   */
  protected transient Object editingCell;

  /**
   *
   */
  protected transient EventObject trigger;

  /**
   *
   */
  protected transient JScrollPane scrollPane;

  /**
   * Holds the editor for plain text editing.
   */
  protected transient JTextArea textArea;

  /**
   * Holds the editor for HTML editing.
   */
  protected transient JEditorPane editorPane;

  /**
   * Specifies if the text content of the HTML body should be extracted
   * before and after editing for HTML markup. Default is true.
   */
  protected boolean extractHtmlBody = true;

  /**
   * Specifies if linefeeds should be replaced with BREAKS before editing,
   * and BREAKS should be replaced with linefeeds after editing. This
   * value is ignored if extractHtmlBody is false. Default is true.
   */
  protected boolean replaceLinefeeds = true;

  /**
   * Specifies if shift ENTER should submit text if enterStopsCellEditing
   * is true. Default is false.
   */
  protected boolean shiftEnterSubmitsText = false;

  /**
   *
   */
  transient Object editorEnterActionMapKey;

  /**
   *
   */
  transient Object textEnterActionMapKey;

  /**
   *
   */
  transient KeyStroke escapeKeystroke = KeyStroke.getKeyStroke("ESCAPE");

  /**
   *
   */
  transient KeyStroke enterKeystroke = KeyStroke.getKeyStroke("ENTER");

  /**
   *
   */
  transient KeyStroke shiftEnterKeystroke = KeyStroke.getKeyStroke("shift ENTER");

  /**
   *
   */
  protected AbstractAction cancelEditingAction = new AbstractAction() {
    public void actionPerformed(ActionEvent e) {
      stopEditing(true);
    }
  };

  /**
   *
   */
  protected AbstractAction textSubmitAction = new AbstractAction() {
    public void actionPerformed(ActionEvent e) {
      stopEditing(false);
    }
  };

  /**
   *
   */
  public mxCellEditor(mxGraphComponent graphComponent) {
    this.graphComponent = graphComponent;

    // Creates the plain text editor
    textArea = new JTextArea();
    textArea.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
    textArea.setOpaque(false);

    // Creates the HTML editor
    editorPane = new JEditorPane();
    editorPane.setOpaque(false);
    editorPane.setContentType("text/html");

    // Workaround for inserted linefeeds in HTML markup with
    // lines that are longar than 80 chars
    editorPane.setEditorKit(new NoLinefeedHtmlEditorKit());

    // Creates the scollpane that contains the editor
    // FIXME: Cursor not visible when scrolling
    scrollPane = new JScrollPane();
    scrollPane.setBorder(BorderFactory.createEmptyBorder());
    scrollPane.getViewport().setOpaque(false);
    scrollPane.setVisible(false);
    scrollPane.setOpaque(false);

    // Installs custom actions
    editorPane.getActionMap().put(CANCEL_EDITING, cancelEditingAction);
    textArea.getActionMap().put(CANCEL_EDITING, cancelEditingAction);
    editorPane.getActionMap().put(SUBMIT_TEXT, textSubmitAction);
    textArea.getActionMap().put(SUBMIT_TEXT, textSubmitAction);

    // Remembers the action map key for the enter keystroke
    editorEnterActionMapKey = editorPane.getInputMap().get(enterKeystroke);
    textEnterActionMapKey = editorPane.getInputMap().get(enterKeystroke);
  }

  /**
   * Returns replaceHtmlLinefeeds
   */
  public boolean isExtractHtmlBody() {
    return extractHtmlBody;
  }

  /**
   * Sets extractHtmlBody
   */
  public void setExtractHtmlBody(boolean value) {
    extractHtmlBody = value;
  }

  /**
   * Returns replaceHtmlLinefeeds
   */
  public boolean isReplaceHtmlLinefeeds() {
    return replaceLinefeeds;
  }

  /**
   * Sets replaceHtmlLinefeeds
   */
  public void setReplaceHtmlLinefeeds(boolean value) {
    replaceLinefeeds = value;
  }

  /**
   * Returns shiftEnterSubmitsText
   */
  public boolean isShiftEnterSubmitsText() {
    return shiftEnterSubmitsText;
  }

  /**
   * Sets shiftEnterSubmitsText
   */
  public void setShiftEnterSubmitsText(boolean value) {
    shiftEnterSubmitsText = value;
  }

  /**
   * Installs the keyListener in the textArea and editorPane
   * for handling the enter keystroke and updating the modified state.
   */
  protected void configureActionMaps() {
    InputMap editorInputMap = editorPane.getInputMap();
    InputMap textInputMap = textArea.getInputMap();

    // Adds handling for the escape key to cancel editing
    editorInputMap.put(escapeKeystroke, cancelEditingAction);
    textInputMap.put(escapeKeystroke, cancelEditingAction);

    // Adds handling for shift-enter and redirects enter to stop editing
    if (graphComponent.isEnterStopsCellEditing()) {
      editorInputMap.put(shiftEnterKeystroke, editorEnterActionMapKey);
      textInputMap.put(shiftEnterKeystroke, textEnterActionMapKey);

      editorInputMap.put(enterKeystroke, SUBMIT_TEXT);
      textInputMap.put(enterKeystroke, SUBMIT_TEXT);
    }
    else {
      editorInputMap.put(enterKeystroke, editorEnterActionMapKey);
      textInputMap.put(enterKeystroke, textEnterActionMapKey);

      if (isShiftEnterSubmitsText()) {
        editorInputMap.put(shiftEnterKeystroke, SUBMIT_TEXT);
        textInputMap.put(shiftEnterKeystroke, SUBMIT_TEXT);
      }
      else {
        editorInputMap.remove(shiftEnterKeystroke);
        textInputMap.remove(shiftEnterKeystroke);
      }
    }
  }

  /**
   * Returns the current editor or null if no editing is in progress.
   */
  public Component getEditor() {
    if (textArea.getParent() != null) {
      return textArea;
    }
    else if (editingCell != null) {
      return editorPane;
    }

    return null;
  }

  /**
   * Returns true if the label bounds of the state should be used for the
   * editor.
   */
  protected boolean useLabelBounds(mxCellState state) {
    mxIGraphModel model = state.getView().getGraph().getModel();
    mxGeometry geometry = model.getGeometry(state.getCell());

    return ((geometry != null &&
             geometry.getOffset() != null &&
             !geometry.isRelative() &&
             (geometry.getOffset().getX() != 0 || geometry.getOffset().getY() != 0)) || model.isEdge(state.getCell()));
  }

  /**
   * Returns the bounds to be used for the editor.
   */
  public Rectangle getEditorBounds(mxCellState state, double scale) {
    mxIGraphModel model = state.getView().getGraph().getModel();
    Rectangle bounds = null;

    if (useLabelBounds(state)) {
      bounds = state.getLabelBounds().getRectangle();
      bounds.height += 10;
    }
    else {
      bounds = state.getRectangle();
    }

    // Applies the horizontal and vertical label positions
    if (model.isVertex(state.getCell())) {
      String horizontal = mxUtils.getString(state.getStyle(), mxConstants.STYLE_LABEL_POSITION, mxConstants.ALIGN_CENTER);

      if (horizontal.equals(mxConstants.ALIGN_LEFT)) {
        bounds.x -= state.getWidth();
      }
      else if (horizontal.equals(mxConstants.ALIGN_RIGHT)) {
        bounds.x += state.getWidth();
      }

      String vertical = mxUtils.getString(state.getStyle(), mxConstants.STYLE_VERTICAL_LABEL_POSITION, mxConstants.ALIGN_MIDDLE);

      if (vertical.equals(mxConstants.ALIGN_TOP)) {
        bounds.y -= state.getHeight();
      }
      else if (vertical.equals(mxConstants.ALIGN_BOTTOM)) {
        bounds.y += state.getHeight();
      }
    }

    bounds.setSize((int)Math.max(bounds.getWidth(), Math.round(minimumWidth * scale)),
                   (int)Math.max(bounds.getHeight(), Math.round(minimumHeight * scale)));

    return bounds;
  }

  /*
   * (non-Javadoc)
   * @see com.mxgraph.swing.view.mxICellEditor#startEditing(java.lang.Object, java.util.EventObject)
   */
  public void startEditing(Object cell, EventObject evt) {
    if (editingCell != null) {
      stopEditing(true);
    }

    mxCellState state = graphComponent.getGraph().getView().getState(cell);

    if (state != null) {
      editingCell = cell;
      trigger = evt;

      double scale = Math.max(minimumEditorScale, graphComponent.getGraph().getView().getScale());
      scrollPane.setBounds(getEditorBounds(state, scale));
      scrollPane.setVisible(true);

      String value = getInitialValue(state, evt);
      JTextComponent currentEditor = null;

      // Configures the style of the in-place editor
      textArea.setFont(mxUtils.getFont(state.getStyle(), scale));
      Color fontColor = mxUtils.getColor(state.getStyle(), mxConstants.STYLE_FONTCOLOR, Color.black);
      textArea.setForeground(fontColor);
      textArea.setText(value);

      scrollPane.setViewportView(textArea);
      currentEditor = textArea;

      graphComponent.getGraphControl().add(scrollPane, 0);

      if (isHideLabel(state)) {
        graphComponent.redraw(state);
      }

      currentEditor.revalidate();
      currentEditor.requestFocusInWindow();
      currentEditor.selectAll();

      configureActionMaps();
    }
  }

  /**
   *
   */
  protected boolean isHideLabel(mxCellState state) {
    return true;
  }

  /*
   * (non-Javadoc)
   * @see com.mxgraph.swing.view.mxICellEditor#stopEditing(boolean)
   */
  public void stopEditing(boolean cancel) {
    if (editingCell != null) {
      scrollPane.transferFocusUpCycle();
      Object cell = editingCell;
      editingCell = null;

      if (!cancel) {
        EventObject trig = trigger;
        trigger = null;
        graphComponent.labelChanged(cell, getCurrentValue(), trig);
      }
      else {
        mxCellState state = graphComponent.getGraph().getView().getState(cell);
        graphComponent.redraw(state);
      }

      if (scrollPane.getParent() != null) {
        scrollPane.setVisible(false);
        scrollPane.getParent().remove(scrollPane);
      }

      graphComponent.requestFocusInWindow();
    }
  }

  /**
   * Gets the initial editing value for the given cell.
   */
  protected String getInitialValue(mxCellState state, EventObject trigger) {
    return graphComponent.getEditingValue(state.getCell(), trigger);
  }

  /**
   * Returns the current editing value.
   */
  public String getCurrentValue() {
    String result;

    if (textArea.getParent() != null) {
      result = textArea.getText();
    }
    else {
      result = editorPane.getText();

      if (isExtractHtmlBody()) {
        result = mxUtils.getBodyMarkup(result, isReplaceHtmlLinefeeds());
      }
    }

    return result;
  }

  /*
   * (non-Javadoc)
   * @see com.mxgraph.swing.view.mxICellEditor#getEditingCell()
   */
  public Object getEditingCell() {
    return editingCell;
  }

  /**
   * @return the minimumEditorScale
   */
  public double getMinimumEditorScale() {
    return minimumEditorScale;
  }

  /**
   * @param minimumEditorScale the minimumEditorScale to set
   */
  public void setMinimumEditorScale(double minimumEditorScale) {
    this.minimumEditorScale = minimumEditorScale;
  }

  /**
   * @return the minimumWidth
   */
  public int getMinimumWidth() {
    return minimumWidth;
  }

  /**
   * @param minimumWidth the minimumWidth to set
   */
  public void setMinimumWidth(int minimumWidth) {
    this.minimumWidth = minimumWidth;
  }

  /**
   * @return the minimumHeight
   */
  public int getMinimumHeight() {
    return minimumHeight;
  }

  /**
   * @param minimumHeight the minimumHeight to set
   */
  public void setMinimumHeight(int minimumHeight) {
    this.minimumHeight = minimumHeight;
  }

  /**
   * Workaround for inserted linefeeds when getting text from HTML editor.
   */
  class NoLinefeedHtmlEditorKit extends HTMLEditorKit {
    public void write(Writer out, Document doc, int pos, int len) throws IOException, BadLocationException {
      if (doc instanceof HTMLDocument) {
        NoLinefeedHtmlWriter w = new NoLinefeedHtmlWriter(out, (HTMLDocument)doc, pos, len);

        // the default behavior of write() was to setLineLength(80) which resulted in
        // the inserting or a CR/LF around the 80ith character in any given
        // line. This was not good because if a merge tag was in that range, it would
        // insert CR/LF in between the merge tag and then the replacement of
        // merge tag with bean values was not working.
        w.setLineLength(Integer.MAX_VALUE);
        w.write();
      }
      else if (doc instanceof StyledDocument) {
        MinimalHTMLWriter w = new MinimalHTMLWriter(out, (StyledDocument)doc, pos, len);
        w.write();
      }
      else {
        super.write(out, doc, pos, len);
      }
    }
  }

  /**
   * Subclassed to make setLineLength visible for the custom editor kit.
   */
  class NoLinefeedHtmlWriter extends HTMLWriter {
    public NoLinefeedHtmlWriter(Writer buf, HTMLDocument doc, int pos, int len) {
      super(buf, doc, pos, len);
    }

    protected void setLineLength(int l) {
      super.setLineLength(l);
    }
  }

}


text:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Deepti Kodeboyina | Gregor von Laszewski</title>
    <link>/author/deepti-kodeboyina/</link>
      <atom:link href="/author/deepti-kodeboyina/index.xml" rel="self" type="application/rss+xml" />
    <description>Deepti Kodeboyina</description>
    <generator>Source Themes Academic (https://sourcethemes.com/academic/)</generator><language>en-us</language><lastBuildDate>Mon, 01 Jan 2007 00:00:00 +0000</lastBuildDate>
    <image>
      <url>/images/icon_hufdd866d90d76849587aac6fbf27da1ac_464_512x512_fill_lanczos_center_3.png</url>
      <title>Deepti Kodeboyina</title>
      <link>/author/deepti-kodeboyina/</link>
    </image>

    <item>
      <title>Java CoG Kit Workflow</title>
      <link>/publication/las-2007-workflow/</link>
      <pubDate>Mon, 01 Jan 2007 00:00:00 +0000</pubDate>
      <guid>/publication/las-2007-workflow/</guid>
      <description></description>
    </item>

    <item>
      <title>Portal-based Knowledge Environment for Collaborative Science</title>
      <link>/publication/las-2007-knowlege-portal/</link>
      <pubDate>Mon, 01 Jan 2007 00:00:00 +0000</pubDate>
      <guid>/publication/las-2007-knowlege-portal/</guid>
      <description></description>
    </item>

    <item>
      <title>Collaboratory for Multi-scale Chemical Science (CMCS): Project Final Report.</title>
      <link>/publication/las-2006-cmcs-report/</link>
      <pubDate>Sat, 01 Jul 2006 00:00:00 +0000</pubDate>
      <guid>/publication/las-2006-cmcs-report/</guid>
      <description></description>
    </item>

    <item>
      <title>Work coordination for Grid computing</title>
      <link>/publication/las-2006-workcoordination/</link>
      <pubDate>Sun, 01 Jan 2006 00:00:00 +0000</pubDate>
      <guid>/publication/las-2006-workcoordination/</guid>
      <description></description>
    </item>

    <item>
      <title>A Repository Service for Grid Workflow Components</title>
      <link>/publication/las-2005-workflowrepo/</link>
      <pubDate>Sat, 01 Oct 2005 00:00:00 +0000</pubDate>
      <guid>/publication/las-2005-workflowrepo/</guid>
      <description></description>
    </item>

    <item>
      <title>Active Thermochemical Tables: Thermochemistry for the 21st century</title>
      <link>/publication/las-2005-atct/</link>
      <pubDate>Sat, 01 Jan 2005 00:00:00 +0000</pubDate>
      <guid>/publication/las-2005-atct/</guid>
      <description></description>
    </item>

  </channel>
</rss>


text:
package net.pmhtech.sys.role.dao;

import java.util.List;
import java.util.Map;

import net.pmhtech.sys.role.domain.SysRole;
import net.pmhtech.sys.role.domain.SysRolePage;

public interface SysRolePageDAO {

	int insert(SysRolePage sysRolePage) throws Exception;
	int delete(Map<String,?> paramMap) throws Exception;
	List<Map<String,?>> selectList(Map<String,?> paramMap) throws Exception;
}


text:
<?php
# MantisBT - a php based bugtracking system

# MantisBT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# MantisBT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MantisBT.  If not, see <http://www.gnu.org/licenses/>.

	 /**
	  * MantisBT Core API's
	  */
	require_once( 'core.php' );

	$f_error		 = gpc_get_bool( 'error' );
	$f_cookie_error		 = gpc_get_bool( 'cookie_error' );
	$f_return		 = string_sanitize_url( gpc_get_string( 'return', '' ) );
	$f_username		 = gpc_get_string( 'username', '' );
	$f_perm_login		 = gpc_get_bool( 'perm_login', false );
	$f_secure_session	 = gpc_get_bool( 'secure_session', false );
	$f_secure_session_cookie = gpc_get_cookie( config_get_global( 'cookie_prefix' ) . '_secure_session', null );

	# Set username to blank if invalid to prevent possible XSS exploits
	if( !user_is_name_valid( $f_username ) ) {
		$f_username = '';
	}

	$t_session_validation = ( ON == config_get_global( 'session_validation' ) );

	// If user is already authenticated and not anonymous
	if( auth_is_user_authenticated() && !current_user_is_anonymous() ) {
		// If return URL is specified redirect to it; otherwise use default page
		if( !is_blank( $f_return ) ) {
			print_header_redirect( $f_return, false, false, true );
		}
		else {
			print_header_redirect( config_get( 'default_home_page' ) );
		}
	}

	# Check for automatic logon methods where we want the logon to just be handled by login.php
	if ( auth_automatic_logon_bypass_form() ) {
		$t_uri = "login.php";

		if ( ON == config_get( 'allow_anonymous_login' ) ) {
			$t_uri = "login_anon.php";
		}

		if ( !is_blank( $f_return ) ) {
			$t_uri .= "?return=" . string_url( $f_return );
		}

		print_header_redirect( $t_uri );
		exit;
	}

	# Login page shouldn't be indexed by search engines
	html_robots_noindex();

	html_page_top1();
	html_page_top2a();

	echo '

';

	# Display short greeting message
	# echo lang_get( 'login_page_info' ) . '
';

	# Only echo error message if error variable is set
	if ( $f_error ) {
		echo '' . lang_get( 'login_error' ) . '';
	}
	if ( $f_cookie_error ) {
		echo lang_get( 'login_cookies_disabled' ) . '
';
	}

	# Determine if secure_session should default on or off?
	# - If no errors, and no cookies set, default to on.
	# - If no errors, but cookie is set, use the cookie value.
	# - If errors, use the value passed in.
	if ( $t_session_validation ) {
		if ( !$f_error && !$f_cookie_error ) {
			$t_default_secure_session = ( is_null( $f_secure_session_cookie ) ? true : $f_secure_session_cookie );
		} else {
			$t_default_secure_session = $f_secure_session;
		}
	}

	echo '
';
?>

<form name="login_form" method="post" action="login.php">
<?php # CSRF protection not required here - form does not result in modifications ?>

		<?php
			if ( !is_blank( $f_return ) ) {
			?>
				<input type="hidden" name="return" value="<?php echo string_html_specialchars( $f_return ) ?>" />
				<?php
			}
			echo lang_get( 'login_title' ) ?>

	<?php
		if ( ON == config_get( 'allow_anonymous_login' ) ) {
			print_bracket_link( 'login_anon.php?return=' . string_url( $f_return ), lang_get( 'login_anonymously' ) );
		}
	?>

		<?php echo lang_get( 'username' ) ?>

		<input type="text" name="username" size="32" maxlength="<?php echo DB_FIELD_SIZE_USERNAME;?>" value="<?php echo string_attribute( $f_username ); ?>" />

		<?php echo lang_get( 'password' ) ?>

		<input type="password" name="password" size="32" maxlength="<?php echo auth_get_password_max_size(); ?>" />

<?php
	if( ON == config_get( 'allow_permanent_cookie' ) ) {
?>

		<?php echo lang_get( 'save_login' ) ?>

	<input type="checkbox" name="perm_login" <?php echo ( $f_perm_login ? 'checked="checked" ' : '' ) ?>/>

<?php
	}

	if ( $t_session_validation ) {
?>

		<?php echo lang_get( 'secure_session' ) ?>

	<input type="checkbox" name="secure_session" <?php echo ( $t_default_secure_session ? 'checked="checked" ' : '' ) ?>/>
	<?php echo '' . lang_get( 'secure_session_long' ) . '' ?>

<?php } ?>

		<input type="submit" class="button" value="<?php echo lang_get( 'login_button' ) ?>" />

</form>

<?php
	echo '

';
	print_signup_link();
	echo ' ';
	print_lost_password_link();
	echo '
';

	#
	# Do some checks to warn administrators of possible security holes.
	# Since this is considered part of the admin-checks, the strings are not translated.
	#

	if ( config_get_global( 'admin_checks' ) == ON ) {

		# Generate a warning if administrator/root is valid.
		$t_admin_user_id = user_get_id_by_name( 'administrator' );
		if ( $t_admin_user_id !== false ) {
			if ( user_is_enabled( $t_admin_user_id ) && auth_does_password_match( $t_admin_user_id, 'root' ) ) {
				echo '
', "\n";
				echo "\t", '
', lang_get( 'warning_default_administrator_account_present' ), '
', "\n";
				echo '
', "\n";
			}
		}

		# Check if the admin directory is available and is readable.
		$t_admin_dir = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'admin' . DIRECTORY_SEPARATOR;
		if ( is_dir( $t_admin_dir ) ) {
			echo '
', "\n";
			echo '
', lang_get( 'warning_admin_directory_present' ), '
', "\n";
			echo '
', "\n";
		}
		if ( is_dir( $t_admin_dir ) && is_readable( $t_admin_dir ) && is_executable( $t_admin_dir ) && @file_exists( "$t_admin_dir/." ) ) {
			# since admin directory and db_upgrade lists are available check for missing db upgrades
			# Check for db upgrade for versions < 1.0.0 using old upgrader
			$t_db_version = config_get( 'database_version' , 0 );
			# if db version is 0, we haven't moved to new installer.
			if ( $t_db_version == 0 ) {
				$t_upgrade_count = 0;
				if ( db_table_exists( db_get_table( 'mantis_upgrade_table' ) ) ) {
					$query = "SELECT COUNT(*) from " . db_get_table( 'mantis_upgrade_table' ) . ";";
					$result = db_query_bound( $query );
					if ( db_num_rows( $result ) > 0 ) {
						$t_upgrade_count = (int)db_result( $result );
					}
				}

				if ( $t_upgrade_count > 0 ) { # table exists, check for number of updates

					# new config table database version is 0.
					# old upgrade tables exist.
					# assume user is upgrading from <1.0 and therefore needs to update to 1.x before upgrading to 1.2
					echo '
';
					echo '
', lang_get( 'error_database_version_out_of_date_1' ), '
';
					echo '
';
				} else {
					# old upgrade tables do not exist, yet config database_version is 0
					echo '
';
					echo '
', lang_get( 'error_database_no_schema_version' ), '
';
					echo '
';
				}
			}

			# Check for db upgrade for versions > 1.0.0 using new installer and schema
			require_once( 'admin' . DIRECTORY_SEPARATOR . 'schema.php' );
			$t_upgrades_reqd = count( $upgrade ) - 1;

			if ( ( 0 < $t_db_version ) &&
					( $t_db_version != $t_upgrades_reqd ) ) {

				if ( $t_db_version < $t_upgrades_reqd ) {
					echo '
';
					echo '
', lang_get( 'error_database_version_out_of_date_2' ), '
';
					echo '
';
				} else {
					echo '
';
					echo '
', lang_get( 'error_code_version_out_of_date' ), '
';
					echo '
';
				}
			}
		}

	} # if 'admin_checks'
?>

<?php if ( ON == config_get( 'use_javascript' ) ) { ?>

<?php } ?>

<?php
	html_page_bottom1a( __FILE__ );


text:
"""
A nice example to make setup.py file can be found
at http://jacobian.org/writing/django-apps-with-buildout/
thanks to Jacob Kaplan-Moss.
"""

import os
from setuptools import setup, find_packages

def read(fname):
    return open(os.path.join(os.path.dirname(__file__), fname)).read()

setup(
    name = "django-rsscloud",
    version = "0.1.1",
    url = 'http://github.com/matagus/django-rsscloud',
    license = 'BSD',
    description = "Simple app to make rsscloud-enabled your Django app feed.",
    long_description = read('README'),

    author = 'Matias Agustin Mendez',
    author_email = 'me@matagus.com.ar',

    packages = find_packages(),

    install_requires = ['setuptools', 'django'],

    classifiers = [
        'Development Status :: 4 - Beta',
        'Framework :: Django',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: BSD License',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Topic :: Internet :: WWW/HTTP',
    ]
)


text:
<?php

namespace Twig;

/**
 * Marks a content as safe.
 *
 * @author Fabien Potencier <fabien@symfony.com>
 */
class Markup implements \Countable
{
    protected $content;
    protected $charset;

    public function __construct($content, $charset)
    {
        $this->content = (string) $content;
        $this->charset = $charset;
    }

    public function __toString()
    {
        return $this->content;
    }

    public function count()
    {
        return \function_exists('mb_get_info') ? mb_strlen($this->content, $this->charset) : \strlen($this->content);
    }
}

class_alias('Twig\Markup', 'Twig_Markup');


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

<!--
  ~ Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
  ~ Use of this file is governed by the BSD 3-clause license that
  ~ can be found in the LICENSE.txt file in the project root.
  -->

<project name="ANTLR v4 Maven plugin">

  <publishDate position="left"/>
  <version position="left"/>

  <poweredBy>
    <logo name="ANTLR Web Site" href="http://antlr.org/"
          img="http://www.antlr.org/images/antlr-logo.png"/>
  </poweredBy>

  <body>
    <links>
      <item name="Antlr Web Site" href="http://www.antlr.org/"/>
    </links>

    <menu name="Overview">
      <item name="Introduction" href="index.html"/>
      <item name="Goals" href="plugin-info.html"/>
      <item name="Usage" href="usage.html"/>
      <item name="FAQ" href="faq.html"/>
    </menu>

    <menu name="Examples">
      <item name="Simple configurations" href="examples/simple.html"/>
      <item name="Using library directories" href="examples/libraries.html"/>
      <item name="Using imported grammars" href="examples/import.html"/>
    </menu>

    <menu ref="reports" />
    <menu ref="modules" />

  </body>
</project>


text:
package de.lalo5.particleeffectlib.effect;

import de.lalo5.particleeffectlib.Effect;
import de.lalo5.particleeffectlib.EffectManager;
import de.lalo5.particleeffectlib.EffectType;
import de.lalo5.particleeffectlib.util.ParticleEffect;
import org.bukkit.Location;
import org.bukkit.util.Vector;

public class LineEffect extends Effect {

    /**
     * ParticleType of spawned particle
     */
    public ParticleEffect particle = ParticleEffect.FLAME;

    /**
     * Should it do a zig zag?
     */
    public boolean isZigZag = false;

    /**
     * Number of zig zags in the line
     */
    public int zigZags = 10;

    /**
     * Direction of zig-zags
     */
    public Vector zigZagOffset = new Vector(0,0.1,0);

    /**
     * Particles per arc
     */
    public int particles = 100;

    /**
     * Length of arc
     * A non-zero value here will use a length instead of the target endpoint
     */
    public double length = 0;

    /**
     * Internal boolean
     */
    protected boolean zag = false;

    /**
     * Internal counter
     */
    protected int step = 0;

    public LineEffect(EffectManager effectManager) {
        super(effectManager);
        type = EffectType.REPEATING;
        period = 1;
        iterations = 1;
    }

    @Override
    public void onRun() {
        Location location = getLocation();
        Location target = null;
        if (length > 0) {
            target = location.clone().add(location.getDirection().normalize().multiply(length));
        } else {
            target = getTarget();
        }
        double amount = particles / zigZags;
        if (target == null) {
            cancel();
            return;
        }
        Vector link = target.toVector().subtract(location.toVector());
        float length = (float) link.length();
        link.normalize();

        float ratio = length / particles;
        Vector v = link.multiply(ratio);
        Location loc = location.clone().subtract(v);
        for (int i = 0; i < particles; i++) {
            if (isZigZag) {
                if (zag) {
                    loc.add(zigZagOffset);
                } else {
                    loc.subtract(zigZagOffset);
                }
            }
            if (step >= amount) {
                if (zag) {
                    zag = false;
                } else {
                    zag = true;
                }
                step = 0;
            }
            step++;
            loc.add(v);
            display(particle, loc);
        }
    }

}