Be a "lazy" Programmer

Source: Internet
Author: User
Tags ultraedit

Laziness is one of my major shortcomings, but I found that the two sides of things are fully reflected in laziness. Laziness is not useless.

For example, write a script.

There are two reasons for writing scripts: one is to save trouble and you don't need to write so many things at a time. Second, I am forgetful and cannot remember lengthy commands.
Take the IPC code as an example,
The root folder of the IPC Code contains N multiple build-xxx files. The content in each build-xxx folder is completely similar, with a set. Sh.
This is the compilation script.
Take out one of them. The content is roughly as follows:
Cmake ..-dcross_compile = arm-hisiv100nptl-linux--dboard = hi3518c-dconfig_path =/etc/CONF. d/jovision/-dtiny_onvif_support = on-dsd_record_support = on-dgb28181_support = on
Let's take a look. It is a tragedy to think of them before each compilation.
How reasonable is writing them as scripts?
However, whether it's a super expert that the company has ever met, or many colleagues today, they all like to knock them out in one word.

For example, file editing.

In onvif, each function, that is, each of its corresponding functions, has the permission to ask questions. In onvif2.4, there are nearly 200 functions.
Search for access class in this PDF to obtain the access permission for each function. For example, the setsystemdateandtime permission is: rite_system)
So what should we do with the permissions of these functions?
Before reading it down, you 'd better download it and find a solution.

Here I will introduce my practices:
1. CTRL + A. Select the full text and copy it to ultraedit. (Many colleagues have a strong copyright awareness. They only use the open-source notepad ++)
2, CTRL + F, search for access class. Note that you must select: To list rows that contain strings
3. Click Next. The tool will list all rows. Click "Clipboard"
4. Create a New ultraedit file and paste it. Then you will get something similar to the following:
Setntp access class: write_system
Getdynamicdns access class: read_system
Setdynamicdns access class: write_system
Getnetworkinterfaces access class: read_system
5. Skill 1 ends and Skill 2 begins
6. Access class in the middle: Use the replacement tool to replace them with spaces.
7. replace two spaces with one.
8. keep replacing it until it fails.
9. Replace the space ",
10, it becomes like this:
Getwsdlurl ", pre_auth
Getservices ", pre_auth
Getservicecapabilities ", pre_auth
Getcapabilities ", pre_auth
Gethostname ", pre_auth

11. Some versions of ultraedit can be used to replace the carriage return with other content. If some versions cannot be used, you can consider using notepad ++.
12. Press enter to:}, \ n {", and finally to the following:
{Getwsdlurl ", pre_auth },
{Getservices ", pre_auth },
{Getservicecapabilities ", pre_auth },
{Getcapabilities ", pre_auth },
{Gethostname ", pre_auth },

For example, image processing

When we were doing DVR, the US Trade Union made a bunch of pictures, all of which were PDF files.
In the actual project, 16 bits of BMP are required.
What do you do? Save one image as one?

My solution is:
Photoshop has a function similar to macro recording. File-> take the initiative-> batch processing. Can generate an EXE file.
Drag a folder to the EXE to convert all the files to the specified format. Very convenient

Central Ideology

There are a lot of methods, but I am going to teach people to fish. Hope someone can understand the spirit and forget the tricks.
Before starting a job, consider whether there is a way to be lazy. Especially repetitive work. There must be some methods or tools that can quickly complete the task.
The difference between humans and animals is that they use tools, right?

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: 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.