linux

What's so special about file descriptor 3 on linux?

I'm working on a server application that's going to work on Linux and Mac OS X. It goes like this: start main application fork of the controller process call lock_down() in the controller process terminate main application the controller process then forks again, creating a worker process eventually the controller keeps forking more wo...

How to count connections to a host over a given time period? TCP logs?

If I do a sudo netstat -tup | awk '{print $5}' | sort | uniq -c | sort -n I can get a list and count of how many connections I have to each host. But how can I tell how many times I've been connecting to that host ever minute/hour/day? Is there a TCP log somewhere that I can grep through to see how and when I'm connecting to what? I...

Strange C program behaviour

Hi guys, I really have a strange situation. I'm making a Linux multi-threaded C application using all the nitty-gritty memory stuff involving char* strings, and I'm stuck in a really odd position. Basically, what happens is, using POSIX threads, I'm reading and writing to a two-dimensional char array, but it has unusual errors. You hav...

Good WYSIWYG web editor (php, CSS, HTML, Javascript) for Ubuntu?

Hey guys, I'm looking for suggestions as to what good easy to use web editors? It needs to edit php,javascript,html,CSS. I'm looking for something that'll speed up my development currently I'm using nano. ...

Unix Linux forking history (vague on details)

I remember reading an article a while back that had a sentence that stuck in my head. First of all, I don't remember if it was about unix or linux, but it was about an operating system. The phrase that got stuck in my head was that the license the guy who started the project chose was good because it kept the project intact because the...

End a Process In Thread

Possible Duplicate: kill thread in pthread How can I end a process running in a thread...or in other words how can I kill a thread? ...

Is busybox available in shared library form?

Is busybox available in shared library form? I would like to use individual apps programmatically instead of using system(). I've heard about libbusybox and libbb but could not find any documentation. ...

How to post-install something using GNU Automake?

I want to setup symlinks and add some lines to system configuration files, I think I should do these jobs in some post-install manner. Makefile.am: bin_SCRIPTS = a a1 a1: ln -snf a a1 This does work but it copies a to a1 in the bindir, while a1 is created as a symlink in the build dir. I'd also want to modify some system co...

sed regular expressions address ranges

I have a txt file that looks something like this ----------------------------------- RUNNING PROCESSES ----------------------------------- ftpd kswapd init etc.. --------------------------------- HOSTNAME -------------------------------- mypc.local.com With sed I want to just get one section of this file. So j...

C# on Linux: How to enumerate the computers on the local network ?

How can I enumerate all machine names and IPs of remote computers in the local network ? Note: NOT on Windows (how to do that one finds via google), I need something that works on Linux ! Or a C/C++ sample would also do it, I can call libc from C#. ...

Multiple HostNames and Multiple Privileges?

Hi all, I want to map 127.0.0.1 to multiple names instead of the standard way as localhost. so my /etc/hosts file in ubuntu would have the following entries 127.0.0.1 localhost 127.0.0.1 localhost:extra1 127.0.0.1 localhost:extra2 Now, In my sql, i want to have a user named karthick and it should have different privile...

How do I modify a datastream on the fly?

Possible Duplicate: modify a datastream on the fly I need to hijack and modify a datastream. The stream consists of fixed-width commands. Each command is a new line, and the documentation says that each command starts and ends with an STX/ETX (start and end of text) pair. The sending system is using serial, but is attacked to...

modify a datastream on the fly

I need to hijack and modify a datastream. The stream consists of fixed-width commands. Each command is a new line, and the documentation says that each command starts and ends with an STX/ETX pair (start and end of text) The sending system is using serial, but is attacked to an iPocket device that communicates over IP to our PBX. Fro...

OS X Vs Linux - Serial port handling

Hello, I am trying to port (or rather customize) a pure Linux application to OS X Snow Leopard (10.6.4). It is an application that sends a binary to a target hardware over the serial port. The app is almost running but i am hit with an interesting problem with the serial port writes. With all the same settings as Linux (115.2k is the b...

Vim Editor open always users home directory

I installed Nerd_tree plugin for vim on ubuntu 10.04. It is great plugin. But I met the following problems: after open nerd_tree to browse the files in /etc/apache2/sites-available/, now I close it, and go on with my work. Later I want open nerd_tree again to edit another file in /etc/apache, but nerd_tree shows me always the user home...

Route error after transfer zend projects from Windows to Linux

When i transfer my zend framework application from windows(zf 1.10.3) to linux (zf.10.7) some controllers work fine but some show this exception Fatal error: Undefined class constant 'EXCEPTION_NO_ROUTE' in /path/to/application/modules/default/controllers/ErrorController.php on line 11 /controllers VideoController.php /view /script...

How to use glDrawVertex() function in ANSI C

Hello :) I'm learning OpenGL, and now usage of function glDrawArrays() but I always get Segmntation fault on glDrawArrays call, i'm doing something wrong? /*MESH*/ struct Mesh { GLsizei numVertices; GLfloat vertices[48]; } m; static void meshCreate(struct Mesh *mesh) { mesh->vertices[0] = 0.000000f; mesh->vertices[1] = -0.000000f;...

CakePHP Console on Godaddy Hosting

I have been struggling to get my CakePHP site working on a Godaddy "grid hosting" account. My cake app is setup is hosted from a subdirectory on the account, and can be accessed via a subdomain. I had to adjust my .htaccess files to get this working, and now I need to get the CakePHP console working in this environment. I have the same ...

Context aware switching of character encoding in terminals

When working on projects that use different character encodings I find myself constantly switching the character encoding of a terminal. In some terminals (e.g. gnome-terminal) you can create profiles for different terminals (say, profile "Project A" for the project that uses UTF-8 and profile "Project B" for the one that uses ISO-8859-1...

C++ / Gloox: how to check when connection is down?

Hi all. I'm trying to write own jabber bot on c++/gloox. Everything goes fine, but when internet connection is down - bot thinks that it's still connected, and when connection is up again - of course bot doesn't respond to any message. Each time since bot is successfully connected gloox' recv() returns ConnNoError, even if interface is...