I write complex TCP/IP client application that generates a lot of outgoing TCP connections. I try to use boost::asio as portable TCP/IP networking implementation in C++. I found following issue. See the code: This code runs background thread to execute io_service::run method. It is supposed that we’ll h…
Converting euid and egid to username and group name
I looked at some of my system logs and its claiming about errors that apply to random effective user id’s and group id’s. For example: I’m just wondering if theres a simple command I can use in the shell to identify the real username and group ID based on the numbers (which in this example i…
Grep lines from a file in batches according to a format
I have a file with contents as: Hi welcome ! Chunk Start Line 1Line2! Chunk Start Line 1 Line 2 Line 3 ! Chunk Start Line 1Line 2Line 3Line 1Line 2Line 3Line 4Line 5Line 1Line 2Line 3Line 4 Now, everything beginning with “! Chunk Start” and before the next “! Chunk Start” is a chunk, i…
My command line gets colored after I output a colored command in linux terminal
I wanted to have colored ping command output using a shell script. But in the process, I ended up having my command line also colored. Is there any way I can have only my output colored? Here is my bash script: Please see this for example: Answer You need to reset the color after you set it. With tput, this
Get latest release version number for chrome browser
I am trying to figure out a rather stable way to programmatically determine the latest release version number of the chrome browser. It doesn’t have to be failproof as it’s only a nice-to-have-feature I can blend out whenever the result looks “suspicious”. There seems to be no API (is …
Read noonnamed pipe in terminal
Hellow. I have very simple C program. I create pipe in program (standard, non-named). Can I read pipe of existing process in terminal (stream with > or cat?). I try it but my command do nothing. Im know tkat i can create named pipe who is very easy for external I/O. I have number of pipe for /proc/number/f…
Propagating all events from a X window
I’a currently working on a small utility, it’s my first ever X project. The utility is used to draw a small circle around your mouse pointer. I use an app called Pinpoint to do the same on my Mac, it helps me find my mouse as I’m visually impaired. The utility creates an transparent X window…
Looping through the file,searching nan’s
I have file with 12000 lines,some of them are nan’s I have written bash,to search for these nan’s But only this appears on the screen What’s wrong with my bash? Answer you are using exit statement, that means this script will immediately exit after printing FIRST error: Not a number . So wha…
Read binary file,cannot execute binary file: Exec format error
My code When I compile with gcc gcc -c n1.c -o n1 and try to run it I got File m_6 and n1.c were executed on the same machine. How to solve this? Answer gcc -c compiles source files without linking. Cancel -c from from command.
How to Grep for special characters in Linux
I wanna grep this $_SESSION[“sig”] in Linux, and find out all of files with this variable. I used but they are not working How can I fix this? Thank you. Answer Just use the grep -F ‘$_SESSION[“sig”]’ * command.