linux

Can running 'cat' speed up subsequent file random access on a linux box?

Hi all, on a linux box with plenty of memory (a few Gigs), I need to access randomly to a big file as fast as possible. I was thinking about doing a cat myfile > /dev/null before accessing it so my file pages go in memory sequentially, hence faster than with a dry random access. Does this approach make sense to you? ...

Programming resources for C++ in Linux

Hi all. I am new (in a way) to C++ programming. I would like to start doing development in linux using C and/or C++ as programming language. I have done a development for a while in Java. Unfortunately, I am not sure where to start. Can you point me to some good resources and also give me a outline as to what would be the primary dif...

Ensuring the existence of a user on a Debian GNU/Linux system

I'm currently working on a Debian package for an in-house program. As part of this package, I need to create the user which most of the functionality of the program runs as. I am doing this in the postinst script. The postinst script can be run several times (on upgrade, for example), so it's important to ensure that I'm not going to ...

Have nautilus open file into new gvim buffer?

Is there a way to configure nautilus to open a file into an existing gvim process in a new buffer instead of loading a new instance of gvim? I know I can drag and drop the file into gvim, but it would be convenient if I could just double-click a file to open it. ...

How to redirect output of an already running process.

Normally I would start a command like longcommand &; I know you can redirect it by doing something like longcommand > /dev/null; for instance to get rid of the output or longcommand 2>&1 > output.log to capture output. But I sometimes forget, and was wondering if there is a way to capture or redirect after the fact. longcomma...

Tips to begin programming and multimedia arts?

Hi, I'm mostly a versatile IT specialist but I wanna convert myself to programming and multimedia arts to be good all-around to replace sometimes the needs of another specialist of another branch for little stuff that I could do myself with a little pratice ... I got little knowledge of programming with VB, html and batch files but for ...

Packet socket in promiscuous mode only receiving local traffic

I have a socket created with socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL)), and I've set it into promiscuous mode using struct ifreq ifr; strncpy((char*)ifr.ifr_name, interface, IF_NAMESIZE); if(ioctl(sock, SIOCGIFINDEX, &ifr)<0) fail(2); struct packet_mreq mr; memset(&mr, 0, sizeof(mr)); mr.mr_ifindex = ifr.ifr_ifindex; mr.mr_type = P...

link with DB2 ODBC drivers on Linux

Hi All, I need to link our C/C++ code that is using the DB2 ODBC driver on linux, and although ive pulled in sqlcli.h I dont know where to find the objects so i can link. Ive installed DB2 v9.1 ESE so i wouldve thought i could get everything. Anybody got any ideas? ...

How to get the copy the first few lines of a giant file and add a line of text at the end of it very simply using some Linux commands?

How to get the copy the first few lines of a giant file and add a line of text at the end of it very simply using some Linux commands? ...

Tar error: Unexpected EOF in archive

I tar a directory full of JPEG images: tar cvfz myarchive.tar.gz mydirectory When I untar the archive: tar xvfz myarchive.tar.gz I get an error tar: Unexpected EOF in archive Looking at the output, it fails in the middle of one particular JPEG image. What am I doing wrong? ...

How to lock IO shared by fork in ruby

How can we lock an IO that has been shared by multiple ruby process? Consider this script: #!/usr/bin/ruby -w # vim: ts=2 sw=2 et if ARGV.length != 2 $stderr.puts "Usage: test-io-fork.rb num_child num_iteration" exit 1 end CHILD = ARGV[0].to_i ITERATION = ARGV[1].to_i def now t = Time.now "#{t.strftime('%H:%M:%S')}.#{t.usec}" ...

process and threads

how the process and threads performance will vary according to timslice.(how much time will approximately take to execute).in which situation we will use threads instead of process. ...

Makefile can`t understand comments

If I put comments (# ...) in my Makefile, make gives me an error and quit. If I remove the comments, the makefile works fine. Makefile:1: *** missing separator. Stop. Make-version: 3.81 Linux: Ubuntu 9.04 The Makefile: # Backup Makefile # # Create backups from various services and the system itself. This # script is used to perfor...

Changing the From address on emails from root

When we get sent emails from cron jobs etc., they tend to have a From address like "root [email protected]". Unfortunately, in Outlook, this only shows up as "root", which makes distinguishing between very similar emails from different machines quite tricky. How can I change the From address on these emails so it's something lik...

Inspecting java class instance variable values in Eclipse

In an application, I have a class with a few member variables and methods. Calling the method with bad parameters produces a AssertionError. I've setup the debugger to halt on uncaught exceptions. Problem is, when switching over to the debug perspective, I can only see the class instance (on which the function was called) and the two pa...

how to transfer required files from ftp server to local unix server?

Hi i have to transfer files whose names consists of two variables X, Y and they are in the directory ABC in ftp server to my local unix directory XYZ. after transfering files i have to go to local directory path and i should untar (input files are compressed files) them. one more thing i have to use username and pwd for connecting to ft...

How to determine JVM memory footprint with multiple processes on Linux

Hi, I’m trying to quantify the difference in memory footprint of a small java app performing the same process multithreaded vs multiprocess. All my tests are on Linux. When running multithreaded, it is relatively easy to determine the overall footprint and additional overhead per thread. When running the single threaded process, the J...

How do I wake select() on a socket close?

I am currently using select loop to manage sockets in a proxy. One of the requirements of this proxy is that if the proxy sends a message to the outside server and does not get a response in a certain time, the proxy should close that socket and try to connect to a secondary server. The closing happens in a separate thread, while the s...

How might I learn to write char device drivers for Linux?

How to write char device drivers in Linux? ...

Ruby - How to do DSCP marking in packets?

I have a need to mark packets with DSCP markers for testing a product, but I'm not seeing a way to do this directly. Am I just missing something, or do I really need to start learning network programming in C to get this done? Or, which may be easier, is there a program out there (for Linux) that will send data with DSCP markers better...