linux

How can I include platform-specific native libraries in the .JAR file using Eclipse?

Hello all, I am just starting to learn JNI. I have been following a simple example, and I have created a Java app that calls a Hello World method in a native library. I'd like to target Win32 and Linux x86. My library resides in a DLL, and I can call it just fine using LoadLibrary when the DLL is added to the root of my Eclipse proje...

How can I quickly sum all numbers in a file?

I have a file which contains several thousand numbers, each on it's own line: 34 42 11 6 2 99 ... I'm looking to write a script which will print the sum of all numbers in the file. I've got a solution, but it's not very efficient. (It takes several minutes to run.) I'm looking for a more efficient solution. Any suggestions? ...

Is a signal sent with kill to a parent thread guaranteed to be processed before the next statement?

Okay, so if I'm running in a child thread on linux (using pthreads if that matters), and I run the following command kill(getpid(), someSignal); it will send the given signal to the parent of the current thread. My question: Is it guaranteed that the parent will then immediately get the CPU and process the signal (killing the app if ...

Sockets and multithreading

Hi to all! I have an interesting (to me) problem... There are two threads, one for capturing data from std input and sending it through socket to server, and another one which receives data from blocking socket. So, when there's no reply from server, recv() call waits indefenitely, right? But instead of blocking only its calling thread, ...

Process list on Linux via Python

How can I get running process list using Python on Linux? ...

Round all numbers in file to equal length in Bash?

Hello, Is there easy way how to round floating numbers in a file to equal length? The file contains other text not only numbers. before: bla bla bla 3.4689 bla bla bla 4.39223 bla. after: bla bla bla 3.47 bla bla bla 4.39 bla. Thanks ...

Real-time aggregation of files from multiple machines to one

I need a tool which gets a list of machine names and file wildcards. Then it connects to all these machines (SSH) and begins to monitor changes (appendings to the end) in each file matched by wildcards. New lines in each such file are saved to the local machine to the file with the same name. (This is a task of real-time log files colle...

Is there a way to find the running time of the last executed command in the shell?

Is there a command like time that can display the running time details of the last or past executed commands on the shell? ...

php (rar) i want to rar a folder using rar on Ubuntu (linux) by php (on dedi server) noob

hey guyz i want rar (not tar) my folder on my server by using php RAR RAR 3.93 Copyright (c) 1993-2010 Alexander Roshal 15 Mar 2010 Registered to my real name OS Ubuntu Release (Karmic) kernel linux 2.6.32.2-xxxx-grs-ipv4-32 Gnome 2.28.1 latest php an lighthttpd i have tried these things http://php.net/ma...

Collaborative kernel development

Hi, I have to develop a patch for the linux kernel (2.6) for an university course I'm attending. I have to develop this patch with a friend of mine and we need to edit the same files on our computers (2-3 PCs). So, we want to use something like a collaborative editor and/or a version control system. The problem is that we never used some...

How do I build git on Red Hat Enterprise Linux 3?

When you try to build git v1.7.0.6 on Red Hat Enterprise Linux 3, you get an error: In file included from /usr/include/openssl/ssl.h:179, from git-compat-util.h:139, from builtin.h:4, from fast-import.c:147: /usr/include/openssl/kssl.h:72:18: krb5.h: No such file or directory I have the answer to...

x86 Assembly: Before Making a System Call on Linux Should You Save All Registers?

I have the below code that opens up a file, reads it into a buffer and then closes the file. The close file system call requires that the file descriptor number be in the ebx register. The ebx register gets the file descriptor number before the read system call is made. My question is should I save the ebx register on the stack or somew...

python operation not permitted (graphtecprint)

I'm running a python program. When it get's to these lines: f = open("/dev/bus/usb/007/005", "r") x = fcntl.ioctl(f.fileno(), 0x84005001, '\x00' * 256) It fails saying: IOError: [Errno 1] Operation not permitted What could be causing this problem? ...

Drawing on top of every windows on X11

Hi, I am trying to make an arcade machine. The user will purchase credits, which will allow him to play for X minutes. I want to write "9:42 minutes left" at the left corner of the screen, even if he's playing a full screen game (UrbanTerror, for example). I would really like if I could do this with Ruby, but any other language is OK. ...

How to set a global CURL rate(speed) limit?

I had a look around for the CURL settings file but didn't find it in /etc/ and didn't find much on the curl site ether... So basically what I want to do set a maximum speed limit that curl can upload at (no matter how many instances of it are running) so that my server has some upload capacity left for other tasks. ...

Linux Kernel - Refreshing VFS Dentry Cache

I wrote a system call that opens a directory and gets the file object and the dentry struct. Im trying to list all entries including entries in subdirectories using the list_for_each() macro. The problem is its only displaying whats currently in the dentry cache. If I open the directory with nautilus then rerun the system call, all the e...

The conventional location for storing my Java libraries and applications in UNIX based systems

I usually store the Java applications and JAR files that I download from the Web in the ~/Java folder on my computer (an OS X machine). I have been doing this since the days when I was a Windows user. However I think in UNIX based systems user local apps are conventionally stored in another directory. I have a feeling that this directory...

What do I need to look out for when I switch compilers from GCC 3.4.2 to a GCC 4.4.2 or to ICC?

The project I'm working with is compiled with GCC 3.4.2. I'm considering switching to a newer compiler. However, the project is at a stage where we're not making any big changes if the risks aren't well known. What sort of problems can I expect when switching compilers? What benefits does GCC 4.x give over GCC 3.4.2? What benefits...

How to controll (and emulate) monitor/projector on Linux?

I would like to write some C/C++ program to take controll over monitor/projector attached to my computer. What I want is to generate arbitrary output on it and I want that only my application can draw on that screen. I've googled around, but I couldn't find almost anything that would lead me in some direction. Do you know where I can le...

Why is a non-blocking TCP connect() occasionally so slow on Linux?

I was trying to measure the speed of a TCP server I'm writing, and I've noticed that there might be a fundamental problem of measuring the speed of the connect() calls: if I connect in a non-blocking way, connect() operations become very slow after a few seconds. Here is the example code in Python: #! /usr/bin/python2.4 import errno imp...