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 a thing 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 directory of the IPC Code contains N multiple build-xxx files. The content in each build-xxx directory is completely similar, and there is a set. Sh.
This is the compilation script.
Take out one of them and 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 would be a tragedy if we had to knock them out before each compilation.
How reasonable is writing them as scripts?
However, whether it's a super master we have seen in the past, or many of our colleagues, they all like to print them out in one word.


For example, file editing.

In onvif, each function, that is, its corresponding function, has its access permission. In onvif2.4, there are nearly 200 functions.
(Onvif-core-specification-v210.pdf
Search for access class in the 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, 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 and only use the open-source notepad ++)
2, CTRL + F, search for access class. Note that you must select: To list rows containing 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 ends
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. In some versions of ultraedit, you can press enter to replace it with other content. If some versions do not work, 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 },
Success


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 actual projects, a 16-bit BMP is required.
What do you do? Save one image as one?


My solution is:
Photoshop has one, similar to the macro recording function, file-> automatic-> batch processing. You can generate an EXE file.
If you drag a directory to the EXE, all the files will be converted to the specified format. Very convenient


Central Ideology

There are still many 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 to 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: 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.