I’m trying to run PHP script (from a Linux server) that will download a file through direct download link and save it on my server. here is the script I’m using: for some reason it doesn’t work for me, any suggestions ? Answer You need to verify that the ports are open on your firewall and u…
Maven, error copying a file with antrun
I have some problems copying files with Maven. I use the antrun plugin in this manner: (I want to copy the file jdk1.5.0_22.tgz to a temporary folder) And it works fine. Now I make a small change to be independent from the jdk file version: (I only change jdk1.5.0_22.tgz to jdk*.*) In this case I have the fol…
How to find the callers and callee of a function in C code in vi/vim?
I want to know how can I easily click (or maybe use some easy shortcuts) on a function name and find all its callee or open where it has been defined. Most of the web manuals in web are really hard to follow or don’t happen to work out. Say I want to click on allocuvm and see where it
O_DIRECT vs. O_SYNC on Linux/FreeBSD
I’m writing a program that runs on both Linux and FreeBSD, and I want to make sure that the data is actually written to the file on the physical device when each write() returns, so that my data won’t get lost by accident (eg, power lost, the process is interrupted unexpected, etc.). According to …
grep without showing path/file:line
How do you grep and only return the matching line? i.e. The path/filename is omitted from the results. In this case I want to look in all .bar files in the current directory, searching for the term FOO Answer No need to find. If you are just looking for a pattern within a specific directory, this should suffi…
How to correctly use Siege to benchmark GET requests?
I use siege to benchmark a local HTTP service: Benchmark result gives ~500 transactions per second throughput. However, when I benchmark the service manually by launching 8 simultaneous loops of curl, the same endpoint gives many thousands per second throughput. So what am I doing wrong with siege? Answer The…
Strange Output Difference Between GCC and MinGW (C++)
I’m working on a project for a computer science class. I wrote the code and tested it using MinGW, and it works fine. I then copied the code over to the university’s Linux server and tested it there, since that’s what my professor grades assignments on. The output is very different – l…
How to restart application in tomcat server
I have been looking for some solution to restart app inside tomcat server on remote linux machine but i haven’t found anything yet. Can anyone please tell me how can i restart the application in Tomcat Server after some time interval without restarting the tomcat server on remote machine? Can anyone hel…
Execute screen command returning `Cannot make directory ‘/var/run/screen’: File exists`
I’ve no idea what is happening. I can run any other shell command through the exec() command and it works fine. It’s clearly something to do with permissions somewhere, but I’m unsure what. I’ve tried this on many different servers and some of them work fine and some don’t. All w…
How to insert a delay between pipelining commands in a bash script. E.g. cat file | telnet mail.domain.com 25
I have a bash script that creates a file and I would like to send an email at the end via telnet. However sometimes it will execute and sometimes it won’t. The command at the end is At the receiving server I see in mail.log the following error when it fails: The same script works perfectly if instead of…