linux

Setting Keyboard Shortcuts in Ubuntu

Is it possible to do the following in Ubuntu? If so can someone point me in the right direction. Say you want to set a keyboard shortcut to do the following: For examples sake, set Alt+F to open Firefox and maximize it, but only if Firefox is not already running. If it is running and not maximized, then maximize the most recently tou...

Linux C and C++: what else should I be logging when handling signals like SIGSEGV?

Working on some linux (Ubuntu) systems, running some in-house C and C++ apps (gcc). There is a long list of signals which are handled, such as SIGSEGV and SIGINT. On signal, the callstack is obtained using backtrace(3) and backgrace_symbols(3). For C++ the function names are even demangled with abi::__cxa_demangle(). My question is: ...

Toolchain question: How do you add a header/lib so the compiler knows where to find it?

I have made a toolchain using this script: http://gist.github.com/403608 (more or less modified to get it to work) Everything is installed and now when I try to compile using it I get an error when I ./configure it says that my C compiler cannot create exeicutables. I'm thinking that my compiler just doesn't know where to look for all ...

How to turn on STL backward compatability?

I am trying to compile something that uses Google's sparsehash include files. libs/include/google/dense_hash_map:93:60: error: ext/hash_fun.h: No such file or directory ^Cmake: *** [all] Interrupt I know that hash_fun.h exists in /usr/include/c++/4.3/backward/hash_fun.h. I am just not sure how to make google sparse hash use it. Any id...

How to access the fields of a timeval structure

I'm trying to print the values in a struct timeval variable as follows: int main() { struct timeval *cur; do_gettimeofday(cur); printf("Here is the time of day: %ld %ld", cur.tv_sec, cur.tv_usec); return 0; } I keep getting this error: request for member 'tv_sec' in something not a structure or union...

Patching code/symbols into a dynamic-linked ELF binary

Suppose I have an ELF binary that's dynamic linked, and I want to override/redirect certain library calls. I know I can do this with LD_PRELOAD, but I want a solution that's permanent in the binary, independent of the environment, and that works for setuid/setgid binaries, none of which LD_PRELOAD can achieve. What I'd like to do is add...

printing a timeval struct

Possible Duplicate: How to access the fields of a timeval structure continue to the link below please about this problem: http://stackoverflow.com/questions/4029923/how-to-access-the-fields-of-a-timeval-structure ...

strtok function thread safety

I have been spending some time in debugging a programme which gives segmentation fault. The bug is quite indeterministic and intermittent, which is annoying. I narrowed it down to the calling of strtok. I suspect that it is the calling of strtok to split string in two different threads that causes the segmentation fault. Can I call strto...

How to use two different versions of a linked lib (i.e. openssl) – one static and one dynamic?

Given I have a shared lib (“dynamic_one”) which links a specific version of a static lib (say 0.9.8 of openssl). Further I have an app which links another version of this lib (say 1.0.0 of openssl) dynamically and also loads the “dynamic_one” lib. Actually I encounter strange memory corruptions due to the incompatible ABI of the two ope...

How can I execute an SQLite statement in C++

I have the following command which works fine on Linux Console. But to get the result to a cpp file I have to store it to file and then read it. But is there a way I can directly execute this command in C++. /usr/bin/sqlite3 /etc/myDB/db/share.db "select path from folder_info where ftp='YES'" ...

Without access to argv[0], how do I get the program name?

Hello, I know the program name is passed as the first argument, and next simple example will print it to the standard output : #include <iostream> int main ( int argc, char *argv[] ) { std::cout<<argv[0]<<std::endl; } Is there a function to get the program name? EDIT I am starting the program from the shell, and the above code wi...

How to find a pattern, and replace it differently?

Hi, I'm having problems with removing duplicate lines in a file, and replacing them a with a non-duplicate line. Ideally, I would just like to replace it with a continuous sequence, so that the duplicate lines could be separated. I was considering sed with some kind of wildcard (*): sed -e "s/text_pattern/text_pattern*/g" my_file.txt ...

Graphical User Interface for git

Possible Duplicate: Git gui client for Linux Does anybody know a good GUI for git on Linux Ubuntu? ...

bash script, line 30: syntax error: unexpected end of file

I`v wrote some script, and have unexpected end of file echo off if [$JAVA_HOME = ""]; then goto no_java_home fi if [$SRV_HOME = ""]; then goto no_srv_home fi echo Uses JAVA_HOME=$JAVA_HOME echo Uses SRV_HOME=$SRV_HOME export ACP="" export ACP=$ACP;$JAVA_HOME/lib/tools.jar export ACP=$ACP;$SRV_HOME/ant/lib/ant.jar export ACP=$ACP;$SRV_...

Setup "open files" limit in Linux per user. Cannot setup more than 1024

I try to increase open file limit for certain user on CentOS 5.5 Linux. I added a new line to /etc/security/limits.conf: seed hard nofile 10240 Then do test: runuser -s /bin/bash - seed -c "ulimit -S -c 0>/dev/null 2>&1; ulimit -a" 0 core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited...

How can I automate testing installation OS to specific hardware?

Hardware is a x86-based platform with two network, usb, vga, and ps/2 ports. I need to test self-assembled linux-base OS. Installation is without any GUI. How can I automate this proccess? ...

Linking against an old version of libc to provide greater application coverage

Linux binaries are usually dynamically linked to the core system library (libc). This keeps the memory footprint of the binary quite small but binaries which are dependent on the latest libraries will not run on older systems. Conversely, binaries linked to older libraries will run happily on the latest systems. Therefore, in order to e...

join/leave multicast group using libpcap

Hello, I need to receive a multicast stream but filter incoming packets by source MAC address on CentOS 5.5. I'm planning to use libpcap library. Is it possible to join/leave multicast group using libpcap? If yes, how to do that? Thanks ...

stty: standard input: Inappropriate ioctl for device

perl script.pl --f1="t1" --f2="t2" --f3="t4" --f4 < /home/joe/a.txt script.pl use Getopt::Long; my ($f1, $f2, $f3, $f4) ; GetOptions ( 'f1=s' => \$f1, 'f2=s' => \$f2, 'f3=s' => \$f3, 'f4' => \$f4, ); if ( $f1) { system('stty -echo'); print "Password:"; $pwd = <STDIN>; syst...

Watermarking video from the Linux command line

Hi, does anyone know how to watermark video from the Linux command line using a simple tool? Watermarking in ffmpeg isn't supported in the current version, and requires a custom compile. Max. ...