linux

how to call lstat(2) instead of lstat(3)?

How do I call the lstat system call in linux/c, not the lstat wrapper around it (lstat(3))? There is no SYS_lstat for syscall(SYS_lstat... ...

How to create a .desktop file application launcher on Linux?

I've developed an application in Qt which uses a launch script, myapp.sh. I've created a .desktop file which launches this script, and set: Command: $PWD/myapp.sh Work path: $PWD However, $PWD prints my home directory when I launch the .desktop file, resulting in attempting to launch ~/myapp.sh rather than ~/Development/build-director...

How to Determine if LCD Monitor is Turned on From Linux Command Line

How do you tell if a computer's monitor(s) are turned on/off from the command line in Linux? I've traditionally thought of monitors as output-only devices, but I've noticed the Gnome Monitor Preferences dialog has a "detect monitor" function. Can this be generalized to determine if a monitor is physically turned off? ...

Loading two instances of a shared library...

Hi. For a test I'd like to load two instances of a shared library from an application. The code in the library provides an API but it does not allow me to initialize two (or more) instances of the library because some of the functions rely on static variables.. I'm currently writing unit-tests for this lib, and I'd like to have two ins...

how to periodically read contents on stdout redirected to file descriptor using dup2

Hi, I am struggling to continuously read contents of stdout which is redirected to file. please help me to resolve issue. My problem in detail is that i have two thread in first thread , i have to execute a c file which is continously writing output to stdout(i.e writing hello world in infinite loop) and in second thread i have to re...

Alternative PHP Cache not working on centos vps

I compiled APC , with succes. Added it to php.ini (php5) Only the first page load works for a page, refresh will give connection error. if i load phpinfo() with the first loading pageload..it indicates apc is working. seems like it works..but is not returning cached pages. kind of newbe in this area..so help is welcome. ...

C# System.PlatformID.Unix vs. Linux

Question: I need to make some system calls in my C# applications. Unfortunately, this behaves differently on Linux than on UNIX. Now I used to switch the Operating system at runtime like this If Environment.OSVersion.Platform = System.PlatformID.Unix Then ' Linux/Unix ' ElseIf Environment.OSVersion.Platform = System.PlatformID.Mac...

What is the common denominator XML library across Linux and Windows for parsing XML in C or C++?

I want to parse some XML in a C and C++ app. This app is deployed to Windows and Linux. What is an XML library that is likely to be installed on many Linux distributions and is readily available on Windows? From my samples of Linux distros, libxml2 seems to be fairly common, but is there a more common xml library? ...

BASH subshells and sudo?

Hello -- I'm writing a bash script that needs to sudo multiple commands. I can do this: ( whoami ; whoami ) but I can't do this: sudo ( whoami ; whoami ) How do I solve this? ...

what is the best IDE to develop large c/c++ apps on Linux

Possible Duplicate: C++ IDE for Linux? what is the best IDE to develop large c/c++ apps on Linux which will provide capabilities to debug/search references etc. ...

How to determine version of glibc (glibcxx) binary will depend on?

It's well known that glibc (and, as far as I know, glibstd++ also) uses symbol versioning mechanism. (For the details refer: How can I link to a specific glibc version.) The question is how to determine exact versions of GLIBC and GLIBCXX will be chosen by linker for names from libc and libstdc++? For example, how to get something like...

Firefox not closing after selenium tests are run

Firefox runs, but when the tests finish executing Firefox stays up. This is on Debian Linux with Firefox 3.6. ...

issue with Python Gtk+

I can't nail exactly when/what update I did on my Lucid box but now I get: Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import gtk /usr/lib/pymodules/python2.6/gtk-2.0/gtk/__init__.py:57: GtkWarning: could not open display warnings.wa...

bash - how to pipe result from the which command to cd

Hi all: I know this must be a stupid question, but how could I pipe the result from a which command to cd? This is what I am trying to do: which oracle | cd cd < which oracle But none of them works :( Is there a way to achieve this (rather than copy/paste of course)? Thanks a lot in advance! Edit : on second thought, this command...

view virtual memory usage visually while debugging

This might be a big ask, but are there any tools that let me view the virtual memory usage of my process in Linux? I am talking detailed, probably graphical view of memory, including what is going into the reserved addresses, the BSS/text/etc segments, heap, stack growth, etc, while I am stepping over the program in a debugger? ...

equivalent encryption/decryption functions on C++ linux and C# windows

hello. i have both a web gui written in C#, running on IIS server and C++ written engine, running on apache. i need my web gui to encrypt and the C++ engine to decrypt the data. what equivalent function can i use to achieve my purpose ? ...

response.setContentType() always trim the space between "; charset" ?

Hi, I'm using Tomcat 6.0.20, HttpServlet my servlet code are as followings :- response.setContentType("application/xml; charset=utf-8"); but each time i will got the content type as : application/xml;charset=utf-8 which is without the space between " ; ". May i know how to bypass the space being trimmed? Is there anyway to do s...

when i easy_install greenlet i got "error: Setup script exited with error: command 'gcc' failed with exit status 1 "

when i easy_install greenlet(also eventlet) as the documents says in ubuntu 10.04 i got the error above. is there anyone know why? Expect your help! And I have install build-essential As I canot take the format right here, so I paste the message printed out there http://sugelawa.appspot.com/?p=35001 Thank u very much! ...

shell script -o operation is not working

DISPLAY_HEADER=1 if [ "$1" != "test" -o "$1" != "test2" ] then if [ $DISPLAY_HEADER == 1 ]; then DISPLAY_HEADER=0 echo "sdasa " echo $1 fi fi its display sdasa and -o is not working ? what is wrong ? ...

How to enable the libattr frature(abbreviated xattr) in linux?

I want to use xattr in python, but found the xattr's keys() is empty, does that indicate the libattr feature wasn't enabled? I've learned the libattr feature is disabled in ext3/ext4 by default, but how to enable it? Expect your help! Thank you~ >>> import xattr >>> x = xattr.xattr('tiger_8a428_userdvd.dmg') >>> x <xattr file='tiger_8a4...