Let's talk about the re-invention of the wheel.

Source: Internet
Author: User
Tags xslt

The following are repeated invention wheel events happening around you. If there are similarities, it is a coincidence.

 

1. Handle freezing of keyboard keysCode

AProgramClick the Enter key to select the first record in the list, and then click it to mark the record as "processed ". That is to say, continuous press of the Enter key will mark a large number of records as "handled"-no one will keep pressing the Enter key, but what if the press of the Enter key gets stuck?

Because this program is used in industrial scenarios, the number of times the return key is pressed is large, and the keyboard gets stuck after a long time. In order to solve the problem of key freezing, a piece of code is added in this program to determine whether the key is stuck. It took a lot of effort to write code and test.

In fact, Windows has built in this function, called "filter key", as long as you set it in "Control Panel-> keyboard.

 

2. Custom XML serialization

When a program transmits data through XML and other programs, it needs to control the content of XML and delete some elements in XML from a specific receiver ).

This program is. developed by. net, the XML generated uses the XML serialization method to serialize the class object into XML. The method to delete XML elements is to directly operate the serialized XML, use dom-like methods to search for a node and a node, find the target element, and delete it. If the XML structure has only one layer, the problem is not big, but if there are several layers, think about how terrible it is, for example

<A>

<B>

<B1> XXX </B1>

<C>

<C1> XXX </C1>

<D>

<D1> XXX </D1>

<D2> XXX </D2>

</D>

</C>

</B>

</A>

In fact,. NET provides two more convenient methods to deal with this situation: Custom serialization and XSLT (XSLT may be slightly less efficient ).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.