linux

What is the meaning of SO_REUSEADDR (setsockopt option) - Linux?

From Linux man page: SO_REUSEADDR Specifies that the rules used in validating addresses supplied to bind() should allow reuse of local addresses, if this is supported by the protocol. This option takes an int value. This is a Boolean option When should I use it? Why does "reuse of local addresses" give? Thanks, Ray ...

directory input sanitation

I have a very simple perl script that moves files (don't ask why i cant use cp, its long, sad, and will make you cry). I take 2 inputs from command line, dir1 and dir2. Then i have an internal file list i pull and concatenate the two together. my $file = dir1 . filename That works great as long as the user puts a traling / on their d...

[Solved] How to change Keyboard Layout (a X11 API solution)

I want to change keyboard layout in Linux by programming, What X11's API function does this? ...

How to search for a time value in a log file using shell and awk?

I have a script where a user provides a date, start time and end time. The script will take these values and scan a log file to search for key words in the log file that fall within the time range. When a user uses AM times (Example: 0700 to 0900 - this is 7am to 9am) as a range or PM times (Example: 1400 to 1600 - this is 2pm to 4pm) as...

Android Eclipse, Dropbox, Windows and Linux

I'm using my Dropbox folder to store my Eclipse workspace in (instant back ups) but want to develop on both Linux and Windows. (I think) the workspace file stores the location of the Android SDK which is different on both machines /home/android... and c:\android. Is there any way of developing on Windows one minute and Linux the next? (...

How to interface with PKCS#11 compliant HSM device in PHP

How can I use key material from a PKCS#11 compliant HSM (for example a SafeNet iKey 2032 [USB] or a Aladdin eToken PRO [USB]) in PHP application running on a Linux server? ...

using tar to compress log directory, what happens when apache tries to write during compression?

Hi! I want to run a cron and compress my /var/log directory every hour to a tar file.. so I can backup that file. What would happen to the log files the exact moment I run the tar command, will I miss those log lines or would the different softwares running and using /var/log wait, or will the tar be corrupt etc? I have a busy webserv...

Regarding C/C++ in Linux

I have started using Redhat Linux i would like to know how to use Gcc to program in Linux. Also i would like to know how i can access: C C++ Boost GTK+ Libraries in Linux... i saw them getting installed when i installed Linux on my System. Please Help!! ...

Uploading files to Linux server from Windows C#

I'm still kind of a beginner... I have to write a C# program that works only needs to work on Windows. It has to allow the user to select a file to upload. That file will be uploaded to a folder on a remote Linux server. I know the username, password, and url for this Linux machine. Does anyone know how I go about connecting to the serv...

"Copy failed: File too large" error in perl

Ok so i have 6.5 Million images in a folder and I need to get them moved asap. I will be moving them into their own folder structure but first I must get them moved off this server. I tried rsync and cp and all sorts of other tools but they always end up erroring out. So i wrote a perl script to pull the information in a more direct met...

how to read output of system('ls') ?

I am doing some file IO with c code. I have a particular pattern in my file. I can verify this by a shell command cat abc.txt | grep abc | wc -l. When I execute the same command using System(), it give proper output, but I have no clue how can I get its output into a variable and compare it in my c code itself. I tried looking into man ...

Using Java to call Linux terminal: How to flush the output?

Hi all: 1) I'm using Java to call Linux terminal to run foo.exe and save the output in a file: String[] cmd = {"/bin/sh", "-c", "foo >haha.file"}; Runtime.getRuntime().exec(cmd); 2) The problem is when I plan to read haha.file later in the code, it hasn't been written yet: File f=new File("haha.file"); // return true in = ne...

Using Expect to administer machines via SSH, but does not complete all tasks.

*Please do not pile on and tell me to just use SSH keys. If it bugs you that this is the way I am doing it, pretend that I am trying to telnet in instead. :-) * I am using an expect script to run some routine commands on a set of servers under my control via ssh. The script should run set of commands (eg svn update ~/folderx\r") on e...

Why does gdb tell me a pointer is 4 bytes on x86-64?

Seen with gdb on openSUSE, CentOS, Fedora, and Ubuntu: This gdb was configured as "x86_64-unknown-linux-gnu". (gdb) p sizeof(void *) $1 = 4 (gdb) p sizeof(long) $2 = 4 Why is gdb giving me the wrong answers on all of my 64-bit systems? ...

Help creating ZIP files Windows won't block

I've made an application that takes tagged versions of a project from an hg repository and creates a downloadable ZIP file of that the tagged revision. The files are created on a MediaTemple server running Linux using CodeIgniter's ZIP Encoding Library. Everything works fine... on a Mac. But, when I download the files on a Windows compu...

User-dependent file content

Hi. For some unfortunate reasons, I have to convert a proprietary and binary library from a one-user per workstation to a multi-user per workstation setup. Current setup. A user uses a program linked against a library. This library reads a system wide configuration file (using an hard-coded path, ie /usr/local/thelib/main.conf ) which ...

ANT Execute failed: java.io.IOException: Cannot run program "cp ": java.io.IOException: error=2, No such file or directory

I'm trying to use ANT to copy files from one directory to another directory on Linux. Firstly I used copy task, it works fine but the file mode is not preserved. Then I changed to use , and that's where I got stuck. My target is like: <target name="test"> <echo message="${basedir}"/> <exec executable="cp " os="Linux" spawn="ye...

Linking with multiple versions of a library

Hi, I have an application that statically links with version X of a library, libfoo, from thirdparty vendor, VENDOR1. It also links with a dynamic (shared) library, libbar, from a different thirdparty vendor, VENDOR2, that statically links version Y of libfoo from VENDOR1. So libbar.so contains version Y of libfoo.a and my executable co...

Does valgrind track memory initialization through drivers?

valgrind is reporting uninitialized memory errors from code like this: unsigned char buf[100]; struct driver_command cmd; cmd.len = sizeof(buf); cmd.buf = buf; ioctl(my_driver_fd, READ, &cmd); for(i = 0; i < sizeof(buf); i++) { foo(buf[i]); /* <<--- uninit use error from valgrind */ } If I memset() the buf before the driver call,...

Hadoop Reduce Error

Hi! I keep getting Exceeded MAX_FAILED_UNIQUE_FETCHES; on the reduce phase even though I tried all the solutions I could find online. Please help me, I have a project presentation in three hours and my solution doesn't scale. I have one master that is NameNode and JobTracker (172.16.8.3) and 3 workers (172.16.8.{11, 12, 13}) Here are...