linux

Linux/Python: Monitor /proc/acpi files without polling?

Is there any way to monitor /proc files, such as /proc/acpi/battery/BAT0/state /proc/acpi/ac_adapter/ADP0/state in a non-polling fashion, similar to inotify on a normal filesystem? I want to do this in a PyGTK app, so I tried using PyGObject's gio.FileMonitor, but no dice. A Python solution that plays well with gtk.main() would be id...

Programming with Alice, not working with Arch Linux

I'm having trouble running Alice 2.0 on Arch. I figure I'd ask here because of the number of programmers here who may have experience with either Java or Alice on Linux. When I was running Ubuntu before, going to the proper folder and running ./run-alice would display: attempting to register mp3 capability... Registered successfully. H...

Find original owning process of a Linux socket

In Linux and other UNIX-like operating systems, it is possible for two (or more) processes to share an Internet socket. Assuming there is no parent-child relationship between the processes, is there any way to tell what process originally created a socket? Clarification: I need to determine this from "outside" the processes using the /p...

Can I share a file descriptor to another process on linux or are they local to the process ?

Say I have 2 processes, ProcessA and ProcessB. If I perform int fd=open(somefile) in ProcessA, can I then pass the value of file descriptor fd over IPC to ProcessB and have it manipulate the same file? ...

calling ptrace inside a ptraced Linux process

Someone added to the Wikipedia "ptrace" article claiming that, on Linux, a ptraced process couldn't itself ptrace another process. I'm trying to determine if (and if so why) that's the case. Below is a simple program I contrived to test this. My program fails (the sub sub process doesn't run properly) but I'm pretty convinced it's my ...

C++ / Linux - How to prevent paging for one program / process?

I don't know if SO or SF is the right place for that kind of question but I think it is something you could achieve with code. I have a program that requires much memory, like 2/3 of all the physical ram. After some runtime my operating system begins to swap the program to hdd. But I need the program to respond very fast all the time, s...

Joining Line Breaks in FASTA file With Condition in SED/AWK/Perl one-liner

I have a data that looks like this > sq1 foofoofoobar foofoofoo > sq2 quxquxquxbar quxquxquxbar quxx > sq3 paxpaxpax pax What I want to do is to join them into one lines: > sq1 foofoofoobarfoofoofoo > sq2 quxquxquxbarquxquxquxbarquxx > sq3 paxpaxpaxpax I tried this code but fail. sed -e 'te' -e 'H;$!d;:e' -e 'x;/^$/d;s/\n//g' Wh...

How to open an editor from a bash function?

...

Perl Oneliner to parse multiple conditions in regex

I have a file that contain lines that looks like this: >AF001546_1 [88 - 462] 1 MGQQ >AF001543_1 [88 - 261] ACGT Not that each line can contain 6 OR 5 fields. What I want to do is to capture Fields 1,2,3(num only), 5(num only) and last field (ACGT or MGOQ strings). So the expected output is this: >AF001546_1 88 462 MGQQ >AF001543_1 ...

How to find shared objects loaded during startup of an application?

Hi, I know that using dlopen with RLTD_NOLOAD one can find out whether a shared object is already loaded or not. This, however, doesn't seem to work if a so is linked to the executable and loaded by the linker during application startup. I mean, lets say I have mylib.so and load it with dlopen. Later, if I make dlopen with RLTD_NOLOAD,...

Kdevelop Issues - setting a variable

Hey, I'm using a program which relies on a certain value of a variable to get into a certain function. It's a dummy variable, which I use during debug when I want the program to enter a speific flow. Until now, I used to set a breakpoint near the variable , set it's value to 1 , and the condition would be met. I was wondering if ther...

Why does hiding an owned window switches app in WinForms (.NET)?

I have an application window which covers the screen and there are several minor tool windows which are hidden by default and their 'Owner' properties are set to this main window. When I show a tool window and click one of its buttons it hides itself to show another window. When I hide that another tool window Windows switches app just...

How to prevent Mono from stretching the windows in a WinForms application vertically (on linux)?

The title is quite descriptive I think. My Winforms applications are running on Mono but there is an annoying problem: all my windows in the application are stretched vertically about 1.5 times. So my square shaped buttons and windows become rectangles. Only the sizes are scretched font sizes are not. So there are big gaps in the layout....

Executing a command from C++, What is expected in argv[0]?

I am using execv() to run commands from /bin/ such as 'ls', 'pwd', 'echo' from my c++ program, and I am wondering what value I should provide in argv[0]; const char * path = getPath(); char ** argv = getArgs(); execv(path,argv); ...

Does ACL on Linux impact performance.

We are planning to implement ACL on our Linux platform. Only one particular group is going to come under ACL. This group would have at the max 20 users. All of the restrictions would be at directory level (not at file name level) Would this show any impact on the server's performance/responsiveness? ...

Can't get Logback Eclipse plugin to display output

I followed these instructions here: http://logback.qos.ch/consolePlugin.html I have the correct and found logback.xml, it is set up correctly, and the port is listening. Nothing shows up with logger.error("Test"); It logs to sysout fine when I remove logback.xml, which shows to me that the logback is working fine. I installed the pl...

Great tools to find and replace in files?

I'm switching from a Windows PHP-specific editor to VIM, on the philosophy of "use one editor for everything and learn it really well." However, one feature I liked in my PHP editor was its "find and replace" capability. I could approach things two ways: Just find. Search all files in a project for a string, see all the occurrences li...

Remotely starting GlassFish v3 when server is down.

Hey, I want to start GlassFish in case it crashes or so. Is this possible someway if I don't have administrator privilege on the Linux based server? Any help would be appreciated! Daniel ...

How do I know if jobs have been/are performing? - Crontab

I have followed the suggestion in this question as I am using Django, I have set the script to store date and time of each run of the script in the db, but no entry has been stored yet in the database. Is there a way to figure out, other than typing "top" and searching through? ...

How to implement the Linux top command UI using JAVA?

How to implement the Linux 'top command' style UI using JAVA? And How to run jar in server side itself, and i can see the state of the program after i log in SSH. ...