Work run into technical problems and treatment experience (b)

Continued essay: https://www.cnblogs.com/kingstarer/p/8469016.html "work run into technical problems and treatment experience."

 

Since the content lot of spaces, if directly pasted in the text, after the publication spaces will disappear, leading to version looks ugly.

So I put the main content of the code as published.

I think every day to work do run into a problem with a simple note very good, one can exercise their skills, and secondly to facilitate their future review, because after work is likely to run into the same problem.

Because every time I note, may just record the keywords, but to do is share issue essays, only these keywords definitely not enough, we saw a loss records.

Therefore, the need for secondary finishing ago, currently finishing to 20,180,424, there are more than a year notes, the back will continue to organize, have published.

hopefully this can provide beneficial help to everyone.

20,171,226 : 
    socket close the child process the parent process can use, but the shutdown of the parent process can not be used. 
    After the shutdown also need to close. 0 close count is automatically shutdown. 

    recv function Definition: 
    MSG_PEEK recv read-only data is not taken 
    msg_waitall recv wait until all the data has been read before returning 
    msg_confirm send other received data until it returns 
    MSG_NOSIGNAL send the other party does not send a signal in the closed sigpipe socket (or returns an error) 
    the TCP_NODELAY, appears 40ms delay most likely is due to the interaction is not set TCP_NODELAY long connection, there are times when a packet is sent is very small, 
    plus a head packet will lead to waste, but due to the transmission of more data, it may cause network congestion, the system defaults to the bottom of the Nagle algorithm, multiple packets can be assembled into a continuous transmission of larger data packets and then transmitted. but for our interactive application meaning not big, in which case we request to send a small packet, it will immediately be waiting, there will not send back a packet with 
    the next data packet, the server at this time there is a problem of delayed return. for this problem can be solved by setting the server end TCP_QUICKACK options. TCP_QUICKACK allow the server response to the ack packet as soon as possible.   
    Using writev plurality of small packets send 
    port on a machine is limited, up to 65,535 (an unsignedchar ) months, in the system file / proc / sys / net / ipv4 / ip_local_port_range we generally see 32768 61000 results, where the port can use this machine range is 32768-61000, 
     Tip: general service model is a server-side port, the client uses a different port to connect, but in fact we can also reverse this process, we only use a client server-side but is really a different port, the client does the following modification of the original some way to allocate a handle socket -> connect handle distribution changed to allocate a handle socket -> socket set on SO_REUSEADDR options -> the same bind as a server port -> Connect can be achieved   
    but this application is relatively small, for as web crawlers this situation will be relatively more applicable, but 6w connection has been more than enough to continue to increase in significance is not necessarily as big as it wants.  
    According to this situation, in general, connect a non-existent ip address, initiating service connections need to wait for the return of the ack, because the ip address does not exist, there will be no return, this time will wait until the time-out before returning. If the connection is an existing ip, but there is no corresponding port services, this time will immediately get returns, receive the results of a ECONNREFUSED (Connection refused) a.  
    But there is in our network will have a limited number of routers, such as some of our machines do not allow access outside the network, ip this time if a visit is outside the network ip (whether or not there), this time will soon get a return Network IS unreachable error, no need to wait. 


20,180,108 :
    g_trash_stack_push will destroy the contents of the stack to keep the inside of 


20,180,110 : 
    Experience: multi-disk system disk may be hot spots, consider using striping makes file systems uniformly distributed 

20,180,112 : 
    Linux stack is a downward extension, so if the array bounds write occurs, damage contents of a variable previously defined array variable. (However, it is the same declaration order from small to large distribution structure inside space) 



20180115 : 
    network programming, the server receives the client sends data to prevent the data is incomplete. The client preferably allows transmission data before transmission to the packet length. 

20180116 : 
    Under linux, select function after the timeout parameters struct timeval modify the parameters need to reset the timeout to the desired 

    read the end of the file: IF ( 0 > (FD = Open (strLogFile, the O_APPEND | O_WRONLY | the O_CREAT | O_TEXT, 0644 ))) 


20,180,201 : 
    If you can not backspace to delete characters, terminal display failure and other problems, the general parameters can observe whether the abnormal stty: stty - a 


20,180,228 : 
    recently positioning system transmission problems appear to P9 data warehousing failure.
    Let me talk a bit of background:
    Our database character encoding is GBK, P9 database encoding is UTF8. Every day we have some data systems need to be exported into a file storage system to pass them. 
    Our approach is to export the GBK encoded files then converted into UTF8 format preached to them by iconv. 
    Agreed to file column separator is  :" | @ | " 
    emerging issues: 
    Due to lack of a library table has a field length, substr when we need to re-warehousing storage, resulting in some data have half of Chinese problem. 
    This will export the data to a vertical line when the latter half Chinese combined iconv then converted to a file format to a new utf8 Chinese. 
    The results will lead to the converted data missing one, the other storage system failure. 
    Solution: 
    is converted into UTF8 format field to export, if the conversion run into unusual characters are ignored. 

20180301 : 
    Today a users system SMS verification code is a brush, although control of the ip phone number and sending frequency, but still a man with chicken n more attacks. 
    The original line item for the user experience, without first verifying graphic code to send text messages directly caused by the scourge. 


20.18031 million : 
    Everything does not search by default c drive, you need to force it to search. Tools -> Options -> Index -> Folder to add user directories to be searched. 

20,180,312
    sqlplus the set term off the results can not be displayed sql () script 

20,180,316 : 
    the case of hybrid coding vim to open a file, Chinese garbled prone. You can force vim to open files as utf8 format: E ++ ENC = utf8 



20,180,318 : 
    When you compile the code error today, suggesting error C2065: "HANDLE_TIMEOUT": undeclared identifier. 
But I clearly defined HANDLE_TIMEOUT in front of the macro: #define HANDLE_TIMEOUT ()   
    thought there was a compiler bug, and later found out that the wording of fishes use the macro function: HANDLE_TIMEOUT (), I had to write directly to the HANDLE_TIMEOUT 

20,180,318 : 
    today with plsql when an error while executing multiple insert statement: ORA - 0091   invalid character 
then I put on before and after the sentence She BEGIN and END; it 


20,180,319 : 
    the SELECT returns readable, but recv returns 0, this is generally because the other side is closed socket 


20,180,322 : 
    SourceInsight before Double-brackets can quickly jump to a position corresponding to the other bracket. 


20,180,408: 
    Release version gdb can not tell Plus - G recompile 

20180410 : 
    today found a command ss, said to be much faster than netstat. netstat -anp <=> SS - TANP 

    ue highlighted word method: the Shift + Double-click the word 

20180411 : 
    today colleagues suddenly can not log on oracle, using the User sqlplus / pwd @ dbname error: "ORA- 12154 : TNS: could not Resolve the connect identifier specified ", let me help him look. 
    I used his machine to perform tnsping dbname, suggesting " tns-12533: tns: Illegal address the Parameters " , the feeling is not configured tns. But the view tns configuration ORACLE_HOME} {$ / Network / ADMIN / the tnsnames.ora, there's no problem with the configuration. 
    Yesterday it was later found in the .profile set up TNS_ADMIN, the tns configured to point to another directory, that there tns configured wrong. I did not check this variable before, to see the default directory ORACLE_HOME} {$ / Network / ADMIN / , so I did not find out why. 


20180412 : 
    Today error when uploading files using sftp" Fail to the Upload failure " , that is the file in question, the investigation did not find for a long time. It was discovered later that the target machine hard disk space is full. 

    Today there gdb debugger, learning a few tips: 1 debug the machine with the compiled source directory source directory different machine, you can use Substitutes-path the SET / XXA / XXB instruct gdb to find the source files to a specified directory. 
    .gdbinit the SET Auto-the Load Safe-path / 
     Print command to modify variable values, usage: the X-Print = 4 
    using the watch command can automatically make gdb breakpoint when a variable is modified: watch * ( char * ) addr2line 

20,180,413 : 
    Today found colleagues in the .h which modified the definition of the structure, but there is no corresponding compile all .c. Resulting in cross-border run-time memory. 
After recompiling the program make clean enough. 
    This problem is indeed more difficult to resolve, because of the poor depend on what is determined for each .c .h write makefile 

    today wrote a will / | TRproc following environment variables files into export statement script 
    CAT Environ ' \ 0 '  ' \ n- ' | awk -F ' = '  ' { 
    the printf ( " export% S% C% S% = C \ n- " , $ . 1 , 39 , $ 2 , 39 ); 
} ' # 39 is the single quotation marks asscii code 


20180414 : 
    later discovered that the Delete * from the Tab; also cause high water level. Before I thought it was only conditional delete will cause high water. 
oracle for each segment (each table can be simply understood as a) has a high level (HWM) labeled limit the use of space. hwm default will only increase, not decrease. 
So if there is a lot of data is inserted, and then delete a large table of data, there will be a high water level far in excess of actual data footprint.
And scans the database to do a full table scan all the data below the high water mark, which sometimes can lead to data table is small, but it is still very slow query situation. 


20,180,416 : 
    HTTP Error 400 due to the common standard syntax error, the server can not understand the request. 404 Web server can not find the file or script that you have requested. 

20180417 : 
    Today screen to find problems when using awk program on the windows Chinese output: 
    1 when using the print output string, the string if there is Chinese, will get an error fatal: print to " Standard the Output " failed The (Invalid argument)
     2 using printf output when a string, the string if there is Chinese, will get an error fatal: printf to " Standard the output " failed the (Bad File descriptor) 
    the solution is not to run directly output awk result to the screen, use redirect the output to txt, it will not the error. 

20180419 : 
    When vs2015 compile the source code has utf8, you need to add a BOM in the file header, otherwise it will error 


20180424 :
    C language to write some macros within the macro variable name is dead, leading to the use of different variables can not name the macro is called 
, for example, the following macro, mandating the use of variable names txnJnl, if you want to use the variable name txnJnl_realName failure will be called 
#define XML_TO_JNL ( IDX) \
 do {\ 
    NRCXmlIpc2St = (& txnJnl, X2S (IDX)); \
     IF (NRC) return NRC; \ 
} the while ( 0 ) 
    In this case c ++ can be used to change reference variable names, you can use the following encoding techniques curve c National Salvation
 #define   txnJnl txnJnl_realName 
    REQ_XML_TO_JNL (X2S_REVERSALAUTHREQ2ONLJNL); 
#undef txnJnl 
    but it is best recommended to write a macro parameter variable name bring 
#define REQ_XML_TO_JNL (txnJnl, IDX) \
 do {\ 
    NRC = XmlIpc2St (&txnJnl, X2S (IDX)); \
     IF (NRC) return NRC; \ 
} the while ( 0 ) 
    so that it meets the design principles of high cohesion and low coupling.

 

Guess you like

Origin www.cnblogs.com/kingstarer/p/11031121.html