linux

Using SED to append a string to an existing line of text?

Hi, I'm trying to use the linux sed command to append a path element to the RewriteBase in a .htaccess file. I have tried it with this arguments: #current RewriteBase is "RewriteBase /mypath" sed -ie 's/RewriteBase\(.*\)/RewriteBase \1\/add/g' .htaccess with this result: addriteBase /mypath So sed overwrites the the beginning of ...

How to get a list of files that match some pattern?

How to get a list of files that match some pattern if filenames may contain \n character? Update: I want solution in pure vimscript, so that it will depend on nothing but vim. Update2: Expected output of glob function Consider the following script: :!touch /test ; mkdir /test$'\n' ; touch /test$'\n'/test :echo glob('/**/test') /test...

Polling and interrupt based methods for packet processing in multicore processor

This query is related with the packet processing in multicore processors. Packet processing can be either in Linux or pure datapath. Is it true that if the packet processing application is on Linux, then it must be interrupt based processing of packets for high performance, but if the packet processing is in pure datapath (without linux)...

Arithmetic problem with shell script

I've got some issues on scripting... if someone could help me, it would be really good ! My script has: VISITS=$((WR + RD)); SERVICE_DEMAND=$((VISITS*SERVICE_DEMAND)); And I'm getting this error: ./calc_serv_demand.sh: line 12: 0.0895406: syntax error: invalid arithmetic operator (error token is ".0895406") Can someone hel...

Tool to identify the similarities in logic between a function of C and C++

Is there a tool in either Linux/Windows that would enable us to determine if a logic of the particular function in C is same as that of a particular function in C++ ? ...

Linux, timerfd accuracy

I have a system that needs at least 10 mseconds of accuracy for timers. I went for timerfd as it suits me perfectly, but found that even for times up to 15 milliseconds it is not accurate at all, either that or I don't understand how it works. The times I have measured were up to 21 mseconds on a 10 mseconds timer. I have put together...

How is device emulation done in kvm

I know that the qemu-kvm does the device emulation stuff in KVM. Is the qemu-kvm being executed in the userspace of the host? So when a kick function is encountered, it exits the VM through a hypercall into the hypervisor, then the hypervisor hand over to qemu-kvm in host userspace. Next after doing the needed things, the qemu-kvm transi...

Can gcc generate different size object code ?

Which option should be enabled in gcc to generate 16-bit or 32-bit or 64-bit object code ? Are there separate options for generating each of the above object code type ? ...

Allocate executable ram in c on linux

I want to make a simple just-in-time compiler with c on Linux. How can I allocate memory such that I can write out raw x86 code to it and execute it as any other function? ...

Credential distribution/storage across fleets

What are the options for secure password/credential storage on a host and propagation of changes across a fleet of hosts? An example would be you have fleet of size N and you want to store credentials, such as AWS access keys, on those hosts. The simple approach is to store it in the source code or a config file, but this is bad beca...

Concatenate all arguments (except the executable name)

Is there a C function that can concatenate all the passed arguments (except the name of the executable) into a char* and return it? ...

Compiling apache modules for Windows and Linux distros

Hello everyone. I have written an Apache2 module in C, now I am at the point of distributing the module. I am not sure of the standard practices regarding the distribution of Apache modules, so I am considering to provide binaries for some of the more common platforms, like Windows and Ubuntu, etc. I have two questions to ask- Will ...

How to find floppy\ CD sector size in Linux?

Hi, How can I get the sector size for floppy and CD disks in Linux, via C++ code? Thank you all. ...

What is EGL And How Can I Use It

Hi all , Can Anybody explain me what is EGL And How it does ?! How can i use EGL with OpenGL-ES On Linux?! IS EGL a Layer Between Hardware And Operating System ?! ...

Authentication Failed (error 530) with Embedded Apache FTP Server

Hi, I am embedding the apache ftpserver in my java web app, I have tried a couple different things and everytime I try to connect to the server via FTP, it says Authentication failed. I have attached my code, and also the console output when I try to do the logging in. Does anyone have any suggestions? I tried running this on OS X and...

Ubuntu: Android device debug

Hey, I have a HTC Desire which i would like to debug and run my Android application on. But when i in Eclipse gets the Window where i can choose between devices my HTC Desire is listed with only questionmarks (????????). What am i doing wrong? I have tried this: Enabled USB Debugging on my device and enabled debugging in my applicatio...

Is there any linux distribution that comes with python 3?

I would like to know if there is any Linux distribution where you can easily install and use Python 3. This means a distribution that will provide not only Python 3 binaries and updates but also python modules. I know that probably we are not going to see any python 3 as the default python interpretor so soon but at least I would like t...

Glib: Can I reuse a pointer queued to be freed with g_test_queue_free?

Using Glib Testing framework, I would like to know if I can reuse a pointer queued to be freed with g_test_queue_free? Here's a code sample of what I'm trying to do: static void some_test() { gchar* tmp; tmp = func_returning_gchar_ptr (...params...); g_assert(tmp); g_test_queue_free(tmp); tmp = func_returning_gchar_ptr (......

pyGTK detect all window move events

I'm trying to capture the configure-event for every window to create a windows 7-esque snap feature. I know there are solutions involving compiz-fusion, but my installation is running within vmware and doesn't have hardware acceleration to run compiz. I figured a simple python script could do what I wanted, but I can't seem to find the r...

How do I stop a process running using Perl?

I want to write a Perl code that ends the process of another program of mine, running on Linux. For example, I execute xxy.py and a process is opened for it. I would like to use Perl to close the process of xxy.py. What do I need to do? ...