linux

Time zone conversion C API on Linux, anyone?

I'm looking for something that I presumed would be very simple - given local Unix time in a specific time zone (specified as a string, e.g., "America/New_York" - note that's not my local time), get the corresponding time value in GMT. I.e., something along the lines of time_t get_gmt_time(time_t local_time, const cha...

is it possible to get python purple running either in cygwin or on a linux that isn't debian?

python purple says it needs dbms and debhelper in order to run, but I don't run debian. Is there a way to get this running on a different linux? or in cygwin? ...

Most Compact Way to Count Number of Lines in a File in C++

What's the most compact way to compute the number of lines of a file? I need this information to create/initialize a matrix data structure. Later I have to go through the file again and store the information inside a matrix. Update: Based on Dave Gamble's. But why this doesn't compile? Note that the file could be very large. So I try t...

Grep a string recursively in all .htaccess files

How can I grep for a certain string recursively in all .htaccess files? grep -r -n -H -I 'string' .htaccess doesn't seem to work. I'm on a GNU Linux system. ...

Find the current stdout OR How to redirect the output back to console.

I'm using Ubuntu 9.04 x64 and, I have a file startup.rb in which I call sudo bash, so that I always have a root console to do administrative tasks without typing password after every 15 minutes or so. This script is called by another script Startup.rb, and content of both files are like this - File ~/Startup.rb #!/usr/bin/ruby system...

tips for installing postgres for a rails project on a linux box

hi I want to use a postgres database for 2 rails projects and for some php blogs. Does anybody have tips for me, which pg gem I should install for ruby? I'm searching also for some general postgres config tips. I run Ubuntu 9.04 as Server. Maybe a (not outdated) good tutorial would be great :) thanks guys ...

Getting error "bash: appletviewer: command not found".

Hi, I'm trying to learn Java and I'm having problems with the appletviewer command. I am using openSUSE 11 and am able to compile and run normal java programs but when I issue the appletviewer command I'm getting the following error "bash: appletviewer: command not found". I have set the PATH variable in the .bashrc file. so the problem...

How do I force a program to appear to run out of memory?

I have a C/C++ program that might be hanging when it runs out of memory. We discovered this by running many copies at the same time. I want to debug the program without completely destroying performance on the development machine. Is there a way to limit the memory available so that a new or malloc will return a NULL pointer after, sa...

Can `apt-get install` be used for JDK?

I've been using a linux machine for less than two weeks, so I am extremely new to Linux. I'd also like to install the Java Developers Kit. How should this be done? Is there an apt-get command, or should I just click on the download button at Sun's website? I'm sure there is more than one way to do this, and it probably doesn't matte...

How i configure logrotate to not delete my log files after rotation?

There's a way to do this? ...

Get the call stack in code with less overhead?

Hi, I am going to implement an internal profiler for memory on linux. I want to save the stack for each malloc/free/realloc. I am trying to use "pstack" to get the stack trace everytime. But the overhead is too high. Is there any lightweigt approach to get the call stack in C code? I know there are some tools like "valgrind, google pro...

Sockets & File Descriptor Reuse (or lack thereof)

Hi, I am getting the error "Too many open files" after the call to socket in the server code below. This code is called repeatedly, and it only occurs just after server_SD gets the value 1022. so i am assuming that i am hitting the limit of 1024 as proscribed by "ulimit -n". What i don't understand is that i am closing the Socket, whic...

What is the simplest way to SSH using Python?

What is the absolute simplest way to SSH to a remote server from a local Python (3.0) script, supply a login/password, execute a command and print the output to the the Python console? I would rather not use any large external library and not install anything on the remote server. ...

Using xxdiff to merge in linux?

Hi guys, I want to use xxdiff for my merging needs. I have just started using git, and I integrated xxdiff to work with it on (git mergetool). My problem is that I can't find any resource that teaches the basic of merging branches with xxdiff, so I get into this three file window with LOCAL BASE REMOTE, but I don't know where to start ...

C++ Socket Server - Unable to saturate CPU

I've developed a mini HTTP server in C++, using boost::asio, and now I'm load testing it with multiple clients and I've been unable to get close to saturating the CPU. I'm running on a 4-cpu box, and getting about 50% usage of one cpu, 20% of another, and the remaining two are idle (according to htop). Details: The server fires up on...

Oracle's NCHR() function is behaving differently across platforms. How to fix?

I am encountering an issue with some Oracle code which uses the NCHR function. The same code is running on Windows/Ora10g and Linux/Ora11g, yet it behaves differently. The NLS characterset is identical on both instances. I am trying to determine if this is an issue with Oracle versions or because of the OS. Has anyone encountered thi...

Requires GLIBCXX_3.4.9 if I've already installed GLIBCXX_4.1.2?

I'm installing the last version of MediainfoDLL on Fedora 8/9 64bits (http://mediainfo.sourceforge.net/es/Download/Fedora). I downloaded libmediainfo-0.7.20 and libzen0-0.4.3 files. When I tried to install libzen0 I get this output: # rpm -i libzen0-0.4.3-1.x86_64.Fedora_9.rpm warning: libzen0-0.4.3-1.x86_64.Fedora_9.rpm: Header V3 DSA...

Fastest service wrapper for Java apps

Hi. I'm looking for most performing Java service wrapper, which could make Java application running as a service on Linux. Can anyone recommend such utility. Thanks. ...

IPC performance: Named Pipe vs Socket

Everywhere seems to say named pipes are fast whereas sockets are slow for ipc. How much greater is the speed advantage of named pipes vs local sockets on linux? I would prefer to use sockets because they can do two way communication and are very flexible but will choose speed over flexibility if it is a by considerable amount. Comments, ...

sending a.out to someone

I have some c++ code compiled using GLUT and OpenGL on os x. It all works fine. I have it as a.out Is there a way to send this to someone using os x? Will there be some weird dependencies? Can I send it to someone using linux? I doubt I can do either which is why I'm asking on here. I looked around on google but couldn't find anything ...