linux

Which program creates a C array given any file?

I remember seeing in the past a program that would take any file and generate a C array representing that file as output; it would prevent distribution of a separate file in some cases. Which Unix/Linux program does that? ...

Transferring an Image using TCP Sockets in Linux

I am trying to transfer an image using TCP sockets using linux. I have used the code many times to transfer small amounts but as soon as I tried to transfer the image it only transfered the first third. Is it possible that there is a maximum buffer size for tcp sockets in linux? If so how can I increase it? Is there a function that does ...

should I be calling lckpwdf() prior to getspent()?

Is lckpwdf() and ulckpwdf() intended to be used only for apps directly accessing the shadow password file? More precisely, my question is: If I call the usual API such as getspnam() or getspent(), should I be calling lckpwdf() first, or is that automatically done by getspnam(), etc...? ...

Is there a linux based terminal app that allows links to be clickable?

Is there a unix based terminal (extension or app) that does link resolution. In particular when I see things like: /home/sam/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue' /home/sam/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active_support/core_ext/benchmark.rb:17:in `...

Intercept WM_DELETE_WINDOW on X11?

I'd like to intercept the WM_DELETE_WINDOW message that is posted to a certain selection of windows that an application I'm writing (AllTray), so that I can act on it instead of the application receiving it. I'm currently looking at trying this at the GDK level via gdk_display_add_client_message_filter if possible, but I'd be happy with...

Shell script to log server checks runs manually, but not from cron

I'm using a basic shell script to log the results of top, netstat, ps and free every minute. This is the script: /scripts/logtop: TERM=vt100 export TERM time=$(date) min=${time:14:2} top -b -n 1 > /var/log/systemCheckLogs/$min netstat -an >> /var/log/systemCheckLogs/$min ps aux >> /var/log/systemCheckLogs/$min free >> /var/log/syste...

How to wait for exit of non-children processes

For child processes, the wait() and waitpid() functions can be used to suspends execution of the current process until a child has exited. But this function can not be used for non-child processes. Is there another function, which can wait for exit of any process ? ...

get group id by group name (Python, Unix)

Hi, I want to use Python to get the group id to a corresponding group name. The routine must work for Unix-like OS (Linux and Mac OS X). Best, ~S Edit: This is what I found so far >>> import grp >>> for g in grp.getgrall(): ... if g[0] == 'wurzel': ... print g[2] ...

Echo off problem in console application (Linux)

Hello, I am facing a strange problem in my console application. First of all, the code snippet: main.cpp #include "DebugInterface.h" static sigset_t signalSet; static pthread_t CleanupHandlerThread; DebugInterface* debugInterface = NULL; void* CleanupHandler (void* param) { int32_t sig, err; err = sigwait (&signalSet, &sig)...

bash: defining a variable with or without export

What is export for? What is the difference between: export name=value and name=value ...

Is msgsnd() thread- and/or process-safe ?

What happens if two pthreads are calling the msgsnd() function at the "same" time, posting message to the same message queue ? What if two processes do the same ? Does it matter if they are threads or processes ? Specifically interested for Linux 2.6.15-2.5 #1 SMP PREEMPT Tue Sep 19 10:56:25 CDT 2006 x86_64 x86_64 x86_64 GNU/Linux ...

Is there any user-mode multi-threading library/framework for C++ under Linux?

I am looking for user-mode multi-threading library/framework for C++ under Linux. I am familiar with boost::thread and ACE_Thread_Manager but AFAIK both of them eventually use OS native thread's support. Suggestions will be highly appreciated. ...

obscure problem with sigsetjmp on linux with C

For some reason when I return from the signal handler for SIGFPE, the variable i is one less than I expect it to be, to get the correct results from my program (iterate through all of the pairs in the pairs array) I must check the return value of sigsetjmp and increment i if I am returning from a signal "catch". Why is this? Why is the i...

difference between vi/vim

Many a times i have seen that people are discussing about the VI/VIM editor,since i use Vi editor,but for the curiosity to know the major difference between two awesome editor i have started using it .but couldn't figure out the major difference between two seems almost same. ...

Postgres visual database design tool for Linux

I'm not looking for something like phpPgAdmin or pgAdmin III. I'm looking for something similar to MySQL Workbench. A tool to design databases visually and convert those visual designs into queries that will generate the database. It should also be able to create a visual representation of an existing database and use that visual repr...

C++ IDE on Linux

Hi, We trying to choose an IDE for C++ development on Linux. The proposed options are KDevelop and Eclipse. Eclipse is highly customizable, but Java centric and heavy. KDevelop is bounded to particular KDE (I believe because KDE API) and can not be replaced if required. What you use and why? Thanks Dima ...

Check signature of Linux shared-object before load

Goal: Load .so or executable that has been verified to be signed (or verified against an arbitrary algorithm). I want to be able to verify a .so/executable and then load/execute that .so/executable with dlopen/... The wrench in this is that there seems to be no programmatic way to check-then-load. One could check the file manually and...

Bash redirection combined with "double pipe" notation

Is it possible to combine redirecting output to a file and pipes with ||? (Not sure what this is called) Example: (wget -qO- example.com/duff || exit) | some_processing >> outfile.txt If wget fails, I would like to exit and not run some_processing or create the blank file. ...

how do I read everything currently in a subprocess.stdout pipe and then return?

I'm using python's subprocess module to interact with a program via the stdin and stdout pipes. If I call the subprocesses readline() on stdout, it hangs because it is waiting for a newline. How can I do a read of all the characters in the stdout pipe of a subprocess instance? If it matters, I'm running in Linux. ...

Recursively traverse Samba shares?

With bash on linux, how would I write a command to recursively traverse shares mounted, and run commands on each file, to get the file type and size, permissions etc, and then output all of this to a file? ...