• Leetcode 529. Minesweeper | Python


    529. Minesweeper game Source: leetcodehttps://leetcode-cn.com/problems/minesweeper subject Let’s play Minesweeper! Given a two-dimensional character matrix representing the game board.  MFor oneNot excavatedMine of mine,EFor oneNot excavatedThe empty square of,BRepresents a mine with no adjacent (top, bottom, left, right, and all four diagonals)ExcavatedThe blank box of,number(‘1’ to ‘8’) indicates how many mines are associated with this areaExcavatedIs […]

  • Mobile terminal city positioning, city area code adcode


    Using the goto positioning API: AMap.Map(‘iCenter’) AMap.CitySearch() First, register the key to apply for location permission in Gaode open platform. Website; Gaode open platform The script with positioning key is introduced into the page to be located <!doctype html> <html> <head> <meta charset=”utf-8″> <meta http-equiv=”X-UA-Compatible” content=”IE=edge”> <meta name=”viewport” content=”initial-scale=1.0, user-scalable=no, width=device-width”> < title > basic […]

  • JVM learning (4): garbage collection


    Areas where garbage is collected: heap, method area The heap and method area of the runtime data area are shared among all threads for recycling All threads are private   When to recycle: This is often used in development List list = new ArrayList<>(); list.add(); list.add(); list.add(); //Business logic code return ; This is unreasonable. […]

  • Control pop-up sequence


    One of the requirements in the work is to control the display sequence of pop-up window automatically when users enter the application. Demand and status When users enter the application, they will display a series of pop-up windows. The display content and display of these pop-up windows depend on a series of request results when […]

  • Dagger 2


    Dagger dagger, another blade of the famous square company (yes! There is also a butter knife, called butterknife; hence the title dagger 2. Dagger2, originated from dagger, is an open source library based on Java annotation, which can complete dependency injection completely in the compilation phase. It is mainly used for decoupling between modules and […]

  • JVM virtual machine GC


    GC During GC, the JVM does not recycle the three regions uniformly. Most of the recycling is in the new generation Cenozoic era From, to Old age There are two types of GC: light GC (normal GC) and heavy GC (Global GC) When an object has gone through GC for 15 times and has not […]

  • html5


    **html5New label**DOCTYPE is not a tag of HTML, it just indicates the version of HTML Why does HTML5 not refer to DTDs?DTD (document type definition)DTD specifies the rules of markup language so that browsers can present content correctlyHTML5 is not based on SGML, so there is no need to refer to DTDs New label:1. Structure […]

  • Detailed explanation of Taobao H5 sign encryption algorithm


    Taobao uses a different way to access H5 from the client. Due to the high risk of saving appsercret in the JS code of H5, MTop adopts the method of randomly assigning token, which allocates a token for each access end, saves it in the user’s cookie, and brings back the token assigned by the […]

  • Tomcat servlet read request parameters


    Read querystring on URL org/apache/tomcat/embed/tomcat-embed-core/8.0.33/tomcat-embed-core-8.0.33-sources.jar!/org/apache/catalina/core/ApplicationDispatcher.java private void doDispatch(ServletRequest request, ServletResponse response) throws ServletException, IOException private void doForward(ServletRequest request, ServletResponse response) throws ServletException, IOException private void doInclude(ServletRequest request, ServletResponse response) throws ServletException, IOException Here’s dodispatch private void doDispatch(ServletRequest request, ServletResponse response) throws ServletException, IOException { // Set up to handle the specified request and response State […]

  • Implementation of session in swote


    Rewrite this $http->on(‘request’, new \Core\SessionMiddleware(function($request, $response){ })); SessionMiddleware.php <?php namespace Core; use \Swoole\Http\Request; use \Swoole\Http\Response; class SessionMiddleware { private $f; public function __construct($f) { $this->f = $f; } public function __invoke(Request $request, Response $response) { list($sessionName, $sessionId) = parseSession($request); $request->sessionId = $sessionId; $cookie = session_get_cookie_params(); $lifeTime = null; if($cookie[‘lifetime’]){ $lifeTime = time() + $cookie[‘lifetime’]; } […]

  • JVM memory model (text collation)


    Four clock algorithm for GC Optimization:1. Reference counting (disadvantages waste technical space, and when infinite loops)2. Replication algorithm (waste a to area) applicable scenario: when the object survivability is low: new area3. Mark clearing algorithm: (two scans seriously waste time and lead to memory fragmentation) (no extra space required)4. Mark compression algorithm: (compression means scanning […]

  • Chapter 6 spark mllib machine learning (1)


    Mllib is a machine learning library provided by spark. By calling the algorithm encapsulated by mllib, machine learning applications can be easily constructed. It provides a wealth of machine learning algorithms, such as classification, regression, clustering and recommendation algorithms. In addition, mllib standardizes the API for machine learning algorithms, making it easier to combine multiple […]