Home  >  Article  >  Backend Development  >  Detailed information on how to avoid some common problems

Detailed information on how to avoid some common problems

巴扎黑
巴扎黑Original
2017-06-14 10:27:141365browse

background: Coding problems have always troubled program developers, especially in Java, because Java is a cross-platform language and there is a lot of switching between coding on different platforms. Next, we will introduce the root causes of Java encoding problems; the differences between several encoding formats often encountered in Java; scenarios that often require encoding in Java; analysis of the causes of Chinese problems; possible encoding problems in developing Java Web Several places; how to control the encoding format of an HTTP request; how to avoid Chinese encoding problems, etc. 1. Several common encoding formats 1.1 Why coding is necessary The smallest unit for storing information in a computer is 1 byte, which is 8 bits, so the range of characters that can be represented is 0 ~ 255. There are too many symbols to represent and cannot be fully represented in 1 byte. 1.2 How to translate The computer provides a variety of translation methods, the common ones are ASCII, ISO-8859-1, GB2312, GBK, UTF-8, UTF-16

1. Parsing Chinese in Java Web Coding problems

Detailed information on how to avoid some common problems

Introduction: Coding problems have always troubled program developers, especially in Java. , because Java is a cross-platform language, there is a lot of switching between coding for different platforms. Next, we will introduce the root causes of Java encoding problems; the differences between several encoding formats often encountered in Java; scenarios that often require encoding in Java; analysis of the causes of Chinese problems; possible encoding problems in developing Java Web Several places; how to control the encoding format of an HTTP request; how to avoid Chinese encoding problems, etc.

2. 4 ways of JavaScript memory leaks and how to avoid them detailed introduction

Detailed information on how to avoid some common problems

##Introduction: This article will explore common client-side JavaScript memory leaks and how to use Chrome development tools to find the problem. Introduction Memory leaks are a problem that every developer will face eventually, and they are the source of many problems: sluggishness, crashes, high latency, and other application issues. What is a memory leak? Essentially, a memory leak can be defined as: when the application no longer needs to occupy the memory, for some reason, the memory is not reclaimed by the operating system or the available memory pool. Programming languages ​​vary in how they manage memory. Only developers know best which memory is no longer needed and can be reclaimed by the operating system. Some programming languages ​​mention...

3. 4 types of JavaScript memory leaks and how to avoid them

Detailed information on how to avoid some common problems

Introduction: Original text: 4TypesofMemoryLeaksinJavaScriptandHowtoGetRidOfThem Translation from: Alon'sBlog This article will explore common client-side JavaScript memory leaks and how to use Chrome to open...

4. Causes of linux zombie processes and how to avoid zombie processes

Detailed information on how to avoid some common problems

## Introduction: The purpose of setting the zombie state for a process is to maintain the information of the child process so that the parent process can obtain it at a later time. This information includes the child process's process ID, termination status, and resource utilization information (CPU time, memory usage, etc.). If a process terminates and has child processes in the zombie state, the parent process IDs of all its zombie child processes will be reset to 1 (init process). The init process that inherits these child processes will clean them up (the init process will wait for them, thereby removing the zombie state).

5.

Generation of PHP random username account

Detailed information on how to avoid some common problems

Introduction: The difficulty in random generation is how to avoid collisions. Some people say to use mechanisms such as md5 and GUID. Of course you can, but as an account, it looks messy, and the number of generated digits is too long. This method only needs to solve concurrent collisions within 1 second, because the fixed head uses unixtime time, which is accurate to the second. If it exceeds 1 second, the time of this head must have changed. At the same time, this method can also generate random order numbers for users. The test condition is to use a loop to create 10,000 random accounts (millisecond level), with 0 collisions, and 100,000 accounts with approximately 0-3 collisions. There should be no Internet company that would...

6. How to avoid scanning the QR code once and entering information multiple times, or clicking multiple times to confirm multiple redemptions?

Introduction: Hello everyone, I am engaged in WeChat development. For example: How to avoid multiple redemptions when scanning a code or clicking a button to claim a prize. There are two ways to redeem rewards in offline activities: 1. Scan the QR code. 2. Click the redemption button. There were no problems during the test (a small company, just a few people testing). This is caused by user network problems...

7. How to avoid JavaScript memory leaks and memory management techniques

Detailed information on how to avoid some common problems

Introduction: Effective JavaScript web applications must be smooth and fast. Any application that interacts with users needs to consider how to ensure that memory is used efficiently, because if too much is consumed, the page will crash, forcing the user to reload. And you can only hide in the corner and cry.

8. Generator function and yield keyword in Javascript

Detailed information on how to avoid some common problems

##Introduction: In Javascript, what everyone discusses most is the operation of asynchronous programming and how to avoid multiple nesting of callbacks. Once asynchronous operation callbacks are nested a lot, not only will the code become bloated, but it will also be error-prone. Various asynchronous programming solutions are constantly being proposed, such as the well-known Promise, co, etc. The generator and yield discussed today are related to asynchronous programming and can help us synchronize asynchronous programming.

9. PHP generation of random username accounts

Detailed information on how to avoid some common problems

Introduction: The difficulty in random generation is how to avoid collisions. Some people say to use mechanisms such as md5 and GUID. Of course you can, but as an account, it looks messy, and the number of generated digits is too long. This method only needs to solve concurrent collisions within 1 second, because the fixed head uses unixtime time, which is accurate to the second. If it exceeds 1 second, the time of this head must have changed. At the same time, this method can also generate random order numbers for users. The test condition is to use a loop to create 10,000 random accounts (millisecond level), with 0 collisions, and 100,000 accounts with approximately 0-3 collisions. There should be no Internet company that would...

10. javascript - Mobile form submission page, if the network is slow, the form will be submitted twice

Introduction: The mobile website submission page works normally when the network is good. When the network is slow, the mobile page will keep loading, but Fiddler crawls it and there are two submissions of the same content. , how to avoid this happening?

[Related Q&A Recommendations]:

C++, how does ostringstream control the contents of the vector container read to prevent reading garbage data?

javascript - How to avoid shallow copy in js

iOS 7 UIView uses code to draw interface controls, how to avoid the "magic number"

java - How to avoid frequent like operations in web applications, such as clicking, canceling, and clicking again?

How to cancel the 30-second time limit for thinkphp to operate mysql?

The above is the detailed content of Detailed information on how to avoid some common problems. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn