text:
//* pagingBuilder.js不用写测试了。
//因为这部分比较简单,就是调用pagingProduct的接口,没有逻辑判断(除了构造函数(要判断className,并调用setDiv)和getProduct方法(返回的操作需测试)可以测试)。
//所以只需要测试上一层用户的需求即可(即测试pagingDirector.js的接口和行为)。
//这样就算测试pagingDirector.js时出错,也能比较快速地找到错误(错误可能在pagingBuilder.js和pagingProduct.js中)
//(虽然不如"测试pagingBuilder.js时出错,找到pagingBuilder.js错误"的速度快)。

//如果pagingBuilder.js或者pagingProduct.js变得比较复杂(有很多的逻辑、耦合、层),则再使用TDD开发新的pagingBuilder.js或者pagingProduct.js。

describe("pagingBuilder.js", function () {

    describe("YYC.Control.Paging.PagingBuilderNoStr类", function () {
        var builder = null;

        beforeEach(function () {
            //                builder = new YYC.Control.Paging.PagingBuilderNoStr({ pageNumber: 1, pageSize: 10, pageCount: 4, totalCount: 33, showNumber: 2, handler: "getContentTab" });
        });
        afterEach(function () {
            //                builder = null;
        });

        it("使用时要创建实例", function () {
            builder = new YYC.Control.Paging.PagingBuilderNoStr({ pageNumber: 1, pageSize: 10, pageCount: 4, totalCount: 33, showNumber: 2, handler: "getContentTab" });

            //实例没有prototype属性,而类(函数)有prototype属性
            expect(builder.prototype).toBeUndefined();
        });

//        如果参数config.className!==undefined,则
        describe("构造函数", function () {
            it("调用getProduct的返回值应该是个层,且类名为config.className", function () {
                builder = new YYC.Control.Paging.PagingBuilderNoStr({ className: "style", pageNumber: 1, pageSize: 10, pageCount: 4, totalCount: 33, showNumber: 2, handler: "getContentTab" });

                var result = builder.getProduct();

                expect(result[0].tagName).toEqual("DIV");
                expect(result.attr("class")).toEqual("style");
            });
            it("如果参数config.className===undefined,调用getProduct的返回值应该是个层,且类名为'page_nav'", function () {
                builder = new YYC.Control.Paging.PagingBuilderNoStr({ pageNumber: 1, pageSize: 10, pageCount: 4, totalCount: 33, showNumber: 2, handler: "getContentTab" });

                var result = builder.getProduct();

                expect(result[0].tagName).toEqual("DIV");
                expect(result.attr("class")).toEqual("page_nav");
            });
        });

        describe("getProduct", function () {

            beforeEach(function () {
                builder = new YYC.Control.Paging.PagingBuilderNoStr({ pageNumber: 2, pageSize: 10, totalCount: 33, pageCount: 4, handler: "getContentTab" });
            });
            afterEach(function () {
                builder = null;
            });

            it("方法存在", function () {
                expect(builder.getProduct).toBeDefined();
            });
            it("测试调用了P_product.getProduct方法并返回", function () {
                spyOn(builder.P_product, "getProduct").andReturn("DIV");
                var element = builder.getProduct();

                expect(builder.P_product.getProduct).toHaveBeenCalled();
                expect(element).toEqual("DIV");
            });
        });

    });

    describe("YYC.Control.Paging.PagingBuilderWithStr类", function () {
        var builder = null;

        beforeEach(function () {
            //                builder = new YYC.Control.Paging.PagingBuilderWithStr({ pageNumber: 1, pageSize: 10, pageCount: 4, totalCount: 33, showNumber: 2, handler: "getContentTab" });
        });
        afterEach(function () {
            //                builder = null;
        });

        it("使用时要创建实例", function () {
            builder = new YYC.Control.Paging.PagingBuilderWithStr({ pageNumber: 1, pageSize: 10, pageCount: 4, totalCount: 33, showNumber: 2, handler: "getContentTab" });

            //实例没有prototype属性,而类(函数)有prototype属性
            expect(builder.prototype).toBeUndefined();
        });

        //        如果参数config.className!==undefined,则
        describe("构造函数", function () {
            it("调用getProduct的返回值应该是个层,且类名为config.className", function () {
                builder = new YYC.Control.Paging.PagingBuilderWithStr({ className: "style", pageNumber: 1, pageSize: 10, pageCount: 4, totalCount: 33, showNumber: 2, handler: "getContentTab" });

                var result = builder.getProduct();

                expect(result[0].tagName).toEqual("DIV");
                expect(result.attr("class")).toEqual("style");
            });
            it("如果参数config.className===undefined,调用getProduct的返回值应该是个层,且类名为'page_nav'", function () {
                builder = new YYC.Control.Paging.PagingBuilderWithStr({ pageNumber: 1, pageSize: 10, pageCount: 4, totalCount: 33, showNumber: 2, handler: "getContentTab" });

                var result = builder.getProduct();

                expect(result[0].tagName).toEqual("DIV");
                expect(result.attr("class")).toEqual("page_nav");
            });
        });

        describe("getProduct", function () {

            beforeEach(function () {
                builder = new YYC.Control.Paging.PagingBuilderWithStr({ pageNumber: 2, pageSize: 10, totalCount: 33, pageCount: 4, handler: "getContentTab" });
            });
            afterEach(function () {
                builder = null;
            });

            it("方法存在", function () {
                expect(builder.getProduct).toBeDefined();
            });
            it("测试调用了P_product.getProduct方法并返回", function () {
                spyOn(builder.P_product, "getProduct").andReturn("DIV");
                var element = builder.getProduct();

                expect(builder.P_product.getProduct).toHaveBeenCalled();
                expect(element).toEqual("DIV");
            });
        });

    });
});

//describe("pagingBuilder.js", function () {

//    describe("YYC.Control.Paging.PagingBuilderNoStr类", function () {
//        var builder = null;

//        function exist(object) {
//            return object.length > 0;
//        };
//        function fakeElement(builder) {
//            builder.P_element = $("<div>");
//        };
//        //获得创建的页码
//        function getAppendPage() {
//            return builder.P_element.children();
//        };

//        beforeEach(function () {
//            builder = new YYC.Control.Paging.PagingBuilderNoStr({ pageNumber: 1, pageSize: 10, pageCount: 4, totalCount: 33, showNumber: 2, handler: "getContentTab" });
//        });
//        afterEach(function () {
//            builder = null;
//        });

//        it("使用时要创建实例", function () {
//            //实例没有prototype属性,而类(函数)有prototype属性
//            expect(builder.prototype).toBeUndefined();
//        });
//        //        it("获得config", function () {
//        //            expect(builder.P_config).toEqual({ pageNumber: 1, pageCount: 4, showNumber: 2, pageSize: 10, totalCount: 33, handler: "getContentTab" });
//        //        });
//        //        it("P_element已定义", function () {
//        //            expect(builder.P_element).toBeDefined();
//        //        });
//        describe("buildDiv", function () {
//            it("方法存在", function () {
//                expect(builder.buildDiv).toBeDefined();
//            });
//it("调用getProduct获得的product应该包括一个层,样式为'page_nav'", function () {
//    //                spyOn(page, "_insertPaging");
//    //                builder.buildMiddle
//    //                element = page._insertPaging.calls[0].args[1];
//    //                        var element = getElement(page);
//    builder.buildDiv();

//    expect(builder.getProduct()[0].tagName).toEqual("DIV");
//    expect(builder.getProduct().attr("class")).toEqual("page_nav");
//});
//        });

//        describe("buildOnlyOne", function () {
//            it("方法存在", function () {
//                expect(builder.buildOnlyOne).toBeDefined();
//            });
//            //            it("如果pageCount小于等于1,则P_element应该包括"共x条"", function () {
//            //                builder = new YYC.Control.Paging.PagingBuilderNoStr({ pageNumber: 1, pageSize: 10, pageCount: 1, totalCount: 8, showNumber: 2, handler: "getContentTab" });

//            //                builder.buildOnlyOne();

//            //                expect(testTool.jqueryToString(builder.P_element)).toMatch(/共8条/);
//            //            });
//            it("element应该包括"共x条"", function () {
//                builder = new YYC.Control.Paging.PagingBuilderNoStr({ pageNumber: 1, pageSize: 10, pageCount: 1, totalCount: 8, showNumber: 2, handler: "getContentTab" });

//                fakeElement(builder);
//                builder.buildOnlyOne();

//                expect(testTool.jqueryToString(builder.P_element)).toMatch(/共8条/);
//            });
//        });

//        describe("首页、上一页、前x页、后x页、下一页、尾页", function () {
//            var temp = null;
//            function fakeGetContentTab() {
//                //创建监控函数getContentTab,用于验证handler
//                window.getContentTab = jasmine.createSpy('getContentTab');
//            };
//            function backUp() {
//                temp = window.getContentTab;
//            };
//            function restore() {
//                window.getContentTab = temp;
//            };

//            beforeEach(function () {
//                builder = new YYC.Control.Paging.PagingBuilderNoStr({ pageNumber: 7, pageSize: 10, totalCount: 200, showNumber: 3, pageCount: 20, handler: "getContentTab" });

//                backUp();
//                fakeGetContentTab();

//                fakeElement(builder);
//            });
//            afterEach(function () {
//                builder = null;
//                restore();
//            });

//            describe("buildFirst", function () {
//                it("方法存在", function () {
//                    expect(builder.buildFirst).toBeDefined();
//                });
//                //                it("_first不为空", function () {
//                //                    builder.buildFirst();

//                //                    expect(builder._first).toBeDefined();
//                //                    expect(builder._first).not.toBeNull();
//                //                });
//                it("验证handler", function () {
//                    //                            builder.buildMiddle
//                    builder.buildFirst();
//                    //                    builder._first.click();    //触发click事件
//                    getAppendPage().click();

//                    expect(window.getContentTab).toHaveBeenCalled();
//                    expect(window.getContentTab).toHaveBeenCalledWith(1, 10);
//                });
//                it("插入到element中", function () {
//                    builder.buildFirst();

//                    expect(testTool.jqueryToString(builder.P_element)).toMatch(/首页/);
//                });
//            });

//            describe("buildPrev", function () {

//                it("方法存在", function () {
//                    expect(builder.buildPrev).toBeDefined();
//                });
//                //                it("_prev不为空", function () {
//                //                    builder.buildPrev();

//                //                    expect(builder._prev).toBeDefined();
//                //                    expect(builder._prev).not.toBeNull();
//                //                });
//                it("验证handler", function () {
//                    //                            builder.buildMiddle
//                    builder.buildPrev();
//                    //                    builder._prev.click();    //触发click事件
//                    getAppendPage().click();

//                    expect(window.getContentTab).toHaveBeenCalled();
//                    expect(window.getContentTab).toHaveBeenCalledWith(6, 10);
//                });
//                it("插入到element中", function () {
//                    builder.buildPrev();

//                    //                    expect(testTool.jqueryToString(builder.P_element).contain("上一页")).toBeTruthy();
//                    expect(testTool.jqueryToString(builder.P_element)).toMatch(/上一页/);
//                });
//            });

//            describe("buildPrevShow", function () {
//                it("方法存在", function () {
//                    expect(builder.buildPrevShow).toBeDefined();
//                });
//                //                it("_prevShow不为空", function () {
//                //                    builder.buildPrevShow();

//                //                    expect(builder._prevShow).not.toBeNull();
//                //                });
//                it("验证handler", function () {
//                    builder.buildPrevShow();
//                    getAppendPage().click();

//                    expect(window.getContentTab).toHaveBeenCalled();
//                    expect(window.getContentTab).toHaveBeenCalledWith(3, 10);
//                });
//                it("插入到element中", function () {
//                    builder.buildPrevShow();

//                    expect(testTool.jqueryToString(builder.P_element)).toMatch(/前\d+页/);
//                });
//            });

//            describe("buildNextShow", function () {
//                it("方法存在", function () {
//                    expect(builder.buildNextShow).toBeDefined();
//                });
//                //                it("_prevShow不为空", function () {
//                //                    builder.buildNextShow();

//                //                    expect(builder._nextShow).not.toBeNull();
//                //                });
//                it("验证handler", function () {
//                    builder.buildNextShow();
//                    getAppendPage().click();

//                    expect(window.getContentTab).toHaveBeenCalled();
//                    expect(window.getContentTab).toHaveBeenCalledWith(11, 10);
//                });
//                it("插入到element中", function () {
//                    builder.buildNextShow();

//                    expect(testTool.jqueryToString(builder.P_element)).toMatch(/后\d+页/);
//                });
//            });

//            describe("buildNext", function () {

//                it("方法存在", function () {
//                    expect(builder.buildNext).toBeDefined();
//                });
//                //                it("_next不为空", function () {
//                //                    builder.buildNext();

//                //                    expect(builder._next).toBeDefined();
//                //                    expect(builder._next).not.toBeNull();
//                //                });
//                it("验证handler", function () {
//                    //                            builder.buildMiddle
//                    builder.buildNext();
//                    getAppendPage().click();

//                    expect(window.getContentTab).toHaveBeenCalled();
//                    expect(window.getContentTab).toHaveBeenCalledWith(8, 10);
//                });
//                it("插入到element中", function () {
//                    builder.buildNext();

//                    expect(testTool.jqueryToString(builder.P_element)).toMatch(/下一页/);
//                });
//            });

//            describe("buildLast", function () {
//                it("方法存在", function () {
//                    expect(builder.buildLast).toBeDefined();
//                });
//                //                it("_first不为空", function () {
//                //                    builder.buildLast();

//                //                    expect(builder._last).toBeDefined();
//                //                    expect(builder._last).not.toBeNull();
//                //                });
//                it("验证handler", function () {
//                    builder.buildLast();
//                    //                    builder._last.click();    //触发click事件
//                    getAppendPage().click();

//                    expect(window.getContentTab).toHaveBeenCalled();
//                    expect(window.getContentTab).toHaveBeenCalledWith(20, 10);
//                });
//                it("插入到element中", function () {
//                    builder.buildLast();

//                    expect(testTool.jqueryToString(builder.P_element)).toMatch(/尾页/);
//                });
//            });
//        });

//        describe("buildMiddle", function () {
//            var temp = null;

//            function construct(pageNumber) {
//                builder = new YYC.Control.Paging.PagingBuilderNoStr({ pageNumber: pageNumber, pageSize: 10, pageCount: 20, totalCount: 200, showNumber: 5, handler: "getContentTab" });
//                fakeElement(builder);
//                builder.buildMiddle()
//            };
//            function fakeGetContentTab() {
//                //创建监控函数getContentTab,用于验证handler
//                window.getContentTab = jasmine.createSpy('getContentTab');
//            };
//            function backUp() {
//                temp = window.getContentTab;
//            };
//            function restore() {
//                window.getContentTab = temp;
//            };

//            beforeEach(function () {

//            });
//            afterEach(function () {
//            });

//            it("方法存在", function () {
//                expect(builder.buildMiddle).toBeDefined();
//            });
//            //            it("_middle不为空", function () {
//            //                //                builder = new YYC.Control.Paging.PagingBuilderNoStr({ pageNumber: 10, pageSize: 10, pageCount: 20, totalCount: 200, showNumber: 5, handler: "getContentTab" });
//            //                //                fakeElement(builder);

//            //                //                builder.buildMiddle()
//            //                construct(10);

//            //                expect(getAppendPage()).toBeDefined();
//            //                expect(getAppendPage()).not.toBeNull();
//            //            });
//            it("如果pageNumber为10,当前页码应该为10", function () {
//                //                builder = new YYC.Control.Paging.PagingBuilderNoStr({ pageNumber: 10, pageSize: 10, totalCount: 200, pageCount: 20, showNumber: 5, handler: "getContentTab" });
//                //                builder.buildMiddle()
//                construct(10);

//                //                        var current = getAppendPage().siblings(".current");
//                var current = getAppendPage().filter(".current");

//                expect(current.length).toEqual(1);  //验证当前页码只有1个
//                expect(current.text()).toEqual("10");
//            });
//            it("如果pageNumber为10、pageCount为20、showNumber为5,则中间页码应该为5 6 7 8 9 10 11 12 13 14 15,其中10为当前页", function () {
//                construct(10);

//                //                        var middle = getAppendPage();
//                var current = getAppendPage().filter(".current");

//                expect(current.text()).toEqual("10");
//                expect(testTool.jqueryToString(getAppendPage())).toMatch(/.+5.+6.+7.+8.+9.+current.+10.+11.+12.+13.+14.+15/);

//                //                        console.log(getAppendPage());
//            });
//            it("如果pageNumber为2、pageCount为20、showNumber为5,则中间页码应该为1234567,其中2为当前页", function () {
//                construct(2);

//                //                        var middle = getAppendPage();
//                var current = getAppendPage().filter(".current");

//                expect(current.text()).toEqual("2");
//                expect(testTool.jqueryToString(getAppendPage())).toMatch(/.+1.+current.+2.+3.+4.+5.+6.+7/);
//            });
//            it("如果pageNumber为20、pageCount为20、showNumber为5,则中间页码应该为151617181920,其中20为当前页", function () {
//                construct(20);

//                //                        var middle = getAppendPage();
//                var current = getAppendPage().filter(".current");

//                expect(current.text()).toEqual("20");
//                expect(testTool.jqueryToString(getAppendPage())).toMatch(/.+15.+16.+17.+18.+19.+current.+20(?!.+21)/);  //页码不能包含21
//            });
//            it("如果pageNumber为10、pageCount为20、showNumber为5,则中间页码应该有11个", function () {
//                construct(10);

//                expect(getAppendPage().length).toEqual(11);

//                //                        console.log(getAppendPage());
//            });
//            it("验证handler", function () {
//                builder = new YYC.Control.Paging.PagingBuilderNoStr({ pageNumber: 10, pageSize: 10, totalCount: 200, pageCount: 20, showNumber: 5, handler: "getContentTab" });

//                //                //创建监控函数getContentTab,用于验证handler
//                //                window.getContentTab = jasmine.createSpy('getContentTab');

//                backUp();
//                fakeGetContentTab();
//                //构造假P_element
//                fakeElement(builder);

//                builder.buildMiddle()

//                var p = getAppendPage().filter(function () {
//                    if ($(this).text() == "9") {
//                        return true;
//                    }

//                    return false;
//                });
//                p.click();    //触发click事件

//                expect(window.getContentTab).toHaveBeenCalled();
//                expect(window.getContentTab).toHaveBeenCalledWith(9, 10);

//                restore();
//            });
//            it("插入到element中", function () {
//                construct(10);
//                //                var element = getElement(builder);

//                expect(testTool.jqueryToString(builder.P_element)).toMatch(/.+5.+6.+7.+8.+9.+current.+10.+11.+12.+13.+14.+15/);
//            });
//        });

//        describe("buildInfo", function () {
//            var regex = /共33条\s每页显示10条\s当前第2\/4页/;

//            beforeEach(function () {
//                builder = new YYC.Control.Paging.PagingBuilderNoStr({ pageNumber: 2, pageSize: 10, totalCount: 33, pageCount: 4, handler: "getContentTab" });
//                fakeElement(builder);
//                builder.buildInfo();
//            });
//            afterEach(function () {
//                builder = null;
//            });

//            it("方法存在", function () {
//                expect(builder.buildInfo).toBeDefined();
//            });
//            //            it("_info不为空", function () {
//            //                expect(builder._info).toBeDefined();
//            //                expect(builder._info).not.toBeNull();
//            //            });
//            it("显示正确的页码信息", function () {
//                expect(testTool.jqueryToString(getAppendPage())).toMatch(regex);
//            });
//            it("插入到element中", function () {
//                expect(testTool.jqueryToString(builder.P_element)).toMatch(regex);
//            });
//        });

//        describe("buildJumpTo", function () {
//            //            function fakePage() {
//            //                $("#page_jumpid").val("3");
//            //            };

//            var temp = null;

//            function fakeJump() {
//                //创建YYC.Control.Paging.pagingTool的监视函数jumpNoStr,从而不依赖YYC.Control.Paging.pagingTool的jumpNoStr方法
//                YYC.Control.Paging.pagingTool.jumpNoStr = jasmine.createSpy('jumpNoStr');
//            };
//            function backUp() {
//                temp = YYC.Control.Paging.pagingTool.jumpNoStr;
//            };
//            function restore() {
//                YYC.Control.Paging.pagingTool.jumpNoStr = temp;
//            };

//            beforeEach(function () {
//                builder = new YYC.Control.Paging.PagingBuilderNoStr({ pageNumber: 2, pageSize: 10, totalCount: 33, pageCount: 4, handler: "getContentTab" });

//                fakeElement(builder);

//                //                spyOn(builder, "jump");

//                backUp();
//                fakeJump();

//                builder.buildJumpTo();
//            });
//            afterEach(function () {
//                builder = null;
//                restore();
//            });

//            it("方法存在", function () {
//                expect(builder.buildJumpTo).toBeDefined();
//            });
//            //            it("_jumpTo不为空", function () {
//            //                expect(builder._jumpTo).not.toBeNull();
//            //            });
//            it("验证handler", function () {
//                //                window.page = page;
//                //                spyOn(page, "jump");

//                //                page.renderTo(container);

//                //                //跳转到第3页
//                //                fakePage();

//                getAppendPage().click();    //触发click事件

//                expect(YYC.Control.Paging.pagingTool.jumpNoStr).toHaveBeenCalled();
//                expect(YYC.Control.Paging.pagingTool.jumpNoStr).toHaveBeenCalledWith({ pageNumber: 2, pageSize: 10, pageCount: 4 });
//            });
//            it("插入到element中", function () {
//                expect(testTool.jqueryToString(builder.P_element)).toMatch(/跳转/);
//            });
//        });

//describe("getProduct", function () {

//    beforeEach(function () {
//        builder = new YYC.Control.Paging.PagingBuilderNoStr({ pageNumber: 2, pageSize: 10, totalCount: 33, pageCount: 4, handler: "getContentTab" });

//        //                fakeElement(builder);
//    });
//    afterEach(function () {
//        builder = null;
//    });

//    it("方法存在", function () {
//        expect(builder.getProduct).toBeDefined();
//    });
//    it("测试返回值", function () {
//        spyOn(builder.P_product, "getProduct").andReturn("DIV");

//        var element = builder.getProduct();

//        expect(builder.P_product.getProduct).toHaveBeenCalled();
//        expect(element).toEqual("DIV");
//    });
//});
//    });
//});


text:
namespace SpartyJet {

class JetTool;

struct simplejet {
  TLorentzVector jet;
  double area;
  double area_error;
  std::vector<TLorentzVector> constituents;
};

JetCollection getjets(JetTool* tool, Jet::jet_list_t& inputJets);
std::vector<TLorentzVector> getjets(JetTool* tool, std::vector<TLorentzVector>&);
std::vector<TLorentzVector> getjets(JetTool* tool, std::vector<TLorentzVector>&, std::vector<std::vector<int> >&);
std::vector<SpartyJet::simplejet> getjets(JetTool* tool, std::vector<SpartyJet::simplejet>& input);

// new class
class SpartyJetTool {
public:
  SpartyJetTool(): m_analysis(NULL) {}
  ~SpartyJetTool() {if (m_analysis) delete m_analysis;}

  JetCollection                     getjets(JetTool* tool, Jet::jet_list_t& inputJets);
  std::vector<TLorentzVector>       getjets(JetTool* tool, std::vector<TLorentzVector>&);
  std::vector<TLorentzVector>       getjets(JetTool* tool, std::vector<TLorentzVector>&, std::vector<std::vector<int> >&);
  std::vector<SpartyJet::simplejet> getjets(JetTool* tool, std::vector<SpartyJet::simplejet>& input);

  void add_tool(JetTool* tool, bool beforeFinder = false);
  void remove_tool(JetTool* tool);
  void clear_additional_tools(bool do_delete = true );

protected:
  JetAnalysis* m_analysis;
  void init_analysis(JetTool* tool);
  std::vector<JetTool*> m_frontTools;
  std::vector<JetTool*> m_backTools;
};

}  // namespace SpartyJet
#endif

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
        <meta name="description" content="">
        <meta name="author" content="">

        <title>Chain Responsive Bootstrap3 Admin</title>

        <link href="css/style.default.css" rel="stylesheet">
        <link href="css/select2.css" rel="stylesheet" />

                        <form class="form form-search" action="search-results.html">
                            <input type="search" class="form-control" placeholder="Search" />
                        </form>

                            <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">

                              5
                            </button>

Notification

                                          Nusja Nawancali likes a photo of you
                                           15 minutes ago

                                          Weno Carasbong shared a photo of you in your Mobile Uploads album.
                                           July 04, 2014

                                          Venro Leonga likes a photo of you
                                           July 03, 2014

                                          Nanterey Reslaba shared a photo of you in your Mobile Uploads album.
                                           July 03, 2014

                                          Nusja Nawancali shared a photo of you in your Mobile Uploads album.
                                           July 02, 2014

                                    See All Notifications

                            <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">

                                2
                            </button>

New Messages

                                        New

                                          Nusja Nawancali

Hi! How are you?...

                                           15 minutes ago

                                        New

                                          Weno Carasbong

Lorem ipsum dolor sit amet...

                                           July 04, 2014

                                          Venro Leonga

Do you have the time to listen to me...

                                           July 03, 2014

                                          Nanterey Reslaba

It might seem crazy what I'm about to say...

                                           July 03, 2014

                                          Nusja Nawancali

Hey I just met you and this is crazy...

                                           July 02, 2014

                                    See All Messages

                            <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">

                            </button>

 My Profile

 Activity Log

 Account Settings

 Help

Sign Out

Elen Adarna

                            Beach Lover

Navigation

 Dashboard

5 Messages

 UI Elements

Alerts & Notifications

Buttons

Extras

Graphs & Charts

Icons

Modals

Panels & Widgets

Sliders

Tabs & Accordions

Typography

 Forms

Code Editor

General Forms

Layouts

Text Editor

Validation

Wizards

 Tables

Basic Tables

Data Tables

 Maps

 Pages

404 Page

Blank Page

Calendar

Invoice

Locked Screen

Media Manager

People Directory

Profile

Search Results

Sign In

Sign Up

Forms

Form Validation

Form Validation

                                <form id="basicForm" action="form-validation.html">

Basic Form Validation

Please provide your name, email address (won't be published) and a comment.

                                                Name *

                                                    <input type="text" name="name" class="form-control" placeholder="Type your name..." required />

                                                Email *

                                                    <input type="email" name="email" class="form-control" placeholder="Type your email..." required />

                                                URL

                                                    <input type="url" name="url" class="form-control" />

                                                Comment *

                                                    <textarea rows="5" class="form-control" placeholder="Type your comment..." required></textarea>

                                            <button class="btn btn-primary mr5">Submit</button>
                                            <button type="reset" class="btn btn-dark">Reset</button>

                                </form>

                                <form id="basicForm2" action="form-validation.html">

Error Message In One Container

Please provide your name, email address (won't be published) and a comment.

                                                Name *

                                                    <input type="text" name="name" class="form-control" title="Your name is required!" placeholder="Type your name..." required />

                                                Email *

                                                    <input type="email" name="email" class="form-control" title="Your email address is required!" placeholder="Type your email..." required />

                                                URL

                                                    <input type="url" name="url" title="Please enter a valid url!" class="form-control" />

                                                Comment *

                                                    <textarea rows="5" class="form-control" name="comment" title="Please type a comment at least 6 characters long!" placeholder="Type your comment..." required></textarea>

                                                <button class="btn btn-primary mr5">Submit</button>
                                                <button type="reset" class="btn btn-dark">Reset</button>

                                </form>

                                <form id="basicForm3" action="form-validation.html">

With Checkboxes and Radio Buttons

Validating a form with a radio and checkbox buttons.

                                            Gender *

                                                    <input type="radio" id="male" value="m" name="gender" required />
                                                    Male

                                                    <input type="radio" value="f" id="female" name="gender">
                                                    Female

                                            Interest *

                                                    <input type="checkbox" id="int_website" value="m" name="int[]" required />
                                                    Website

                                                    <input type="checkbox" value="f" id="int_software" name="int[]" />
                                                    Software

                                                    <input type="checkbox" value="f" id="int_mobile" name="int[]" />
                                                    Mobile

                                                <button class="btn btn-primary mr5">Submit</button>
                                                <button type="reset" class="btn btn-dark">Reset</button>

                                </form>

                                <form id="basicForm4" action="form-validation.html">

Validation With Select Boxes

Validating a form using select boxes with single or multiple selection.

                                            Fruits

                                                <select id="fruits" data-placeholder="Choose One" class="width100p" required>
                                                    <option value="">Choose One</option>
                                                    <option value="apple">Apple</option>
                                                    <option value="orange">Orange</option>
                                                    <option value="grapes">Grapes</option>
                                                    <option value="strawberry">Strawberry</option>
                                                </select>

                                                <button type="submit" class="btn btn-primary mr5">Submit</button>
                                                <button type="reset" class="btn btn-dark">Reset</button>

                                </form>


text:
MHTML test

 This is a test of multipart/related using
Content-ID headers, and the cid: URL type.
However, both Content-Base and Content-Location
headers are present.

  A picture of a frog in a cage should appear below:

  (Not a picture of jwz.)

Nothing should appear after this line.


text:
package CIAPI.Java.core.dto;

/**
 * !This is an auto generated model object!
 *
 * Contains the result of a ListActiveStopLimitOrder query
 */
public class ListActiveStopLimitOrderResponseDTO {

	/**
	 * No argument constructor
	 */
	public ListActiveStopLimitOrderResponseDTO() {
	}

	private ApiActiveStopLimitOrderDTO[] ActiveStopLimitOrders;

	/**
	 * The requested list of active stop / limit orders.
	 */
	public ApiActiveStopLimitOrderDTO[] getActiveStopLimitOrders() {
		return ActiveStopLimitOrders;
	}

	public void setActiveStopLimitOrders(ApiActiveStopLimitOrderDTO[] ActiveStopLimitOrders) {
		this.ActiveStopLimitOrders = ActiveStopLimitOrders;
	}
}


text:
var util     = require('util');
var fse      = require('fs-extra');
var path     = require('path');
var resemble = require('node-resemble-js');

/**
 * @typedef {Object} Coordinates
 * @property {Number} x
 * @property {Number} y
 */

/**
 * @typedef {Object} Dimensions
 * @property {Number} width
 * @property {Number} height
 */

/**
 * Crops the screenshot to the bounding box of the given element
 * Note: This uses gm, which requires that you install graphicsMagick or imageMagick
 * @see https://www.npmjs.com/package/gm
 * @param  {String}      file   Path and filename of the screenshot to crop
 * @param  {Coordinates} origin Coordinates of upper-left corner of area to crop
 * @param  {Dimensions}  size   2-D Dimensions of the area to crop
 * @param  {Function}    cb     Callback invoked when the process is finished
 * @return {Object}             Returns 'this' to allow chaining
 */
var cropElement = function(file, origin, size, cb) {
    var gm = require('gm');
    var self = this;

    // Crop the screenshot to desired element
    gm(file)
        .crop(size.width, size.height, origin.x, origin.y)
        .write(file, function(err){
            // All Operations Finished, trigger callback
            if( typeof cb === "function" ){
                cb.call(self);
            }

            if (err) {
                console.log('Failure cropping screenshot');
                console.log(err);
            }
        })
    ;

    return this;
};

/**
 * Compares a screenshot to a preconfigured baseline
 * If the baseline doesn't exist, the current image is copied to the baseline
 * and the tests will pass
 * @param  {String}   screenshotFile Path and file of the new screenshot
 * @param  {Function} callback       Callback invoked when processing finishes
 * @return {Object}                  Return 'this' to allow chaining
 */
var compareToBaseline = function(screenshotFile, callback){
    var options       = this.globals.visualRegression;
    var diffFile      = screenshotFile.replace(/(\.[a-zA-Z0-9]+)$/, '.diff$1');
    var baseFilename  = path.join(options.baselineFolder,  screenshotFile);
    var newFilename   = path.join(options.currentFolder,   screenshotFile);
    var diffFilename  = path.join(options.currentFolder,   diffFile);
    var errorFilename = path.join(options.errorFolder,     diffFile);

    var fNew;
    var fBase;
    var fDiff;

    var statBase;

    // fs.exists is deprecated, so we need to check file existance this way...
    try {
        statBase = fse.statSync(baseFilename);
    } catch(e) {
        // Baseline doesn't exist, new screenshot is baseline
        fse.copySync(newFilename, baseFilename);
    }

    try {
        fNew  = fse.readFileSync(newFilename);
        fBase = fse.readFileSync(baseFilename);

        resemble(fNew)
            .compareTo(fBase)
            .ignoreAntialiasing()
            .onComplete(function(data){
                // Write diff file
                fse.ensureFileSync(diffFilename);
                data.getDiffImage().pack().pipe(fse.createWriteStream(diffFilename));

                try {
                    // Remove previous error file, if it exists
                    fse.removeSync(errorFilename);
                } catch(e) {
                    //nothing
                }

                // Save a reference to the relative screenshot path for later use
                data.screenshotFile = screenshotFile;

                // Call callback
                callback.call(this, data);
            }
        );
    } catch(e) {
        console.log('Failure during screenshot comparisson');
        console.log(e);
    }

    return this;
};

/**
 * This assertion compares a screenshot to a baseline
 * If the mismatch percentage is greater than the predefined tolerance, it fails
 * Failures are moved to a separate folder for easier reference
 * @param  {String} [selector] Optionally crop the screenshot down to this element
 * @param  {String} [label]    Optional label to add to the filename
 * @param  {String} [msg]      Optionally override the assertion output message
 * @return {Object}            Return 'this' for chaining
 */
exports.assertion = function(selector, label, msg) {
    var options    = this.api.globals.visualRegression;
    var selElement = selector || options.defaultSelector;
    var self       = this;

    // If the selector comes from a section of a page object
    // selector will be an array of objects starting from the outermost
    // ancestor (section), and ending with the element
    // Join their selectors in order
    if( selector && typeof selector !== 'string' ){
        selElement = '';

        for( var i = 0; i < selector.length; i++ ){
            oElement = selector[i];
            selElement += ' ' + oElement.selector;
        }
    }

    // Separate the screenshots by client
    var filepath   = path.join(
        this.api.currentTest.module,           // Test Name
        [
            this.api.capabilities.browserName, // Browser
            this.api.capabilities.version,     // Browser Version
            this.api.capabilities.platform     // OS
        ].join('_')
    );

    // Generate a filename unique to this test/element combination
    var filename   = this.api.currentTest.name +             // Test Step
                     (selElement ? '__' + selElement.replace(/\W+/g, '_') : '') + // Element
                     (label      ? '--' + label      : '') + // Custom Label
                     '.png'                                  // Extension
    ;

    /**
     * Compares a screenshot to a preconfigured baseline
     * If the baseline doesn't exist, the current image is copied to the baseline
     * and the tests will pass
     * @param  {String}   screenshotFile Path and file of the new screenshot
     * @param  {Function} callback       Callback invoked when processing finishes
     * @return {Object}                  Return 'this' to allow chaining
     */
    var compareToBaseline = function(screenshotFile, callback){
        var options       = this.globals.visualRegression;
        var diffFile      = screenshotFile.replace(/(\.[a-zA-Z0-9]+)$/, '.diff$1');
        var baseFilename  = path.join(options.baselineFolder,  screenshotFile);
        var newFilename   = path.join(options.currentFolder,   screenshotFile);
        var diffFilename  = path.join(options.currentFolder,   diffFile);
        var errorFilename = path.join(options.errorFolder,     diffFile);

        var fNew;
        var fBase;
        var fDiff;

        var statBase;

        // fs.exists is deprecated, so we need to check file existance this way...
        try {
            statBase = fse.statSync(baseFilename);
        } catch(e) {
            // Baseline doesn't exist, new screenshot is baseline
            fse.copySync(newFilename, baseFilename);
        }

        try {
            fNew  = fse.readFileSync(newFilename);
            fBase = fse.readFileSync(baseFilename);

            resemble(fNew)
                .compareTo(fBase)
                .ignoreAntialiasing()
                .onComplete(function(data){
                    // Write diff file
                    fse.ensureFileSync(diffFilename);
                    data.getDiffImage().pack().pipe(fse.createWriteStream(diffFilename));

                    try {
                        // Remove previous error file, if it exists
                        fse.removeSync(errorFilename);
                    } catch(e) {
                        //nothing
                    }

                    if (!self.pass(self.value(data))) {
                        // On a failure, save the diff file to the error folder
                        // Already packed earlier, when diff file written
                        try {
                            fse.ensureFileSync(errorFilename);
                            data.getDiffImage().pipe(fse.createWriteStream(errorFilename));
                        } catch(e) {
                            console.log(e);
                        }

                        self.message = util.format('Visual Regression: Screen differs by %s% (see: %s)', self.value(data), errorFilename);
                    }

                    // Call callback
                    callback.call(this, data);
                }
            );
        } catch(e) {
            console.log('Failure during screenshot comparisson');
            console.log(e);
        }
    };

    this.expected = options.mismatchTolerance;
    this.message  = msg || util.format('Visual Regression: "%s" change is less than %s%', selElement, this.expected);

    this.pass = function(value) {
        // Mismatch percentage is within tolerance
        return value < this.expected;
    };

    this.value = function(result) {
        // Return mismatch percentage
        return result.misMatchPercentage;
    };

    this.command = function(callback) {
        // Get handle of active window
        // Needed to get window size
        this.api.windowHandle(function(response){
            var wHandle = response.value;

            // Get size of active window
            // Note we need to drop 'this.api' and use just 'this'
            this.windowSize(wHandle, function(response){
                var wSize       = response.value;
                var wDimensions = wSize.width + 'x' + wSize.height;
                var file;

                // Join the final piece of the path (dimensions) to create
                // the full file pathname relative to the base folder
                file = path.join( filepath, wDimensions, filename );

                // For capture/crop, work in the 'new' folder
                // For compare, only pass the relative portion of the filename
                if( selElement ){

                    // This was failing called within the saveScreenshot callback, so moved here
                    this.getLocationInView(selector||selElement, function(results){
                        var origin = results.value;

                        this.getElementSize(selector || selElement, function(results){
                            // Get width and height of the element
                            var size = results.value;

                            this.saveScreenshot(path.join(options.currentFolder , file), function(){
                                // use selector if defined - may be from a page object
                                // otherwise, use the element selector string
                                cropElement.call(this, path.join(options.currentFolder , file), origin, size, function(){
                                    compareToBaseline.call(this, file, callback);
                                });
                            });
                        });
                    });

                } else {
                    this.saveScreenshot.call(this, path.join(options.currentFolder , file), function(){
                        compareToBaseline.call(this, file, callback);
                    });
                }

            });
        });
    };

};


text:
module Segno
  module Configuration
    VALID_OPTIONS_KEYS = [
      :b,
      :k,
      :seed,
      :seed_vec
    ].freeze

    DEFAULT_B = 1
    DEFAULT_K = 128
    DEFAULT_SEED = 2090358822
    DEFAULT_SEED_VEC = nil

    attr_accessor *VALID_OPTIONS_KEYS

    def self.extended(base)
      base.reset
    end

    def configure
      yield self
      self
    end

    def options
      VALID_OPTIONS_KEYS.inject({}) do |options, key|
        options.merge!(key => send(key))
      end
    end

    def reset
      self.b    = DEFAULT_B
      self.k    = DEFAULT_K
      self.seed = DEFAULT_SEED
      self.seed_vec = DEFAULT_SEED_VEC
      self
    end
  end
end


text:
`libtoggle` is a Rust library for [feature toggles](http://martinfowler.com/bliki/FeatureToggle.html).

Basic usage:
```rust
use toggle::{Toggle, Disabled, Enabled};

struct HelloStruct<MapTg> where MapTg: Toggle<HashMap<String, i32>> {
  t: MapTg,
}

fn main() {
  let nomap = HelloStruct{
    t: Disabled::new(),
  }
  nomap.t.as_ref().map(|_| { println!("i am a spooky ghost"); });

  let mut hasmap = HelloStruct{
    t: Enabled::new(HashMap::new()),
  };
  hasmap.t.as_mut().map(|t| { println!("hello world!"); });
}
```


text:
#include "engine/material_cache.h"

namespace Engine {

const Scene::Material *MaterialCache::getMaterial(Graphics::MaterialShader *shader, std::vector<ID3D11ShaderResourceView *> &textureSRVs, std::vector<ID3D11SamplerState *> &textureSamplers) {
	// Lock the cache
	std::lock_guard<std::mutex> guard(m_cacheLock);

	return &(*(m_materialCache.emplace(shader, textureSRVs, textureSamplers).first));

	// The mutex will unlock when 'guard' goes out of scope and destructs
}

} // End of namespace Engine


text:
package com.danga.camli;

import java.io.BufferedInputStream;
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

import android.os.AsyncTask;
import android.util.Log;

public class Util {
    private static final String TAG = "Camli_Util";

    public static String slurp(InputStream in) throws IOException {
        StringBuilder sb = new StringBuilder();
        byte[] b = new byte[4096];
        for (int n; (n = in.read(b)) != -1;) {
            sb.append(new String(b, 0, n));
        }
        return sb.toString();
    }

    public static void runAsync(final Runnable r) {
        new AsyncTask<Void, Void, Void>() {
            @Override
            protected Void doInBackground(Void... unused) {
                r.run();
                return null;
            }
        }.execute();
    }

    private static final String HEX = "0123456789abcdef";

    private static String getHex(byte[] raw) {
        if (raw == null) {
            return null;
        }
        final StringBuilder hex = new StringBuilder(2 * raw.length);
        for (final byte b : raw) {
            hex.append(HEX.charAt((b & 0xF0) >> 4)).append(
                    HEX.charAt((b & 0x0F)));
        }
        return hex.toString();
    }

    // Requires that the fd be seeked to the beginning.
    public static String getSha1(FileDescriptor fd) {
        MessageDigest md;
        try {
            md = MessageDigest.getInstance("SHA-1");
        } catch (NoSuchAlgorithmException e) {
            throw new RuntimeException(e);
        }
        byte[] b = new byte[4096];
        FileInputStream fis = new FileInputStream(fd);
        InputStream is = new BufferedInputStream(fis, 4096);
        try {
            for (int n; (n = is.read(b)) != -1;) {
                md.update(b, 0, n);
            }
        } catch (IOException e) {
            Log.w(TAG, "IOException while computing SHA-1");
            return null;
        }
        byte[] sha1hash = new byte[40];
        sha1hash = md.digest();
        return getHex(sha1hash);
    }
}


text:
/** Add Trigger to Pool DDL operation. */
package org.apache.hadoop.hive.ql.ddl.workloadmanagement.trigger.pool.add;


text:
<?php /** @var  \Illuminate\Pagination\LengthAwarePaginator  $resets */ ?>
@section('header')

 {{ trans('auth::password-resets.titles.password-resets') }} {{ trans('auth::password-resets.titles.password-resets-list') }}

@endsection

@section('content')

            @include('core::admin._includes.pagination.labels', ['paginator' => $resets])

            @unless($resets->isEmpty())

                         {{ trans('auth::password-resets.actions.clear-expired') }}

                         {{ trans('auth::password-resets.actions.delete-all') }}

            @endunless

                            {{ trans('auth::users.attributes.email') }}
                            {{ trans('auth::users.attributes.full_name') }}
                            {{ trans('core::generals.created_at') }}
                            {{ trans('auth::password-resets.attributes.expired') }}
                            {{ trans('core::generals.actions') }}

                        @forelse ($resets as $reset)
                            <?php /** @var  \Arcanesoft\Auth\Models\PasswordReset  $reset */ ?>

                                {{ $reset->email }}
                                {{ $reset->user->full_name }}
                                {{ $reset->created_at }}

                                    @if ($reset->isExpired())
                                        Yes
                                    @else
                                        No
                                    @endif

                                    {{ ui_link_icon('show', route('admin::auth.users.show', [$reset->user->hashed_id])) }}

                        @empty

                                    {{ trans('auth::password-resets.list-empty') }}

                        @endforelse

        @if ($resets->hasPages())

{{ $resets->render() }}

        @endif

@endsection

@section('modals')
    @unless($resets->isEmpty())

                {{ form()->open(['route' => 'admin::auth.password-resets.clear', 'method' => 'DELETE', 'class' => 'form form-loading', 'id' => 'clear-password-resets-form', 'autocomplete' => 'off']) }}

                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

{{ trans('auth::password-resets.modals.clear.title') }}

{!! trans('auth::password-resets.modals.clear.message') !!}

                            {{ ui_button('cancel')->appendClass('pull-left')->setAttribute('data-dismiss', 'modal') }}
                            {{ ui_button('clear', 'submit')->withLoadingText() }}

                {{ form()->close() }}

                {{ form()->open(['route' => 'admin::auth.password-resets.delete', 'method' => 'DELETE', 'class' => 'form form-loading', 'id' => 'delete-password-resets-form', 'autocomplete' => 'off']) }}

                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

{{ trans('auth::password-resets.modals.delete.title') }}

{!! trans('auth::password-resets.modals.delete.message') !!}

                            {{ ui_button('cancel')->appendClass('pull-left')->setAttribute('data-dismiss', 'modal') }}
                            {{ ui_button('delete', 'submit')->withLoadingText() }}

                {{ form()->close() }}

    @endunless
@endsection

@section('scripts')
    @unless($resets->isEmpty())

    @endunless
@endsection


text:
for (auto {{tuple_name}} : {{inputsym}}) {
    {{inner_plan_compiled}}
} // end scan over {{inputsym}}


text:
<?php

defined('_JEXEC') or die('Restricted access');

require_once( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'model.php' );

/**
 * Content Component Article Model
 *
 * @package		Joomla
 * @subpackage	Content
 * @since 1.5
 */
class EasyBlogModelBlogroll extends EasyBlogModel
{
	/**
	 * Constructor
	 *
	 * @since 1.5
	 */
	function __construct()
	{
		parent::__construct();
	}

	function listBloggers()
	{
		$db	= EasyBlogHelper::db();

		$query	=	'SELECT a.*, b.`name` FROM #__easyblog_users AS a, #__users AS b';
		$query	.=	' WHERE a.`id` = b.`id`';
		$db->setQuery($query);

		$result	= $db->loadObjectList();

		return $result;
	}
}


text:
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.contrib.auth.models import AbstractUser
from django.utils import timezone

class User(AbstractUser):
    id = models.AutoField(primary_key=True)
    company = models.CharField(max_length=100, help_text="Company Name")

    def __str__(self):
        return str(self.username)

class Gateway(models.Model):
    gps_lat = models.DecimalField(max_digits=11, decimal_places=8, help_text=
    'Latitudinal coordinate of the gateway.')
    gps_lon = models.DecimalField(max_digits=11, decimal_places=8, help_text=
    'Longitudinal coordinate of the gateway.')
    last_seen = models.DateTimeField(default=timezone.now)
    mac = models.UUIDField(help_text="The device's MAC address.")
    user = models.ForeignKey(User, null=False)
    serial = models.CharField(max_length=100, help_text="The device's serial number")

    def __str__(self):
        return str(self.__dict__)

class Node(models.Model):
    app_eui = models.UUIDField()
    app_key = models.CharField(max_length=100)
    dev_addr = models.CharField(max_length=100)
    dev_eui = models.UUIDField()
    last_gateway = models.ForeignKey(Gateway, null=True, blank=True)
    last_seen = models.DateTimeField(default=timezone.now)
    name = models.CharField(max_length=100)
    type = models.CharField(max_length=100)
    user = models.ForeignKey(User, null=False)

    def __str__(self):
        return str(self.__dict__)

class Swarm(models.Model):
    created = models.DateTimeField()
    last_seen = models.DateTimeField()
    name = models.CharField(max_length=100)
    nodes = models.ForeignKey(Node)
    user = models.ForeignKey(User, null=False)

    def __str__(self):
        return str(self.__dict__)

# {
#   "applicationID": "bd60ba7f-a94e-466c-a26f-ea2d5e517173",
#   "applicationName": "wind-sensor",
#   "data": 532.9433,
#   "devEUI": "87832a8a-7c05-4568-bef5-9e81b44d282f",
#   "fCnt": 25,
#   "fPort": 1,
#   "nodeName": "sensor",
#   "frequency": 868500000

class Message(models.Model):
    applicationName = models.CharField(max_length=100)
    applicationID = models.UUIDField()
    devEUI = models.UUIDField()
    nodeName = models.CharField(max_length=100)
    data = models.TextField()
    fCnt = models.IntegerField()
    fPort = models.IntegerField()
    node = models.ForeignKey(Node, blank=True, null=True)
    timestamp = models.DateTimeField(auto_now=True)
    rxInfo = models.ForeignKey('RxInfo', blank=True, null=True)
    txInfo = models.ForeignKey('TxInfo', blank=True, null=True)

    def __str__(self):
        return str(self.__dict__)

# "rxInfo": [
#     {
#       "altitude": 1845,
#       "latitude": 27.7452,
#       "loRaSNR": 18,
#       "longitude": 14.5545,
#       "mac": "a8911506-23b1-4b0f-b333-3ad5ce4d3d24",
#       "name": "gateway",
#       "rssi": -44,
#       "time": "2002-05-27T06:01:09.000Z"
#     }
#   ],
class RxInfo(models.Model):
    altitude = models.IntegerField()
    latitude = models.DecimalField(max_digits=11, decimal_places=8)
    longitude = models.DecimalField(max_digits=11, decimal_places=8)
    loRaSNR = models.IntegerField()
    gateway = models.ForeignKey(Gateway, blank=True, null=True)
    gatewayMac = models.UUIDField()
    gatewayName = models.CharField(max_length=100)
    rssi = models.IntegerField()
    time = models.DateTimeField()

    def __str__(self):
        return str(self.__dict__)

#   "txInfo": {
#     "adr": false,
#     "codeRate": "4/8",
#     "dataRate": {
#       "bandwidth": 5,
#       "modulation": "LORA",
#       "spreadFactor": 12
#     }
#   }
# }
class TxInfo(models.Model):
    adr = models.BooleanField(default=False)
    codeRate = models.CharField(max_length=10)
    bandwidth = models.IntegerField(default=0)
    modulation = models.CharField(max_length=10)
    spreadFactor = models.IntegerField(default=0)
    frequency = models.IntegerField(default=0)

    def __str__(self):
        return str(self.__dict__)

class ErrorModel(models.Model):
    type = models.CharField(max_length=100)
    errorCode = models.IntegerField()


text:
cask 'font-droid-sans-tamil' do
  # version '1.02'
  version :latest
  sha256 :no_check

  url 'https://github.com/google/fonts/trunk/apache/droidsanstamil',
      using:      :svn,
      revision:   '50',
      trust_cert: true
  homepage 'https://www.google.com/fonts/earlyaccess'
  license :oss

  font 'DroidSansTamil-Bold.ttf'
  font 'DroidSansTamil-Regular.ttf'
end


text:
<?php

namespace Cdc\Definition\Exception;

/**
 * @codeCoverageIgnore
 */
class MultipleRelationsFound extends \Cdc\Exception {

}


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

<TITLE>
Uses of Package org.apache.hadoop.fs (Hadoop 0.2.0 API)
</TITLE>

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Uses of Package
org.apache.hadoop.fs

Packages that use org.apache.hadoop.fs

org.apache.hadoop.conf
Configuration of system parameters.

org.apache.hadoop.dfs
A distributed implementation of FileSystem.

org.apache.hadoop.fs
An abstract file system API.

org.apache.hadoop.io
Generic i/o code for use when reading and writing data to the network,
to databases, and to files.

org.apache.hadoop.mapred
A system for scalable, fault-tolerant, distributed computation over
large data collections.

Classes in org.apache.hadoop.fs used by org.apache.hadoop.conf

Path

          Names a file or directory in a FileSystem.

Classes in org.apache.hadoop.fs used by org.apache.hadoop.dfs

FileSystem

          An abstract base class for a fairly generic filesystem.

FSInputStream

          FSInputStream is a generic old InputStream with a little bit
 of RAF-style seek ability.

FSOutputStream

          FSOutputStream is an OutputStream that can track its position.

Path

          Names a file or directory in a FileSystem.

Classes in org.apache.hadoop.fs used by org.apache.hadoop.fs

FileSystem

          An abstract base class for a fairly generic filesystem.

FSDataInputStream

          Utility that wraps a FSInputStream in a DataInputStream
 and buffers input through a BufferedInputStream.

FSDataOutputStream

          Utility that wraps a FSOutputStream in a DataOutputStream,
 buffers output through a BufferedOutputStream and creates a checksum
 file.

FSInputStream

          FSInputStream is a generic old InputStream with a little bit
 of RAF-style seek ability.

FSOutputStream

          FSOutputStream is an OutputStream that can track its position.

Path

          Names a file or directory in a FileSystem.

PathFilter

Seekable

          Stream that permits seeking.

Classes in org.apache.hadoop.fs used by org.apache.hadoop.io

FileSystem

          An abstract base class for a fairly generic filesystem.

Path

          Names a file or directory in a FileSystem.

Classes in org.apache.hadoop.fs used by org.apache.hadoop.mapred

FileSystem

          An abstract base class for a fairly generic filesystem.

Path

          Names a file or directory in a FileSystem.

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Copyright © 2006 The Apache Software Foundation


text:
#include "core/layout/line/LineBreaker.h"

#include "core/layout/line/BreakingContextInlineHeaders.h"

namespace blink {

void LineBreaker::skipLeadingWhitespace(InlineBidiResolver& resolver, LineInfo& lineInfo,
    FloatingObject* lastFloatFromPreviousLine, LineWidth& width)
{
    while (!resolver.position().atEnd() && !requiresLineBox(resolver.position(), lineInfo, LeadingWhitespace)) {
        LineLayoutItem lineLayoutItem = resolver.position().getLineLayoutItem();
        if (lineLayoutItem.isOutOfFlowPositioned()) {
            setStaticPositions(m_block, LineLayoutBox(lineLayoutItem), width.indentText());
            if (lineLayoutItem.style()->isOriginalDisplayInlineType()) {
                resolver.runs().addRun(createRun(0, 1, LineLayoutItem(lineLayoutItem), resolver));
                lineInfo.incrementRunsFromLeadingWhitespace();
            }
        } else if (lineLayoutItem.isFloating()) {
            m_block.positionNewFloatOnLine(*m_block.insertFloatingObject(LineLayoutBox(lineLayoutItem)), lastFloatFromPreviousLine, lineInfo, width);
        }
        resolver.position().increment(&resolver);
    }
    resolver.commitExplicitEmbedding(resolver.runs());
}

void LineBreaker::reset()
{
    m_positionedObjects.clear();
    m_hyphenated = false;
    m_clear = ClearNone;
}

InlineIterator LineBreaker::nextLineBreak(InlineBidiResolver& resolver, LineInfo& lineInfo,
    LayoutTextInfo& layoutTextInfo, FloatingObject* lastFloatFromPreviousLine,
    WordMeasurements& wordMeasurements)
{
    reset();

    ASSERT(resolver.position().root() == m_block);

    bool appliedStartWidth = resolver.position().offset() > 0;

    LineWidth width(m_block, lineInfo.isFirstLine(), requiresIndent(lineInfo.isFirstLine(), lineInfo.previousLineBrokeCleanly(), m_block.styleRef()));

    skipLeadingWhitespace(resolver, lineInfo, lastFloatFromPreviousLine, width);

    if (resolver.position().atEnd())
        return resolver.position();

    BreakingContext context(resolver, lineInfo, width, layoutTextInfo, lastFloatFromPreviousLine, appliedStartWidth, m_block);

    while (context.currentItem()) {
        context.initializeForCurrentObject();
        if (context.currentItem().isBR()) {
            context.handleBR(m_clear);
        } else if (context.currentItem().isOutOfFlowPositioned()) {
            context.handleOutOfFlowPositioned(m_positionedObjects);
        } else if (context.currentItem().isFloating()) {
            context.handleFloat();
        } else if (context.currentItem().isLayoutInline()) {
            context.handleEmptyInline();
        } else if (context.currentItem().isAtomicInlineLevel()) {
            context.handleReplaced();
        } else if (context.currentItem().isText()) {
            if (context.handleText(wordMeasurements, m_hyphenated)) {
                // We've hit a hard text line break. Our line break iterator is updated, so go ahead and early return.
                return context.lineBreak();
            }
        } else {
            ASSERT_NOT_REACHED();
        }

        if (context.atEnd())
            return context.handleEndOfLine();

        context.commitAndUpdateLineBreakIfNeeded();

        if (context.atEnd())
            return context.handleEndOfLine();

        context.increment();
    }

    context.clearLineBreakIfFitsOnLine();

    return context.handleEndOfLine();
}

} // namespace blink


text:
package octokit

import (
	"net/http"
	"testing"

	"github.com/bmizerany/assert"
)

func TestRootService_One(t *testing.T) {
	setup()
	defer tearDown()

	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		testMethod(t, r, "GET")
		respondWithJSON(w, loadFixture("root.json"))
	})

	url, err := RootURL.Expand(nil)
	assert.Equal(t, nil, err)

	root, result := client.Root(url).One()
	assert.T(t, !result.HasError())
	assert.Equal(t, "https://api.github.com/users/{user}", string(root.UserURL))
}

func TestClientRel(t *testing.T) {
	setup()
	defer tearDown()

	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		testMethod(t, r, "GET")
		respondWithJSON(w, loadFixture("root.json"))
	})

	u, err := client.Rel("user", M{"user": "root"})
	assert.Equal(t, nil, err)
	assert.Equal(t, "https://api.github.com/users/root", u.String())
}


text:
'use strict';

var contextParams = require('./context-params');

var AppSettings = function(config) {
    var mainAppBaseUrl = 'http://' + config.mainAppHost + ":" + config.mainAppPort;
    var apiGatewayBaseUrl = 'http://' + config.gatewayHost + ":" + config.gatewayPort;
    // var mainAppBaseUrl = 'http://localhost:63769';
    // var apiGatewayBaseUrl = 'http://localhost:2000';

    return {
        appTitle: 'application',
        appLanguage: 'en',
        contextPrefix: contextParams.contextPrefix(), //'/gateway',
        apiUrl: {
            defaultRedirectAfterLoginUrl: mainAppBaseUrl + "/mainUi",
            loginUrl: apiGatewayBaseUrl + '/gateway/login',
            createUserUrl: apiGatewayBaseUrl + '/gateway/gateway/createUser',
            activateUser: apiGatewayBaseUrl + '/gateway/gateway/activateUser',
            initiateResetPassword: apiGatewayBaseUrl + '/gateway/gateway/initiateResetPassword',
            resetPassword: apiGatewayBaseUrl + '/gateway/gateway/resetPassword?resetPasswordToken='
        },
        errorMessages: {
            authenticationFailed: 'Invalid username and/or password.',
            emptyUsername: 'Username is mandatory',
            emptyPassword: 'Password is mandatory'
        },
    };
};

module.exports = AppSettings;


text: default[:accounts][:users][:donate][:status] = :role


text:
<?xml version="1.0" ?>
<doc>
	<str name="Patent Number">
		US7491325
	</str>
	<str name="Application Number">
		US11551538
	</str>
	<str name="Kind Code">
		B2
	</str>
	<str name="Title">
		Biological treatment system and assembly
	</str>
	<str name="Abstract">
		An assembly for supporting biomass for treating sludge or wastewater includes a first corrugated sheet having crests and valleys, a second corrugated sheet having crests and valleys and an intermediate member mounted between the first and second corrugated sheets. The crests have peak surfaces and the valleys have trough surfaces. The first corrugated sheet has a first longitudinal axis and the second corrugated sheet has a second longitudinal axis. The corrugations of the first corrugated sheet define a first corrugation angle of about zero degrees (0.degree.) to about forty-five degrees (45.degree.) relative to the first longitudinal axis and the corrugations of the second corrugated sheet define a second corrugation angle of about zero degrees (0.degree.) to about forty-five degrees (45.degree.) relative to the second longitudinal axis. The second corrugated sheet is mounted to the first corrugated sheet and the intermediate member has openings therein.
	</str>
	<str name="Document Types">
		US | USB | DOCDB
	</str>
	<str name="Application Date">
		2006-10-20
	</str>
	<str name="Application Year">
		2006
	</str>
	<str name="Application(Year/Month)">
		2006-10
	</str>
	<str name="Publication Date">
		2009-02-17
	</str>
	<str name="Publication Year">
		2009
	</str>
	<str name="Publication(Year/Month)">
		2009-02
	</str>
	<str name="All IPC">
		C02F3/06
	</str>
	<str name="IPC Primary">
		C02F3/06
	</str>
	<str name="IPC Section">
		C
	</str>
	<str name="IPC Class">
		C02
	</str>
	<str name="IPC Subclass">
		C02F
	</str>
	<str name="IPC Group">
		C02F3
	</str>
	<str name="All UPC">
		261/DIG.72 | 210/150 | 210/541 | 210/615
	</str>
	<str name="UPC Primary">
		261/DIG.72
	</str>
	<str name="UPC Class">
		261
	</str>
	<str name="Family Members">
		US7491325 | US20080093294A1
	</str>
	<str name="Family Member Count">
		2
	</str>
	<str name="Family Members Cited By Count">
		1
	</str>
	<str name="Other References Count">
		0
	</str>
	<str name="Cited By">
		US7931255
	</str>
	<str name="Cited By Count">
		1
	</str>
	<str name="Cites">
		US5389247 | US6544628 | US6942788 | US3904525 | US5545327 | US5326475 | US4437988 | US6869534 | US5384178 | US5771716 | US4599174 | US6878280 | US6280819 | US6811700 | US7083324 | US4666593 | US3618778 | US4597916
	</str>
	<str name="Cites Count">
		18
	</str>
	<str name="Priority Country">
		US
	</str>
	<str name="Priority Number">
		55153806
	</str>
	<str name="Priority Date">
		2006-10-20
	</str>
	<str name="Assignee(s)">
		BRENTWOOD INDUSTRIES, INC.
	</str>
	<str name="1st Assignee">
		BRENTWOOD INDUSTRIES, INC.
	</str>
	<str name="Number of Assignees">
		1
	</str>
	<str name="1st Assignee Address">
		Reading, PA
	</str>
	<str name="Assignee(s) Address">
		Reading, PA
	</str>
	<str name="Inventor(s)">
		KULICK, III, FRANK, M. | KRELL, TIMOTHY, E. | HARTUNG, ROBERT, W. | MCDOWELL, CURTIS, S.
	</str>
	<str name="1st Inventor">
		KULICK, III, FRANK, M.
	</str>
	<str name="Number of Inventors">
		4
	</str>
	<str name="1st Inventor Address">
		Lake, Ariel, PA
	</str>
	<str name="Inventor(s) Address">
		Lake, Ariel, PA | Mohrsville, PA | Abington, PA | Allentown, PA
	</str>
	<str name="Agent/Attorney">
		PANITCH SCHWARZE BELISARIO & NADEL LLP
	</str>
	<str name="Primary Examiner">
		UPTON, CHRISTOPHER
	</str>
	<str name="cited by within 3 years">
		0
	</str>
	<str name="cited by within 5 years">
		0
	</str>
</doc>


text:
using System;
using Com.Aspose.Cells.Api;
using Com.Aspose.Cells.Model;
using Com.Aspose.Storage.Api;

namespace Charts
{
    class UpdateChartTitle
    {
        public static void Run()
        {
            // ExStart:1
            CellsApi cellsApi = new CellsApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH);
            StorageApi storageApi = new StorageApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH);

            String fileName = "Sample_Test_Book.xls";
            String sheetName = "Sheet5";
            int chartIndex = 0;
            String storage = "";
            String folder = "";
            Title body = new Title();
            body.Text = "aspose";
            body.Height = 15;

            try
            {
                // Upload source file to aspose cloud storage
                storageApi.PutCreate(fileName, "", "", System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));

                // Invoke Aspose.Cells Cloud SDK API to update chart title
                TitleResponse apiResponse = cellsApi.PostWorksheetChartTitle(fileName, sheetName, chartIndex, storage, folder, body);

                if (apiResponse != null && apiResponse.Status.Equals("OK"))
                {
                    Console.WriteLine("Update Chart Title in Excel Worksheet, Done!");
                    Console.ReadKey();
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
            }
            // ExEnd:1
        }
    }
}


text:
#pragma once

#include <dtkCore/dtkPlugin.h>

#include <medVtkViewPluginExport.h>

class medVtkViewPluginPrivate;

class MEDVTKVIEWPLUGIN_EXPORT medVtkViewPlugin : public dtkPlugin
{
    Q_OBJECT
    Q_INTERFACES(dtkPlugin)

public:
     medVtkViewPlugin(QObject *parent = 0);
    ~medVtkViewPlugin();

    virtual bool initialize();
    virtual bool uninitialize();

    virtual QString name() const;
    virtual QString description() const;
    virtual QString version() const;

    virtual QStringList authors() const;
    virtual QString contact() const;
    virtual QStringList contributors() const;

    virtual QStringList tags() const;
    virtual QStringList types() const;

private:
     medVtkViewPluginPrivate *d;
};


text:
def string_clean(s):
    """
    Function will return the cleaned string
    """
    return ''.join(x for x in s if not x.isdigit())


text:
layout: default
---
{% block content %}

{% set headerStyle = 'background-color: #aaa' %}

{% if page.header_img.url %}
    {% set headerStyle %}
        background-image: url('{{ site.url }}/assets/img/{{ page.header_img.url }}')
    {% endset %}
{% endif %}

{{ page.title | default(site.title) }}

                    {{ page.description }}
                    {% if page.header_img.author %}

                    Photo by
                        {% if page.header_img.author_url %}
                        {{ page.header_img.author }}
                        {% else %}
                        {{ page.header_img.author }}
                        {% endif %}
                    {% endif %}

			{{ page.content }}

{% endblock %}


text:
package io.vertx.ext.hawkular.examples;

import io.vertx.core.Vertx;
import io.vertx.core.VertxOptions;
import io.vertx.core.net.NetServer;
import io.vertx.ext.hawkular.VertxHawkularOptions;

/**
 * @author Thomas Segismont
 */
public class NetServerExample {

  public static void main(String[] args) {
    VertxHawkularOptions vertxHawkularOptions = new VertxHawkularOptions();
    vertxHawkularOptions.setPrefix("instance1");
    vertxHawkularOptions.setEnabled(true);

    VertxOptions vertxOptions = new VertxOptions();
    vertxOptions.setMetricsOptions(vertxHawkularOptions);

    Vertx vertx = Vertx.vertx(vertxOptions);

    NetServer server = vertx.createNetServer();
    // Connect with telnet, write some text + Enter
    server.connectHandler(socket -> {
      socket.handler(buffer -> {
        socket.write("Received your request!\n").close();
      });
    });
    server.listen(9292);
  }
}


text:
package gov.nih.nci.caintegrator.application.query.domain;

import static org.junit.Assert.assertEquals;
import gov.nih.nci.caintegrator.application.study.AbstractTestDataGenerator;
import gov.nih.nci.caintegrator.domain.AbstractCaIntegrator2Object;
import gov.nih.nci.caintegrator.domain.application.AbstractCriterion;
import gov.nih.nci.caintegrator.domain.application.BooleanOperatorEnum;
import gov.nih.nci.caintegrator.domain.application.CompoundCriterion;
import gov.nih.nci.caintegrator.domain.application.FoldChangeCriterion;
import gov.nih.nci.caintegrator.domain.application.NumericComparisonCriterion;
import gov.nih.nci.caintegrator.domain.application.SelectedValueCriterion;
import gov.nih.nci.caintegrator.domain.application.StringComparisonCriterion;

import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
/**
 * This generator gets called by the test QueryResultTestIntegration, through the QueryGenerator.
 */
public final class CompoundCriterionGenerator extends AbstractTestDataGenerator<CompoundCriterion> {

    public static final CompoundCriterionGenerator INSTANCE = new CompoundCriterionGenerator();

    private CompoundCriterionGenerator() {
        super();
    }
    @Override
    public void compareFields(CompoundCriterion original, CompoundCriterion retrieved) {
        assertEquals(original.getId(), retrieved.getId());
        assertEquals(original.getBooleanOperator(), retrieved.getBooleanOperator());
        assertEquals(original.getCriterionCollection().size(), retrieved.getCriterionCollection().size());

        NumericComparisonCriterion originalNumericCriterion = null;
        NumericComparisonCriterion retrievedNumericCriterion = null;
        StringComparisonCriterion originalStringCriterion = null;
        StringComparisonCriterion retrievedStringCriterion = null;
        SelectedValueCriterion originalSelectedValueCriterion = null;
        SelectedValueCriterion retrievedSelectedValueCriterion = null;
        FoldChangeCriterion originalFoldChangeCriterion = null;
        FoldChangeCriterion retrievedFoldChangeCriterion = null;

        for (AbstractCriterion criterion : original.getCriterionCollection()) {
            if (criterion instanceof NumericComparisonCriterion) {
                originalNumericCriterion = (NumericComparisonCriterion) criterion;
            }
            if (criterion instanceof StringComparisonCriterion) {
                originalStringCriterion = (StringComparisonCriterion) criterion;
            }
            if (criterion instanceof SelectedValueCriterion) {
                originalSelectedValueCriterion = (SelectedValueCriterion) criterion;
            }
            if (criterion instanceof FoldChangeCriterion) {
                originalFoldChangeCriterion = (FoldChangeCriterion) criterion;
            }
        }

        for (AbstractCriterion criterion : retrieved.getCriterionCollection()) {
            if (criterion instanceof NumericComparisonCriterion) {
                retrievedNumericCriterion = (NumericComparisonCriterion) criterion;
            }
            if (criterion instanceof StringComparisonCriterion) {
                retrievedStringCriterion = (StringComparisonCriterion) criterion;
            }
            if (criterion instanceof SelectedValueCriterion) {
                retrievedSelectedValueCriterion = (SelectedValueCriterion) criterion;
            }
            if (criterion instanceof FoldChangeCriterion) {
                retrievedFoldChangeCriterion = (FoldChangeCriterion) criterion;
            }
        }

        NumericComparisonCriterionGenerator.INSTANCE.compare(originalNumericCriterion, retrievedNumericCriterion);
        StringComparisonCriterionGenerator.INSTANCE.compare(originalStringCriterion, retrievedStringCriterion);
        SelectedValueCriterionGenerator.INSTANCE.compare(originalSelectedValueCriterion, retrievedSelectedValueCriterion);
        FoldChangeCriterionGenerator.INSTANCE.compare(originalFoldChangeCriterion, retrievedFoldChangeCriterion);
    }

    @Override
    public CompoundCriterion createPersistentObject() {
        return new CompoundCriterion();
    }

    @Override
    public void setValues(CompoundCriterion compoundCriterion, Set<AbstractCaIntegrator2Object> nonCascadedObjects) {
        compoundCriterion.setBooleanOperator(getNewEnumValue(compoundCriterion.getBooleanOperator(), BooleanOperatorEnum.values()));

        Collection<AbstractCriterion> abstractCriterionCollection = new HashSet<AbstractCriterion>();
        StringComparisonCriterion scc = new StringComparisonCriterion();
        StringComparisonCriterionGenerator.INSTANCE.setValues(scc, nonCascadedObjects);
        abstractCriterionCollection.add(scc);

        NumericComparisonCriterion ncc = new NumericComparisonCriterion();
        NumericComparisonCriterionGenerator.INSTANCE.setValues(ncc, nonCascadedObjects);
        abstractCriterionCollection.add(ncc);

        SelectedValueCriterion svc = new SelectedValueCriterion();
        SelectedValueCriterionGenerator.INSTANCE.setValues(svc, nonCascadedObjects);
        abstractCriterionCollection.add(svc);

        FoldChangeCriterion fc = new FoldChangeCriterion();
        FoldChangeCriterionGenerator.INSTANCE.setValues(fc, nonCascadedObjects);
        abstractCriterionCollection.add(fc);

        compoundCriterion.setCriterionCollection(abstractCriterionCollection);

    }

}


text:
<?php
namespace AMD\Common\Application;

interface Query
{

}


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

<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>

    <title>Github</title>

    <link>https://github.com/listenzz</link>
    <description></description>
    <language>en-uk</language>
    <managingEditor> Listen</managingEditor>
    <atom:link href="rss" rel="self" type="application/rss+xml" />

<item>
  <title>Mac 开发环境配置</title>
  <link>//configue-mac-for-develop.html</link>
  <author>Listen</author>
  <pubDate>2017-03-18T18:48:00+08:00</pubDate>
  <guid>//configue-mac-for-develop.html</guid>
  <description><![CDATA[

因为某些原因,比如入手了新的电脑,或者是重装系统,我们需要配置开发环境。本文讲述 Mac OS 下的开发环境配置。

Update: 2020/02/19 更新到 macOS Catalina

Xcode

就算你不从事 iOS 开发,也请确保你已经安装了 Xcode,并至少打开过一次。因为很多工具的安装需要依赖 Xcode。

直接通过 AppStore 安装即可。

第一次打开 Xcode 时,需要同意 Agreement。

Homebrew

Homebrew 是 Mac OSX 上的软件包管理工具,能在 Mac 中方便的安装软件或者卸载软件,相当于 linux 下的 apt-get、yum 神器;Homebre 可以在 Mac 上安装一些 OS X 没有的 UNIX 工具,Homebrew 将这些工具统统安装到了 /usr/local/Cellar 目录中,并在 /usr/local/bin 中创建符号链接。

可以通过以下命令来安装 Homebrew:

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

需要先安装好 Xcode

Jekyll

Jekyll 是静态博客生成器

sudo gem install jekyll bundler

Cocoapods

Cocoapods 是 iOS 开发包依赖管理工具。

$ sudo gem install cocoapods

在控制台输入:

xcrun -k --sdk iphoneos --show-sdk-path

如果输出是:

xcrun:_ error: SDK "iphoneos" cannot be located
xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: unable to lookup item 'Path' in SDK 'iphoneos'

那么:

sudo xcode-select --switch /Applications/Xcode.app

Fastlane

Fastlane 是 iOS 开发中用到的一个非常有用的工具,它可以帮你自动完成打包,签名,上传 app store 等一系列工作。

sudo gem install fastlane -NV

Node

如果从事前端、小程序、ReactNative 开发,那么需要安装 Node。

不要使用 Homebrew 来安装 Node。

正如 rvm 是 Ruby 的版本管理器,nvm 是 Node 的版本管理器。

不要使用 Homebrew 来安装 nvm

点击 nvm,根据官方提示来安装

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash

先安装好 Xcode,因为需要。

nvm 安装完成后,安装 Node

nvm install --lts

安装 yarn

curl -o- -L https://yarnpkg.com/install.sh | bash

VS Code

Download for Mac

安装完成后打开

同时按下 ⇧ + ⌘ + p,安装 code command shell

安装主题 Ayu

安装主题 Material Icon Theme

安装插件 ESLint

安装插件 Prettier - Code formatter

安装插件 GitLens

安装插件 minapp - 小程序

同时按下 ⌘ + , 设置 User Settings

{
  "workbench.colorTheme": "Ayu Mirage",
  "workbench.iconTheme": "material-icon-theme",

  "javascript.updateImportsOnFileMove.enabled": "always",
  "typescript.updateImportsOnFileMove.enabled": "always",
  "[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode",
    "editor.formatOnSave": false
  },
  "[javascriptreact]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode",
    "editor.formatOnSave": false
  },
  "[typescript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode",
    "editor.formatOnSave": false
  },
  "[typescriptreact]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode",
    "editor.formatOnSave": false
  },
  "editor.fontSize": 14,
  "editor.formatOnSave": true,
  "eslint.autoFixOnSave": true,
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    {
      "language": "typescript",
      "autoFix": true
    },
    {
      "language": "typescriptreact",
      "autoFix": true
    }
  ]
}

Android 开发工具

确保你已安装了 Homebrew

安装 java

$ brew cask install java

安装 Android Studio

$ brew cask install android-studio

设置 Android Studio 相关环境变量

$ touch .zshrc

打开配置文件

$ open -e .zshrc

拷贝如下设置到文件中,注意将listen更换成你的用户名

export ANDROID_HOME=/Users/listen/Library/Android/sdk
export PATH="${ANDROID_HOME}/tools:${PATH}"
export PATH="${ANDROID_HOME}/platform-tools:${PATH}"

按下⌘+S保存设置,同时输入如下命令激活设置:

$ source .zshrc

Google Chrome

使用 Homebrew 安装 Google Chrome

brew cask install google-chrome

GitLab Runner

GitLab Runner

安装 GitLab Runner

sudo curl --output /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-darwin-amd64

赋予执行权限

sudo chmod +x /usr/local/bin/gitlab-runner

注册 runner

gitlab-runner register

安装和运行

 cd ~
 gitlab-runner install
 gitlab-runner start

修改配置

open -e ~/.gitlab-runner/config.toml

gitlab-runner 使用的 shell 是 bash,如果你的系统默认 shell 是 zsh,需要在 ~/.bash_profile 中加入 source ~/.zshrc

  ]]></description>
</item>

  </channel>
</rss>


text:
Bootswatch

  A collection of open source themes for Bootstrap

  View Bootswatch themes »

  Report bug
  ·
  Request feature
  ·
  Blog

## Usage

There are a few different ways you can integrate Bootswatch into your project.

### Via Pre-compiled Asset

Download the `bootstrap.min.css` file associated with a theme and replace
Bootstrap's default stylesheet. You must still include Bootstrap's JavaScript
file to have functional dropdowns, modals, etc.

### Via CDN

You can use the themes via CDN at [jsDelivr](https://www.jsdelivr.com/package/npm/bootswatch).

### Via Sass Imports

If you're using [Sass](https://sass-lang.com/) (SCSS) in your project, you can
import the `_variables.scss` and `_bootswatch.scss` files for a given theme.
This method allows you to override theme variables.

```scss
// Your variable overrides go here, e.g.:
// $h1-font-size: 3rem;

@import "~bootswatch/dist/[theme]/variables";
@import "~bootstrap/scss/bootstrap";
@import "~bootswatch/dist/[theme]/bootswatch";
```

Make sure to import Bootstrap's `bootstrap.scss` in between `_variables.scss`
and `_bootswatch.scss`!

### Via NPM

You can install as a package with the command `npm install bootswatch`.

#### React Users (`create-react-app`, or similar bundler)

Modern JavaScript bundlers (webpack, parcel, rollup) support `import`ing CSS from JS files. This can make it easier to deploy various 1st and 3rd party assets predictably. Note: _There are tradeoffs to the following method, research your tooling before deploying to production._

Before continuing, ensure you've run `npm install bootswatch` in your local project folder. (Use either `npm` or `yarn`.)

Add the following `import` to your top-level `index.js` (or `App.js`) file. Add it **before** any other `.css` imports.

```js
import "bootswatch/dist/[theme]/bootstrap.min.css";
// TODO: Note: Replace ^[theme]^ (examples: darkly, slate, cosmo, spacelab, and superhero. See https://bootswatch.com for current theme names.)
```

Here's an example of updated `imports` in `App.js` to use "slate" theme (using a `create-react-app` fresh project.)

```js
import React from 'react';
import logo from './logo.svg';
import 'bootswatch/dist/slate/bootstrap.min.css'; // Added this :boom:
import './App.css';

function App() {
...
```

### Via Ruby Gem

In your Ruby project, you can access the latest version of each theme by adding
the following to your Gemfile and running `bundle install`:

```ruby
gem "bootswatch", github: "thomaspark/bootswatch"
```

Each theme directory is then accessible via the path
`"#{Gem.loaded_specs["bootswatch"].load_paths.first}/[theme]"`.

Ruby on Rails users can add the following to an initializer (e.g.
`config/initializers/bootswatch.rb`):

```ruby
Rails.application.config.assets.paths += Gem.loaded_specs["bootswatch"].load_paths
```

And thus be able to import themes via Sass like so:

```scss
@import "[theme]/variables";
@import "~bootstrap/scss/bootstrap";
@import "[theme]/bootswatch";
```

### Via API

A simple JSON API is available for integrating your platform with Bootswatch.
More info can be found on the [Help page](https://bootswatch.com/help/#api).

## Customization

Bootswatch is open source and you're welcome to modify the themes.

Each theme consists of two SASS files. `_variables.scss`, which is included by default in Bootstrap, allows you to customize the settings. `_bootswatch.scss` introduces more extensive structural changes.

Check out the [Help page](https://bootswatch.com/help/#customization) for more details on building your own theme.

## Contributing

It's through your contributions that Bootswatch will continue to improve. You can contribute in several ways.

**Issues:** Provide a detailed report of any bugs you encounter and open an issue on [GitHub](https://github.com/thomaspark/bootswatch/issues).

**Documentation:** If you'd like to fix a typo or beef up the docs, you can fork the project, make your changes, and submit a pull request.

**Code:** Make a fix and submit it as a pull request. When making changes, it's important to keep the CSS and SASS versions in sync. To do this, be sure to edit the SASS source files for the particular theme first, then run the  tasks `grunt swatch` to build the CSS.

**Donation:** Donations are gratefully accepted via [GitHub](https://github.com/sponsors/thomaspark) and [PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=PU2DH4BMF9MWS&source=url).

## Author

Thomas Park

* <https://github.com/thomaspark>
* <https://thomaspark.co/>

## Thanks

[Mark Otto](https://github.com/mdo) and [Jacob Thornton](https://github.com/fat) for [Bootstrap](https://github.com/twbs/bootstrap).

[Jenil Gogari](https://jgog.in/) for his contributions to the Flatly theme.

[James Taylor](https://github.com/jostylr) for [cors-lite](https://github.com/jostylr/cors-lite).

[Corey Sewell](https://github.com/cjsewell) for SASS conversion.

## Copyright and License

Copyright 2014-2020 Thomas Park

Code released under the MIT License.


text:
cask 'clyang-welly' do
  version '3.1.1.1'
  sha256 'f17aa74d8668d02ff7c6eee81ae7e0c06d76a51d4aa50624ffe757c95f498ecf'

  url "https://github.com/clyang/welly/releases/download/#{version}/Welly.v#{version}.zip"
  appcast 'https://github.com/clyang/welly/releases.atom'
  name 'Welly'
  homepage 'https://github.com/clyang/welly'

  auto_updates true

  app 'Welly.app'

  zap trash: [
               '~/Library/Application Support/Welly',
               '~/Library/Caches/Welly',
               '~/Library/Caches/org.net9.Welly',
               '~/Library/Cookies/org.net9.Welly.binarycookies',
               '~/Library/Preferences/org.net9.Welly.plist',
             ]
end


text:
(function() {
	'use strict';

	var DisplaySheetTaskTask = require('./display-sheet-task');

	var testDataset = require('./test-dataset');

	describe('The DisplaySheetTask', function () {
		var task;
		var currentStatus;

		beforeEach(function () {
			var dataset = testDataset.dataset(true);
			task = DisplaySheetTaskTask.start(dataset);

			task.status().subscribe(function (status) {
				currentStatus = status;
			});
		});

		it('is initially in the ready state', function () {
			expect(currentStatus.statusName).to.eql('ready');
		});

		it('becomes displayed when visualization rendering is done', function () {
			var visualization = {};
			task.visualizationRendered(visualization);

			expect(currentStatus.statusName).to.eql('displayed');
		});
	});
}());


text:
package org.jboss.logmanager;

import org.jboss.logmanager.formatters.PatternFormatter;
import org.jboss.logmanager.handlers.FileHandler;
import org.junit.Test;

import java.io.File;
import java.io.UnsupportedEncodingException;
import java.util.logging.Formatter;

/**
 * @author Carlo de Wolf
 */
public class FileHandlerPerformanceTests {
    private static final Formatter testFormatter = new PatternFormatter("%m\n");

    private static void initHandler(ExtHandler handler) throws UnsupportedEncodingException {
        handler.setFormatter(testFormatter);
        handler.setLevel(Level.ALL);
        handler.setAutoFlush(true);
        handler.setEncoding("utf-8");
    }

    private static void publish(final ExtHandler handler, final String msg) {
        handler.publish(new ExtLogRecord(Level.INFO, msg, null));
    }

    @Test
    public void testPerformance() throws Exception {
        final FileHandler handler = new FileHandler();
        initHandler(handler);
        final File tempFile = File.createTempFile("jblm-", ".log");
        tempFile.deleteOnExit();
        handler.setFile(tempFile);
        final long start = System.currentTimeMillis();
        for (int i = 0; i < 100000; i++) {
            publish(handler, "Test message " + i);
        }
        // the result is system dependant and can therefore only be checked manually
        // a 'sluggish' build indicates a problem
        System.out.println((System.currentTimeMillis() - start));
    }
}


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

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="match_parent"
              android:layout_height="match_parent">
    <LinearLayout
            android:orientation="vertical"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" android:layout_marginTop="10dp" android:layout_marginBottom="30dp"
            android:id="@+id/progressBox" android:focusable="true" android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp" android:visibility="invisible">
        <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Proszę czekać..."
                android:id="@+id/progressInfo" android:layout_gravity="center"/>
        <ProgressBar
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:id="@+id/progressBar" android:layout_gravity="center"
                style="@android:style/Widget.DeviceDefault.Light.ProgressBar.Horizontal" android:progress="40"
                android:indeterminateOnly="false" android:longClickable="true" android:indeterminate="false"
                android:clickable="true" android:focusableInTouchMode="true" android:layout_marginLeft="40dp"
                android:layout_marginRight="40dp"/>
    </LinearLayout>
    <Button
            android:layout_width="200dp"
            android:layout_height="wrap_content"
            android:text="Coffee"
            android:onClick="onButtonClick"
            android:layout_gravity="center"
            android:id="@+id/coffeeButton"
            android:layout_marginBottom="20dp"
            android:background="@drawable/blue_button"
            style="@style/ButtonText"/>
    <Button
            android:layout_width="200dp"
            android:layout_height="wrap_content"
            android:text="Feeding"
            android:onClick="onButtonClick"
            android:layout_gravity="center"
            android:id="@+id/feedingButton"
            android:layout_marginBottom="20dp"
            android:background="@drawable/blue_button"
            style="@style/ButtonText"/>
    <Switch
            android:layout_width="200dp"
            android:layout_height="wrap_content"
            android:text="Windows"
            android:id="@+id/windowsSwitch"
            android:textOff=' off '
            android:textOn=' on '
            android:onClick="onSwitchClick"
            android:layout_gravity="center"
            android:layout_marginBottom="20dp"
            />
    <Switch
            android:layout_width="200dp"
            android:layout_height="wrap_content"
            android:text="Shade"
            android:id="@+id/shadesSwitch"
            android:textOff=' off '
            android:textOn=' on '
            android:onClick="onSwitchClick"
            android:layout_gravity="center"
            android:layout_marginBottom="20dp"
            />
    <Switch
            android:layout_width="200dp"
            android:layout_height="wrap_content"
            android:text="Vacuum cleaner"
            android:id="@+id/CleanerSwitch"
            android:textOff=' off '
            android:textOn=' on '
            android:onClick="onSwitchClick"
            android:layout_gravity="center"
            android:layout_marginBottom="20dp"
            />
    <Switch
            android:layout_width="200dp"
            android:layout_height="wrap_content"
            android:text="Heating"
            android:id="@+id/heatingSwitch"
            android:textOff=' off '
            android:textOn=' on '
            android:onClick="onSwitchClick"
            android:layout_gravity="center"
            android:layout_marginBottom="20dp"
            android:checked="true"
            />
    <Switch
            android:layout_width="200dp"
            android:layout_height="wrap_content"
            android:text="Light"
            android:textOff=' off '
            android:textOn=' on '
            android:id="@+id/lightSwitch"
            android:onClick="onSwitchClick"
            android:layout_gravity="center"
            />
</LinearLayout>