I've been looking for a way to get the terminal width from within my C program. What I keep coming up with is something along the lines of:
#include <sys/ioctl.h>
#include <stdio.h>
int main (void)
{
struct ttysize ts;
ioctl(0, TIOCGSIZE, &ts);
printf ("lines %d\n", ts.ts_lines);
printf ("columns %d\n", ts.ts_cols);
}
...
I have a Java nonblocking server that keeps track of all the socket channels in a selector. I then establish 500 connections to the server and send data regularly. Every piece of data the server receives is echoed back to the client.
The problem comes where the test works wonderfully for a couple of hours and then all of the sudden gra...
It seems to me that Linux has it easy with /proc/self/exe. But I'd like to know if there is a convenient way to find the current application's directory in C/C++ with cross-platform interfaces. I've seen some projects mucking around with argv[0], but it doesn't seem entirely reliable.
If you ever had to support, say, Mac OS X, which do...
Hi,
I have what is probably a very simple terminal related question.
I'm running Ubuntu 8.10 Intrepid Ibex, using Gnome, and I often open a terminal-based
ssh session only to have it dropped at some point later on. Once the session is dropped the
terminal becomes unusable, obviously because the network connection has been dropped.
...
Hello
SQLite is fine as a single-access database, but it gets risky when used by more than one user at a time. MySQL, Firebird, PostgreSQL etc. are more difficult to deploy and are simply overkill for my use.
Ideally, I'd like a compact, single-EXE server meant to run on low-spec hardware (eg. 128MB RAM, 256MB flash RAM) that would be ...
Hello!
My firefox started crashing since today. I haven't changed anything on the system or on firefox config.
I use
strace -ff -o dumpfile.txt firefox
to trace the problem. It's not a big help.
I see the segfault, in two of the generated process dumps,
but how I can trace them to their cause?
After running for 10 seconds and crashin...
I am writing a system-critical program for a Linux distribution that I am developing. It needs to restart itself on receiving certain signals, to try to avoid crashing. The problem is, after the restart, I cannot re-enable that signal. That is, the signal cannot be received twice. After execv()'ing itself, when the new process calls sign...
Two questions, really:
(1) Is there a standard/convention regarding the placement on configuration files? For system or quasi-system programs they seem to usually be somewhere in /ect. It seems less clear for plain application programs or pgms that with insufficient privileges for /etc.
(2) There are multiple ways to provide informat...
Hello all,
I have looked everywhere to find a linux utility that will allow me to download rtmp streams. Not flv video but MP3 streams. The location of the streams I want to download are in this format.
rtmp://live.site.com/loc/45/std_fc74a6b7f79c70a5f60.mp3
Anyone know of such a command line tool? Or even anything close to what I am...
To create a .exe in Linux using Qt SDK, should I cross compile my application in Linux or cross compile my application in Windows? I am totally confused. :(
Please help.
...
I have a device that takes low current 3-12v input signal to do it's magic and I would like to interface it to my linux box. What kind of options do I have on this? It would be great to have some low-cost possibly user-space solution.
...
Hello,
When i try to execute a program from php5 on my debian, the webpage freeze and the program do nothing.
This script works when i call it from the command line. Safe mode is disabled. Echo stdout doesnt work (because of the freeze).
I read some answers in google which tells of www permissions but if someone here have a quick and si...
I'd like to monitor the time on a couple of servers. Ideally I'd do this in an app running on a windows machine. Is this possible and where might I start? I know next to nothing about Linux.
...
How can I find out the size of a block device, such as /dev/sda? Running ls -l gives no useful information.
...
We have a message processing system where low latency is critical. Recently, I found that while we keep a high rate through our system we are seeing some "outliers." (Messages that take much longer then they should) When we removed logging our systems show none of these outliers.
Right now our logging is basically just a wrapped os...
Hi there, I found a command a couple of months ago that made my bash history auto-complete on what's already on the line when pressing the up arrow:
$ vim fi
[press up]
$ vim file.py
I'd like to set this up on my new computer, because it saves a lot of time when keeping a big history. The problem is that I can't for the life of me r...
As all linux distributions use the same linux kernel, is there any difference between their executable binary files?
If yes, what are the main differences? Or does that mean we can build a universal linux executable file?
...
Hi, I have a XFCE 4.6 on kernel 2.6. Is there a quick and easy way to flash a message on the screen for a few seconds?
My Thinkpad T60 has 3 volume buttons (up, down, mute). When I pressed the buttons, I would like to flash the volume on the screen for a second on screen. Can it be done with Python?
...
hi, I want to tell whether two tarball files contain identical files, in terms of file name and file content, not including meta-data like date, user, group.
However, There are some restrictions:
first, I have no control of whether the meta-data is included when making the tar file, actually, the tar file always contains meta-data, so d...
I have a small command-line application written in C that acts as a wrapper/launcher for other programs (think: xargs). The application is written to compile on FreeBSD/Linux (via fork()/exec()) and Windows (CreateProcess()). In addition to being able to intercept, inject, or otherwise manipulate the command-line arguments for the chil...