I am struggling to read current frequency channel of Wifi card using Wireless Extension Tools for Linux library with following Qt/C++ method: Now, iw_get_ext always returns -1 and errno is set to value of 22. I’ve taken a look at the errno.h and search for error 22 and I’ve got following error dec…
Printf makes program work in C, htonl and ntohl not working?
This is for a Linux system, in C. It involves network programming. It is for a file transfer program. I’ve been having this problem where this piece of code works unpredictably. It either is completely successful, or the while loop in the client never ends. I discovered that this is because the fileLeng…
Increasing memory through terminal in linux through “-XX:PermSize=192m -XX:MaxPermSize=2g -Xms2g -Xmx2g”
I am running java developer IDE and in a process of trouble shooting a module . For this i have increased the logging memory of the tool, Now when logging it error is coming on console as i am using below command for increasing memory earlier it is my system memory is 16 GB through the command cat /proc/memin…
Linux context switch internals: What happens when process exits before timer interrupt?
How is context switch made in linux kernel when process exits before timer interrupt? I know that if the process is running and timer interrupt occurs then schedule function is called automatically if the flag is set, schedule function then selects next process to run. Basically in this case the schedule func…
PID of infinite loop run in background (&) in bash script
I have simple bash script How can I assign pid of this loop to variable, to kill process in future ? I try trap, but loop has own pid so I should know pid of loop running in background to kill it for example after SIGTERM. Answer The PID of the background-process started can be extracted from this $! variable…
Mail notifications through Qt on Linux
I want to write a program which would show a pop up if a new mail arrives through Gmail. What library/api am I supposed to use get notifications from Gmail pro-grammatically? Answer You can treat GMail as an IMAP server and work with it like that. You’ll want a C++ IMAP library, there’s quite a fe…
Diifferetn result in Linux and Visual Studio
Does anybody know why compiling program in Visual Studio 2015 gives different result (those are correct I want to keep them) vs Linux Ubuntu (those are wrong).? Answer Reading beyond the end of an array invokes undefined behavior in C. Once your program invokes undefined behavior anything can happen or nothin…
GCC compiled code: why integer declaration needs several statements?
I’m learning AT&T assembly,I know arrays/variables can be declared using .int/.long, or using .equ to declare a symbol, that’s to be replaced by assembly. They’re declared insided either .data section(initialzed),or .bss section(uninitialzed). But when I used gcc to compiled a very simpl…
How can GNU time utility ignores pipe symbol and takes all what left in command line as one execve argument?
Linux, if I run time tar -c stock_file | lz4 > stock_file.lz4, actually it makes something like time (tar -c stock_file | lz4 > stock_file.lz4), but if I write one little program: Then I build it to pretending_time and run it: Well well, the parameter is well not well | cat, then I have the check the so…
Better way of using the redirection symbol in conjunction with find -exec
My goal is to empty every file in a directory. I DON’T want to actually delete the file, I just want to delete it’s contents. If you want to do this with a single file you can do > file.txt If I want to run this operation on every file in a directory I can do this: Notice how the