linux

Socket with recv-timeout: What is wrong with this code?

I'm trying to implement a socket with a recv timeout of 1 Second: int sockfd; struct sockaddr_in self; struct sockaddr_in client_addr; int addrlen=sizeof(client_addr); ssize_t nBytes; sockfd = socket(AF_INET, SOCK_STREAM, 0); self.sin_family = AF_INET; self.sin_port = htons(PORT); self.sin_addr.s_addr = INADDR_ANY; int on = 1; setso...

What is a good Linux exit error code strategy?

I have several independent executable Perl, PHP CLI scripts and C++ programs for which I need to develop an exit error code strategy. These programs are called by other programs using a wrapper class I created to use exec() in PHP. So, I will be able to get an error code back. Based on that error code, the calling script will need to ...

Restricting symbols in a Linux static library

I'm looking for ways to restrict the number of C symbols exported to a Linux static library (archive). I'd like to limit these to only those symbols that are part of the official API for the library. I already use 'static' to declare most functions as static, but this restricts them to file scope. I'm looking for a way to restrict to ...

Best Books for getting up to speed in all things UNIX

I have been hacking around on UNIX servers for a while now, I love Debian, its a great server OS. But I feel like I don't really grasp the entire system and overall environment of UNIX. More and more, server maintenance and configuration is becoming a bigger part of my life and I am looking for some great book recommendations. Keep in ...

Best General GNU/Linux Book

What is the best general GNU/Linux book? I've been occasionally using Linux for a few years, but I could still benefit from a good complete manual that isn't tied too closely to a specific distribution. Is there one that stands above the rest? I am fine with online books too. Topics I'm interested in include file systems, security, direc...

Flex: How does the compiler know about dependencies?

Hi, I'm completely new to Flex and am just having a play with a sample application from the Mate framework. I'm hacking on Linux so I'm using the command prompt and a text editor rather than Flex Builder. The sample app has two folders in its root directory lib & src. Lib contains a dependency. How can I compile the mxml file in src, s...

Best practice to run Linux service as a different user

Services default to starting as root at boot time on my RHEL box. IIRC, the same is true for other Linux distros which use the init scripts in /etc/init.d. What do you think is the best way to instead have the processes run as a (static) user of my choosing? The only method I'd arrived at was to use something like: su my_user -c 'dae...

What cutting edge desktop environments are out there?

Gnome, KDE, Fluxbox, IceWM, XFce, etc. etc. These are desktop environments/window managers that have been around a long time. I'd love to know about some of the 'cutting edge' desktop environments/window managers out there. Ones that maybe make use of 3D in a useful way. Or ones that make use of other forms of input such as touchscreens...

Are child processes created with fork() automatically killed when the parent is killed?

I'm creating child processes with fork() in C/C++. When the parent process ends (or is killed for some reason) I want all child processes to be killed as well. Is that done automatically by the system? Or I have to do it myself? Thanks. Pre-existing similar questions: http://stackoverflow.com/questions/269494/how-can-i-cause-a-chil...

GC in multithreaded environment

How to do garbage collection in a program that consist from multiple threads or processes? I also like to know how can I scan the stack from each of those threads and processes? Does each process require it's own garbage collection routine? Is it a good idea to run the garbage collector in a separate thread/process from the actual prog...

How to make Windows Flash games run on Linux?

I have some educational flash games for Windows (legally bought), that I would like for my daughter to be able to use on her OLPC. I know that some users have been able to run them under Linux by using wine, but that is really not an option on the OLPC as they need the cd in the drive to run, and the OLPC does not have a cd drive. The ...

How can I let users run a script with root permissions?

Given the dangers of SUID shell scripts, is there a more secure way of giving passwordless access to scripts (bash, PHP) with root permissions in Linux? (Ubuntu 8.10) ...

Document management under Linux

Hi all, after years navigating seas of unorganized documents, I'm starting to look for a cheap/free way to classify our work docs structurally, in order to tidy things up and to better enforce the workflow.. So I'd like to be able to tag documents according to project, customer, components used etc.. For example, imagine these documents:...

How do YOU manage Perl modules when using a package manager?

A recent question here on SO got me thinking. On most Linux distributions that I tried, some Perl modules would be available through the package manager. Others, of course, not. For quite a while I would use my package manager whenever I needed to install some CPAN module to find out whether a package was available or not and to install...

Splitting a string on AT&T IA-32 Linux Assembler (gas)

.section .data astring: .asciz "11010101" format: .asciz "%d\n" .section .text .globl _start _start: xorl %ecx, %ecx movb astring(%ecx,1), %al movzbl %al, %eax pushl %eax pushl $format call printf addl $8, %esp movl $1, %eax movl $0, %ebx int $0x80 Suppose I wanna break the .asciz string 1101011 and get it's first one. How do I...

SQL Server GUI For Linux

Anybody know of a GUI for querying / managing Microsoft SQL Server >= 2005 from Linux. So far I've only found Razor SQL http://www.razorsql.com/download_linux.html ...

Should developers fear updates to their workstation software / development stack?

As I have discovered, many developers avoid any updating (automatic or manual), because they fear it might do changes to their machine they don't understand, and the software they are developing might fail at some point for reasons they don't know. strategy A.) LEAVE THE SYSTEM AS IT IS, FOR AS LONG AS POSSIBLE. I personally like to ha...

How can I get a list of available wireless networks on Linux?

I would like to get a list of the wireless networks available. Ideally this would be via some C call, but I don't mind if I have to kludge it with a system call. Even better if the required C call or program doesn't require some exotic 3rd party package. The internet seems to suggest I use sudo iwlist <interface> scan which does seem to...

Shell script to compare dates from multiple files in Linux

I have lots of home directories under /ifshome on Linux. I want to see which users have not logged in for the past 6 months, and my solution is to parse the /ifshome/user/.lastlogin file. Each .lastlogin file has the same format, 1 line: Last Login: Fri Mar 09 18:06:27 PST 2001 I need to build a shell script that can parse the .lastlo...

How do I create a DSN for ODBC in Linux?

I am digging around in a Linux application that supposedly uses DSNs to connet to SQL Server. The connection stopped working and I can't find the credentials that are being used (all I know is the DSN's name). I am familiar with DSNs in Windows, but how are they created and where are they stored in Linux? ...