linux

Losing bytes on an epoll controlled non-blocking socket when the other side writes and closes

I've a non-blocking socket currently subscribed to: ev.events = EPOLLIN | EPOLLPRI | EPOLLERR | EPOLLHUP | EPOLLRDHUP| EPOLLET; It receives a couple of EPOLLINs which I read non-blocking till EAGAIN and then I receive HUP & RDHUP, sometimes with a few bytes more to read. The other side is just: send(socket,960_bytes_buffer) close(s...

Can I run a script in an Eclipse run configuration?

My company has traditionally used a Linux command line development environment. We use a script to manage the PATH and LD_LIBRARY_PATH environment variables when compiling and running. This script is called by adding it to the beginning of a command, like this: sbs make sbs ../bin/foo.exe I am trying to get our code to run from Ecli...

Linux: Unzip an archive containing files with the same name.

I was sent a zip file containing 40 files with the same name. I wanted to extract each of these files to a seperate folder OR extract each file with a different name (file1, file2, etc). Is there a way to do this automatically with standard linux tools? A check of man unzip revealed nothing that could help me. zipsplit also does not see...

What are some techniques or tools for profiling excessive code size in C/C++ applications?

I have a C++ library that generates much larger code that I would really expect for what it is doing. From less than 50K lines of source I get shared objects that are almost 4 MB and static archives pushing 9. This is problematic both because the library binaries are quite large, and, much worse, even simple applications linking against ...

How can I find which ELF dependency is not fulfill?

I've built a test ELF program using the LSB SDK (note that my question is not specific to LSB): $ /opt/lsb/bin/lsbcc tst.c $ ls -l a.out -rwxr-xr-x 1 math math 10791 2009-10-13 20:13 a.out $ file a.out a.out: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not stripped ...

Bash: find and copy

Hi, Anybody has an alternate way of finding and copying files in bash than: find . -ctime -15 | awk '{print "cp " $1 " ../otherfolder/"}' | sh I like this way because it's flexible, as I'm building my command (can by any command) and executing it after. Are there other ways of streamlining commands to a list of files? Thanks ...

How to know when to use the .a or .so when linking to Boost?

I wanted to try out the Boost::Serialization library for a project I'm working on. I'm also trying to get used to programming in Linux as well. I set up boost in its default locations. I tried compiling the test file they provide here with the command line arguments they provide and it worked fine. In this example they use the .a file. ...

Custom Prefetch

Any programmatic techniques, portable or specific to NT and Linux that get the result of number of large files loading faster? I am after a 'ahead of time', a priori, whatever you prefer to call it mechanisms that I can control in code for two OS-es in question. Each file has to be processed in full, ie. completely in size and sequenti...

Howto use maven in a heterogenous environment with different encodings?

I've created a svn repositoy on a linux server (Debian) and used a client on a windows machine to check my java sources in. Now I've set up a Hudson server on a different linux server (Ubuntu) to periodically run tests on my code. But the tests fail with a compiler error: Error: unmappable character for encoding ASCII On my windows ...

What possibilities exist to build an installer for a windows application on Linux (install target=windows, build environment=Linux)

After playing around with NSIS (Nullsoft Scriptable Installation System) for a few days, I really feel the pain it's use brings me. No wonder, the authors claim it's scripting implementation is a "mixture of PHP and Assembly". So, I hope there is something better to write installation procedures to get Windows programs installed, while ...

Fastest implementation of one thread providing data, many threads consuming data

I have a lot of data that I want to disseminate to many different threads. This data is coming from a single thread. The consuming threads can safely access the container simultaneously. The data needs to be merged into the container ever delta seconds (50ms < delta < 1), during which time the consuming threads need to be locked out, ...

In Oracle, how do you change the 'default' database?

I really should know this, but would someone tell me how to change the default database on Linux? For example: I have a database test1 on server1 with ORACLE_SID=test1. So, to connect to test1 I can use: sqlplus myuser/password Connects to the default database, test1 I would now like the default sqlplus connection to go to database...

Read a Device in GNU/Linux or FreeBSD.

I am wondering, do you need a specific device driver to read a usb device in Linux, or should it just be able to be read. If I connect my cell phone or iPod touch to my linux box, it is not found is /proc/partitions and thus is not a mountable device by fdisks standards, though gnomes nautilus does in fact mount the iPod but not the win...

How can get exact total space of a drive via c in linux?

How can get exact total space of a drive via c in linux? not use shell script.just c, thanx ...

How to eject the CD Drive on Linux using C?

I was reading through this Advanced Linux Programming tutorial when I encountered a problem. I was trying to eject the CD-ROM drive using this code: int fd = open(path_to_cdrom, O_RDONLY); // Eject the CD-ROM drive ioctl(fd, CDROMEJECT); close(fd); Then I try to compile this code and get the following output: In file included from ...

Open Default browser with Mono+gtk#

I need to open an url from my application, on both linux and windows and i want to avoid replacing an existing page on an open browser. How do i call for it to open? I know i can use System.Diagnostics.Process.Start("http://mysite.com"); which should also work under linux, but this will replace any page shown on an already open brow...

Can I do a copy-on-write memcpy in Linux?

I have some code where I frequently copy a large block of memory, often after making only very small changes to it. I have implemented a system which tracks the changes, but I thought it might be nice, if possible to tell the OS to do a 'copy-on-write' of the memory, and let it deal with only making a copy of those parts which change. H...

Linux kernel modules - security risk?

How much of a security risk are linux kernel modules? I remember reading that it was possible if someone got access, that all they had to do was load a rootkit module. Is this correct? Is there any way to protect against this? What parts of the kernel are actually exposed through the module interface, and what functions do programmers h...

How to parse links in bash output

Let assume that we have this output in bash console: $ findgrep RAILS_ENV ./script/munin_stats:7:RAILS_ENV = ENV['RAILS_ENV'] || "development" ./script/munin_stats:12: dbconfig = dbhash[RAILS_ENV] ./lib/tasks/juggernaut.rake:4: @rails_env = ENV["RAILS_ENV"] || "development" ...

I need raw read data from and write data into drive..help

I need raw read data from and write data into drive..not via existed filesystem like fat32 or something....i just wanna raw write read...... I was told in Windows i can use CreateFile WriteFile and ReadFile APIs to access data in drive directly... but I dont know in Linux whether there r similar functions.... dont tell me to use hardwar...