├── .settings ├── org.eclipse.wst.jsdt.ui.superType.name ├── org.eclipse.wst.validation.prefs ├── org.eclipse.wst.jsdt.ui.superType.container ├── org.eclipse.m2e.wtp.prefs ├── org.eclipse.m2e.core.prefs ├── org.eclipse.wst.common.project.facet.core.prefs.xml ├── org.eclipse.wst.common.project.facet.core.xml ├── org.eclipse.core.resources.prefs ├── .jsdtscope └── org.eclipse.wst.common.component ├── src ├── main │ ├── java │ │ └── com │ │ │ └── lz │ │ │ ├── hadoop │ │ │ ├── mapreduce │ │ │ │ ├── file1.txt │ │ │ │ ├── file2.txt │ │ │ │ ├── score.txt │ │ │ │ └── t1.txt │ │ │ ├── hdfs │ │ │ │ ├── RegxAcceptPathFilter.java │ │ │ │ ├── UrlCat.java │ │ │ │ ├── FileSystemCat.java │ │ │ │ ├── FileCopyWithProgress.java │ │ │ │ ├── Test.java │ │ │ │ └── MultipleFileUpload.java │ │ │ └── zookeeper │ │ │ │ ├── MyTestWatcher.java │ │ │ │ ├── MyTestWatcher2.java │ │ │ │ └── Test1.java │ │ │ ├── art │ │ │ ├── base │ │ │ │ ├── BaseDao.java │ │ │ │ ├── IBaseDao.java │ │ │ │ ├── IBaseService.java │ │ │ │ ├── BaseServiceImpl.java │ │ │ │ └── BaseController.java │ │ │ ├── service │ │ │ │ ├── IUrlservice.java │ │ │ │ ├── IAccountService.java │ │ │ │ ├── IReviewsService.java │ │ │ │ ├── ICrawlerService.java │ │ │ │ └── impl │ │ │ │ │ ├── UrlServiceImpl.java │ │ │ │ │ ├── AccountServiceImpl.java │ │ │ │ │ ├── ReviewsServiceImpl.java │ │ │ │ │ └── CrawlerServiceImpl.java │ │ │ ├── common │ │ │ │ ├── SpiderMap.java │ │ │ │ ├── ApplicationHelper.java │ │ │ │ ├── StringHelper.java │ │ │ │ └── DataNotyOptions.java │ │ │ ├── controller │ │ │ │ ├── ContentController.java │ │ │ │ ├── ReviewController.java │ │ │ │ └── CrawlerController.java │ │ │ ├── thread │ │ │ │ └── StartAmazonCrawlerThread.java │ │ │ ├── pojo │ │ │ │ └── Url.java │ │ │ ├── dao │ │ │ │ └── UrlMapper.java │ │ │ └── crawler │ │ │ │ └── SinaBlogProcessor.java │ │ │ ├── pattern │ │ │ ├── bridge │ │ │ │ ├── BagColor.java │ │ │ │ ├── Red.java │ │ │ │ ├── Wallet.java │ │ │ │ ├── Yellow.java │ │ │ │ ├── HandBag.java │ │ │ │ ├── Bag.java │ │ │ │ └── BridgeTest.java │ │ │ ├── commend │ │ │ │ ├── base │ │ │ │ │ ├── Command.java │ │ │ │ │ ├── Receiver.java │ │ │ │ │ ├── Client.java │ │ │ │ │ ├── ConcreteCommand.java │ │ │ │ │ └── Invoker.java │ │ │ │ └── example │ │ │ │ │ ├── Command.java │ │ │ │ │ ├── PlayCommand.java │ │ │ │ │ ├── StopCommand.java │ │ │ │ │ ├── PauseCommand.java │ │ │ │ │ ├── Singleton.java │ │ │ │ │ ├── AudioPlayer.java │ │ │ │ │ ├── Keypad.java │ │ │ │ │ └── People.java │ │ │ ├── decorator │ │ │ │ ├── example2 │ │ │ │ │ ├── Component.java │ │ │ │ │ ├── ConcreteComponent.java │ │ │ │ │ ├── ConcreteDecorator.java │ │ │ │ │ ├── UseDecorator.java │ │ │ │ │ └── Decorator.java │ │ │ │ └── example1 │ │ │ │ │ ├── Food.java │ │ │ │ │ ├── FoodDecoration.java │ │ │ │ │ ├── Duck.java │ │ │ │ │ ├── Chicken.java │ │ │ │ │ ├── RoastFood.java │ │ │ │ │ ├── SteamedFood.java │ │ │ │ │ └── Client.java │ │ │ ├── combination │ │ │ │ ├── Articles.java │ │ │ │ ├── Goods.java │ │ │ │ ├── Bags.java │ │ │ │ └── ShoppingTest.java │ │ │ ├── memo │ │ │ │ ├── Memento.java │ │ │ │ ├── Caretaker.java │ │ │ │ ├── Originator.java │ │ │ │ └── Client.java │ │ │ └── chain │ │ │ │ ├── Leader.java │ │ │ │ ├── Dean.java │ │ │ │ ├── DeanOfStudies.java │ │ │ │ ├── DepartmentHead.java │ │ │ │ ├── ClassAdviser.java │ │ │ │ └── LeaveApprovalTest.java │ │ │ ├── study │ │ │ ├── java8 │ │ │ │ ├── lambda │ │ │ │ │ ├── MyFun.java │ │ │ │ │ ├── exer │ │ │ │ │ │ ├── MyFunction2.java │ │ │ │ │ │ ├── MyFunction.java │ │ │ │ │ │ └── TestLambda.java │ │ │ │ │ ├── MyPredicate.java │ │ │ │ │ ├── FilterEmployeeForAge.java │ │ │ │ │ ├── FilterEmployeeForSalary.java │ │ │ │ │ └── MyTestJava8.java │ │ │ │ └── stream │ │ │ │ │ ├── MyClass.java │ │ │ │ │ ├── MyFun.java │ │ │ │ │ ├── SubClass.java │ │ │ │ │ ├── MyInterface.java │ │ │ │ │ ├── TestDefaultInterface.java │ │ │ │ │ ├── Man.java │ │ │ │ │ ├── Godness.java │ │ │ │ │ ├── DateFormatThreadLocal.java │ │ │ │ │ ├── exer │ │ │ │ │ ├── Trader.java │ │ │ │ │ ├── Transaction.java │ │ │ │ │ └── TestStreamAPI.java │ │ │ │ │ ├── NewMan.java │ │ │ │ │ ├── ForkJoinCalculate.java │ │ │ │ │ └── TestForkJoin.java │ │ │ ├── redis │ │ │ │ └── BaseRedisDao.java │ │ │ ├── netty │ │ │ │ ├── serial │ │ │ │ │ ├── Resource.java │ │ │ │ │ ├── test │ │ │ │ │ │ ├── Test2.java │ │ │ │ │ │ ├── Test4.java │ │ │ │ │ │ ├── Test3.java │ │ │ │ │ │ └── Test1.java │ │ │ │ │ ├── BufferFactory.java │ │ │ │ │ └── Player.java │ │ │ │ ├── server │ │ │ │ │ ├── Server.java │ │ │ │ │ └── HelloHandler.java │ │ │ │ └── client │ │ │ │ │ ├── HiHandler.java │ │ │ │ │ └── Client.java │ │ │ ├── protobuf │ │ │ │ └── GenerateClass.java │ │ │ ├── thread │ │ │ │ └── TestThreadPool.java │ │ │ ├── binary │ │ │ │ └── ByteTest.java │ │ │ └── https │ │ │ │ └── Test.java │ │ │ ├── weixin │ │ │ ├── message │ │ │ │ ├── resp │ │ │ │ │ ├── MusicMessage.java │ │ │ │ │ ├── TextMessage.java │ │ │ │ │ ├── NewsMessage.java │ │ │ │ │ ├── Music.java │ │ │ │ │ ├── Article.java │ │ │ │ │ └── BaseMessage.java │ │ │ │ └── req │ │ │ │ │ ├── ImageMessage.java │ │ │ │ │ ├── TextMessage.java │ │ │ │ │ ├── VoiceMessage.java │ │ │ │ │ ├── LinkMessage.java │ │ │ │ │ ├── LocationMessage.java │ │ │ │ │ └── BaseMessage.java │ │ │ ├── Constants.java │ │ │ ├── GetWeiXinCode.java │ │ │ └── MD5.java │ │ │ ├── util │ │ │ ├── FilterDailyRollingFileAppender.java │ │ │ └── TeskDataLoad.java │ │ │ ├── thread │ │ │ └── pool │ │ │ │ ├── LostUpdate.java │ │ │ │ └── TestLock.java │ │ │ ├── jms │ │ │ ├── rabbitmq │ │ │ │ ├── fanout │ │ │ │ │ ├── Constants.java │ │ │ │ │ ├── FanoutConsumer_2.java │ │ │ │ │ ├── FanoutProducer.java │ │ │ │ │ └── FanoutConsumer_1.java │ │ │ │ ├── Send.java │ │ │ │ ├── ReceiveLogs.java │ │ │ │ ├── NewTask.java │ │ │ │ ├── Recv.java │ │ │ │ ├── EmitLog.java │ │ │ │ └── Work.java │ │ │ ├── kafka │ │ │ │ └── ConsumerDemo.java │ │ │ └── activemq │ │ │ │ └── TOPReceiver.java │ │ │ └── image │ │ │ ├── local │ │ │ ├── Test.java │ │ │ └── FillFilter.java │ │ │ └── opencv │ │ │ ├── Linux安装opencv3.4 │ │ │ ├── GaussianBlur.java │ │ │ └── LoadLibrary.java │ ├── webapp │ │ ├── ui │ │ │ ├── bootstrap │ │ │ │ ├── img │ │ │ │ │ ├── crop.gif │ │ │ │ │ ├── avatar.jpg │ │ │ │ │ ├── quote.png │ │ │ │ │ ├── resize.png │ │ │ │ │ ├── sprite.png │ │ │ │ │ ├── bg-input.png │ │ │ │ │ ├── bg-login.jpg │ │ │ │ │ ├── buttons.gif │ │ │ │ │ ├── chat-left.png │ │ │ │ │ ├── dialogs.png │ │ │ │ │ ├── icons-big.png │ │ │ │ │ ├── progress.gif │ │ │ │ │ ├── slider_r8.png │ │ │ │ │ ├── toolbar.gif │ │ │ │ │ ├── toolbar.png │ │ │ │ │ ├── browser-ie.png │ │ │ │ │ ├── chat-right.png │ │ │ │ │ ├── glyphicons.png │ │ │ │ │ ├── icons-small.png │ │ │ │ │ ├── timeline-bg.png │ │ │ │ │ ├── arrows-active.png │ │ │ │ │ ├── arrows-normal.png │ │ │ │ │ ├── bg-input-focus.png │ │ │ │ │ ├── browser-opera.png │ │ │ │ │ ├── browser-safari.png │ │ │ │ │ ├── chat-left@2x.png │ │ │ │ │ ├── chat-right@2x.png │ │ │ │ │ ├── chosen-sprite.png │ │ │ │ │ ├── close-button.png │ │ │ │ │ ├── gallery │ │ │ │ │ │ ├── photo1.jpg │ │ │ │ │ │ ├── photo2.jpg │ │ │ │ │ │ ├── photo3.jpg │ │ │ │ │ │ ├── photo4.jpg │ │ │ │ │ │ ├── photo5.jpg │ │ │ │ │ │ ├── photo6.jpg │ │ │ │ │ │ ├── photo7.jpg │ │ │ │ │ │ ├── photo8.jpg │ │ │ │ │ │ ├── photo9.jpg │ │ │ │ │ │ ├── photo10.jpg │ │ │ │ │ │ ├── photo11.jpg │ │ │ │ │ │ ├── photo12.jpg │ │ │ │ │ │ └── photo13.jpg │ │ │ │ │ ├── quicklook-bg.png │ │ │ │ │ ├── spinner-mini.gif │ │ │ │ │ ├── chat-left-metro.png │ │ │ │ │ ├── chat-right-metro.png │ │ │ │ │ ├── glyphicons-white.png │ │ │ │ │ ├── quicklook-icons.png │ │ │ │ │ ├── uploadify-cancel.png │ │ │ │ │ ├── browser-chrome-big.png │ │ │ │ │ ├── browser-firefox-big.png │ │ │ │ │ ├── chat-left-metro@2x.png │ │ │ │ │ ├── chat-right-metro@2x.png │ │ │ │ │ ├── close-button-white.png │ │ │ │ │ ├── timeline-left-arrow.png │ │ │ │ │ ├── glyphicons-halflings.png │ │ │ │ │ ├── glyphicons_halflings.png │ │ │ │ │ ├── timeline-right-arrow.png │ │ │ │ │ ├── timeline-left-arrow@2x.png │ │ │ │ │ ├── timeline-right-arrow@2x.png │ │ │ │ │ ├── ui-icons_222222_256x240.png │ │ │ │ │ ├── ui-icons_2e83ff_256x240.png │ │ │ │ │ ├── ui-icons_454545_256x240.png │ │ │ │ │ ├── ui-icons_888888_256x240.png │ │ │ │ │ ├── ui-icons_cd0a0a_256x240.png │ │ │ │ │ ├── glyphicons-halflings-white.png │ │ │ │ │ ├── glyphicons_halflings-white.png │ │ │ │ │ ├── ui-bg_flat_0_aaaaaa_40x100.png │ │ │ │ │ ├── ui-bg_flat_75_ffffff_40x100.png │ │ │ │ │ ├── ui-bg_glass_55_fbf9ee_1x400.png │ │ │ │ │ ├── ui-bg_glass_65_ffffff_1x400.png │ │ │ │ │ ├── ui-bg_glass_75_dadada_1x400.png │ │ │ │ │ ├── ui-bg_glass_75_e6e6e6_1x400.png │ │ │ │ │ ├── ui-bg_glass_95_fef1ec_1x400.png │ │ │ │ │ ├── iphone-style-checkboxes │ │ │ │ │ │ ├── off-63584.png │ │ │ │ │ │ ├── on-63584.png │ │ │ │ │ │ ├── slider_left-63584.png │ │ │ │ │ │ ├── slider_center-63584.png │ │ │ │ │ │ └── slider_right-63584.png │ │ │ │ │ └── ui-bg_highlight-soft_75_cccccc_1x100.png │ │ │ │ ├── font │ │ │ │ │ ├── glyphicons-regular.eot │ │ │ │ │ ├── glyphicons-regular.ttf │ │ │ │ │ ├── glyphicons-regular-0.eot │ │ │ │ │ ├── glyphicons-regular.woff │ │ │ │ │ ├── fontawesome-webfont-0.eot │ │ │ │ │ ├── fontawesome-webfont-62877.eot │ │ │ │ │ ├── fontawesome-webfont-62877.ttf │ │ │ │ │ ├── fontawesome-webfont-62877.woff │ │ │ │ │ ├── glyphiconshalflings-regular.eot │ │ │ │ │ ├── glyphiconshalflings-regular.ttf │ │ │ │ │ ├── glyphiconshalflings-regular.woff │ │ │ │ │ └── glyphiconshalflings-regular-0.eot │ │ │ │ ├── css │ │ │ │ │ ├── ie9.css │ │ │ │ │ ├── jquery.cleditor.css │ │ │ │ │ └── elfinder.theme.css │ │ │ │ ├── datetimepicker │ │ │ │ │ └── bootstrap-datetimepicker.zh-CN.js │ │ │ │ └── js │ │ │ │ │ ├── jquery.flot.resize.min.js │ │ │ │ │ ├── retina.js │ │ │ │ │ ├── counter.js │ │ │ │ │ └── jquery.cookie.js │ │ │ └── js │ │ │ │ ├── global.js │ │ │ │ └── review.js │ │ └── WEB-INF │ │ │ ├── jsp │ │ │ ├── content.jsp │ │ │ └── article │ │ │ │ ├── reviews.jsp │ │ │ │ └── article-list.jsp │ │ │ └── web.xml │ └── resources │ │ ├── redis.properties │ │ ├── local │ │ └── jdbc.properties │ │ ├── mybatis.xml │ │ ├── ehcache.xml │ │ ├── spring-cache.xml │ │ └── spring-config.xml └── test │ └── java │ ├── example │ └── MultiThread.java │ ├── common │ ├── Test.java │ └── ChargingTest.java │ └── redis │ ├── ShardedJedisPoolTest.java │ └── RedisTest.java ├── proto └── LoginApply.proto ├── README.md ├── .gitattributes ├── .externalToolBuilders └── org.eclipse.wst.jsdt.core.javascriptValidator.launch ├── .classpath ├── .project └── .gitignore /.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /src/main/java/com/lz/hadoop/mapreduce/file1.txt: -------------------------------------------------------------------------------- 1 | Hello World Bye World -------------------------------------------------------------------------------- /src/main/java/com/lz/art/base/BaseDao.java: -------------------------------------------------------------------------------- 1 | package com.lz.art.base; 2 | -------------------------------------------------------------------------------- /src/main/java/com/lz/hadoop/mapreduce/file2.txt: -------------------------------------------------------------------------------- 1 | Hello Hadoop GoodBye Hadoop -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /.settings/org.eclipse.m2e.wtp.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.m2e.wtp.enabledProjectSpecificPrefs=false 3 | -------------------------------------------------------------------------------- /.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/crop.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/crop.gif -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/avatar.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/avatar.jpg -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/quote.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/quote.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/resize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/resize.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/sprite.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/bg-input.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/bg-input.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/bg-login.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/bg-login.jpg -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/buttons.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/buttons.gif -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/chat-left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/chat-left.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/dialogs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/dialogs.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/icons-big.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/icons-big.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/progress.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/progress.gif -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/slider_r8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/slider_r8.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/toolbar.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/toolbar.gif -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/toolbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/toolbar.png -------------------------------------------------------------------------------- /src/main/java/com/lz/art/base/IBaseDao.java: -------------------------------------------------------------------------------- 1 | package com.lz.art.base; 2 | 3 | public interface IBaseDao { 4 | 5 | int insert(T obj); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/browser-ie.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/browser-ie.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/chat-right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/chat-right.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/glyphicons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/glyphicons.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/icons-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/icons-small.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/timeline-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/timeline-bg.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/arrows-active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/arrows-active.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/arrows-normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/arrows-normal.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/bg-input-focus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/bg-input-focus.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/browser-opera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/browser-opera.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/browser-safari.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/browser-safari.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/chat-left@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/chat-left@2x.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/chat-right@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/chat-right@2x.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/chosen-sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/chosen-sprite.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/close-button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/close-button.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/gallery/photo1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/gallery/photo1.jpg -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/gallery/photo2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/gallery/photo2.jpg -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/gallery/photo3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/gallery/photo3.jpg -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/gallery/photo4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/gallery/photo4.jpg -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/gallery/photo5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/gallery/photo5.jpg -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/gallery/photo6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/gallery/photo6.jpg -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/gallery/photo7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/gallery/photo7.jpg -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/gallery/photo8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/gallery/photo8.jpg -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/gallery/photo9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/gallery/photo9.jpg -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/quicklook-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/quicklook-bg.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/spinner-mini.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/spinner-mini.gif -------------------------------------------------------------------------------- /src/main/java/com/lz/art/base/IBaseService.java: -------------------------------------------------------------------------------- 1 | package com.lz.art.base; 2 | 3 | public interface IBaseService { 4 | 5 | void insert(T obj); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/chat-left-metro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/chat-left-metro.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/chat-right-metro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/chat-right-metro.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/gallery/photo10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/gallery/photo10.jpg -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/gallery/photo11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/gallery/photo11.jpg -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/gallery/photo12.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/gallery/photo12.jpg -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/gallery/photo13.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/gallery/photo13.jpg -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/glyphicons-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/glyphicons-white.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/quicklook-icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/quicklook-icons.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/uploadify-cancel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/uploadify-cancel.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/font/glyphicons-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/font/glyphicons-regular.eot -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/font/glyphicons-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/font/glyphicons-regular.ttf -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/browser-chrome-big.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/browser-chrome-big.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/browser-firefox-big.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/browser-firefox-big.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/chat-left-metro@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/chat-left-metro@2x.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/chat-right-metro@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/chat-right-metro@2x.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/close-button-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/close-button-white.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/timeline-left-arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/timeline-left-arrow.png -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/bridge/BagColor.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.bridge; 2 | 3 | public interface BagColor { 4 | 5 | public String getColor(); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/font/glyphicons-regular-0.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/font/glyphicons-regular-0.eot -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/font/glyphicons-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/font/glyphicons-regular.woff -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/glyphicons-halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/glyphicons-halflings.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/glyphicons_halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/glyphicons_halflings.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/timeline-right-arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/timeline-right-arrow.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/font/fontawesome-webfont-0.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/font/fontawesome-webfont-0.eot -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/timeline-left-arrow@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/timeline-left-arrow@2x.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/timeline-right-arrow@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/timeline-right-arrow@2x.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/ui-icons_222222_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/ui-icons_222222_256x240.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/ui-icons_2e83ff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/ui-icons_2e83ff_256x240.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/ui-icons_454545_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/ui-icons_454545_256x240.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/ui-icons_888888_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/ui-icons_888888_256x240.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/ui-icons_cd0a0a_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/ui-icons_cd0a0a_256x240.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/font/fontawesome-webfont-62877.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/font/fontawesome-webfont-62877.eot -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/font/fontawesome-webfont-62877.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/font/fontawesome-webfont-62877.ttf -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/glyphicons-halflings-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/glyphicons-halflings-white.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/glyphicons_halflings-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/glyphicons_halflings-white.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/ui-bg_flat_0_aaaaaa_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/ui-bg_flat_0_aaaaaa_40x100.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/font/fontawesome-webfont-62877.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/font/fontawesome-webfont-62877.woff -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/font/glyphiconshalflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/font/glyphiconshalflings-regular.eot -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/font/glyphiconshalflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/font/glyphiconshalflings-regular.ttf -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/font/glyphiconshalflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/font/glyphiconshalflings-regular.woff -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/ui-bg_flat_75_ffffff_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/ui-bg_flat_75_ffffff_40x100.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/ui-bg_glass_55_fbf9ee_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/ui-bg_glass_55_fbf9ee_1x400.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/ui-bg_glass_65_ffffff_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/ui-bg_glass_65_ffffff_1x400.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/ui-bg_glass_75_dadada_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/ui-bg_glass_75_dadada_1x400.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/ui-bg_glass_75_e6e6e6_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/ui-bg_glass_75_e6e6e6_1x400.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/ui-bg_glass_95_fef1ec_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/ui-bg_glass_95_fef1ec_1x400.png -------------------------------------------------------------------------------- /src/main/java/com/lz/hadoop/mapreduce/score.txt: -------------------------------------------------------------------------------- 1 | 陈明 66 2 | 李宁 89 3 | 韩庚 57 4 | 孙悟空 88 5 | 猪八戒 76 6 | 唐三藏 99 7 | 沙僧 60 8 | 李宁 78 9 | 孙悟空 80 10 | 小明 45 11 | 小黄 69 12 | 小明 76 13 | 唐三藏 76 -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/font/glyphiconshalflings-regular-0.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/font/glyphiconshalflings-regular-0.eot -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/iphone-style-checkboxes/off-63584.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/iphone-style-checkboxes/off-63584.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/iphone-style-checkboxes/on-63584.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/iphone-style-checkboxes/on-63584.png -------------------------------------------------------------------------------- /src/main/java/com/lz/art/service/IUrlservice.java: -------------------------------------------------------------------------------- 1 | package com.lz.art.service; 2 | 3 | import com.lz.art.pojo.Url; 4 | 5 | public interface IUrlservice { 6 | public void saveUrl(Url url); 7 | } 8 | -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/ui-bg_highlight-soft_75_cccccc_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/ui-bg_highlight-soft_75_cccccc_1x100.png -------------------------------------------------------------------------------- /src/main/java/com/lz/study/java8/lambda/MyFun.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.java8.lambda; 2 | 3 | @FunctionalInterface 4 | public interface MyFun { 5 | 6 | public Integer getValue(Integer num); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/com/lz/study/java8/lambda/exer/MyFunction2.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.java8.lambda.exer; 2 | 3 | public interface MyFunction2 { 4 | 5 | public R getValue(T t1, T t2); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/lz/study/java8/stream/MyClass.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.java8.stream; 2 | 3 | public class MyClass { 4 | 5 | public String getName(){ 6 | return "嘿嘿嘿"; 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/lz/study/java8/stream/MyFun.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.java8.stream; 2 | 3 | public interface MyFun { 4 | 5 | default String getName(){ 6 | return "哈哈哈"; 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/commend/base/Command.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.commend.base; 2 | 3 | public interface Command { 4 | 5 | /** 6 | * 执行方法 7 | */ 8 | void execute(); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/lz/study/java8/lambda/MyPredicate.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.java8.lambda; 2 | 3 | @FunctionalInterface 4 | public interface MyPredicate { 5 | 6 | public boolean test(T t); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/iphone-style-checkboxes/slider_left-63584.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/iphone-style-checkboxes/slider_left-63584.png -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/decorator/example2/Component.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.decorator.example2; 2 | 3 | /** 4 | * 抽象构建 5 | */ 6 | public interface Component { 7 | public void operation(); 8 | } 9 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/content.jsp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | Hello 9 |
-------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/iphone-style-checkboxes/slider_center-63584.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/iphone-style-checkboxes/slider_center-63584.png -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/img/iphone-style-checkboxes/slider_right-63584.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcqtt/article-spider/HEAD/src/main/webapp/ui/bootstrap/img/iphone-style-checkboxes/slider_right-63584.png -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/combination/Articles.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.combination; 2 | 3 | //抽象构件:物品 4 | public interface Articles 5 | { 6 | public float calculation(); //计算 7 | public void show(); 8 | } -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/bridge/Red.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.bridge; 2 | 3 | public class Red implements BagColor { 4 | 5 | @Override 6 | public String getColor() { 7 | return "紅色"; 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/lz/study/java8/lambda/exer/MyFunction.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.java8.lambda.exer; 2 | 3 | @FunctionalInterface 4 | public interface MyFunction { 5 | 6 | public String getValue(String str); 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/bridge/Wallet.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.bridge; 2 | 3 | public class Wallet extends Bag { 4 | 5 | @Override 6 | public String getName() { 7 | return color.getColor() + "钱包"; 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/bridge/Yellow.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.bridge; 2 | 3 | public class Yellow implements BagColor { 4 | 5 | @Override 6 | public String getColor() { 7 | 8 | return "黃色"; 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/bridge/HandBag.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.bridge; 2 | 3 | public class HandBag extends Bag { 4 | 5 | @Override 6 | public String getName() { 7 | return color.getColor() + "挎包"; 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/main/resources/redis.properties: -------------------------------------------------------------------------------- 1 | redis.host=192.168.87.132 2 | redis.port=6379 3 | redis.pass=123456 4 | #redis.database=0 5 | redis.maxActive=300 6 | redis.maxIdle=300 7 | redis.maxWait=1500 8 | redis.timeout=10000 9 | redis.testOnBorrow=true -------------------------------------------------------------------------------- /proto/LoginApply.proto: -------------------------------------------------------------------------------- 1 | package java_outer_classname = "LoginApply"; 2 | message LoginApply 3 | { 4 | required string Key=1, 5 | required string SendTime=2018-09-27 14:57:55, 6 | required string CtrlStatus=1, 7 | required string SerialNumber=1000, 8 | } -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/decorator/example1/Food.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.decorator.example1; 2 | 3 | /** 4 | * 抽象构建 5 | */ 6 | public abstract class Food { 7 | 8 | protected String desc; 9 | public abstract String getDesc(); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/lz/hadoop/mapreduce/t1.txt: -------------------------------------------------------------------------------- 1 | child parent 2 | Tom Lucy 3 | Tom Jack 4 | Jone Lucy 5 | Jone Jack 6 | Lucy Mary 7 | Lucy Ben 8 | Jack Alice 9 | Jack Jesse 10 | Terry Alice 11 | Terry Jesse 12 | Philip Terry 13 | Philip Alma 14 | Mark Terry 15 | Mark Alma -------------------------------------------------------------------------------- /src/main/java/com/lz/art/service/IAccountService.java: -------------------------------------------------------------------------------- 1 | package com.lz.art.service; 2 | 3 | public interface IAccountService { 4 | 5 | public boolean login(String username,String password); 6 | 7 | public boolean register(String username, String password); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/decorator/example1/FoodDecoration.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.decorator.example1; 2 | 3 | /** 4 | * 抽象装饰 5 | */ 6 | public abstract class FoodDecoration extends Food { 7 | 8 | @Override 9 | public abstract String getDesc(); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/resources/local/jdbc.properties: -------------------------------------------------------------------------------- 1 | driver=com.mysql.jdbc.Driver 2 | url=jdbc:mysql://127.0.0.1:3306/article?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8 3 | username=root 4 | password=root 5 | initialSize=2 6 | maxActive=10 7 | maxIdle=10 8 | minIdle=2 9 | maxWait=60000 -------------------------------------------------------------------------------- /src/main/java/com/lz/study/java8/stream/SubClass.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.java8.stream; 2 | 3 | public class SubClass /*extends MyClass*/ implements MyFun, MyInterface{ 4 | 5 | @Override 6 | public String getName() { 7 | return MyInterface.super.getName(); 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/bridge/Bag.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.bridge; 2 | 3 | public abstract class Bag { 4 | 5 | protected BagColor color; 6 | 7 | public void setColor(BagColor color) { 8 | this.color = color; 9 | } 10 | 11 | public abstract String getName(); 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/lz/study/java8/lambda/FilterEmployeeForAge.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.java8.lambda; 2 | 3 | public class FilterEmployeeForAge implements MyPredicate{ 4 | 5 | @Override 6 | public boolean test(Employee t) { 7 | return t.getAge() <= 35; 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/lz/study/java8/stream/MyInterface.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.java8.stream; 2 | 3 | public interface MyInterface { 4 | 5 | default String getName(){ 6 | return "呵呵呵"; 7 | } 8 | 9 | public static void show(){ 10 | System.out.println("接口中的静态方法"); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/lz/art/base/BaseServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.lz.art.base; 2 | 3 | public class BaseServiceImpl implements IBaseService { 4 | 5 | IBaseDao baseDao; 6 | 7 | @Override 8 | public void insert(T obj) { 9 | 10 | int num = baseDao.insert(obj); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/lz/study/java8/lambda/FilterEmployeeForSalary.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.java8.lambda; 2 | 3 | public class FilterEmployeeForSalary implements MyPredicate { 4 | 5 | @Override 6 | public boolean test(Employee t) { 7 | return t.getSalary() >= 5000; 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/main/resources/mybatis.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/commend/base/Receiver.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.commend.base; 2 | 3 | public class Receiver { 4 | /** 5 | * 真正执行命令相应的操作。负责具体实施和执行请求。 6 | * 任何一个类都可以成为接收者,实施和执行请求的方法叫做行动方法。 7 | */ 8 | public void action(){ 9 | System.out.println("执行操作"); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/commend/example/Command.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.commend.example; 2 | 3 | /** 4 | * 抽象命令角色 5 | * Function: 6 | * @author : laizhiwen 7 | * Date: 2017年9月30日 8 | */ 9 | public interface Command { 10 | /** 11 | * 执行方法 12 | */ 13 | public void execute(); 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/lz/study/java8/stream/TestDefaultInterface.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.java8.stream; 2 | 3 | public class TestDefaultInterface { 4 | 5 | public static void main(String[] args) { 6 | SubClass sc = new SubClass(); 7 | System.out.println(sc.getName()); 8 | 9 | MyInterface.show(); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/decorator/example1/Duck.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.decorator.example1; 2 | 3 | /** 4 | * 具体构件 5 | */ 6 | public class Duck extends Food { 7 | 8 | public Duck(){ 9 | desc = "鸭肉"; 10 | } 11 | 12 | @Override 13 | public String getDesc() { 14 | // TODO Auto-generated method stub 15 | return desc; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/decorator/example1/Chicken.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.decorator.example1; 2 | 3 | /** 4 | * 具体构件 5 | */ 6 | public class Chicken extends Food { 7 | 8 | public Chicken(){ 9 | desc = "鸡肉"; 10 | } 11 | 12 | @Override 13 | public String getDesc() { 14 | // TODO Auto-generated method stub 15 | return desc; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/lz/weixin/message/resp/MusicMessage.java: -------------------------------------------------------------------------------- 1 | package com.lz.weixin.message.resp; 2 | 3 | public class MusicMessage extends BaseMessage { 4 | // 音乐 5 | private Music Music; 6 | 7 | public Music getMusic() { 8 | return Music; 9 | } 10 | 11 | public void setMusic(Music music) { 12 | Music = music; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/memo/Memento.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.memo; 2 | 3 | /** 4 | * 备忘录角色 5 | * 负责存储Originator发起人对象的内部状态,在需要的时候提供发起人需要的内部状态。 6 | */ 7 | public class Memento { 8 | 9 | private String state; 10 | 11 | public Memento(String state) { 12 | this.state = state; 13 | } 14 | 15 | public String getState() { 16 | return state; 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /src/main/java/com/lz/weixin/message/resp/TextMessage.java: -------------------------------------------------------------------------------- 1 | package com.lz.weixin.message.resp; 2 | 3 | public class TextMessage extends BaseMessage { 4 | // 回复的消息内容 5 | private String Content; 6 | 7 | public String getContent() { 8 | return Content; 9 | } 10 | 11 | public void setContent(String content) { 12 | Content = content; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/chain/Leader.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.chain; 2 | 3 | //抽象处理者:领导类 4 | public abstract class Leader { 5 | private Leader next; 6 | 7 | public void setNext(Leader next) { 8 | this.next = next; 9 | } 10 | 11 | public Leader getNext() { 12 | return next; 13 | } 14 | 15 | //处理请求的方法 16 | public abstract void handleRequest(int LeaveDays); 17 | } -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.common.project.facet.core.prefs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/memo/Caretaker.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.memo; 2 | 3 | /** 4 | * 管理员角色 5 | * 对备忘录进行管理、保存和提供备忘录,只能将备忘录传递给其他角色。 6 | */ 7 | public class Caretaker { 8 | 9 | private Memento memento; 10 | 11 | public Memento getMemento() { 12 | return memento; 13 | } 14 | 15 | public void setMemento(Memento memento) { 16 | this.memento = memento; 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # article-spider 为技术实练项目 2 | ###(JAVA项目)网络爬虫-webmagic-bootstrap 3 | 项目框架由SpringMVC,Spring4,MyBatis3集成 4 | 5 | ###项目集成的内容主要有: 6 | * 1、支持网页爬虫 7 | * 2、多线程、线程池 8 | * 3、支持全文搜索 9 | * 4、支持Hadoop分布式平台、HDFS/MapReduce、Zookeeper、HBase 10 | * 5、支持redis分布式缓存 11 | * 6、集成微信公众号开发 12 | * 7、Spring4新特性 13 | * 8、ActiveMQ 14 | * 9、Nginx详细配置 15 | * 10、OpenCV图像处理技术 16 | * 11、缓存Ehcache 17 | * 12、java设计模式练习、Demo 18 | * 13、java8练习 19 | * 14、Netty -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/decorator/example2/ConcreteComponent.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.decorator.example2; 2 | 3 | /** 4 | * 具体构件 5 | */ 6 | public class ConcreteComponent implements Component { 7 | public ConcreteComponent() { 8 | System.out.println("创建具体构件角色"); 9 | } 10 | 11 | @Override 12 | public void operation() { 13 | System.out.println("调用具体构件角色的方法operation()"); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/lz/study/redis/BaseRedisDao.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.redis; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.data.redis.core.RedisTemplate; 5 | import org.springframework.stereotype.Repository; 6 | 7 | @Repository 8 | public abstract class BaseRedisDao { 9 | 10 | @Autowired(required=true) 11 | protected RedisTemplate redisTemplate; 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/css/ie9.css: -------------------------------------------------------------------------------- 1 | .dark { 2 | right: -25px; 3 | } 4 | 5 | .btn-overlay { 6 | filter: none !important; 7 | } 8 | 9 | hr, 10 | .sliderOverlay, 11 | .progressBarOverlay, 12 | .slider, 13 | .progress, 14 | .progressSlim, 15 | .ui-progressbar-value, 16 | .ui-slider-range, 17 | .sliderVertical { 18 | filter: none !important; 19 | } 20 | 21 | .verticalChart .singleBar .bar .value span{ 22 | color: #3b3b41; 23 | } -------------------------------------------------------------------------------- /src/main/java/com/lz/art/service/IReviewsService.java: -------------------------------------------------------------------------------- 1 | package com.lz.art.service; 2 | 3 | import java.util.Date; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import com.lz.art.pojo.Reviews; 8 | 9 | public interface IReviewsService { 10 | 11 | public List pageOfReviews(Map map); 12 | 13 | public void addReview(Reviews review); 14 | 15 | public boolean checkExist(String reviewer, Date date); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /src/test/java/example/MultiThread.java: -------------------------------------------------------------------------------- 1 | package example; 2 | 3 | public class MultiThread extends Thread { 4 | public void run() { 5 | for (int n = 1; n <= 20; n++) { 6 | try { 7 | sleep(300); 8 | System.out.println("输出第" + n + "次"); 9 | } catch (Exception e) { 10 | e.printStackTrace(); 11 | } 12 | } 13 | } 14 | 15 | public static void main(String[] args) { 16 | MultiThread t = new MultiThread(); 17 | t.start(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/java=UTF-8 3 | encoding//src/main/resources=UTF-8 4 | encoding//src/main/resources/local=UTF-8 5 | encoding//src/main/webapp/WEB-INF/jsp/article/article-list.jsp=UTF-8 6 | encoding//src/main/webapp/index.jsp=UTF-8 7 | encoding//src/main/webapp/ui/admin/menu.jsp=UTF-8 8 | encoding//src/test/java=UTF-8 9 | encoding//src/test/resources=UTF-8 10 | encoding/=UTF-8 11 | -------------------------------------------------------------------------------- /src/main/java/com/lz/util/FilterDailyRollingFileAppender.java: -------------------------------------------------------------------------------- 1 | package com.lz.util; 2 | 3 | import org.apache.log4j.DailyRollingFileAppender; 4 | import org.apache.log4j.Priority; 5 | 6 | public class FilterDailyRollingFileAppender extends DailyRollingFileAppender { 7 | 8 | @Override 9 | public boolean isAsSevereAsThreshold(Priority priority) { 10 | //只判断是否相等,而不判断优先级 11 | return this.getThreshold().equals(priority); 12 | } 13 | } -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/commend/base/Client.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.commend.base; 2 | 3 | public class Client { 4 | 5 | public static void main(String[] args) { 6 | //创建接收者 7 | Receiver receiver = new Receiver(); 8 | //创建命令对象,设定它的接收者 9 | Command command = new ConcreteCommand(receiver); 10 | //创建请求者,把命令对象设置进去 11 | Invoker invoker = new Invoker(command); 12 | //执行方法 13 | invoker.action(); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/commend/example/PlayCommand.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.commend.example; 2 | 3 | /** 4 | * 具体命令角色类,执行play命令 5 | * Function: 6 | * @author : laizhiwen 7 | * Date: 2017年9月30日 8 | */ 9 | public class PlayCommand implements Command { 10 | 11 | private AudioPlayer audio; 12 | 13 | public PlayCommand(AudioPlayer audio){ 14 | this.audio = audio; 15 | } 16 | 17 | @Override 18 | public void execute() { 19 | audio.play(); //执行play命令 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/commend/example/StopCommand.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.commend.example; 2 | 3 | /** 4 | * 具体命令角色类,执行stop命令 5 | * Function: 6 | * @author : laizhiwen 7 | * Date: 2017年9月30日 8 | */ 9 | public class StopCommand implements Command { 10 | 11 | private AudioPlayer audio; 12 | 13 | public StopCommand(AudioPlayer audio){ 14 | this.audio = audio; 15 | } 16 | 17 | @Override 18 | public void execute() { 19 | audio.stop(); //执行stop命令 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/lz/study/java8/stream/Man.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.java8.stream; 2 | 3 | public class Man { 4 | 5 | private Godness god; 6 | 7 | public Man() { 8 | } 9 | 10 | public Man(Godness god) { 11 | this.god = god; 12 | } 13 | 14 | public Godness getGod() { 15 | return god; 16 | } 17 | 18 | public void setGod(Godness god) { 19 | this.god = god; 20 | } 21 | 22 | @Override 23 | public String toString() { 24 | return "Man [god=" + god + "]"; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/lz/study/netty/serial/Resource.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.netty.serial; 2 | 3 | public class Resource extends Serializer { 4 | 5 | private int gold; 6 | 7 | 8 | public int getGold() { 9 | return gold; 10 | } 11 | 12 | public void setGold(int gold) { 13 | this.gold = gold; 14 | } 15 | 16 | @Override 17 | protected void read() { 18 | this.gold = readInt(); 19 | } 20 | 21 | @Override 22 | protected void write() { 23 | writeInt(gold); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/lz/weixin/message/req/ImageMessage.java: -------------------------------------------------------------------------------- 1 | package com.lz.weixin.message.req; 2 | 3 | /** 4 | * 图片消息 5 | * Function: 6 | * @author : laizhiwen 7 | * Date: 2017年8月31日 8 | */ 9 | public class ImageMessage extends BaseMessage { 10 | // 图片链接 11 | private String PicUrl; 12 | 13 | public String getPicUrl() { 14 | return PicUrl; 15 | } 16 | 17 | public void setPicUrl(String picUrl) { 18 | PicUrl = picUrl; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/lz/weixin/message/req/TextMessage.java: -------------------------------------------------------------------------------- 1 | package com.lz.weixin.message.req; 2 | 3 | /** 4 | * 文本消息 5 | * Function: 6 | * @author : laizhiwen 7 | * Date: 2017年8月31日 8 | */ 9 | public class TextMessage extends BaseMessage { 10 | // 消息内容 11 | private String Content; 12 | 13 | public String getContent() { 14 | return Content; 15 | } 16 | 17 | public void setContent(String content) { 18 | Content = content; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/bridge/BridgeTest.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.bridge; 2 | 3 | import org.junit.Test; 4 | 5 | public class BridgeTest { 6 | 7 | @Test 8 | public void test1( ) { 9 | BagColor yellow = new Yellow(); 10 | Bag bag = new Wallet(); 11 | bag.setColor(yellow); 12 | System.out.println(bag.getName()); 13 | 14 | BagColor red = new Red(); 15 | Bag bag2 = new HandBag(); 16 | bag2.setColor(red); 17 | bag2.getName(); 18 | System.out.println(bag2.getName()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/lz/study/java8/lambda/MyTestJava8.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.java8.lambda; 2 | 3 | import java.util.function.Function; 4 | 5 | public class MyTestJava8 { 6 | 7 | public static String setHandler(String str, Function fun){ 8 | return fun.apply(str); 9 | } 10 | 11 | public static void main(String[] args) { 12 | String s = "ABC-2A-28-01-01-01"; 13 | 14 | String sub = setHandler(s, (str) -> str.substring(0, 12)); 15 | System.out.println(sub); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/decorator/example1/RoastFood.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.decorator.example1; 2 | 3 | /** 4 | * 具体装饰 5 | */ 6 | public class RoastFood extends FoodDecoration { 7 | 8 | private Food food; 9 | 10 | public RoastFood(Food f){ 11 | this.food = f; 12 | } 13 | 14 | @Override 15 | public String getDesc() { 16 | // TODO Auto-generated method stub 17 | return getDecoration() + food.getDesc(); 18 | } 19 | 20 | private String getDecoration(){ 21 | return "烤"; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/lz/study/java8/stream/Godness.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.java8.stream; 2 | 3 | public class Godness { 4 | 5 | private String name; 6 | 7 | public Godness() { 8 | } 9 | 10 | public Godness(String name) { 11 | this.name = name; 12 | } 13 | 14 | public String getName() { 15 | return name; 16 | } 17 | 18 | public void setName(String name) { 19 | this.name = name; 20 | } 21 | 22 | @Override 23 | public String toString() { 24 | return "Godness [name=" + name + "]"; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/chain/Dean.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.chain; 2 | 3 | //具体处理者3:院长类 4 | class Dean extends Leader { 5 | public void handleRequest(int LeaveDays) { 6 | if (LeaveDays <= 10) { 7 | System.out.println("院长批准您请假" + LeaveDays + "天。"); 8 | } else { 9 | if (getNext() != null) { 10 | getNext().handleRequest(LeaveDays); 11 | } else { 12 | System.out.println("请假天数太多,没有人批准该假条!"); 13 | } 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/main/java/com/lz/hadoop/hdfs/RegxAcceptPathFilter.java: -------------------------------------------------------------------------------- 1 | package com.lz.hadoop.hdfs; 2 | 3 | import org.apache.hadoop.fs.Path; 4 | import org.apache.hadoop.fs.PathFilter; 5 | 6 | public class RegxAcceptPathFilter implements PathFilter{ 7 | private final String regex; 8 | public RegxAcceptPathFilter(String regex) { 9 | this.regex=regex; 10 | } 11 | @Override 12 | public boolean accept(Path path) { 13 | 14 | boolean flag=path.toString().matches(regex); 15 | return flag; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/commend/example/PauseCommand.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.commend.example; 2 | 3 | /** 4 | * 具体命令角色,执行stop命令 5 | * Function: 6 | * @author : laizhiwen 7 | * Date: 2017年9月30日 8 | */ 9 | public class PauseCommand implements Command { 10 | 11 | private AudioPlayer audio; 12 | 13 | public PauseCommand(AudioPlayer audio){ 14 | this.audio = audio; 15 | } 16 | 17 | @Override 18 | public void execute() { 19 | audio.pause(); //执行pause命令 20 | Singleton.getInstance().status=1; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/decorator/example2/ConcreteDecorator.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.decorator.example2; 2 | 3 | //具体装饰角色 4 | public class ConcreteDecorator extends Decorator { 5 | public ConcreteDecorator(Component component) { 6 | super(component); 7 | } 8 | 9 | public void operation() { 10 | super.operation(); //调用原有业务方法 11 | addedFunction(); //调用新增的业务方法 12 | } 13 | 14 | public void addedFunction() { 15 | System.out.println("为具体构件角色增加额外的功能addedFunction()"); 16 | } 17 | } -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/commend/example/Singleton.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.commend.example; 2 | 3 | /** 4 | * 单例模式记录每一个操作的状态变化 5 | * Function: 6 | * @author : laizhiwen 7 | * Date: 2017年9月30日 8 | */ 9 | public class Singleton { 10 | 11 | int status = 0; //0:播放,1:暂停,2:停止 12 | 13 | private static Singleton instance; 14 | 15 | private Singleton(){} 16 | 17 | public static Singleton getInstance(){ 18 | if(instance == null){ 19 | instance = new Singleton(); 20 | } 21 | 22 | return instance; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/chain/DeanOfStudies.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.chain; 2 | 3 | //具体处理者4:教务处长类 4 | class DeanOfStudies extends Leader { 5 | public void handleRequest(int LeaveDays) { 6 | if (LeaveDays <= 20) { 7 | System.out.println("教务处长批准您请假" + LeaveDays + "天。"); 8 | } else { 9 | if (getNext() != null) { 10 | getNext().handleRequest(LeaveDays); 11 | } else { 12 | System.out.println("请假天数太多,没有人批准该假条!"); 13 | } 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/chain/DepartmentHead.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.chain; 2 | 3 | //具体处理者2:系主任类 4 | class DepartmentHead extends Leader { 5 | public void handleRequest(int LeaveDays) { 6 | if (LeaveDays <= 7) { 7 | System.out.println("系主任批准您请假" + LeaveDays + "天。"); 8 | } else { 9 | if (getNext() != null) { 10 | getNext().handleRequest(LeaveDays); 11 | } else { 12 | System.out.println("请假天数太多,没有人批准该假条!"); 13 | } 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/main/java/com/lz/art/service/ICrawlerService.java: -------------------------------------------------------------------------------- 1 | package com.lz.art.service; 2 | 3 | import java.util.List; 4 | 5 | import com.lz.art.common.DataNotyOptions; 6 | import com.lz.art.pojo.Crawler; 7 | 8 | public interface ICrawlerService { 9 | 10 | public List pageOfCrawler(); 11 | 12 | public DataNotyOptions saveCrawler(Crawler crawler, String opt); 13 | 14 | public Crawler findById(String id); 15 | 16 | public DataNotyOptions startCrawler(Crawler crawler); 17 | 18 | public DataNotyOptions stopCrawler(String id); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/lz/art/common/SpiderMap.java: -------------------------------------------------------------------------------- 1 | package com.lz.art.common; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | import us.codecraft.webmagic.Spider; 7 | 8 | public class SpiderMap extends HashMap{ 9 | private static final long serialVersionUID = 1L; 10 | private static SpiderMap instance; 11 | 12 | private SpiderMap (){} 13 | 14 | public static synchronized SpiderMap getInstance() { 15 | if (instance == null) { 16 | instance = new SpiderMap(); 17 | } 18 | return instance; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/lz/art/service/impl/UrlServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.lz.art.service.impl; 2 | 3 | import javax.annotation.Resource; 4 | 5 | import org.springframework.stereotype.Service; 6 | 7 | import com.lz.art.dao.UrlMapper; 8 | import com.lz.art.pojo.Url; 9 | import com.lz.art.service.IUrlservice; 10 | 11 | @Service("urlService") 12 | public class UrlServiceImpl implements IUrlservice { 13 | 14 | @Resource 15 | private UrlMapper urlMapper; 16 | 17 | @Override 18 | public void saveUrl(Url url) { 19 | urlMapper.insert(url); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/lz/study/protobuf/GenerateClass.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.protobuf; 2 | 3 | import java.io.IOException; 4 | 5 | public class GenerateClass { 6 | 7 | public static void main(String[] args) { 8 | String strCmd = "D:/protobuf-3.6.1/src/protoc.exe -I=./proto --java_out=./src/main/java/com/lz/study/protobuf ./LoginApply.proto"; 9 | try { 10 | Runtime.getRuntime().exec(strCmd); 11 | } catch (IOException e) { 12 | e.printStackTrace(); 13 | }//通过执行cmd命令调用protoc.exe程序 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/chain/ClassAdviser.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.chain; 2 | 3 | //具体处理者1:班主任类 4 | class ClassAdviser extends Leader { 5 | public void handleRequest(int LeaveDays) { 6 | if (LeaveDays <= 2) { 7 | System.out.println("班主任批准您请假" + LeaveDays + "天。"); 8 | } else { 9 | if (getNext() != null) { //这里getNext()得到的是teacher2 10 | getNext().handleRequest(LeaveDays); 11 | } else { 12 | System.out.println("请假天数太多,没有人批准该假条!"); 13 | } 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/commend/base/ConcreteCommand.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.commend.base; 2 | 3 | /** 4 | * 具体命令角色 5 | * Function: 6 | * @author : laizhiwen 7 | * Date: 2017年9月30日 8 | */ 9 | public class ConcreteCommand implements Command { 10 | 11 | //持有相应的接收者对象 12 | private Receiver receiver = null; 13 | 14 | /** 15 | * 构造方法 16 | */ 17 | public ConcreteCommand(Receiver receiver){ 18 | this.receiver = receiver; 19 | } 20 | 21 | @Override 22 | public void execute() { 23 | receiver.action(); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/lz/weixin/Constants.java: -------------------------------------------------------------------------------- 1 | package com.lz.weixin; 2 | 3 | public class Constants { 4 | 5 | // public static final String APPID = "wx45bed7da609d1e8d"; 6 | // public static final String SECRET = "61a3d9041618bea48704c81298fdfa4d"; 7 | public static final String APPID = "wx7a5e38e2c2d40fa3"; 8 | public static final String SECRET = "18fb04288f023eec29f0a96bb8548353"; 9 | public static final String REDIRECT_URI = "https://mceapi.gionee.com/ucs-api/wx/getuser.do"; //获奖用户信息编辑页面 10 | public static final String SCOPE = "snsapi_userinfo"; 11 | 12 | 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/chain/LeaveApprovalTest.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.chain; 2 | 3 | public class LeaveApprovalTest { 4 | public static void main(String[] args) { 5 | //组装责任链 6 | Leader teacher1 = new ClassAdviser(); 7 | Leader teacher2 = new DepartmentHead(); 8 | Leader teacher3 = new Dean(); 9 | // Leader teacher4=new DeanOfStudies(); 10 | teacher1.setNext(teacher2); 11 | teacher2.setNext(teacher3); 12 | // teacher3.setNext(teacher4); 13 | //提交请求 14 | teacher1.handleRequest(25); 15 | } 16 | } -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/commend/base/Invoker.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.commend.base; 2 | 3 | /** 4 | * 请求者角色类 5 | * Function: 6 | * @author : laizhiwen 7 | * Date: 2017年9月30日 8 | */ 9 | public class Invoker { 10 | /** 11 | * 持有命令对象 12 | */ 13 | private Command command = null; 14 | 15 | /** 16 | * 构造方法 17 | */ 18 | public Invoker(Command command){ 19 | this.command = command; 20 | } 21 | 22 | /** 23 | * 行动方法 24 | */ 25 | public void action(){ 26 | 27 | command.execute(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/decorator/example1/SteamedFood.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.decorator.example1; 2 | 3 | /** 4 | * 蒸的 5 | * Function: 具体装饰 6 | * @author : laizhiwen 7 | * Date: 2017年9月29日 8 | */ 9 | public class SteamedFood extends FoodDecoration { 10 | 11 | private Food food; 12 | 13 | public SteamedFood(Food f){ 14 | this.food = f; 15 | } 16 | 17 | @Override 18 | public String getDesc() { 19 | // TODO Auto-generated method stub 20 | return getDecoration() + food.getDesc(); 21 | } 22 | 23 | private String getDecoration(){ 24 | return "蒸"; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/decorator/example2/UseDecorator.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.decorator.example2; 2 | 3 | /** 4 | * 装饰模式应用 5 | */ 6 | public class UseDecorator { 7 | public static void main(String[] args){ 8 | //1.创建具体构建角色 9 | Component p=new ConcreteComponent(); 10 | //2.调用具体构建角色的方法 11 | p.operation(); 12 | System.out.println("---------------------------------"); 13 | 14 | //3.创建具体装饰角色,具体装饰角色继承抽象装饰角色,重写抽象装饰类的operation(),在里面是用super.operation()执行原有功能,再扩展新功能 15 | Component d=new ConcreteDecorator(p); 16 | d.operation(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/java/com/lz/study/java8/stream/DateFormatThreadLocal.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.java8.stream; 2 | 3 | import java.text.DateFormat; 4 | import java.text.ParseException; 5 | import java.text.SimpleDateFormat; 6 | import java.util.Date; 7 | 8 | public class DateFormatThreadLocal { 9 | 10 | private static final ThreadLocal df = new ThreadLocal(){ 11 | 12 | protected DateFormat initialValue(){ 13 | return new SimpleDateFormat("yyyyMMdd"); 14 | } 15 | 16 | }; 17 | 18 | public static final Date convert(String source) throws ParseException{ 19 | return df.get().parse(source); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/decorator/example2/Decorator.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.decorator.example2; 2 | 3 | /** 4 | * 抽象装饰角色 5 | */ 6 | public class Decorator implements Component { 7 | private Component component; 8 | 9 | /*public Decorator(Component component) { 10 | this.component = component; 11 | } 12 | 13 | @Override 14 | public void operation() { 15 | component.operation(); 16 | }*/ 17 | 18 | public Decorator(Component component) { 19 | this.component = component; 20 | } 21 | 22 | @Override 23 | public void operation() { 24 | component.operation(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/lz/thread/pool/LostUpdate.java: -------------------------------------------------------------------------------- 1 | package com.lz.thread.pool; 2 | 3 | import java.util.concurrent.CountDownLatch; 4 | 5 | public class LostUpdate implements Runnable { 6 | 7 | private CountDownLatch countDown; 8 | public LostUpdate(CountDownLatch countDown){ 9 | this.countDown = countDown; 10 | } 11 | 12 | @Override 13 | public void run() { 14 | for(int i=0;i<10000;i++) { 15 | System.out.println("输出:" + i); 16 | try { 17 | Thread.sleep(100); 18 | } catch (InterruptedException e) { 19 | e.printStackTrace(); 20 | } 21 | } 22 | //表示一次任务完成 23 | countDown.countDown(); 24 | 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/combination/Goods.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.combination; 2 | 3 | //树叶构件:商品 4 | public class Goods implements Articles { 5 | private String name; //名字 6 | private int quantity; //数量 7 | private float unitPrice; //单价 8 | 9 | public Goods(String name, int quantity, float unitPrice) { 10 | this.name = name; 11 | this.quantity = quantity; 12 | this.unitPrice = unitPrice; 13 | } 14 | 15 | public float calculation() { 16 | return quantity * unitPrice; 17 | } 18 | 19 | public void show() { 20 | System.out.println(name + "(数量:" + quantity + ",单价:" + unitPrice + "元)"); 21 | } 22 | } -------------------------------------------------------------------------------- /.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/memo/Originator.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.memo; 2 | 3 | /** 4 | * 发起人角色: 5 | * 记录当前时刻的内部状态,并负责创建和恢复备忘录数据,允许访问返回到先前状态所需的所有数据。 6 | */ 7 | public class Originator { 8 | 9 | private String state; 10 | 11 | public String getState() { 12 | return state; 13 | } 14 | 15 | public void setState(String state) { 16 | this.state = state; 17 | } 18 | 19 | public Memento createMento() { 20 | return (new Memento(state)); 21 | } 22 | 23 | public void setMemento(Memento memento) { 24 | state = memento.getState(); 25 | } 26 | 27 | public void show() { 28 | System.out.println("状态 = " + state); 29 | } 30 | 31 | } -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/memo/Client.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.memo; 2 | 3 | public class Client { 4 | 5 | public static void main(String[] args) { 6 | Originator originator = new Originator();// 创建发起人对象 7 | originator.setState("On"); //设置Originator初始状态 8 | originator.show(); 9 | 10 | Caretaker caretaker = new Caretaker(); // 创建管理员对象 11 | caretaker.setMemento(originator.createMento()); // 通过发起人创建备忘录,并已经保存了发起人的当前状态 12 | 13 | originator.setState("Off"); //发起人Originator状态变为Off 14 | originator.show(); 15 | 16 | originator.setMemento(caretaker.getMemento()); //回复初始状态,这里面的备忘录是已经保存好上一个状态的了,直接读取就能获得 17 | originator.show(); 18 | } 19 | 20 | } -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/datetimepicker/bootstrap-datetimepicker.zh-CN.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Simplified Chinese translation for bootstrap-datetimepicker 3 | * Yuan Cheung 4 | */ 5 | ;(function($){ 6 | $.fn.datetimepicker.dates['zh-CN'] = { 7 | days: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"], 8 | daysShort: ["周日", "周一", "周二", "周三", "周四", "周五", "周六", "周日"], 9 | daysMin: ["日", "一", "二", "三", "四", "五", "六", "日"], 10 | months: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], 11 | monthsShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], 12 | today: "今天", 13 | suffix: [], 14 | meridiem: ["上午", "下午"] 15 | }; 16 | }(jQuery)); 17 | -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/commend/example/AudioPlayer.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.commend.example; 2 | 3 | /** 4 | * 接受者角色,负责执行具体的命名行为 5 | * Function: 6 | * @author : laizhiwen 7 | * Date: 2017年9月30日 8 | */ 9 | public class AudioPlayer { 10 | 11 | public void play(){ 12 | if(Singleton.getInstance().status ==1 ){ 13 | System.out.println("继续播放..."); 14 | Singleton.getInstance().status = 0; 15 | }else if(Singleton.getInstance().status == 2){ 16 | System.out.println("开始播放..."); 17 | }else { 18 | System.out.println("播放..."); 19 | } 20 | } 21 | 22 | public void pause(){ 23 | System.out.println("暂停..."); 24 | } 25 | 26 | public void stop(){ 27 | System.out.println("停止..."); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/lz/study/netty/serial/test/Test2.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.netty.serial.test; 2 | 3 | import java.nio.ByteBuffer; 4 | import java.util.Arrays; 5 | 6 | public class Test2 { 7 | 8 | public static void main(String[] args) { 9 | int id = 101; 10 | int age = 21; 11 | 12 | ByteBuffer buffer = ByteBuffer.allocate(8); 13 | buffer.putInt(id); 14 | buffer.putInt(age); 15 | byte[] array = buffer.array(); 16 | System.out.println(Arrays.toString(buffer.array())); 17 | 18 | //==================================================== 19 | 20 | ByteBuffer buffer2 = ByteBuffer.wrap(array); 21 | System.out.println("id:"+buffer2.getInt()); 22 | System.out.println("age:"+buffer2.getInt()); 23 | 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/lz/weixin/message/req/VoiceMessage.java: -------------------------------------------------------------------------------- 1 | package com.lz.weixin.message.req; 2 | 3 | /** 4 | * 语音消息 5 | * Function: 6 | * @author : laizhiwen 7 | * Date: 2017年8月31日 8 | */ 9 | public class VoiceMessage extends BaseMessage { 10 | // 媒体ID 11 | private String MediaId; 12 | // 语音格式 13 | private String Format; 14 | 15 | public String getMediaId() { 16 | return MediaId; 17 | } 18 | 19 | public void setMediaId(String mediaId) { 20 | MediaId = mediaId; 21 | } 22 | 23 | public String getFormat() { 24 | return Format; 25 | } 26 | 27 | public void setFormat(String format) { 28 | Format = format; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/lz/jms/rabbitmq/fanout/Constants.java: -------------------------------------------------------------------------------- 1 | package com.lz.jms.rabbitmq.fanout; 2 | public class Constants { 3 | 4 | 5 | public static String direct_exchange = "lzw-exchange"; 6 | public static String queue_direct = "lzw-queue"; 7 | 8 | public static String fanout_exchange = "lzw-exchange-fanout"; 9 | public static String queue_fanout_1 = "lzw-queue-fanout-1"; 10 | public static String queue_fanout_2 = "lzw-queue-fanout-2"; 11 | 12 | 13 | public static String topic_exchange = "lzw-exchange-topic"; 14 | public static String queue_topic_1 = "lzw-queue-topic-1"; 15 | public static String queue_topic_2 = "lzw-queue-topic-2"; 16 | public static String queue_topic_3 = "lzw-queue-topic-3"; 17 | 18 | } -------------------------------------------------------------------------------- /src/main/java/com/lz/hadoop/hdfs/UrlCat.java: -------------------------------------------------------------------------------- 1 | package com.lz.hadoop.hdfs; 2 | 3 | import java.io.InputStream; 4 | import java.net.URL; 5 | 6 | import org.apache.hadoop.fs.FsUrlStreamHandlerFactory; 7 | import org.apache.hadoop.io.IOUtils; 8 | 9 | public class UrlCat { 10 | 11 | static{ 12 | URL.setURLStreamHandlerFactory(new FsUrlStreamHandlerFactory()); 13 | } 14 | 15 | public static void main(String[] args){ 16 | InputStream in = null; 17 | try { 18 | in = new URL("hdfs://localhost/testDir/note.txt").openStream(); 19 | IOUtils.copyBytes(in, System.out, 4096,false); 20 | } catch (Exception e) { 21 | // TODO: handle exception 22 | }finally { 23 | IOUtils.closeStream(in); 24 | } 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/lz/study/java8/stream/exer/Trader.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.java8.stream.exer; 2 | //交易员类 3 | public class Trader { 4 | 5 | private String name; 6 | private String city; 7 | 8 | public Trader() { 9 | } 10 | 11 | public Trader(String name, String city) { 12 | this.name = name; 13 | this.city = city; 14 | } 15 | 16 | public String getName() { 17 | return name; 18 | } 19 | 20 | public void setName(String name) { 21 | this.name = name; 22 | } 23 | 24 | public String getCity() { 25 | return city; 26 | } 27 | 28 | public void setCity(String city) { 29 | this.city = city; 30 | } 31 | 32 | @Override 33 | public String toString() { 34 | return "Trader [name=" + name + ", city=" + city + "]"; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/lz/weixin/message/resp/NewsMessage.java: -------------------------------------------------------------------------------- 1 | package com.lz.weixin.message.resp; 2 | 3 | import java.util.List; 4 | 5 | public class NewsMessage extends BaseMessage { 6 | // 图文消息个数,限制为10条以内 7 | private int ArticleCount; 8 | // 多条图文消息信息,默认第一个item为大图 9 | private List
Articles; 10 | 11 | public int getArticleCount() { 12 | return ArticleCount; 13 | } 14 | 15 | public void setArticleCount(int articleCount) { 16 | ArticleCount = articleCount; 17 | } 18 | 19 | public List
getArticles() { 20 | return Articles; 21 | } 22 | 23 | public void setArticles(List
articles) { 24 | Articles = articles; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/lz/art/common/ApplicationHelper.java: -------------------------------------------------------------------------------- 1 | package com.lz.art.common; 2 | 3 | import org.springframework.beans.BeansException; 4 | import org.springframework.context.ApplicationContext; 5 | import org.springframework.context.ApplicationContextAware; 6 | import org.springframework.stereotype.Component; 7 | 8 | @Component 9 | public class ApplicationHelper implements ApplicationContextAware { 10 | 11 | public static ApplicationContext applicationContext; 12 | 13 | @Override 14 | public void setApplicationContext(ApplicationContext appContext) throws BeansException { 15 | applicationContext = appContext; 16 | } 17 | 18 | public static ApplicationContext getApplicationContext() { 19 | return applicationContext; 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /src/main/java/com/lz/study/java8/stream/NewMan.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.java8.stream; 2 | 3 | import java.util.Optional; 4 | 5 | //注意:Optional 不能被序列化 6 | public class NewMan { 7 | 8 | private Optional godness = Optional.empty(); 9 | 10 | private Godness god; 11 | 12 | public Optional getGod(){ 13 | return Optional.of(god); 14 | } 15 | 16 | public NewMan() { 17 | } 18 | 19 | public NewMan(Optional godness) { 20 | this.godness = godness; 21 | } 22 | 23 | public Optional getGodness() { 24 | return godness; 25 | } 26 | 27 | public void setGodness(Optional godness) { 28 | this.godness = godness; 29 | } 30 | 31 | @Override 32 | public String toString() { 33 | return "NewMan [godness=" + godness + "]"; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/commend/example/Keypad.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.commend.example; 2 | 3 | public class Keypad { 4 | 5 | private Command playCommand; 6 | private Command pauseCommand; 7 | private Command stopCommand; 8 | 9 | public void play(){ 10 | playCommand.execute(); 11 | } 12 | 13 | public void pause(){ 14 | pauseCommand.execute(); 15 | } 16 | 17 | public void stop(){ 18 | stopCommand.execute(); 19 | } 20 | 21 | public void setPlayCommand(Command playCommand) { 22 | this.playCommand = playCommand; 23 | } 24 | 25 | public void setPauseCommand(Command pauseCommand) { 26 | this.pauseCommand = pauseCommand; 27 | } 28 | 29 | public void setStopCommand(Command stopCommand) { 30 | this.stopCommand = stopCommand; 31 | } 32 | 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/lz/art/common/StringHelper.java: -------------------------------------------------------------------------------- 1 | package com.lz.art.common; 2 | 3 | import java.util.Calendar; 4 | import java.util.Date; 5 | import java.util.UUID; 6 | 7 | public class StringHelper { 8 | 9 | /** 10 | * 获取记录id 11 | * @return 12 | */ 13 | public static String getUUID(){ 14 | UUID uuid = UUID.randomUUID(); 15 | String str = uuid.toString().replace("-", ""); 16 | return str; 17 | } 18 | 19 | public static Date strToDate(String str) { 20 | @SuppressWarnings("deprecation") 21 | long time = Date.parse(str); 22 | Calendar c = Calendar.getInstance(); 23 | c.setTimeInMillis(time); 24 | return c.getTime(); 25 | } 26 | 27 | public static void main(String[] args) { 28 | System.out.println(strToDate(new String("on May 8, 2016").substring(3))); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/commend/example/People.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.commend.example; 2 | 3 | public class People { 4 | public static void main(String[] args) { 5 | //创建接收者对象 6 | AudioPlayer audioPlayer = new AudioPlayer(); 7 | //创建命令对象 8 | PlayCommand playCommand = new PlayCommand(audioPlayer); 9 | PauseCommand pauseCommand = new PauseCommand(audioPlayer); 10 | StopCommand stopCommand = new StopCommand(audioPlayer); 11 | 12 | Keypad keypad = new Keypad(); 13 | keypad.setPlayCommand(playCommand); 14 | keypad.setPauseCommand(pauseCommand); 15 | keypad.setStopCommand(stopCommand); 16 | keypad.play(); 17 | keypad.pause(); 18 | keypad.play(); 19 | keypad.stop(); 20 | keypad.play(); 21 | 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/decorator/example1/Client.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.decorator.example1; 2 | 3 | /** 4 | * 动态给一个对象添加一些额外的职责。 5 | * Function: 6 | * @author : laizhiwen 7 | * Date: 2017年9月29日 8 | */ 9 | public class Client { 10 | 11 | public static void main(String[] args) { 12 | // 测试单纯的食物 13 | Food f1 = new Chicken(); 14 | System.out.println(f1.getDesc()); 15 | 16 | System.out.println("---------------------------------------"); 17 | 18 | // 测试单重修饰的食物 19 | RoastFood rf = new RoastFood(f1); 20 | System.out.println(rf.getDesc()); 21 | 22 | System.out.println("---------------------------------------"); 23 | 24 | // 测试单重修饰的食物 25 | SteamedFood sf = new SteamedFood(f1); 26 | System.out.println(sf.getDesc()); 27 | 28 | System.out.println("---------------------------------------"); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/lz/study/thread/TestThreadPool.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.thread; 2 | 3 | //测试线程池 4 | public class TestThreadPool { 5 | public static void main(String[] args) { 6 | // 创建3个线程的线程池 7 | ThreadPool t = ThreadPool.getThreadPool(3); 8 | t.execute(new Runnable[] { new Task(), new Task(), new Task() }); 9 | t.execute(new Runnable[] { new Task(), new Task(), new Task() }); 10 | System.out.println(t); 11 | t.destroy();// 所有线程都执行完成才destory 12 | System.out.println(t); 13 | } 14 | 15 | // 任务类 16 | static class Task implements Runnable { 17 | private static volatile int i = 1; 18 | 19 | @Override 20 | public void run() {// 执行任务 21 | System.out.println("任务 " + (i++) + " 完成"); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/lz/study/netty/serial/BufferFactory.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.netty.serial; 2 | 3 | 4 | import java.nio.ByteOrder; 5 | import org.jboss.netty.buffer.ChannelBuffer; 6 | import org.jboss.netty.buffer.ChannelBuffers; 7 | /** 8 | * buff工厂 9 | * 10 | */ 11 | public class BufferFactory { 12 | 13 | public static ByteOrder BYTE_ORDER = ByteOrder.BIG_ENDIAN; 14 | 15 | /** 16 | * 获取一个buffer 17 | * 18 | * @return 19 | */ 20 | public static ChannelBuffer getBuffer() { 21 | ChannelBuffer dynamicBuffer = ChannelBuffers.dynamicBuffer(); 22 | return dynamicBuffer; 23 | } 24 | 25 | /** 26 | * 将数据写入buffer 27 | * @param bytes 28 | * @return 29 | */ 30 | public static ChannelBuffer getBuffer(byte[] bytes) { 31 | ChannelBuffer copiedBuffer = ChannelBuffers.copiedBuffer(bytes); 32 | return copiedBuffer; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/lz/study/netty/serial/test/Test4.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.netty.serial.test; 2 | 3 | import java.util.Arrays; 4 | 5 | import com.lz.study.netty.serial.Player; 6 | 7 | public class Test4 { 8 | 9 | public static void main(String[] args) { 10 | 11 | Player player = new Player(); 12 | player.setPlayerId(10001); 13 | player.setAge(22); 14 | player.getSkills().add(101); 15 | player.getResource().setGold(99999); 16 | 17 | byte[] bytes = player.getBytes(); 18 | 19 | System.out.println(Arrays.toString(bytes)); 20 | 21 | //============================================== 22 | 23 | Player player2 = new Player(); 24 | player2.readFromBytes(bytes); 25 | System.out.println(player2.getPlayerId() + " "+player2.getAge() + " "+ Arrays.toString(player2.getSkills().toArray())+" " +player2.getResource().getGold()); 26 | 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/lz/art/controller/ContentController.java: -------------------------------------------------------------------------------- 1 | package com.lz.art.controller; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.servlet.ModelAndView; 6 | 7 | @Controller 8 | @RequestMapping("content") 9 | public class ContentController { 10 | 11 | @RequestMapping(value="/toToContent") 12 | public ModelAndView goToContent(){ 13 | ModelAndView model = new ModelAndView(); 14 | model.addObject("object", "地铁每周统计"); 15 | model.setViewName("WEB-INF/jsp/content"); 16 | return model; 17 | } 18 | 19 | @RequestMapping(value="/toToContent2") 20 | public ModelAndView goToContent2(){ 21 | ModelAndView model = new ModelAndView(); 22 | model.addObject("object", "地铁每周统计"); 23 | model.setViewName("WEB-INF/jsp/content3"); 24 | return model; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/lz/study/netty/serial/test/Test3.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.netty.serial.test; 2 | 3 | import java.util.Arrays; 4 | 5 | import org.jboss.netty.buffer.ChannelBuffer; 6 | import org.jboss.netty.buffer.ChannelBuffers; 7 | 8 | public class Test3 { 9 | 10 | public static void main(String[] args) { 11 | 12 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); 13 | buffer.writeInt(101); 14 | buffer.writeDouble(80.1); 15 | 16 | byte[] bytes = new byte[buffer.writerIndex()]; 17 | buffer.readBytes(bytes); 18 | 19 | System.out.println(Arrays.toString(bytes)); 20 | 21 | "abc".getBytes(); 22 | 23 | //================================================ 24 | ChannelBuffer wrappedBuffer = ChannelBuffers.wrappedBuffer(bytes); 25 | System.out.println(wrappedBuffer.readInt()); 26 | System.out.println(wrappedBuffer.readDouble()); 27 | 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/lz/art/base/BaseController.java: -------------------------------------------------------------------------------- 1 | package com.lz.art.base; 2 | 3 | import javax.servlet.http.HttpServletRequest; 4 | import javax.servlet.http.HttpServletResponse; 5 | 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RequestMethod; 9 | 10 | public class BaseController { 11 | 12 | IBaseService baseService; 13 | 14 | /** 15 | * 设置基础service 16 | * @param baseService 17 | */ 18 | @Autowired 19 | public void setBaseService(IBaseService baseService) { 20 | this.baseService = baseService; 21 | } 22 | 23 | @RequestMapping(value = "/insert", method = RequestMethod.POST) 24 | public void insert(T obj,HttpServletRequest request,HttpServletResponse response){ 25 | baseService.insert(obj); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/lz/thread/pool/TestLock.java: -------------------------------------------------------------------------------- 1 | package com.lz.thread.pool; 2 | 3 | import java.util.concurrent.CountDownLatch; 4 | import java.util.concurrent.ExecutorService; 5 | import java.util.concurrent.Executors; 6 | 7 | public class TestLock { 8 | public static void main(String[] args) throws InterruptedException { 9 | //创建线程池,里面有10个线程,共执行100次+1操作 10 | final int THREAD_COUNT=10; 11 | final int RUN_TIME=100; 12 | 13 | ExecutorService threadPool=Executors.newFixedThreadPool(THREAD_COUNT); 14 | //用CountDownLatch保证主线程等待所有任务完成 15 | CountDownLatch count=new CountDownLatch(RUN_TIME); 16 | 17 | for(int i=0;i bags = new ArrayList(); 9 | 10 | public Bags(String name) { 11 | this.name = name; 12 | } 13 | 14 | public void add(Articles c) { 15 | bags.add(c); 16 | } 17 | 18 | public void remove(Articles c) { 19 | bags.remove(c); 20 | } 21 | 22 | public Articles getChild(int i) { 23 | return bags.get(i); 24 | } 25 | 26 | public float calculation() { 27 | float s = 0; 28 | for (Object obj : bags) { 29 | s += ((Articles) obj).calculation(); 30 | } 31 | return s; 32 | } 33 | 34 | public void show() { 35 | for (Object obj : bags) { 36 | ((Articles) obj).show(); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /src/main/java/com/lz/weixin/message/req/LinkMessage.java: -------------------------------------------------------------------------------- 1 | package com.lz.weixin.message.req; 2 | 3 | /** 4 | * 链接消息 5 | * Function: 6 | * @author : laizhiwen 7 | * Date: 2017年8月31日 8 | */ 9 | public class LinkMessage extends BaseMessage { 10 | // 消息标题 11 | private String Title; 12 | // 消息描述 13 | private String Description; 14 | // 消息链接 15 | private String Url; 16 | 17 | public String getTitle() { 18 | return Title; 19 | } 20 | 21 | public void setTitle(String title) { 22 | Title = title; 23 | } 24 | 25 | public String getDescription() { 26 | return Description; 27 | } 28 | 29 | public void setDescription(String description) { 30 | Description = description; 31 | } 32 | 33 | public String getUrl() { 34 | return Url; 35 | } 36 | 37 | public void setUrl(String url) { 38 | Url = url; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/lz/study/java8/stream/exer/Transaction.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.java8.stream.exer; 2 | //交易类 3 | public class Transaction { 4 | 5 | private Trader trader; 6 | private int year; 7 | private int value; 8 | 9 | public Transaction() { 10 | } 11 | 12 | public Transaction(Trader trader, int year, int value) { 13 | this.trader = trader; 14 | this.year = year; 15 | this.value = value; 16 | } 17 | 18 | public Trader getTrader() { 19 | return trader; 20 | } 21 | 22 | public void setTrader(Trader trader) { 23 | this.trader = trader; 24 | } 25 | 26 | public int getYear() { 27 | return year; 28 | } 29 | 30 | public void setYear(int year) { 31 | this.year = year; 32 | } 33 | 34 | public int getValue() { 35 | return value; 36 | } 37 | 38 | public void setValue(int value) { 39 | this.value = value; 40 | } 41 | 42 | @Override 43 | public String toString() { 44 | return "Transaction [trader=" + trader + ", year=" + year + ", value=" 45 | + value + "]"; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/lz/art/thread/StartAmazonCrawlerThread.java: -------------------------------------------------------------------------------- 1 | package com.lz.art.thread; 2 | 3 | import org.apache.log4j.Logger; 4 | 5 | import com.lz.art.common.SpiderMap; 6 | import com.lz.art.crawler.AmazonReviewProcessor; 7 | import com.lz.art.pojo.Crawler; 8 | 9 | import us.codecraft.webmagic.Spider; 10 | 11 | public class StartAmazonCrawlerThread extends Thread { 12 | final Logger log = Logger.getLogger(StartAmazonCrawlerThread.class); 13 | 14 | private Crawler crawler; 15 | 16 | public StartAmazonCrawlerThread(Crawler crawler){ 17 | this.crawler = crawler; 18 | } 19 | 20 | @Override 21 | public void run() { 22 | long t1 = System.currentTimeMillis(); 23 | Spider spider = Spider.create(new AmazonReviewProcessor(crawler)); 24 | SpiderMap.getInstance().put(crawler.getId(), spider); 25 | 26 | spider.addUrl(crawler.getStartUrl()) 27 | //开启5个线程抓取 28 | .thread(5) 29 | //启动爬虫 30 | .run(); 31 | long t2 = System.currentTimeMillis(); 32 | log.info("耗时: "+ (t2-t1) ); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/lz/hadoop/zookeeper/MyTestWatcher.java: -------------------------------------------------------------------------------- 1 | package com.lz.hadoop.zookeeper; 2 | 3 | import org.apache.zookeeper.WatchedEvent; 4 | import org.apache.zookeeper.Watcher; 5 | import org.apache.zookeeper.Watcher.Event.EventType; 6 | 7 | public class MyTestWatcher implements Watcher{ 8 | 9 | @Override 10 | public void process(WatchedEvent event) { 11 | 12 | System.out.println("hello zookeeper"); 13 | System.out.println(String.format("hello event! type=%s, stat=%s, path=%s",event.getType(),event.getState(),event.getPath())); 14 | 15 | if(event.getType()==EventType.NodeDeleted){ 16 | System.out.println("节点被删除!节点删除事件触发"); 17 | } 18 | 19 | if(event.getType()==EventType.NodeChildrenChanged){ 20 | System.out.println("修改节点的子节点信息"); 21 | } 22 | 23 | if(event.getType()==EventType.NodeCreated){ 24 | System.out.println("节点创建事件触发!"); 25 | } 26 | 27 | if(event.getType()==EventType.NodeDataChanged){ 28 | System.out.println("节点数据修改!"); 29 | } 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/lz/hadoop/hdfs/FileSystemCat.java: -------------------------------------------------------------------------------- 1 | package com.lz.hadoop.hdfs; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | import java.net.URI; 6 | 7 | import org.apache.hadoop.conf.Configuration; 8 | import org.apache.hadoop.fs.FileSystem; 9 | import org.apache.hadoop.fs.Path; 10 | import org.apache.hadoop.io.IOUtils; 11 | 12 | public class FileSystemCat { 13 | public static void main(String[] args) throws IOException { 14 | String uri = "hdfs://localhost/testDir/note.txt"; 15 | 16 | Configuration conf = new Configuration(); 17 | FileSystem fs = FileSystem.get(URI.create(uri),conf); 18 | 19 | InputStream in = null; 20 | try { 21 | in = fs.open(new Path(uri)); 22 | //String result = org.apache.commons.io.IOUtils.toString(in, "UTF-8"); 23 | //System.out.println(result); 24 | IOUtils.copyBytes(in, System.out, 4096,false); 25 | } catch (Exception e) { 26 | // TODO: handle exception 27 | }finally { 28 | IOUtils.closeStream(in); 29 | } 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/test/java/common/Test.java: -------------------------------------------------------------------------------- 1 | package common; 2 | import java.util.regex.Matcher; 3 | import java.util.regex.Pattern; 4 | 5 | public class Test { 6 | 7 | static String str = "[INFO] [2017-09-25 10:46:04][com.gionee.baserom.search.controller.RedirectController][客户端IP:117.150.234.218 - 重定向的URL:http://mini.eastday.com/a/170924195318293.html?qid=gouwudating02] - - Mozilla/5.0 (Linux; U; Android 5.1; zh-cn; F100 Build/IMM76D) AppleWebKit/534.30 (KHTML,like Gecko) Version/4.0 Chrome/50.0.0.0 Mobile Safari/534.30 Id/2D4FA7BED64BA70401E4F22314CFC7CB RV/5.0.16"; 8 | 9 | public static void main(String[] args) { 10 | String pattern = ",?((\\w+?\\.)+?(com|net))"; 11 | Pattern p = Pattern.compile(pattern); 12 | String line = str; 13 | Matcher m = p.matcher(line); 14 | 15 | if(m.find()){ 16 | //匹配结果 17 | System.out.println(m.group()); 18 | }else{ 19 | System.out.println("匹配失败"); 20 | } 21 | //替换 22 | //System.out.println(line.replaceAll(pattern, "")); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/lz/image/local/Test.java: -------------------------------------------------------------------------------- 1 | package com.lz.image.local; 2 | import java.awt.Desktop; 3 | import java.awt.image.BufferedImage; 4 | import java.io.File; 5 | import java.io.IOException; 6 | 7 | import javax.imageio.ImageIO; 8 | 9 | /** 10 | * @author 444716720 11 | * 高斯模糊 12 | * 13 | */ 14 | 15 | public class Test { 16 | public static void main(String[] args) { 17 | try { 18 | //读取原图 19 | File file = new File("C:\\Users\\gionee\\Desktop\\dog.jpg"); 20 | BufferedImage b1 = ImageIO.read(file); 21 | //模糊 22 | GaussianFilter filter = new GaussianFilter(65); 23 | BufferedImage blurredImage = filter.filter(b1, new BufferedImage(b1.getWidth(), b1.getHeight(), BufferedImage.TYPE_INT_RGB)); 24 | //保存处理后的图 25 | File newFile = new File("C:\\Users\\gionee\\Desktop\\dog-blur.jpg"); 26 | ImageIO.write(blurredImage, "jpg", newFile); 27 | 28 | //打开文件 29 | if (Desktop.isDesktopSupported() 30 | && Desktop.getDesktop().isSupported(Desktop.Action.OPEN)) 31 | Desktop.getDesktop().open(newFile); 32 | } catch (IOException e) { 33 | e.printStackTrace(); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/lz/image/opencv/Linux安装opencv3.4: -------------------------------------------------------------------------------- 1 | 1、解压缩opencv-3.4.0.zip(源码版)到指定目录,我的是/usr/opencv 2 | 2、编译opencv 3 | 2.1 安装cmake: 4 | 看看本机有没有安装cmake: cmake --version ,如果有输出版本信息则已经安装。 5 | 如果没有cmake,下载Binary distributions版本cmake-3.10.2-Linux-x86_64.tar.gz。解压到/usr/local 6 | 配置PATH: vim /etc/profile 在PATH环境变量中加入如下内容::/usr/local/cmake-3.10.2-Linux-x86_64/bin 7 | 更新环境变量:source /etc/profile 8 | 2.2 安装build-essential 9 | 安装aptitude: sudo apt-get install aptitude 10 | 安装build-essential:sudo aptitude install build-essential 11 | 如果选择yes无法通过,再试选择no,然后出现的提示选择yes.等待安装完毕。 12 | 2.3 编译opencv 13 | 进入/usr/opencv/opencv-3.4.0 14 | 删除CMakeCache.txt,新建目录build,进入build 15 | 执行:make -j8 ,等待编译完成 16 | 3、添加到环境变量 17 | 执行: vim /etc/ld.so.conf.d/opencv.conf 18 | 输入opencv的库路径:/usr/opencv/opencv-3.4.0/build/lib 19 | 保存退出 20 | 在/etc/profile中加入: 21 | export PKG_CONFIG_PATH=/usr/opencv/opencv-3.4.0/build/lib/pkgconfig:$PKG_CONFIG_PATH 22 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/opencv/opencv-3.4.0/build/lib 23 | (其中libopencv_java340.so,在/usr/opencv/opencv-3.4.0/build/lib目录下) 24 | 执行:source /etc/profile 25 | 执行:sudo ldconfig 26 | -------------------------------------------------------------------------------- /src/main/java/com/lz/study/java8/stream/ForkJoinCalculate.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.java8.stream; 2 | 3 | import java.util.concurrent.RecursiveTask; 4 | 5 | public class ForkJoinCalculate extends RecursiveTask{ 6 | 7 | /** 8 | * 9 | */ 10 | private static final long serialVersionUID = 13475679780L; 11 | 12 | private long start; 13 | private long end; 14 | 15 | private static final long THRESHOLD = 10000L; //临界值 16 | 17 | public ForkJoinCalculate(long start, long end) { 18 | this.start = start; 19 | this.end = end; 20 | } 21 | 22 | @Override 23 | protected Long compute() { 24 | long length = end - start; 25 | 26 | if(length <= THRESHOLD){ 27 | long sum = 0; 28 | 29 | for (long i = start; i <= end; i++) { 30 | sum += i; 31 | } 32 | 33 | return sum; 34 | }else{ 35 | long middle = (start + end) / 2; 36 | 37 | ForkJoinCalculate left = new ForkJoinCalculate(start, middle); 38 | left.fork(); //拆分,并将该子任务压入线程队列 39 | 40 | ForkJoinCalculate right = new ForkJoinCalculate(middle+1, end); 41 | right.fork(); 42 | 43 | return left.join() + right.join(); 44 | } 45 | 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/lz/weixin/message/resp/Music.java: -------------------------------------------------------------------------------- 1 | package com.lz.weixin.message.resp; 2 | 3 | public class Music { 4 | // 音乐名称 5 | private String Title; 6 | // 音乐描述 7 | private String Description; 8 | // 音乐链接 9 | private String MusicUrl; 10 | // 高质量音乐链接,WIFI环境优先使用该链接播放音乐 11 | private String HQMusicUrl; 12 | 13 | public String getTitle() { 14 | return Title; 15 | } 16 | 17 | public void setTitle(String title) { 18 | Title = title; 19 | } 20 | 21 | public String getDescription() { 22 | return Description; 23 | } 24 | 25 | public void setDescription(String description) { 26 | Description = description; 27 | } 28 | 29 | public String getMusicUrl() { 30 | return MusicUrl; 31 | } 32 | 33 | public void setMusicUrl(String musicUrl) { 34 | MusicUrl = musicUrl; 35 | } 36 | 37 | public String getHQMusicUrl() { 38 | return HQMusicUrl; 39 | } 40 | 41 | public void setHQMusicUrl(String musicUrl) { 42 | HQMusicUrl = musicUrl; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/lz/art/common/DataNotyOptions.java: -------------------------------------------------------------------------------- 1 | package com.lz.art.common; 2 | 3 | public class DataNotyOptions { 4 | 5 | /** 6 | * 提示内容 7 | */ 8 | private String text; 9 | 10 | /** 11 | * 以下值供选择: 12 | * topLeft/topCenter/topRight 13 | * top/center/bottom 14 | * bottomLeft/bottomCenter/bottomRight 15 | */ 16 | private String layout; 17 | 18 | /** 19 | * 提示类型 20 | * success、error、information、alert 21 | */ 22 | private String type; 23 | 24 | public DataNotyOptions(String type){ 25 | if(type.equals("success")){ 26 | this.text = "操作成功"; 27 | }else if(type.equals("error")){ 28 | this.text = "操作失败"; 29 | } 30 | this.type = type; 31 | this.layout="top"; 32 | } 33 | 34 | public String getText() { 35 | return text; 36 | } 37 | 38 | public void setText(String text) { 39 | this.text = text; 40 | } 41 | 42 | public String getLayout() { 43 | return layout; 44 | } 45 | 46 | public void setLayout(String layout) { 47 | this.layout = layout; 48 | } 49 | 50 | public String getType() { 51 | return type; 52 | } 53 | 54 | public void setType(String type) { 55 | this.type = type; 56 | } 57 | 58 | 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/com/lz/weixin/GetWeiXinCode.java: -------------------------------------------------------------------------------- 1 | package com.lz.weixin; 2 | 3 | import java.net.URLEncoder; 4 | 5 | public class GetWeiXinCode { 6 | public static String GetCodeRequest = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&state=STATE#wechat_redirect"; 7 | public static String getCodeRequest(){ 8 | String result = null; 9 | GetCodeRequest = GetCodeRequest.replace("APPID", urlEnodeUTF8(Constants.APPID)); 10 | GetCodeRequest = GetCodeRequest.replace("REDIRECT_URI",urlEnodeUTF8(Constants.REDIRECT_URI)); 11 | GetCodeRequest = GetCodeRequest.replace("SCOPE", Constants.SCOPE); 12 | result = GetCodeRequest; 13 | return result; 14 | } 15 | public static String urlEnodeUTF8(String str){ 16 | String result = str; 17 | try { 18 | result = URLEncoder.encode(str,"UTF-8"); 19 | } catch (Exception e) { 20 | e.printStackTrace(); 21 | } 22 | return result; 23 | } 24 | public static void main(String[] args) { 25 | System.out.println(getCodeRequest()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/article/reviews.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> 2 | 3 | 4 | 5 |
6 |
7 |
8 |

9 | 全文搜索面板 10 |

11 |
12 | 13 |
14 |
15 |
16 | 17 | 关键字: 18 | 开始时间: 19 | 结束时间: 20 | 21 |
22 |
23 |
24 | 25 |
-------------------------------------------------------------------------------- /src/main/java/com/lz/study/binary/ByteTest.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.binary; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | import java.util.UUID; 6 | 7 | import com.lz.util.ByteUtils; 8 | 9 | public class ByteTest { 10 | 11 | private static float num = 123456.78f; 12 | 13 | public static void main(String[] args) { 14 | // byte[] numByte = new byte[4]; 15 | // numByte[0] = 0x78; 16 | // numByte[1] = 0x56; 17 | // numByte[2] = 0x34; 18 | // numByte[3] = 0x12; 19 | // System.out.println("电表数据:" + num); 20 | // System.out.println("===============数据加上0x33之后再传输===================="); 21 | // for(int i=0;i accList = accountMapper.selectByExample(emp); 28 | 29 | return accList.size()>0?true:false; 30 | } 31 | 32 | @Override 33 | public boolean register(String username, String password) { 34 | Account acc = new Account(); 35 | acc.setAccount(username); 36 | acc.setPassword(password); 37 | int n = accountMapper.insert(acc); 38 | return n>0?true:false; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/lz/weixin/message/req/LocationMessage.java: -------------------------------------------------------------------------------- 1 | package com.lz.weixin.message.req; 2 | 3 | /** 4 | * 地理位置消息 5 | * Function: 6 | * @author : laizhiwen 7 | * Date: 2017年8月31日 8 | */ 9 | public class LocationMessage extends BaseMessage { 10 | // 地理位置维度 11 | private String Location_X; 12 | // 地理位置经度 13 | private String Location_Y; 14 | // 地图缩放大小 15 | private String Scale; 16 | // 地理位置信息 17 | private String Label; 18 | 19 | public String getLocation_X() { 20 | return Location_X; 21 | } 22 | 23 | public void setLocation_X(String location_X) { 24 | Location_X = location_X; 25 | } 26 | 27 | public String getLocation_Y() { 28 | return Location_Y; 29 | } 30 | 31 | public void setLocation_Y(String location_Y) { 32 | Location_Y = location_Y; 33 | } 34 | 35 | public String getScale() { 36 | return Scale; 37 | } 38 | 39 | public void setScale(String scale) { 40 | Scale = scale; 41 | } 42 | 43 | public String getLabel() { 44 | return Label; 45 | } 46 | 47 | public void setLabel(String label) { 48 | Label = label; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/resources/ehcache.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 19 | 20 | 23 | 24 | 25 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/main/java/com/lz/jms/rabbitmq/NewTask.java: -------------------------------------------------------------------------------- 1 | package com.lz.jms.rabbitmq; 2 | 3 | import java.io.IOException; 4 | 5 | import com.rabbitmq.client.Channel; 6 | import com.rabbitmq.client.Connection; 7 | import com.rabbitmq.client.ConnectionFactory; 8 | /** 9 | * RabbitMQ的几种典型使用场景 https://www.cnblogs.com/luxiaoxun/p/3918054.html 10 | * 11 | */ 12 | public class NewTask { 13 | 14 | // 队列名称 15 | private final static String QUEUE_NAME = "LZW_TEST_APP"; 16 | 17 | public static void main(String[] args) throws IOException { 18 | // 创建连接和频道 19 | ConnectionFactory factory = new ConnectionFactory(); 20 | factory.setHost("localhost"); 21 | Connection connection = factory.newConnection(); 22 | Channel channel = connection.createChannel(); 23 | // 声明队列 24 | channel.queueDeclare(QUEUE_NAME, false, false, false, null); 25 | // 发送10条消息,依次在消息后面附加1-10个点 26 | for (int i = 0; i < 10; i++) { 27 | String dots = ""; 28 | for (int j = 0; j <= i; j++) { 29 | dots += "."; 30 | } 31 | String message = "helloworld" + dots + dots.length(); 32 | channel.basicPublish("", QUEUE_NAME, null, message.getBytes()); 33 | System.out.println(" [x] Sent '" + message + "'"); 34 | } 35 | // 关闭频道和资源 36 | channel.close(); 37 | connection.close(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/js/retina.js: -------------------------------------------------------------------------------- 1 | // retina.js, a high-resolution image swapper (http://retinajs.com), v0.0.2 2 | 3 | (function(){function t(e){this.path=e;var t=this.path.split("."),n=t.slice(0,t.length-1).join("."),r=t[t.length-1];this.at_2x_path=n+"@2x."+r}function n(e){this.el=e,this.path=new t(this.el.getAttribute("src"));var n=this;this.path.check_2x_variant(function(e){e&&n.swap()})}var e=typeof exports=="undefined"?window:exports;e.RetinaImagePath=t,t.confirmed_paths=[],t.prototype.is_external=function(){return!!this.path.match(/^https?\:/i)&&!this.path.match("//"+document.domain)},t.prototype.check_2x_variant=function(e){var n,r=this;if(this.is_external())return e(!1);if(this.at_2x_path in t.confirmed_paths)return e(!0);n=new XMLHttpRequest,n.open("HEAD",this.at_2x_path),n.onreadystatechange=function(){return n.readyState!=4?e(!1):n.status>=200&&n.status<=399?(t.confirmed_paths.push(r.at_2x_path),e(!0)):e(!1)},n.send()},e.RetinaImage=n,n.prototype.swap=function(e){function n(){t.el.complete?(t.el.setAttribute("width",t.el.offsetWidth),t.el.setAttribute("height",t.el.offsetHeight),t.el.setAttribute("src",e)):setTimeout(n,5)}typeof e=="undefined"&&(e=this.path.at_2x_path);var t=this;n()},e.devicePixelRatio>1&&(window.onload=function(){var e=document.getElementsByTagName("img"),t=[],r,i;for(r=0;r 2 | 13 | 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/main/java/com/lz/pattern/combination/ShoppingTest.java: -------------------------------------------------------------------------------- 1 | package com.lz.pattern.combination; 2 | 3 | public class ShoppingTest { 4 | 5 | /** 6 | * 组合模式 7 | * 应用场景: 8 | * 1.在需要表示一个对象整体与部分的层次结构的场合。 9 | * 2.要求对用户隐藏组合对象与单个对象的不同,用户可以用统一的接口使用组合结构中的所有对象的场合。 10 | * @param args 11 | */ 12 | 13 | public static void main(String[] args) { 14 | float s = 0; 15 | Bags BigBag, mediumBag, smallRedBag, smallWhiteBag; 16 | Goods sp; 17 | BigBag = new Bags("大袋子"); 18 | mediumBag = new Bags("中袋子"); 19 | smallRedBag = new Bags("红色小袋子"); 20 | smallWhiteBag = new Bags("白色小袋子"); 21 | sp = new Goods("婺源特产", 2, 7.9f); 22 | smallRedBag.add(sp); 23 | sp = new Goods("婺源地图", 1, 9.9f); 24 | smallRedBag.add(sp); 25 | sp = new Goods("韶关香菇", 2, 68); 26 | smallWhiteBag.add(sp); 27 | sp = new Goods("韶关红茶", 3, 180); 28 | smallWhiteBag.add(sp); 29 | sp = new Goods("景德镇瓷器", 1, 380); 30 | mediumBag.add(sp); 31 | mediumBag.add(smallRedBag); 32 | sp = new Goods("李宁牌运动鞋", 1, 198); 33 | BigBag.add(sp); 34 | BigBag.add(smallWhiteBag); 35 | BigBag.add(mediumBag); 36 | System.out.println("您选购的商品有:"); 37 | BigBag.show(); 38 | s = BigBag.calculation(); 39 | System.out.println("要支付的总价是:" + s + "元"); 40 | } 41 | } -------------------------------------------------------------------------------- /src/main/java/com/lz/study/java8/stream/exer/TestStreamAPI.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.java8.stream.exer; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | import java.util.Optional; 6 | 7 | import org.junit.Test; 8 | 9 | import com.lz.study.java8.stream.Employee; 10 | import com.lz.study.java8.stream.Employee.Status; 11 | 12 | public class TestStreamAPI { 13 | 14 | /* 15 | 1. 给定一个数字列表,如何返回一个由每个数的平方构成的列表呢? 16 | ,给定【1,2,3,4,5】, 应该返回【1,4,9,16,25】。 17 | */ 18 | @Test 19 | public void test1(){ 20 | Integer[] nums = new Integer[]{1,2,3,4,5}; 21 | 22 | Arrays.stream(nums) 23 | .map((x) -> x * x) 24 | .forEach(System.out::println); 25 | } 26 | 27 | /* 28 | 2. 怎样用 map 和 reduce 方法数一数流中有多少个Employee呢? 29 | */ 30 | List emps = Arrays.asList( 31 | new Employee(102, "李四", 59, 6666.66, Status.BUSY), 32 | new Employee(101, "张三", 18, 9999.99, Status.FREE), 33 | new Employee(103, "王五", 28, 3333.33, Status.VOCATION), 34 | new Employee(104, "赵六", 8, 7777.77, Status.BUSY), 35 | new Employee(104, "赵六", 8, 7777.77, Status.FREE), 36 | new Employee(104, "赵六", 8, 7777.77, Status.FREE), 37 | new Employee(105, "田七", 38, 5555.55, Status.BUSY) 38 | ); 39 | 40 | @Test 41 | public void test2(){ 42 | Optional count = emps.stream() 43 | .map((e) -> 1) 44 | .reduce(Integer::sum); 45 | 46 | System.out.println(count.get()); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/lz/study/netty/serial/Player.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.netty.serial; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | public class Player extends Serializer{ 7 | 8 | private long playerId; 9 | 10 | private int age; 11 | 12 | private List skills = new ArrayList<>(); 13 | 14 | private Resource resource = new Resource(); 15 | 16 | public Resource getResource() { 17 | return resource; 18 | } 19 | 20 | public void setResource(Resource resource) { 21 | this.resource = resource; 22 | } 23 | 24 | public long getPlayerId() { 25 | return playerId; 26 | } 27 | 28 | public void setPlayerId(long playerId) { 29 | this.playerId = playerId; 30 | } 31 | 32 | public int getAge() { 33 | return age; 34 | } 35 | 36 | public void setAge(int age) { 37 | this.age = age; 38 | } 39 | 40 | public List getSkills() { 41 | return skills; 42 | } 43 | 44 | public void setSkills(List skills) { 45 | this.skills = skills; 46 | } 47 | 48 | @Override 49 | protected void read() { 50 | this.playerId = readLong(); 51 | this.age = readInt(); 52 | this.skills = readList(Integer.class); 53 | this.resource = read(Resource.class); 54 | } 55 | 56 | @Override 57 | protected void write() { 58 | writeLong(playerId); 59 | writeInt(age); 60 | writeList(skills); 61 | writeObject(resource); 62 | } 63 | 64 | 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/com/lz/art/service/impl/ReviewsServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.lz.art.service.impl; 2 | 3 | import java.util.Date; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import javax.annotation.Resource; 8 | 9 | import org.springframework.stereotype.Service; 10 | 11 | import com.lz.art.dao.ReviewsMapper; 12 | import com.lz.art.pojo.Reviews; 13 | import com.lz.art.pojo.ReviewsExample; 14 | import com.lz.art.pojo.ReviewsExample.Criteria; 15 | import com.lz.art.service.IReviewsService; 16 | 17 | @Service("reviewsService") 18 | public class ReviewsServiceImpl implements IReviewsService { 19 | 20 | @Resource 21 | private ReviewsMapper reviewsMapper ; 22 | 23 | 24 | public List pageOfReviews(Map map) { 25 | //List list = reviewsMapper.selectByExample(null); 26 | List list = reviewsMapper.selectByFullText(map); 27 | return list; 28 | } 29 | 30 | 31 | @Override 32 | public void addReview(Reviews review) { 33 | reviewsMapper.insert(review); 34 | } 35 | 36 | 37 | @Override 38 | public boolean checkExist(String reviewer, Date date) { 39 | ReviewsExample example = new ReviewsExample(); 40 | Criteria criteria = example.createCriteria(); 41 | criteria.andReviewerEqualTo(reviewer); 42 | criteria.andDateEqualTo(date); 43 | List list = reviewsMapper.selectByExample(example); 44 | 45 | return list.size()>0?true:false; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/lz/weixin/message/req/BaseMessage.java: -------------------------------------------------------------------------------- 1 | package com.lz.weixin.message.req; 2 | 3 | public class BaseMessage { 4 | 5 | // 开发者微信号 6 | private String ToUserName; 7 | // 发送方帐号(一个OpenID) 8 | private String FromUserName; 9 | // 消息创建时间 (整型) 10 | private long CreateTime; 11 | // 消息类型(text/image/location/link) 12 | private String MsgType; 13 | // 消息id,64位整型 14 | private long MsgId; 15 | 16 | public String getToUserName() { 17 | return ToUserName; 18 | } 19 | 20 | public void setToUserName(String toUserName) { 21 | ToUserName = toUserName; 22 | } 23 | 24 | public String getFromUserName() { 25 | return FromUserName; 26 | } 27 | 28 | public void setFromUserName(String fromUserName) { 29 | FromUserName = fromUserName; 30 | } 31 | 32 | public long getCreateTime() { 33 | return CreateTime; 34 | } 35 | 36 | public void setCreateTime(long createTime) { 37 | CreateTime = createTime; 38 | } 39 | 40 | public String getMsgType() { 41 | return MsgType; 42 | } 43 | 44 | public void setMsgType(String msgType) { 45 | MsgType = msgType; 46 | } 47 | 48 | public long getMsgId() { 49 | return MsgId; 50 | } 51 | 52 | public void setMsgId(long msgId) { 53 | MsgId = msgId; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/test/java/common/ChargingTest.java: -------------------------------------------------------------------------------- 1 | package common; 2 | 3 | import java.util.Date; 4 | 5 | import org.junit.Test; 6 | 7 | import com.alibaba.fastjson.JSON; 8 | import com.alibaba.fastjson.JSONObject; 9 | import com.lz.util.DateUtil; 10 | import com.lz.util.HttpClientUtil; 11 | 12 | public class ChargingTest { 13 | 14 | @Test 15 | public void testGetKwh() { 16 | 17 | String body = "{\r\n" + 18 | " \"head\": {\r\n" + 19 | " \"namespace\": \"power\",\r\n" + 20 | " \"method\": \"GET\"\r\n" + 21 | " },\r\n" + 22 | " \"payload\": {}\r\n" + 23 | "}"; 24 | 25 | String url = "http://172.26.83.37/localApi"; 26 | 27 | try { 28 | long total = 0; 29 | for(int i=0;i<=100000;i++) { 30 | String result = HttpClientUtil.sendPostByJson(url, body); 31 | JSONObject obj = JSON.parseObject(result); 32 | JSONObject payload = obj.getJSONObject("payload"); 33 | JSONObject power = payload.getJSONObject("power"); 34 | String now = DateUtil.format(new Date()); 35 | total += Long.parseLong(power.getString("power")); 36 | System.out.println(now + " : 本次查询:" + power.getString("power") + " 总用电量:" + total); 37 | Thread.sleep(10000); 38 | } 39 | } catch (Exception e) { 40 | e.printStackTrace(); 41 | } 42 | 43 | } 44 | 45 | @Test 46 | public void testStr() { 47 | String deviceCode = "10082025123456789563"; 48 | System.out.println(deviceCode.substring(0,4)); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/lz/hadoop/zookeeper/MyTestWatcher2.java: -------------------------------------------------------------------------------- 1 | package com.lz.hadoop.zookeeper; 2 | 3 | import java.util.concurrent.CountDownLatch; 4 | 5 | import org.apache.zookeeper.WatchedEvent; 6 | import org.apache.zookeeper.Watcher; 7 | import org.apache.zookeeper.Watcher.Event.EventType; 8 | import org.apache.zookeeper.Watcher.Event.KeeperState; 9 | 10 | public class MyTestWatcher2 implements Watcher{ 11 | 12 | private CountDownLatch connectedLatch; 13 | 14 | MyTestWatcher2(CountDownLatch connectedLatch) { 15 | this.connectedLatch = connectedLatch; 16 | } 17 | 18 | @Override 19 | public void process(WatchedEvent event) { 20 | 21 | if (event.getState() == KeeperState.SyncConnected) { 22 | connectedLatch.countDown(); 23 | } 24 | 25 | System.out.println("hello zookeeper"); 26 | System.out.println(String.format("hello event! type=%s, stat=%s, path=%s",event.getType(),event.getState(),event.getPath())); 27 | 28 | if(event.getType()==EventType.NodeDeleted){ 29 | System.out.println("节点被删除!节点删除事件触发"); 30 | } 31 | 32 | if(event.getType()==EventType.NodeChildrenChanged){ 33 | System.out.println("修改节点的子节点信息"); 34 | } 35 | 36 | if(event.getType()==EventType.NodeCreated){ 37 | System.out.println("节点创建事件触发!"); 38 | } 39 | 40 | if(event.getType()==EventType.NodeDataChanged){ 41 | System.out.println("节点数据修改!"); 42 | } 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/webapp/ui/js/global.js: -------------------------------------------------------------------------------- 1 | /** 2 | * author:laizhiwen 3 | */ 4 | (function($) { 5 | var version = "1.0"; 6 | var navigation = "
    " 7 | + "
  • " 8 | + "" 9 | + "主页" 10 | + "" 11 | + "
  • " 12 | + "
  • {nav}
  • " 13 | +"
"; 14 | $.initContent = function(requestUrl,nav){ 15 | jQuery.ajax({ 16 | type:'GET', 17 | url:requestUrl, 18 | dataType:'html', 19 | timeout: 50000, 20 | cache: false, 21 | error: function(xhr,textStatus,errorThrown ){ 22 | alert('加载页面失败: ' + requestUrl + "\nHttp 状态码: " + xhr.status + " " + xhr.statusText); 23 | }, 24 | success: function( data, textStatus, jqXHR){ 25 | if(nav!="主页"){ 26 | var _navigation = navigation.replace("{nav}", nav); 27 | } 28 | $("#content").html(_navigation + data); 29 | } 30 | }); 31 | } 32 | 33 | /** 34 | * data:{formid:"#formid",url:"url",tableid:"#tableid",refhUrl:"refhUrl"} 35 | * 注意:如果操作完之后需要刷新列表,则加入参数tableid&&refUrl(必须同时配置) 36 | */ 37 | $.formSubmit = function(options) { 38 | $(options.formid).ajaxSubmit({ 39 | type: 'post', 40 | dataType: 'json', 41 | url: options.url, 42 | success: function(responseText) { 43 | if(options.tableid != undefined){ 44 | $(options.tableid).bootstrapTable('refresh'); 45 | } 46 | noty(responseText); 47 | } 48 | }); 49 | } 50 | })(jQuery); -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/css/jquery.cleditor.css: -------------------------------------------------------------------------------- 1 | .cleditorMain {border:1px solid #ddd; padding:0 1px 1px; background-color:white} 2 | .cleditorMain iframe {border:none; margin:0; padding:0} 3 | .cleditorMain textarea {border:none; margin:0; padding:0; overflow-y:scroll; font:10pt Arial,Verdana; resize:none; outline:none /* webkit grip focus */} 4 | .cleditorToolbar {background: url('../img/toolbar.gif') repeat} 5 | .cleditorGroup {float:left; height:26px} 6 | .cleditorButton {float:left; width:24px; height:24px; margin:1px 0 1px 0; background: url('../img/buttons.gif')} 7 | .cleditorDisabled {opacity:0.3; filter:alpha(opacity=30)} 8 | .cleditorDivider {float:left; width:1px; height:23px; margin:1px 0 1px 0; background:#CCC} 9 | .cleditorPopup {border:solid 1px #999; background-color:white; position:absolute; font:10pt Arial,Verdana; cursor:default; z-index:10000} 10 | .cleditorList div {padding:2px 4px 2px 4px} 11 | .cleditorList p, 12 | .cleditorList h1, 13 | .cleditorList h2, 14 | .cleditorList h3, 15 | .cleditorList h4, 16 | .cleditorList h5, 17 | .cleditorList h6, 18 | .cleditorList font {padding:0; margin:0; background-color:Transparent} 19 | .cleditorColor {width:150px; padding:1px 0 0 1px} 20 | .cleditorColor div {float:left; width:14px; height:14px; margin:0 1px 1px 0} 21 | .cleditorPrompt {background-color:#F6F7F9; padding:4px; font-size:8.5pt} 22 | .cleditorPrompt input, 23 | .cleditorPrompt textarea {font:8.5pt Arial,Verdana;} 24 | .cleditorMsg {background-color:#FDFCEE; width:150px; padding:4px; font-size:8.5pt} 25 | -------------------------------------------------------------------------------- /src/main/java/com/lz/art/controller/ReviewController.java: -------------------------------------------------------------------------------- 1 | package com.lz.art.controller; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import javax.annotation.Resource; 8 | import javax.servlet.http.HttpServletRequest; 9 | 10 | import org.springframework.stereotype.Controller; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.ResponseBody; 13 | import org.springframework.web.servlet.ModelAndView; 14 | 15 | import com.lz.art.pojo.Reviews; 16 | import com.lz.art.service.IReviewsService; 17 | 18 | @Controller 19 | @RequestMapping("reviews") 20 | public class ReviewController { 21 | 22 | @Resource 23 | private IReviewsService reviewsService; 24 | 25 | @RequestMapping(value="/reviewsView") 26 | public ModelAndView reviewsView(){ 27 | ModelAndView model = new ModelAndView(); 28 | model.setViewName("WEB-INF/jsp/article/reviews"); 29 | return model; 30 | } 31 | 32 | @RequestMapping(value="/reviewsList") 33 | @ResponseBody 34 | public List reviewsList(String searchText,HttpServletRequest request){ 35 | String startDate = request.getParameter("startDate"); 36 | String endDate = request.getParameter("endDate"); 37 | Map map= new HashMap(); 38 | map.put("searchText", searchText); 39 | map.put("startDate", startDate); 40 | map.put("endDate", endDate); 41 | List list = reviewsService.pageOfReviews(map); 42 | return list; 43 | } 44 | 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/lz/study/java8/stream/TestForkJoin.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.java8.stream; 2 | 3 | import java.util.concurrent.ForkJoinPool; 4 | import java.util.concurrent.ForkJoinTask; 5 | import java.util.stream.LongStream; 6 | 7 | import org.junit.Test; 8 | 9 | public class TestForkJoin { 10 | 11 | @Test 12 | public void test1(){ 13 | long start = System.currentTimeMillis(); 14 | 15 | ForkJoinPool pool = new ForkJoinPool(); 16 | ForkJoinTask task = new ForkJoinCalculate(0L, 10000000000L); 17 | 18 | long sum = pool.invoke(task); 19 | System.out.println(sum); 20 | 21 | long end = System.currentTimeMillis(); 22 | 23 | System.out.println("耗费的时间为: " + (end - start)); //112-1953-1988-2654-2647-20663-113808 24 | } 25 | 26 | @Test 27 | public void test2(){ 28 | long start = System.currentTimeMillis(); 29 | 30 | long sum = 0L; 31 | 32 | for (long i = 0L; i <= 10000000000L; i++) { 33 | sum += i; 34 | } 35 | 36 | System.out.println(sum); 37 | 38 | long end = System.currentTimeMillis(); 39 | 40 | System.out.println("耗费的时间为: " + (end - start)); //34-3174-3132-4227-4223-31583 41 | } 42 | 43 | @Test 44 | public void test3(){ 45 | long start = System.currentTimeMillis(); 46 | 47 | Long sum = LongStream.rangeClosed(0L, 10000000000L) 48 | .parallel() 49 | .sum(); 50 | 51 | System.out.println(sum); 52 | 53 | long end = System.currentTimeMillis(); 54 | 55 | System.out.println("耗费的时间为: " + (end - start)); //2061-2053-2086-18926 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/lz/jms/rabbitmq/Recv.java: -------------------------------------------------------------------------------- 1 | package com.lz.jms.rabbitmq; 2 | 3 | import java.io.IOException; 4 | 5 | import com.rabbitmq.client.Channel; 6 | import com.rabbitmq.client.Connection; 7 | import com.rabbitmq.client.ConnectionFactory; 8 | import com.rabbitmq.client.ConsumerCancelledException; 9 | import com.rabbitmq.client.QueueingConsumer; 10 | import com.rabbitmq.client.ShutdownSignalException; 11 | 12 | public class Recv { 13 | // 队列名称 14 | private final static String QUEUE_NAME = "hello"; 15 | 16 | public static void main(String[] args) 17 | throws ShutdownSignalException, ConsumerCancelledException, InterruptedException, IOException { 18 | // 打开连接和创建频道,与发送端一样 19 | ConnectionFactory factory = new ConnectionFactory(); 20 | factory.setHost("localhost"); 21 | Connection connection = factory.newConnection(); 22 | Channel channel = connection.createChannel(); 23 | // 声明队列,主要为了防止消息接收者先运行此程序,队列还不存在时创建队列。 24 | channel.queueDeclare(QUEUE_NAME, false, false, false, null); 25 | System.out.println(" [*] Waiting for messages. To exit press CTRL+C"); 26 | 27 | // 创建队列消费者 28 | QueueingConsumer consumer = new QueueingConsumer(channel); 29 | // 指定消费队列 30 | channel.basicConsume(QUEUE_NAME, true, consumer); 31 | while (true) { 32 | // nextDelivery是一个阻塞方法(内部实现其实是阻塞队列的take方法) 33 | QueueingConsumer.Delivery delivery = consumer.nextDelivery(); 34 | String message = new String(delivery.getBody()); 35 | System.out.println(" [x] Received '" + message + "'"); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/lz/study/netty/server/Server.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.netty.server; 2 | 3 | import java.net.InetSocketAddress; 4 | import java.util.concurrent.ExecutorService; 5 | import java.util.concurrent.Executors; 6 | 7 | import org.jboss.netty.bootstrap.ServerBootstrap; 8 | import org.jboss.netty.channel.ChannelPipeline; 9 | import org.jboss.netty.channel.ChannelPipelineFactory; 10 | import org.jboss.netty.channel.Channels; 11 | import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory; 12 | import org.jboss.netty.handler.codec.string.StringDecoder; 13 | import org.jboss.netty.handler.codec.string.StringEncoder; 14 | 15 | public class Server { 16 | public static void main(String[] args) { 17 | ServerBootstrap bootstrap = new ServerBootstrap(); 18 | 19 | ExecutorService boss = Executors.newCachedThreadPool(); 20 | ExecutorService worker = Executors.newCachedThreadPool(); 21 | 22 | //设置niosocket工程 23 | bootstrap.setFactory(new NioServerSocketChannelFactory(boss, worker)); 24 | 25 | //设置管道工厂 26 | bootstrap.setPipelineFactory(new ChannelPipelineFactory() { 27 | 28 | @Override 29 | public ChannelPipeline getPipeline() throws Exception { 30 | ChannelPipeline pipeline = Channels.pipeline(); 31 | pipeline.addLast("decoder", new StringDecoder()); 32 | pipeline.addLast("encoder", new StringEncoder()); 33 | pipeline.addLast("helloHandler", new HelloHandler()); 34 | return pipeline; 35 | } 36 | }); 37 | 38 | bootstrap.bind(new InetSocketAddress(10101)); 39 | 40 | System.out.println("start!!!"); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/lz/weixin/message/resp/BaseMessage.java: -------------------------------------------------------------------------------- 1 | package com.lz.weixin.message.resp; 2 | 3 | /** 4 | * 消息基类(公众帐号 -> 普通用户) 5 | * Function: 6 | * @author : laizhiwen 7 | * Date: 2017年8月31日 8 | */ 9 | public class BaseMessage { 10 | // 接收方帐号(收到的OpenID) 11 | private String ToUserName; 12 | // 开发者微信号 13 | private String FromUserName; 14 | // 消息创建时间 (整型) 15 | private long CreateTime; 16 | // 消息类型(text/music/news) 17 | private String MsgType; 18 | // 位0x0001被标志时,星标刚收到的消息 19 | private int FuncFlag; 20 | 21 | public String getToUserName() { 22 | return ToUserName; 23 | } 24 | 25 | public void setToUserName(String toUserName) { 26 | ToUserName = toUserName; 27 | } 28 | 29 | public String getFromUserName() { 30 | return FromUserName; 31 | } 32 | 33 | public void setFromUserName(String fromUserName) { 34 | FromUserName = fromUserName; 35 | } 36 | 37 | public long getCreateTime() { 38 | return CreateTime; 39 | } 40 | 41 | public void setCreateTime(long createTime) { 42 | CreateTime = createTime; 43 | } 44 | 45 | public String getMsgType() { 46 | return MsgType; 47 | } 48 | 49 | public void setMsgType(String msgType) { 50 | MsgType = msgType; 51 | } 52 | 53 | public int getFuncFlag() { 54 | return FuncFlag; 55 | } 56 | 57 | public void setFuncFlag(int funcFlag) { 58 | FuncFlag = funcFlag; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/com/lz/util/TeskDataLoad.java: -------------------------------------------------------------------------------- 1 | package com.lz.util; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.File; 5 | import java.io.FileInputStream; 6 | import java.io.IOException; 7 | import java.io.InputStreamReader; 8 | import java.util.List; 9 | 10 | import com.google.gson.Gson; 11 | 12 | public abstract class TeskDataLoad { 13 | /** 14 | * 读取源文件,生成对应的对象数据 15 | * 16 | * @param f 17 | * @param t 18 | * @return List 19 | */ 20 | @SuppressWarnings("unchecked") 21 | public List readJson(File f, T t) throws IOException { 22 | List results = com.google.common.collect.Lists.newArrayList(); 23 | List jsons = readFile(f); 24 | for (String json : jsons) { 25 | try { 26 | T nt = (T) new Gson().fromJson(json, t.getClass()); 27 | results.add(nt); 28 | } catch (Exception e) { 29 | 30 | } 31 | } 32 | return results; 33 | } 34 | 35 | //读取源数据生成json串的list 36 | private List readFile(File f) throws IOException { 37 | List results = com.google.common.collect.Lists.newArrayList(); 38 | InputStreamReader reader = new InputStreamReader(new FileInputStream(f)); // 建立一个输入流对象reader 39 | BufferedReader br = new BufferedReader(reader); // 建立一个对象,它把文件内容转成计算机能读懂的语言 40 | String line = ""; 41 | line = br.readLine(); 42 | while (line != null) { 43 | line = br.readLine(); 44 | results.add(line); 45 | } 46 | 47 | br.close(); 48 | reader.close(); 49 | return results; 50 | } 51 | 52 | /** 53 | * 修改对应属性 54 | * @param list 55 | */ 56 | public abstract void changeAttribute(List list); 57 | 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/article/article-list.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> 2 | 66 |
-------------------------------------------------------------------------------- /src/main/java/com/lz/jms/kafka/ConsumerDemo.java: -------------------------------------------------------------------------------- 1 | package com.lz.jms.kafka; 2 | 3 | import java.util.Arrays; 4 | import java.util.Properties; 5 | 6 | import org.apache.kafka.clients.consumer.ConsumerRecord; 7 | import org.apache.kafka.clients.consumer.ConsumerRecords; 8 | import org.apache.kafka.clients.consumer.KafkaConsumer; 9 | 10 | public class ConsumerDemo { 11 | 12 | public static void main(String[] args) throws InterruptedException { 13 | Properties properties = new Properties(); 14 | properties.put("bootstrap.servers", "127.0.0.1:9092"); 15 | properties.put("group.id", "group-1"); 16 | properties.put("enable.auto.commit", "true"); 17 | properties.put("auto.commit.interval.ms", "1000"); 18 | properties.put("auto.offset.reset", "earliest"); 19 | properties.put("session.timeout.ms", "30000"); 20 | properties.put("key.deserializer", "org.apache.kafka.common.serialization.StringDeserializer"); 21 | properties.put("value.deserializer", "org.apache.kafka.common.serialization.StringDeserializer"); 22 | 23 | KafkaConsumer kafkaConsumer = new KafkaConsumer<>(properties); 24 | kafkaConsumer.subscribe(Arrays.asList("test")); 25 | while (true) { 26 | ConsumerRecords records = kafkaConsumer.poll(100); 27 | for (ConsumerRecord record : records) { 28 | System.out.printf("offset = %d, value = %s", record.offset(), record.value()); 29 | System.out.println("=====================>"); 30 | } 31 | } 32 | 33 | } 34 | } -------------------------------------------------------------------------------- /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/main/java/com/lz/study/netty/server/HelloHandler.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.netty.server; 2 | 3 | import org.jboss.netty.channel.ChannelHandlerContext; 4 | import org.jboss.netty.channel.ChannelStateEvent; 5 | import org.jboss.netty.channel.ExceptionEvent; 6 | import org.jboss.netty.channel.MessageEvent; 7 | import org.jboss.netty.channel.SimpleChannelHandler; 8 | 9 | public class HelloHandler extends SimpleChannelHandler { 10 | 11 | @Override 12 | public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception { 13 | 14 | System.out.println("messageReceived"); 15 | String s = (String) e.getMessage(); 16 | System.out.println(s); 17 | 18 | //回复 19 | ctx.getChannel().write("hi"); 20 | 21 | super.messageReceived(ctx, e); 22 | } 23 | 24 | @Override 25 | public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception { 26 | // TODO Auto-generated method stub 27 | super.exceptionCaught(ctx, e); 28 | } 29 | 30 | @Override 31 | public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { 32 | System.out.println("channelConnected"); 33 | super.channelConnected(ctx, e); 34 | } 35 | 36 | @Override 37 | public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { 38 | System.out.println("channelDisconnected"); 39 | super.channelDisconnected(ctx, e); 40 | } 41 | 42 | @Override 43 | public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { 44 | System.out.println("channelClosed"); 45 | super.channelClosed(ctx, e); 46 | } 47 | 48 | 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/lz/jms/activemq/TOPReceiver.java: -------------------------------------------------------------------------------- 1 | package com.lz.jms.activemq; 2 | 3 | import javax.jms.Connection; 4 | import javax.jms.JMSException; 5 | import javax.jms.Message; 6 | import javax.jms.MessageConsumer; 7 | import javax.jms.MessageListener; 8 | import javax.jms.Session; 9 | import javax.jms.TextMessage; 10 | import javax.jms.Topic; 11 | 12 | import org.apache.activemq.ActiveMQConnection; 13 | import org.apache.activemq.ActiveMQConnectionFactory; 14 | 15 | public class TOPReceiver { 16 | // 连接账号 17 | private static String userName = ActiveMQConnection.DEFAULT_USER; 18 | // 连接密码 19 | private static String password = ActiveMQConnection.DEFAULT_PASSWORD; 20 | // 连接地址 21 | private static String brokerURL = ActiveMQConnection.DEFAULT_BROKER_URL; 22 | 23 | public static void main(String[] args) throws JMSException { 24 | // 连接到ActiveMQ服务器 25 | ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(userName, password, brokerURL); 26 | Connection connection = factory.createConnection(); 27 | connection.start(); 28 | final Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); 29 | // 创建主题 30 | Topic topic = session.createTopic("topic-text"); 31 | // 创建订阅 32 | MessageConsumer consumer = session.createConsumer(topic); 33 | consumer.setMessageListener(new MessageListener() { 34 | // 订阅接收方法 35 | public void onMessage(Message message) { 36 | TextMessage tm = (TextMessage) message; 37 | try { 38 | System.out.println("接收: " + tm.getText()); 39 | //session.commit(); 40 | } catch (JMSException e) { 41 | e.printStackTrace(); 42 | } 43 | } 44 | }); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/lz/jms/rabbitmq/EmitLog.java: -------------------------------------------------------------------------------- 1 | package com.lz.jms.rabbitmq; 2 | 3 | import com.rabbitmq.client.ConnectionFactory; 4 | import com.rabbitmq.client.Connection; 5 | import com.rabbitmq.client.Channel; 6 | 7 | public class EmitLog { 8 | 9 | private static final String EXCHANGE_NAME = "lzw"; 10 | private static final String LZW_MQ_TEST_QUEUE = "LZW_MQ_TEST_QUEUE"; 11 | 12 | public static void main(String[] argv) throws Exception { 13 | 14 | /* 15 | * 发送消息到一个名为“lzw”的exchange上,使用“fanout”方式发送,即广播消息,不需要使用queue,发送端不需要关心谁接收 16 | */ 17 | 18 | ConnectionFactory factory = new ConnectionFactory(); 19 | factory.setHost("localhost"); 20 | Connection connection = factory.newConnection(); 21 | Channel channel = connection.createChannel(); 22 | 23 | channel.queueDeclare(LZW_MQ_TEST_QUEUE, false, false, false, null); 24 | channel.exchangeDeclare(EXCHANGE_NAME, "fanout"); 25 | 26 | String message = getMessage(argv); 27 | 28 | channel.basicPublish(EXCHANGE_NAME, "", null, message.getBytes()); 29 | System.out.println(" 发送消息:" + message); 30 | 31 | channel.close(); 32 | connection.close(); 33 | } 34 | 35 | private static String getMessage(String[] strings) { 36 | if (strings.length < 1) 37 | return "info: Hello World!"; 38 | return joinStrings(strings, " "); 39 | } 40 | 41 | private static String joinStrings(String[] strings, String delimiter) { 42 | int length = strings.length; 43 | if (length == 0) 44 | return ""; 45 | StringBuilder words = new StringBuilder(strings[0]); 46 | for (int i = 1; i < length; i++) { 47 | words.append(delimiter).append(strings[i]); 48 | } 49 | return words.toString(); 50 | } 51 | } -------------------------------------------------------------------------------- /src/main/java/com/lz/image/opencv/GaussianBlur.java: -------------------------------------------------------------------------------- 1 | //package com.lz.image.opencv; 2 | // 3 | //import org.opencv.core.Core; 4 | //import org.opencv.core.Mat; 5 | //import org.opencv.core.Size; 6 | //import org.opencv.imgcodecs.Imgcodecs; 7 | //import org.opencv.imgproc.Imgproc; 8 | // 9 | //public class GaussianBlur { 10 | // public static void main(String[] args) { 11 | // try{ 12 | // System.loadLibrary(Core.NATIVE_LIBRARY_NAME); 13 | // 14 | // Mat src=Imgcodecs.imread("C:\\Users\\gionee\\Desktop\\123860572759110476.jpg"); 15 | // //读取图像到矩阵中 16 | // if(src.empty()){ 17 | // throw new Exception("no file"); 18 | // } 19 | // 20 | // Mat dst = src.clone(); 21 | // //复制矩阵进入dst 22 | // 23 | // //图像模糊化处理1 24 | // Imgproc.GaussianBlur(src,dst,new Size(13,13),10,10); 25 | // Imgcodecs.imwrite("D:/data/img/gaussianblur1.jpg", dst); 26 | // 27 | // //图像模糊化处理2 28 | // Imgproc.GaussianBlur(src,dst,new Size(151,151),25,25); 29 | // Imgcodecs.imwrite("D:/data/img/gaussianblur2.jpg", dst); 30 | // 31 | // //图像模糊化处理3 32 | // Imgproc.GaussianBlur(src,dst,new Size(51,101),25,25); 33 | // Imgcodecs.imwrite("D:/data/img/gaussianblur3.jpg", dst); 34 | // 35 | // //图像模糊化处理4 36 | // Imgproc.GaussianBlur(src,dst,new Size(161,161),1000,1000); 37 | // Imgcodecs.imwrite("D:/data/img/gaussianblur4.jpg", dst); 38 | // System.out.println("模糊完毕..."); 39 | // }catch(Exception e){ 40 | // System.out.println("例外:" + e); 41 | // } 42 | // 43 | // } 44 | //} 45 | -------------------------------------------------------------------------------- /src/main/java/com/lz/hadoop/hdfs/MultipleFileUpload.java: -------------------------------------------------------------------------------- 1 | package com.lz.hadoop.hdfs; 2 | 3 | import java.net.URI; 4 | 5 | import org.apache.hadoop.conf.Configuration; 6 | import org.apache.hadoop.fs.FileStatus; 7 | import org.apache.hadoop.fs.FileSystem; 8 | import org.apache.hadoop.fs.FileUtil; 9 | import org.apache.hadoop.fs.Path; 10 | import org.apache.hadoop.fs.PathFilter; 11 | 12 | public class MultipleFileUpload { 13 | //声明两个从不同文件系统类型的静态变量 14 | private static FileSystem fs = null; 15 | private static FileSystem local = null; 16 | 17 | public static void main(String[] args) throws Exception { 18 | //指定在元数据目录的地址在linux环境下 19 | String srcPath="F:/accesslog/*"; 20 | String dstPath="hdfs://localhost:9000/accesslog/"; 21 | //调用上传到HDFS 22 | listFile(srcPath, dstPath); 23 | } 24 | 25 | public static void listFile(String srcPath,String dstPath) throws Exception{ 26 | //读取配置文件 27 | Configuration conf=new Configuration(); 28 | //指定HDFS地址 29 | URI uri=new URI("hdfs://localhost:9000"); 30 | fs = FileSystem.get(uri,conf); 31 | // 获取本地文件系统 32 | local=FileSystem.getLocal(conf); 33 | //获取文件目录 34 | FileStatus[] listFile=local.globStatus(new Path(srcPath)); 35 | //获取文件路径 36 | Path[] listPath=FileUtil.stat2Paths(listFile); 37 | //输出文件路径 38 | Path outPath=new Path(dstPath); 39 | //循环遍历所有文件路径 40 | for(Path p:listPath){ 41 | System.out.println("上传文件:" + p.toUri().getPath()); 42 | fs.copyFromLocalFile(p, outPath); 43 | } 44 | 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/lz/jms/rabbitmq/Work.java: -------------------------------------------------------------------------------- 1 | package com.lz.jms.rabbitmq; 2 | 3 | import com.rabbitmq.client.Channel; 4 | import com.rabbitmq.client.Connection; 5 | import com.rabbitmq.client.ConnectionFactory; 6 | import com.rabbitmq.client.QueueingConsumer; 7 | 8 | public class Work { 9 | // 队列名称 10 | private final static String QUEUE_NAME = "LZW_TEST_APP"; 11 | 12 | public static void main(String[] argv) throws java.io.IOException, java.lang.InterruptedException { 13 | // 区分不同工作进程的输出 14 | int hashCode = Work.class.hashCode(); 15 | // 创建连接和频道 16 | ConnectionFactory factory = new ConnectionFactory(); 17 | factory.setHost("localhost"); 18 | Connection connection = factory.newConnection(); 19 | Channel channel = connection.createChannel(); 20 | // 声明队列 21 | channel.queueDeclare(QUEUE_NAME, false, false, false, null); 22 | System.out.println(hashCode + " [*] Waiting for messages. To exit press CTRL+C"); 23 | 24 | QueueingConsumer consumer = new QueueingConsumer(channel); 25 | // 指定消费队列 26 | channel.basicConsume(QUEUE_NAME, true, consumer); 27 | while (true) { 28 | QueueingConsumer.Delivery delivery = consumer.nextDelivery(); 29 | String message = new String(delivery.getBody()); 30 | 31 | System.out.println(hashCode + " [x] Received '" + message + "'"); 32 | doWork(message); 33 | System.out.println(hashCode + " [x] Done"); 34 | 35 | } 36 | 37 | } 38 | 39 | /** 40 | * 每个点耗时1s 41 | * 42 | * @param task 43 | * @throws InterruptedException 44 | */ 45 | private static void doWork(String task) throws InterruptedException { 46 | for (char ch : task.toCharArray()) { 47 | if (ch == '.') 48 | Thread.sleep(1000); 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /src/main/java/com/lz/study/netty/client/HiHandler.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.netty.client; 2 | 3 | import org.jboss.netty.buffer.ChannelBuffer; 4 | import org.jboss.netty.buffer.ChannelBuffers; 5 | import org.jboss.netty.channel.ChannelHandlerContext; 6 | import org.jboss.netty.channel.ChannelStateEvent; 7 | import org.jboss.netty.channel.ExceptionEvent; 8 | import org.jboss.netty.channel.MessageEvent; 9 | import org.jboss.netty.channel.SimpleChannelHandler; 10 | 11 | public class HiHandler extends SimpleChannelHandler { 12 | 13 | @Override 14 | public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception { 15 | 16 | System.out.println("messageReceived"); 17 | String s = (String) e.getMessage(); 18 | System.out.println(s); 19 | 20 | //回复 21 | ctx.getChannel().write("hi"); 22 | 23 | super.messageReceived(ctx, e); 24 | } 25 | 26 | @Override 27 | public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception { 28 | // TODO Auto-generated method stub 29 | super.exceptionCaught(ctx, e); 30 | } 31 | 32 | @Override 33 | public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { 34 | System.out.println("channelConnected"); 35 | super.channelConnected(ctx, e); 36 | } 37 | 38 | @Override 39 | public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { 40 | System.out.println("channelDisconnected"); 41 | super.channelDisconnected(ctx, e); 42 | } 43 | 44 | @Override 45 | public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { 46 | System.out.println("channelClosed"); 47 | super.channelClosed(ctx, e); 48 | } 49 | 50 | 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/lz/weixin/MD5.java: -------------------------------------------------------------------------------- 1 | package com.lz.weixin; 2 | 3 | import java.io.UnsupportedEncodingException; 4 | 5 | import org.apache.commons.codec.digest.DigestUtils; 6 | 7 | public class MD5 { 8 | 9 | /** 10 | * 签名字符串 11 | * @param text 需要签名的字符串 12 | * @param key 密钥 13 | * @param input_charset 编码格式 14 | * @return 签名结果 15 | */ 16 | public static String sign(String text, String key, String input_charset) { 17 | text = text + key; 18 | return DigestUtils.md5Hex(getContentBytes(text, input_charset)); 19 | } 20 | 21 | /** 22 | * 签名字符串 23 | * @param text 需要签名的字符串 24 | * @param sign 签名结果 25 | * @param key 密钥 26 | * @param input_charset 编码格式 27 | * @return 签名结果 28 | */ 29 | public static boolean verify(String text, String sign, String key, String input_charset) { 30 | text = text + key; 31 | String mysign = DigestUtils.md5Hex(getContentBytes(text, input_charset)); 32 | if(mysign.equals(sign)) { 33 | return true; 34 | } 35 | else { 36 | return false; 37 | } 38 | } 39 | 40 | /** 41 | * @param content 42 | * @param charset 43 | * @return 44 | * @throws SignatureException 45 | * @throws UnsupportedEncodingException 46 | */ 47 | private static byte[] getContentBytes(String content, String charset) { 48 | if (charset == null || "".equals(charset)) { 49 | return content.getBytes(); 50 | } 51 | try { 52 | return content.getBytes(charset); 53 | } catch (UnsupportedEncodingException e) { 54 | throw new RuntimeException("MD5签名过程中出现错误,指定的编码集不对,您目前指定的编码集是:" + charset); 55 | } 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/main/resources/spring-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 32 | 33 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/main/java/com/lz/study/netty/serial/test/Test1.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.netty.serial.test; 2 | 3 | import java.io.ByteArrayInputStream; 4 | import java.io.ByteArrayOutputStream; 5 | import java.io.IOException; 6 | import java.util.Arrays; 7 | 8 | public class Test1 { 9 | 10 | public static void main(String[] args) throws IOException { 11 | int id = 101; 12 | int age = 21; 13 | 14 | ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream(); 15 | arrayOutputStream.write(int2bytes(id)); 16 | arrayOutputStream.write(int2bytes(age)); 17 | 18 | byte[] byteArray = arrayOutputStream.toByteArray(); 19 | 20 | System.out.println(Arrays.toString(byteArray)); 21 | 22 | //============================================================== 23 | ByteArrayInputStream arrayInputStream = new ByteArrayInputStream(byteArray); 24 | byte[] idBytes = new byte[4]; 25 | arrayInputStream.read(idBytes); 26 | System.out.println("id:" + bytes2int(idBytes)); 27 | 28 | byte[] ageBytes = new byte[4]; 29 | arrayInputStream.read(ageBytes); 30 | System.out.println("age:" + bytes2int(ageBytes)); 31 | 32 | } 33 | 34 | 35 | /** 36 | * 大端字节序列(先写高位,再写低位) 37 | * 百度下 大小端字节序列 38 | * @param i 39 | * @return 40 | */ 41 | public static byte[] int2bytes(int i){ 42 | byte[] bytes = new byte[4]; 43 | bytes[0] = (byte)(i >> 3*8); 44 | bytes[1] = (byte)(i >> 2*8); 45 | bytes[2] = (byte)(i >> 1*8); 46 | bytes[3] = (byte)(i >> 0*8); 47 | return bytes; 48 | } 49 | 50 | 51 | /** 52 | * 大端 53 | * @param bytes 54 | * @return 55 | */ 56 | public static int bytes2int(byte[] bytes){ 57 | return (bytes[0] << 3*8) | 58 | (bytes[1] << 2*8) | 59 | (bytes[2] << 1*8) | 60 | (bytes[3] << 0*8); 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/lz/study/java8/lambda/exer/TestLambda.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.java8.lambda.exer; 2 | 3 | import java.util.Arrays; 4 | import java.util.Collections; 5 | import java.util.List; 6 | 7 | import org.junit.Test; 8 | 9 | import com.lz.study.java8.lambda.Employee; 10 | 11 | public class TestLambda { 12 | 13 | List emps = Arrays.asList( 14 | new Employee(101, "张三", 18, 9999.99), 15 | new Employee(102, "李四", 59, 6666.66), 16 | new Employee(103, "王五", 28, 3333.33), 17 | new Employee(104, "赵六", 8, 7777.77), 18 | new Employee(105, "田七", 38, 5555.55) 19 | ); 20 | 21 | @Test 22 | public void test1(){ 23 | Collections.sort(emps, (e1, e2) -> { 24 | if(e1.getAge() == e2.getAge()){ 25 | return e1.getName().compareTo(e2.getName()); 26 | }else{ 27 | return -Integer.compare(e1.getAge(), e2.getAge()); 28 | } 29 | }); 30 | 31 | for (Employee emp : emps) { 32 | System.out.println(emp); 33 | } 34 | } 35 | 36 | @Test 37 | public void test2(){ 38 | String trimStr = strHandler("\t\t\t 我大尚硅谷威武 ", (str) -> str.trim()); 39 | System.out.println(trimStr); 40 | 41 | String upper = strHandler("abcdef", (str) -> str.toUpperCase()); 42 | System.out.println(upper); 43 | 44 | String newStr = strHandler("我大尚硅谷威武", (str) -> str.substring(2, 5)); 45 | System.out.println(newStr); 46 | } 47 | 48 | //需求:用于处理字符串 49 | public String strHandler(String str, MyFunction mf){ 50 | return mf.getValue(str); 51 | } 52 | 53 | @Test 54 | public void test3(){ 55 | op(100L, 200L, (x, y) -> x + y); 56 | 57 | op(100L, 200L, (x, y) -> x * y); 58 | } 59 | 60 | //需求:对于两个 Long 型数据进行处理 61 | public void op(Long l1, Long l2, MyFunction2 mf){ 62 | System.out.println(mf.getValue(l1, l2)); 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/com/lz/art/controller/CrawlerController.java: -------------------------------------------------------------------------------- 1 | package com.lz.art.controller; 2 | 3 | import java.util.List; 4 | 5 | import javax.annotation.Resource; 6 | 7 | import org.springframework.stereotype.Controller; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.ResponseBody; 10 | import org.springframework.web.servlet.ModelAndView; 11 | 12 | import com.lz.art.common.DataNotyOptions; 13 | import com.lz.art.pojo.Crawler; 14 | import com.lz.art.service.ICrawlerService; 15 | 16 | @Controller 17 | @RequestMapping("crawler") 18 | public class CrawlerController { 19 | 20 | @Resource 21 | private ICrawlerService crawlerService; 22 | 23 | @RequestMapping(value="/crawlerView") 24 | public ModelAndView crawlerView(){ 25 | ModelAndView model = new ModelAndView(); 26 | model.setViewName("WEB-INF/jsp/crawler/crawler-list"); 27 | return model; 28 | } 29 | 30 | @RequestMapping(value="/crawlerList") 31 | @ResponseBody 32 | public List crawlerList(){ 33 | List list = crawlerService.pageOfCrawler(); 34 | return list; 35 | } 36 | 37 | @RequestMapping(value="/saveCrawler") 38 | @ResponseBody 39 | public DataNotyOptions saveCrawler(Crawler crawler,String opt){ 40 | DataNotyOptions dno = crawlerService.saveCrawler(crawler,opt); 41 | return dno; 42 | } 43 | 44 | @RequestMapping(value="/startCrawler") 45 | @ResponseBody 46 | public DataNotyOptions startCrawler(Crawler crawler){ 47 | DataNotyOptions dno = crawlerService.startCrawler(crawler); 48 | return dno; 49 | } 50 | 51 | @RequestMapping(value="/stopCrawler") 52 | @ResponseBody 53 | public DataNotyOptions stopCrawler(String id){ 54 | DataNotyOptions dno = crawlerService.stopCrawler(id); 55 | return dno; 56 | } 57 | 58 | 59 | 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/lz/jms/rabbitmq/fanout/FanoutConsumer_2.java: -------------------------------------------------------------------------------- 1 | package com.lz.jms.rabbitmq.fanout; 2 | 3 | import com.rabbitmq.client.Channel; 4 | import com.rabbitmq.client.Connection; 5 | import com.rabbitmq.client.ConnectionFactory; 6 | import com.rabbitmq.client.QueueingConsumer; 7 | 8 | /** 9 | * Created by dy on 16-4-28. 10 | */ 11 | public class FanoutConsumer_2 { 12 | public String host ="127.0.0.1"; 13 | 14 | public void init() throws Exception{ 15 | ConnectionFactory factory = new ConnectionFactory(); 16 | factory.setHost(host); 17 | 18 | Connection connection = factory.newConnection(); 19 | Channel channel = connection.createChannel(); 20 | 21 | channel.queueDeclare(Constants.queue_fanout_2, false, false, false, null); 22 | 23 | //绑定队列,交换器,路由键(该模式路由不用了) 24 | channel.queueBind(Constants.queue_fanout_2, Constants.fanout_exchange,""); 25 | 26 | QueueingConsumer consumer = new QueueingConsumer(channel); 27 | channel.basicConsume(Constants.queue_fanout_2, false,consumer); 28 | 29 | while (true) { 30 | try { 31 | QueueingConsumer.Delivery delivery = consumer.nextDelivery(); 32 | String msg = new String(delivery.getBody(), "UTF-8"); 33 | 34 | System.out.println("我接收到的消息是:"+msg); 35 | 36 | // 返回接收到消息的确认信息 37 | channel.basicAck(delivery.getEnvelope().getDeliveryTag(), false); 38 | } catch (Exception e) { 39 | System.out.println(e.toString()); 40 | } 41 | } 42 | } 43 | 44 | public static void main(String[] args) { 45 | try { 46 | new FanoutConsumer_2().init(); 47 | } catch (Exception e) { 48 | e.printStackTrace(); 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /src/test/java/redis/RedisTest.java: -------------------------------------------------------------------------------- 1 | package redis; 2 | 3 | import org.junit.Assert; 4 | import org.junit.Test; 5 | import org.junit.runner.RunWith; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.test.context.ContextConfiguration; 8 | import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; 9 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 10 | 11 | import com.lz.art.pojo.Article; 12 | import com.lz.study.redis.ArticleRedisDao; 13 | 14 | @RunWith(SpringJUnit4ClassRunner.class) 15 | @ContextConfiguration(locations = {"classpath*:spring-config.xml"}) 16 | public class RedisTest extends AbstractJUnit4SpringContextTests { 17 | 18 | @Autowired 19 | ArticleRedisDao articleRedisDao; 20 | 21 | //@Test 22 | public void testSaveArticle() { 23 | Article art = new Article(); 24 | art.setId("1"); 25 | art.setTitle("今天天气非常好!你吃饭了吗!"); 26 | boolean res = articleRedisDao.saveArticle(art); 27 | Assert.assertTrue(res); 28 | } 29 | 30 | @Test 31 | public void testUpdateArticle() { 32 | Article art = new Article(); 33 | art.setId("1"); 34 | art.setTitle("天气好,去春游!"); 35 | boolean res = articleRedisDao.updateArticle(art); 36 | Assert.assertTrue(res); 37 | } 38 | 39 | //@Test 40 | public void testFindArticle() { 41 | Article art = articleRedisDao.findArticle("1"); 42 | if(art==null){ 43 | System.out.println("结果:" + art); 44 | }else{ 45 | System.out.println(art.getId() + "-" + art.getTitle() ); 46 | } 47 | } 48 | 49 | //@Test 50 | public void testDelArticle() { 51 | boolean res = articleRedisDao.deleteArticle("1"); 52 | Assert.assertTrue(res); 53 | } 54 | 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/lz/art/pojo/Url.java: -------------------------------------------------------------------------------- 1 | package com.lz.art.pojo; 2 | 3 | public class Url { 4 | /** 5 | * This field was generated by MyBatis Generator. 6 | * This field corresponds to the database column url.id 7 | * 8 | * @mbggenerated 9 | */ 10 | private String id; 11 | 12 | /** 13 | * This field was generated by MyBatis Generator. 14 | * This field corresponds to the database column url.url 15 | * 16 | * @mbggenerated 17 | */ 18 | private String url; 19 | 20 | /** 21 | * This method was generated by MyBatis Generator. 22 | * This method returns the value of the database column url.id 23 | * 24 | * @return the value of url.id 25 | * 26 | * @mbggenerated 27 | */ 28 | public String getId() { 29 | return id; 30 | } 31 | 32 | /** 33 | * This method was generated by MyBatis Generator. 34 | * This method sets the value of the database column url.id 35 | * 36 | * @param id the value for url.id 37 | * 38 | * @mbggenerated 39 | */ 40 | public void setId(String id) { 41 | this.id = id == null ? null : id.trim(); 42 | } 43 | 44 | /** 45 | * This method was generated by MyBatis Generator. 46 | * This method returns the value of the database column url.url 47 | * 48 | * @return the value of url.url 49 | * 50 | * @mbggenerated 51 | */ 52 | public String getUrl() { 53 | return url; 54 | } 55 | 56 | /** 57 | * This method was generated by MyBatis Generator. 58 | * This method sets the value of the database column url.url 59 | * 60 | * @param url the value for url.url 61 | * 62 | * @mbggenerated 63 | */ 64 | public void setUrl(String url) { 65 | this.url = url == null ? null : url.trim(); 66 | } 67 | } -------------------------------------------------------------------------------- /src/main/java/com/lz/image/local/FillFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2006 Jerry Huxtable 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package com.lz.image.local; 18 | 19 | import java.awt.*; 20 | import java.awt.image.*; 21 | 22 | /** 23 | * A filter which fills an image with a given color. Normally you would just call Graphics.fillRect but it can sometimes be useful 24 | * to go via a filter to fit in with an existing API. 25 | */ 26 | public class FillFilter extends PointFilter { 27 | 28 | private int fillColor; 29 | 30 | /** 31 | * Construct a FillFilter. 32 | */ 33 | public FillFilter() { 34 | this(0xff000000); 35 | } 36 | 37 | /** 38 | * Construct a FillFilter. 39 | * @param color the fill color 40 | */ 41 | public FillFilter(int color) { 42 | this.fillColor = color; 43 | } 44 | 45 | /** 46 | * Set the fill color. 47 | * @param fillColor the fill color 48 | * @see #getFillColor 49 | */ 50 | public void setFillColor(int fillColor) { 51 | this.fillColor = fillColor; 52 | } 53 | 54 | /** 55 | * Get the fill color. 56 | * @return the fill color 57 | * @see #setFillColor 58 | */ 59 | public int getFillColor() { 60 | return fillColor; 61 | } 62 | 63 | public int filterRGB(int x, int y, int rgb) { 64 | return fillColor; 65 | } 66 | } 67 | 68 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | article-spider 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.ui.externaltools.ExternalToolBuilder 10 | full,incremental, 11 | 12 | 13 | LaunchConfigHandle 14 | <project>/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator.launch 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | org.eclipse.wst.common.project.facet.core.builder 25 | 26 | 27 | 28 | 29 | org.eclipse.wst.validation.validationbuilder 30 | 31 | 32 | 33 | 34 | org.springframework.ide.eclipse.core.springbuilder 35 | 36 | 37 | 38 | 39 | org.eclipse.m2e.core.maven2Builder 40 | 41 | 42 | 43 | 44 | 45 | org.springframework.ide.eclipse.core.springnature 46 | org.eclipse.jem.workbench.JavaEMFNature 47 | org.eclipse.wst.common.modulecore.ModuleCoreNature 48 | org.eclipse.jdt.core.javanature 49 | org.eclipse.m2e.core.maven2Nature 50 | org.eclipse.wst.common.project.facet.core.nature 51 | org.eclipse.wst.jsdt.core.jsNature 52 | 53 | 54 | -------------------------------------------------------------------------------- /src/main/webapp/ui/js/review.js: -------------------------------------------------------------------------------- 1 | /** 2 | * author:laizhiwen 3 | */ 4 | $(document).ready(function(){ 5 | $('#reviews-table').bootstrapTable({ 6 | url: 'reviews/reviewsList', 7 | columns: [{ 8 | checkbox: 'true' 9 | },{ 10 | field: 'id', 11 | title: "id", 12 | visible: false 13 | },{ 14 | field: 'review', 15 | title: '评论' 16 | }, { 17 | field: 'reviewer', 18 | title: '评论人' 19 | }, { 20 | field: 'date', 21 | title: '日期', 22 | width: 100, 23 | formatter: function(value, row, index){ 24 | var date = value.substring(0,10); 25 | return date; 26 | } 27 | }, { 28 | field: 'starts', 29 | title: '得分' 30 | }, { 31 | field: 'helpfulCount', 32 | title: '有用次数', 33 | visible: false 34 | }], 35 | pagination: true, 36 | //pageNumber: 1, 37 | //pageSize: 3, 38 | //showPaginationSwitch:true, 39 | pageList: [10, 20, 50, 100] 40 | 41 | }); 42 | 43 | $("#searchReviewBtn").on("click",function(){ 44 | var searchText = $("#searchText").val(); 45 | var startDate = $("#startDate").val(); 46 | var endDate = $("#endDate").val(); 47 | var parameter = { 48 | url: "reviews/reviewsList", 49 | query: { 50 | searchText: searchText, 51 | startDate: startDate, 52 | endDate: endDate 53 | } 54 | }; 55 | $('#reviews-table').bootstrapTable('refresh', parameter); 56 | }); 57 | 58 | /* 59 | $('#datetimepicker').datetimepicker({ 60 | format: 'yyyy-mm-dd', 61 | todayBtn: 1, 62 | autoclose: 1, 63 | todayHighlight: 1, 64 | startView: 2, 65 | minView: 2, 66 | forceParse: 0 67 | }); 68 | $('#datetimepicker').datetimepicker('setStartDate', '2012-01-01'); 69 | $("#searchText").popover({ 70 | delay: { show: 3000, hide: 200 } 71 | }); 72 | */ 73 | }); -------------------------------------------------------------------------------- /src/main/java/com/lz/jms/rabbitmq/fanout/FanoutProducer.java: -------------------------------------------------------------------------------- 1 | package com.lz.jms.rabbitmq.fanout; 2 | 3 | import com.rabbitmq.client.Channel; 4 | import com.rabbitmq.client.Connection; 5 | import com.rabbitmq.client.ConnectionFactory; 6 | 7 | /** 8 | * Created by dy on 16-4-28. 9 | */ 10 | public class FanoutProducer { 11 | public String host ="127.0.0.1"; 12 | public Connection connection; 13 | public Channel channel; 14 | 15 | 16 | public void init() throws Exception{ 17 | ConnectionFactory factory = new ConnectionFactory(); 18 | factory.setHost(host); 19 | 20 | //获取链接 21 | connection = factory.newConnection(); 22 | //创建信道 23 | channel = connection.createChannel(); 24 | 25 | /** 26 | * 声明交换器 27 | * 交换器类型主要有三种 28 | * direct:精准匹配路由键,fanout:广播匹配,topic模糊(多)匹配路由键(可以优先级) 29 | * exchangeDeclare(String exchange, String type) 30 | */ 31 | channel.exchangeDeclare(Constants.fanout_exchange, "fanout"); 32 | 33 | 34 | } 35 | public void publish(String msg) throws Exception{ 36 | //basicPublish(String exchange, String routingKey, BasicProperties props, byte[] body) 37 | this.channel.basicPublish(Constants.fanout_exchange,"", null, msg.getBytes("UTF-8")); 38 | 39 | } 40 | public void close() throws Exception{ 41 | channel.close(); 42 | connection.close(); 43 | } 44 | 45 | public static void main(String[] args) { 46 | try { 47 | FanoutProducer producer = new FanoutProducer(); 48 | producer.init(); 49 | String msg ="我是来自 fanout producer的消息!我的序列是:"; 50 | for (int i = 1;i<8;i++){ 51 | producer.publish(msg+i); 52 | } 53 | producer.close(); 54 | } catch (Exception e) { 55 | e.printStackTrace(); 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ###################### 2 | # 解决java产生文件 3 | ###################### 4 | *.class 5 | 6 | # Log file 7 | *.log 8 | 9 | # BlueJ files 10 | *.ctxt 11 | 12 | # Mobile Tools for Java (J2ME) 13 | .mtj.tmp/ 14 | 15 | # Package Files # 16 | *.jar 17 | *.war 18 | *.ear 19 | *.zip 20 | *.tar.gz 21 | *.rar 22 | 23 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 24 | hs_err_pid* 25 | 26 | ###################### 27 | # 解决maven产生的文件 28 | ###################### 29 | 30 | target/ 31 | **/target/ 32 | pom.xml.tag 33 | pom.xml.releaseBackup 34 | pom.xml.versionsBackup 35 | pom.xml.next 36 | release.properties 37 | dependency-reduced-pom.xml 38 | buildNumber.properties 39 | .mvn/timing.properties 40 | 41 | ###################### 42 | # 解决各类编辑器自动产生的文件 43 | ###################### 44 | 45 | # Eclipse # 46 | .settings/ 47 | .classpath 48 | .project 49 | .factorypath 50 | 51 | *.iml 52 | 53 | ## Directory-based project format: 54 | .idea/ 55 | .DS_Store 56 | # if you remove the above rule, at least ignore the following: 57 | 58 | # User-specific stuff: 59 | .idea/workspace.xml 60 | .idea/tasks.xml 61 | .idea/dictionaries 62 | 63 | # Sensitive or high-churn files: 64 | # .idea/dataSources.ids 65 | # .idea/dataSources.xml 66 | # .idea/sqlDataSources.xml 67 | # .idea/dynamic.xml 68 | # .idea/uiDesigner.xml 69 | 70 | # Gradle: 71 | # .idea/gradle.xml 72 | # .idea/libraries 73 | 74 | # Mongo Explorer plugin: 75 | .idea/mongoSettings.xml 76 | 77 | ## File-based project format: 78 | *.ipr 79 | *.iws 80 | 81 | ## Plugin-specific files: 82 | 83 | # IntelliJ 84 | /out/ 85 | /target/ 86 | 87 | # mpeltonen/sbt-idea plugin 88 | .idea_modules/ 89 | 90 | # JIRA plugin 91 | atlassian-ide-plugin.xml 92 | 93 | # Crashlytics plugin (for Android Studio and IntelliJ) 94 | com_crashlytics_export_strings.xml 95 | crashlytics.properties 96 | crashlytics-build.properties 97 | /bin/ 98 | -------------------------------------------------------------------------------- /src/main/java/com/lz/study/netty/client/Client.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.netty.client; 2 | 3 | import java.net.InetSocketAddress; 4 | import java.util.Scanner; 5 | import java.util.concurrent.ExecutorService; 6 | import java.util.concurrent.Executors; 7 | 8 | import org.jboss.netty.bootstrap.ClientBootstrap; 9 | import org.jboss.netty.channel.Channel; 10 | import org.jboss.netty.channel.ChannelFuture; 11 | import org.jboss.netty.channel.ChannelPipeline; 12 | import org.jboss.netty.channel.ChannelPipelineFactory; 13 | import org.jboss.netty.channel.Channels; 14 | import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory; 15 | import org.jboss.netty.handler.codec.string.StringDecoder; 16 | import org.jboss.netty.handler.codec.string.StringEncoder; 17 | 18 | public class Client { 19 | public static void main(String[] args) { 20 | ClientBootstrap bootstrap = new ClientBootstrap(); 21 | 22 | //线程池 23 | ExecutorService boss = Executors.newCachedThreadPool(); 24 | ExecutorService worker = Executors.newCachedThreadPool(); 25 | 26 | //socket工厂 27 | bootstrap.setFactory(new NioClientSocketChannelFactory(boss, worker)); 28 | 29 | //管道工厂 30 | bootstrap.setPipelineFactory(new ChannelPipelineFactory() { 31 | 32 | @Override 33 | public ChannelPipeline getPipeline() throws Exception { 34 | ChannelPipeline pipeline = Channels.pipeline(); 35 | pipeline.addLast("decoder", new StringDecoder()); 36 | pipeline.addLast("encoder", new StringEncoder()); 37 | pipeline.addLast("hiHandler", new HiHandler()); 38 | return pipeline; 39 | } 40 | }); 41 | 42 | //连接服务端 43 | ChannelFuture connect = bootstrap.connect(new InetSocketAddress("127.0.0.1", 10101)); 44 | Channel channel = connect.getChannel(); 45 | 46 | System.out.println("client start!!"); 47 | 48 | Scanner scanner = new Scanner(System.in); 49 | 50 | channel.write(scanner.next()); 51 | 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/lz/art/dao/UrlMapper.java: -------------------------------------------------------------------------------- 1 | package com.lz.art.dao; 2 | 3 | import com.lz.art.pojo.Url; 4 | import com.lz.art.pojo.UrlExample; 5 | import java.util.List; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | public interface UrlMapper { 9 | /** 10 | * This method was generated by MyBatis Generator. 11 | * This method corresponds to the database table url 12 | * 13 | * @mbggenerated 14 | */ 15 | int countByExample(UrlExample example); 16 | 17 | /** 18 | * This method was generated by MyBatis Generator. 19 | * This method corresponds to the database table url 20 | * 21 | * @mbggenerated 22 | */ 23 | int deleteByExample(UrlExample example); 24 | 25 | /** 26 | * This method was generated by MyBatis Generator. 27 | * This method corresponds to the database table url 28 | * 29 | * @mbggenerated 30 | */ 31 | int insert(Url record); 32 | 33 | /** 34 | * This method was generated by MyBatis Generator. 35 | * This method corresponds to the database table url 36 | * 37 | * @mbggenerated 38 | */ 39 | int insertSelective(Url record); 40 | 41 | /** 42 | * This method was generated by MyBatis Generator. 43 | * This method corresponds to the database table url 44 | * 45 | * @mbggenerated 46 | */ 47 | List selectByExample(UrlExample example); 48 | 49 | /** 50 | * This method was generated by MyBatis Generator. 51 | * This method corresponds to the database table url 52 | * 53 | * @mbggenerated 54 | */ 55 | int updateByExampleSelective(@Param("record") Url record, @Param("example") UrlExample example); 56 | 57 | /** 58 | * This method was generated by MyBatis Generator. 59 | * This method corresponds to the database table url 60 | * 61 | * @mbggenerated 62 | */ 63 | int updateByExample(@Param("record") Url record, @Param("example") UrlExample example); 64 | } -------------------------------------------------------------------------------- /src/main/java/com/lz/jms/rabbitmq/fanout/FanoutConsumer_1.java: -------------------------------------------------------------------------------- 1 | package com.lz.jms.rabbitmq.fanout; 2 | 3 | import com.rabbitmq.client.Channel; 4 | import com.rabbitmq.client.Connection; 5 | import com.rabbitmq.client.ConnectionFactory; 6 | import com.rabbitmq.client.QueueingConsumer; 7 | 8 | /** 9 | * Created by dy on 16-4-28. 10 | */ 11 | public class FanoutConsumer_1 { 12 | public String host ="127.0.0.1"; 13 | 14 | public void init() throws Exception{ 15 | ConnectionFactory factory = new ConnectionFactory(); 16 | factory.setHost(host); 17 | 18 | //获取链接 19 | Connection connection = factory.newConnection(); 20 | //创建信道 21 | Channel channel = connection.createChannel(); 22 | channel.queueDeclare(Constants.queue_fanout_1, false, false, false, null); 23 | 24 | //绑定队列,交换器,路由键(该模式路由不用了) 25 | channel.queueBind(Constants.queue_fanout_1, Constants.fanout_exchange,""); 26 | 27 | /** 28 | * 订阅消息 29 | * autoAck是否消息订阅到队列就确认 30 | * basicConsume(String queue, boolean autoAck, TopicConsumer_1 callback) 31 | */ 32 | QueueingConsumer consumer = new QueueingConsumer(channel); 33 | channel.basicConsume(Constants.queue_fanout_1, false,consumer); 34 | 35 | while (true) { 36 | try { 37 | QueueingConsumer.Delivery delivery = consumer.nextDelivery(); 38 | String msg = new String(delivery.getBody(), "UTF-8"); 39 | 40 | System.out.println("我接收到的消息是: "+msg); 41 | 42 | // 返回接收到消息的确认信息 43 | channel.basicAck(delivery.getEnvelope().getDeliveryTag(), false); 44 | } catch (Exception e) { 45 | System.out.println(e.toString()); 46 | } 47 | } 48 | } 49 | 50 | public static void main(String[] args) { 51 | try { 52 | new FanoutConsumer_1().init(); 53 | } catch (Exception e) { 54 | e.printStackTrace(); 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/js/counter.js: -------------------------------------------------------------------------------- 1 | (function($) { 2 | $.fn.countTo = function(options) { 3 | // merge the default plugin settings with the custom options 4 | options = $.extend({}, $.fn.countTo.defaults, options || {}); 5 | 6 | // how many times to update the value, and how much to increment the value on each update 7 | var loops = Math.ceil(options.speed / options.refreshInterval), 8 | increment = (options.to - options.from) / loops; 9 | 10 | return $(this).each(function() { 11 | var _this = this, 12 | loopCount = 0, 13 | value = options.from, 14 | interval = setInterval(updateTimer, options.refreshInterval); 15 | 16 | function updateTimer() { 17 | value += increment; 18 | loopCount++; 19 | $(_this).html(value.toFixed(options.decimals)); 20 | 21 | if (typeof(options.onUpdate) == 'function') { 22 | options.onUpdate.call(_this, value); 23 | } 24 | 25 | if (loopCount >= loops) { 26 | clearInterval(interval); 27 | value = options.to; 28 | 29 | if (typeof(options.onComplete) == 'function') { 30 | options.onComplete.call(_this, value); 31 | } 32 | } 33 | } 34 | }); 35 | }; 36 | 37 | $.fn.countTo.defaults = { 38 | from: 0, // the number the element should start at 39 | to: 100, // the number the element should end at 40 | speed: 1000, // how long it should take to count between the target numbers 41 | refreshInterval: 100, // how often the element should be updated 42 | decimals: 0, // the number of decimal places to show 43 | onUpdate: null, // callback method for every time the element is updated, 44 | onComplete: null, // callback method for when the element finishes updating 45 | }; 46 | })(jQuery); -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/css/elfinder.theme.css: -------------------------------------------------------------------------------- 1 | /** 2 | * MacOS X like theme for elFinder. 3 | * Required jquery ui "smoothness" theme. 4 | * 5 | * @author Dmitry (dio) Levashov 6 | **/ 7 | 8 | /* dialogs */ 9 | .std42-dialog, .std42-dialog .ui-widget-content { background-color:#ededed; background-image:none; background-clip: content-box; } 10 | 11 | /* navbar */ 12 | .elfinder .elfinder-navbar { background:#dde4eb; } 13 | .elfinder-navbar .ui-state-hover { background:transparent; border-color:transparent; } 14 | .elfinder-navbar .ui-state-active { background: #3875d7; border-color:#3875d7; color:#fff; } 15 | /* disabled elfinder */ 16 | .elfinder-disabled .elfinder-navbar .ui-state-active { background: #dadada; border-color:#aaa; color:#fff; } 17 | 18 | 19 | /* current directory */ 20 | /* selected file in "icons" view */ 21 | .elfinder-cwd-view-icons .elfinder-cwd-file .ui-state-hover { background:#ccc; } 22 | /* list view*/ 23 | .elfinder-cwd table tr:nth-child(odd) { background-color:#edf3fe; } 24 | .elfinder-cwd table tr { border-top:1px solid #fff; } 25 | 26 | /* common selected background/color */ 27 | .elfinder-cwd-view-icons .elfinder-cwd-file .elfinder-cwd-filename.ui-state-hover, 28 | .elfinder-cwd table td.ui-state-hover, 29 | .elfinder-button-menu .ui-state-hover { background: #3875d7; color:#fff;} 30 | /* disabled elfinder */ 31 | .elfinder-disabled .elfinder-cwd-view-icons .elfinder-cwd-file .elfinder-cwd-filename.ui-state-hover, 32 | .elfinder-disabled .elfinder-cwd table td.ui-state-hover { background:#dadada;} 33 | 34 | /* statusbar */ 35 | .elfinder .elfinder-statusbar { color:#555; } 36 | .elfinder .elfinder-statusbar a { text-decoration:none; color:#555;} 37 | 38 | 39 | .std42-dialog .elfinder-help, .std42-dialog .elfinder-help .ui-widget-content { background:#fff;} 40 | 41 | /* contextmenu */ 42 | .elfinder-contextmenu .ui-state-hover { background: #3875d7; color:#fff; } 43 | .elfinder-contextmenu .ui-state-hover .elfinder-contextmenu-arrow { background-image:url('../img/arrows-active.png'); } 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/main/java/com/lz/art/service/impl/CrawlerServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.lz.art.service.impl; 2 | 3 | import java.util.List; 4 | 5 | import javax.annotation.Resource; 6 | 7 | import org.springframework.stereotype.Service; 8 | 9 | import com.lz.art.common.SpiderMap; 10 | import com.lz.art.common.DataNotyOptions; 11 | import com.lz.art.common.StringHelper; 12 | import com.lz.art.dao.CrawlerMapper; 13 | import com.lz.art.pojo.Crawler; 14 | import com.lz.art.service.ICrawlerService; 15 | import com.lz.art.thread.StartAmazonCrawlerThread; 16 | 17 | @Service("crawlerService") 18 | public class CrawlerServiceImpl implements ICrawlerService { 19 | 20 | @Resource 21 | private CrawlerMapper crawlerMapper ; 22 | 23 | 24 | public List pageOfCrawler() { 25 | List list = crawlerMapper.selectByExample(null); 26 | return list; 27 | } 28 | 29 | 30 | @Override 31 | public DataNotyOptions saveCrawler(Crawler crawler,String opt) { 32 | DataNotyOptions dno = null; 33 | int n = 0; 34 | if(opt.equals("add")){ 35 | crawler.setId(StringHelper.getUUID()); 36 | n = crawlerMapper.insert(crawler); 37 | }else if(opt.equals("edit")){ 38 | n = crawlerMapper.updateByPrimaryKeySelective(crawler); 39 | } 40 | if(n>0){ 41 | dno = new DataNotyOptions("success"); 42 | }else{ 43 | dno = new DataNotyOptions("error"); 44 | } 45 | return dno; 46 | } 47 | 48 | 49 | @Override 50 | public Crawler findById(String id) { 51 | return crawlerMapper.selectByPrimaryKey(id); 52 | } 53 | 54 | 55 | @Override 56 | public DataNotyOptions startCrawler(Crawler crawler) { 57 | try { 58 | new StartAmazonCrawlerThread(crawler).start(); 59 | } catch (Exception e) { 60 | e.printStackTrace(); 61 | return new DataNotyOptions("error"); 62 | } 63 | crawler.setStatus(1); 64 | crawlerMapper.updateByPrimaryKeySelective(crawler); 65 | return new DataNotyOptions("success"); 66 | } 67 | 68 | 69 | @Override 70 | public DataNotyOptions stopCrawler(String id) { 71 | SpiderMap.getInstance().get(id).stop(); 72 | return new DataNotyOptions("success"); 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/com/lz/hadoop/zookeeper/Test1.java: -------------------------------------------------------------------------------- 1 | package com.lz.hadoop.zookeeper; 2 | 3 | import java.io.IOException; 4 | import java.util.HashMap; 5 | import java.util.Map; 6 | 7 | import org.apache.zookeeper.CreateMode; 8 | import org.apache.zookeeper.KeeperException; 9 | import org.apache.zookeeper.ZooDefs.Ids; 10 | import org.apache.zookeeper.ZooKeeper; 11 | import org.apache.zookeeper.data.Stat; 12 | 13 | import com.lz.util.SerializeUtil; 14 | 15 | public class Test1 { 16 | 17 | public static String host = "192.168.87.132:2181"; 18 | public static int sessionTimeOut = 30000; 19 | public static String root = "/zktest"; 20 | 21 | public static void createZnode() throws IOException, KeeperException, InterruptedException{ 22 | ZooKeeper zooKeeper = new ZooKeeper(host,sessionTimeOut,new MyTestWatcher()); 23 | Stat stat = zooKeeper.exists(root, false); 24 | if(stat == null){ 25 | try { 26 | zooKeeper.create(root, "zktestData".getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); 27 | zooKeeper.setData(root, "这个节点数据".getBytes(), -1); 28 | Stat st = new Stat(); 29 | byte[] data = zooKeeper.getData(root, false, stat); 30 | System.out.println("获取到的节点数据:" + SerializeUtil.unserializeForList(data)); 31 | } catch (KeeperException | InterruptedException e) { 32 | e.printStackTrace(); 33 | } 34 | }else{ 35 | System.out.println("节点存在!"); 36 | } 37 | } 38 | 39 | public static void delZnode() throws IOException{ 40 | ZooKeeper zooKeeper = new ZooKeeper(host,sessionTimeOut,new MyTestWatcher()); 41 | try { 42 | if(zooKeeper.exists(root, false)!=null){ 43 | zooKeeper.delete(root, -1); 44 | } 45 | } catch (InterruptedException e) { 46 | e.printStackTrace(); 47 | } catch (KeeperException e) { 48 | e.printStackTrace(); 49 | } 50 | } 51 | 52 | 53 | public static void main(String[] args) throws IOException { 54 | try { 55 | createZnode(); 56 | } catch (KeeperException | InterruptedException e) { 57 | e.printStackTrace(); 58 | } 59 | //delZnode(); 60 | 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/lz/art/crawler/SinaBlogProcessor.java: -------------------------------------------------------------------------------- 1 | package com.lz.art.crawler; 2 | 3 | import us.codecraft.webmagic.Page; 4 | import us.codecraft.webmagic.Site; 5 | import us.codecraft.webmagic.Spider; 6 | import us.codecraft.webmagic.pipeline.JsonFilePipeline; 7 | import us.codecraft.webmagic.processor.PageProcessor; 8 | 9 | public class SinaBlogProcessor implements PageProcessor { 10 | 11 | public static final String URL_LIST = "http://blog\\.sina\\.com\\.cn/s/articlelist_1487828712_0_\\d+\\.html"; 12 | 13 | public static final String URL_POST = "http://blog\\.sina\\.com\\.cn/s/blog_\\w+\\.html"; 14 | 15 | private Site site = Site 16 | .me() 17 | .setDomain("blog.sina.com.cn") 18 | .setSleepTime(3000) 19 | .setUserAgent( 20 | "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31"); 21 | 22 | @Override 23 | public void process(Page page) { 24 | //列表页 25 | if (page.getUrl().regex(URL_LIST).match()) { 26 | page.addTargetRequests(page.getHtml().xpath("//div[@class=\"articleList\"]").links().regex(URL_POST).all()); 27 | page.addTargetRequests(page.getHtml().links().regex(URL_LIST).all()); 28 | //文章页 29 | } else { 30 | page.putField("title", page.getHtml().xpath("//div[@class='articalTitle']/h2")); 31 | page.putField("content", page.getHtml().xpath("//div[@id='articlebody']//div[@class='articalContent']")); 32 | page.putField("date", 33 | page.getHtml().xpath("//div[@id='articlebody']//span[@class='time SG_txtc']").regex("\\((.*)\\)")); 34 | } 35 | } 36 | 37 | @Override 38 | public Site getSite() { 39 | return site; 40 | } 41 | 42 | public static void main(String[] args) { 43 | Spider.create(new SinaBlogProcessor()) 44 | .addUrl("http://blog.sina.com.cn/s/articlelist_1487828712_0_1.html") 45 | //.addPipeline(new JsonFilePipeline("D:\\webmagic\\")) 46 | .run(); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | article Application 4 | 5 | contextConfigLocation 6 | classpath:spring-config.xml 7 | 8 | 9 | encodingFilter 10 | org.springframework.web.filter.CharacterEncodingFilter 11 | true 12 | 13 | encoding 14 | UTF-8 15 | 16 | 17 | ForceEncoding 18 | true 19 | 20 | 21 | 22 | encodingFilter 23 | /* 24 | 25 | 26 | org.springframework.web.context.ContextLoaderListener 27 | 28 | 29 | org.springframework.web.util.IntrospectorCleanupListener 30 | 31 | 32 | SpringMVC 33 | org.springframework.web.servlet.DispatcherServlet 34 | 35 | contextConfigLocation 36 | classpath:spring-mvc.xml 37 | 38 | 1 39 | true 40 | 41 | 42 | SpringMVC 43 | / 44 | 45 | 46 | index.jsp 47 | 48 | 49 | 30 50 | 51 | -------------------------------------------------------------------------------- /src/main/webapp/ui/bootstrap/js/jquery.cookie.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery Cookie Plugin 3 | * https://github.com/carhartl/jquery-cookie 4 | * 5 | * Copyright 2011, Klaus Hartl 6 | * Dual licensed under the MIT or GPL Version 2 licenses. 7 | * http://www.opensource.org/licenses/mit-license.php 8 | * http://www.opensource.org/licenses/GPL-2.0 9 | */ 10 | (function($) { 11 | $.cookie = function(key, value, options) { 12 | 13 | // key and at least value given, set cookie... 14 | if (arguments.length > 1 && (!/Object/.test(Object.prototype.toString.call(value)) || value === null || value === undefined)) { 15 | options = $.extend({}, options); 16 | 17 | if (value === null || value === undefined) { 18 | options.expires = -1; 19 | } 20 | 21 | if (typeof options.expires === 'number') { 22 | var days = options.expires, t = options.expires = new Date(); 23 | t.setDate(t.getDate() + days); 24 | } 25 | 26 | value = String(value); 27 | 28 | return (document.cookie = [ 29 | encodeURIComponent(key), '=', options.raw ? value : encodeURIComponent(value), 30 | options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE 31 | options.path ? '; path=' + options.path : '', 32 | options.domain ? '; domain=' + options.domain : '', 33 | options.secure ? '; secure' : '' 34 | ].join('')); 35 | } 36 | 37 | // key and possibly options given, get cookie... 38 | options = value || {}; 39 | var decode = options.raw ? function(s) { return s; } : decodeURIComponent; 40 | 41 | var pairs = document.cookie.split('; '); 42 | for (var i = 0, pair; pair = pairs[i] && pairs[i].split('='); i++) { 43 | if (decode(pair[0]) === key) return decode(pair[1] || ''); // IE saves cookies with empty string as "c; ", e.g. without "=" as opposed to EOMB, thus pair[1] may be undefined 44 | } 45 | return null; 46 | }; 47 | })(jQuery); 48 | -------------------------------------------------------------------------------- /src/main/java/com/lz/image/opencv/LoadLibrary.java: -------------------------------------------------------------------------------- 1 | package com.lz.image.opencv; 2 | 3 | import java.io.File; 4 | import java.io.FileOutputStream; 5 | import java.io.InputStream; 6 | import java.io.OutputStream; 7 | 8 | public class LoadLibrary { 9 | public static void loadOpenCV() { 10 | try { 11 | InputStream inputStream = null; 12 | File fileOut = null; 13 | String osName = System.getProperty("os.name"); 14 | System.out.println(osName); 15 | 16 | if (osName.startsWith("Windows")) { 17 | int bitness = Integer.parseInt(System.getProperty("sun.arch.data.model")); 18 | if (bitness == 32) { 19 | inputStream = LoadLibrary.class.getResourceAsStream("/opencv/windows/x86/opencv_java300.dll"); 20 | fileOut = File.createTempFile("lib", ".dll"); 21 | } else if (bitness == 64) { 22 | inputStream = LoadLibrary.class.getResourceAsStream("/opencv/windows/x64/opencv_java300.dll"); 23 | fileOut = File.createTempFile("lib", ".dll"); 24 | } else { 25 | inputStream = LoadLibrary.class.getResourceAsStream("/opencv/windows/x86/opencv_java300.dll"); 26 | fileOut = File.createTempFile("lib", ".dll"); 27 | } 28 | } else if (osName.equals("Mac OS X")) { 29 | inputStream = LoadLibrary.class.getResourceAsStream("/opencv/mac/libopencv_java300.dylib"); 30 | fileOut = File.createTempFile("lib", ".dylib"); 31 | } 32 | 33 | if (fileOut != null) { 34 | OutputStream outputStream = new FileOutputStream(fileOut); 35 | byte[] buffer = new byte[1024]; 36 | int length; 37 | 38 | while ((length = inputStream.read(buffer)) > 0) { 39 | outputStream.write(buffer, 0, length); 40 | } 41 | 42 | inputStream.close(); 43 | outputStream.close(); 44 | System.load(fileOut.toString()); 45 | } 46 | } catch (Exception e) { 47 | e.printStackTrace(); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/lz/study/https/Test.java: -------------------------------------------------------------------------------- 1 | package com.lz.study.https; 2 | 3 | import java.net.URI; 4 | import java.security.KeyManagementException; 5 | import java.security.KeyStoreException; 6 | import java.security.NoSuchAlgorithmException; 7 | import java.util.List; 8 | 9 | import org.apache.http.impl.client.CloseableHttpClient; 10 | import org.springframework.http.HttpEntity; 11 | import org.springframework.http.HttpHeaders; 12 | import org.springframework.http.HttpMethod; 13 | import org.springframework.http.ResponseEntity; 14 | import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; 15 | import org.springframework.http.converter.HttpMessageConverter; 16 | import org.springframework.web.client.RestTemplate; 17 | 18 | public class Test { 19 | 20 | public static void main(String[] args) throws KeyManagementException, KeyStoreException, NoSuchAlgorithmException { 21 | RestTemplate restTemplate = new RestTemplate(new HttpsClientRequestFactory()); 22 | // List> converterList = restTemplate.getMessageConverters(); 23 | // converterList.remove(1); 24 | // restTemplate.setMessageConverters(converterList); 25 | HttpHeaders headers = new HttpHeaders(); 26 | headers.add("AAAAAAA", "AAAAAAA"); 27 | 28 | String httpBody = null; 29 | HttpEntity httpEntity = new HttpEntity(httpBody,headers); 30 | StringBuffer stringBuf = new StringBuffer("https://www.2345.com/"); 31 | URI uri = URI.create(stringBuf.toString()); 32 | 33 | ResponseEntity response = restTemplate.exchange(uri, HttpMethod.POST, httpEntity, String.class); 34 | 35 | if(response.hasBody()) { 36 | System.out.println("OK"); 37 | } 38 | 39 | System.out.println("================================================"); 40 | CloseableHttpClient httpClient = HttpClientUtils.acceptsUntrustedCertsHttpClient(); 41 | HttpComponentsClientHttpRequestFactory clientHttpRequestFactory = new HttpComponentsClientHttpRequestFactory(httpClient); 42 | restTemplate = new RestTemplate(clientHttpRequestFactory); 43 | String result = restTemplate.getForObject("https://www.2345.com/",String.class); 44 | System.out.println(result); 45 | 46 | } 47 | 48 | } 49 | --------------------------------------------------------------------------------