linux

How to better study Linux?

I'm taking a very basic university course on OS kernels and related stuff (process management, virtual memory, file systems, drivers..) I wanted to deepen my understanding of Linux in these fields, but also get to know it from a more practical point of view (important directories, the shell, important logs and files, hacking in general) ...

In Python, what does getresponse() return?

import httplib conn = httplib.HTTPConnection(head) conn.request("HEAD",tail) res = conn.getresponse() I can get the res.status , which is the http status code. What other elements can I get? Why is it that when I do print res, it won't print the dictionary? I just want to see the keys that are in that dictionary... ...

How to get the true URL of a file on the web. (Python)

I notice that sometimes audio files on the internet have a "fake" URL. http://garagaeband.com/3252243 And this will 302 to the real URL: http://garageband.com/michael_jackson4.mp3 My question is...when supplied with the fake URL, how can you get the REAL URL from headers? Currently, this is my code for reading the headers of a f...

How best to manage Linux's buffering behavior when writing a high-bandwidth data stream?

Hi all, My problem is this: I have a C/C++ app that runs under Linux, and this app receives a constant-rate high-bandwith (~27MB/sec) stream of data that it needs to stream to a file (or files). The computer it runs on is a quad-core 2GHz Xeon running Linux. The filesystem is ext4, and the disk is a solid state E-SATA drive which sh...

Read single sector

Hi, I am trying to read a single specific sector from the disk directly. I've currently run out of ideas and any suggestions how to go about it would be great! (I'm a linux newbie) ...

Parameters passed by reference come back garbage using P/Invoke

I am using Mono/C# on Linux and have the following C# code: [DllImport("libaiousb")] extern static ResultCode QueryDeviceInfo(uint deviceIndex, ref uint PID, ref uint nameSize, StringBuilder name, ref uint DIOBytes, ref uint counters); And I call a Linux shared library call defined as follows: unsigned long QueryDeviceInfo(...

memory mapped files system call - linux

When we map a file to memory, a system call is required. Do subsequent accesses to the file require system calls or is the virtual memory page of the process mapped to the actual page cache in memory? update: what i also want to know is that if multiple processes are accessing the same file through mmap. they will be accessing the same ...

Reading from serial port fails

I have the following C program: #include <fcntl.h> #include <termios.h> #include <stdio.h> int main() { int fd = open("/dev/ttyS0", O_RDWR | O_NOCTTY | O_NONBLOCK); if(fd < 0) { perror("Could not open device"); } printf("Device opened\n"); struct termios options; tcgetattr(fd, &options); cfmaker...

Displaying Chinese text in an Applet

We have an Applet that can possibly display Chinese text. We are specifying a font for it (Arial), it works fine under both Windows and Mac OSX. But in Firefox on Linux the Chinese characters are rendered as squares. Is there a way to work around this? Note that we can't assume the existence of a particular font file on the client. ...

.deb package conffiles problem

I am distributing one of my applications using a .deb package, but have a problem relating to one of the files. The distribution includes a database file which is constantly updated by the app, on a fresh install I want the installer to copy a new, empty db file onto the users system, but on an upgrade I want the installer to leave the...

How to check if port is available

Is there an API function on Linux (kernel 2.6.20) which can be used to check if a given TCP/IP port is used - bound and/or connected ? Is bind() the only solution (binding to the given port using a socket with the SO_REUSEADDR option, and then closing it) ? ...

Add a changing icon to Ubuntu Panel

What would be the most simple way of adding and changing an icon in the Ubuntu (Gnome) Panel? I'm looking for something as simple as shell scripting, but I'm not restricted to that. Will write a program for it if that's a better or simpler approach. The idea is to create a script/program to monitor some condition (e.g. availability of a...

Writing iPhone apps on linux - What tools do you need

Hello. I wanted to know if it's possible to WRITE and COMPILE/TEST iPhone apps on a linux platform. I've been on google for a couple of days now, and people either talk about "Mac OS X only!", or "Develop jailbroke apps on Linux". My dev partner has a mac and has a certificate to sign the apps. I don't have a mac, but I will be doing mo...

Compress files while reading data from STDIN

Is it possible to compress (create a compressed archive) data while reading from stdin on Linux. ...

snmp and platform specific information

I need to come with a strategy to use gather information about the health of my linux platform, hardware health such as high CPU temperature and may be disk space usage, etc... I know my examples are not very good ones. Essentially, I have an SNMP agent running on Linux and I need it to provide platform specific health and state informa...

Deploying a python CGI app

I have developed a python CGI application which works just fine on my development box. My hosting provider however gives me little control of its server: I use a lot of custom stuff in my python environment (like sqlalchemy and mako templating) and the servers python version is far too old to be used. My question is: how do I set up a is...

compiler versions

I have some guys here who have code that needs to be compiled with gcc-3.3. We have a CentOS 5.2. When we compile it with their make files, it fails during the link and they say it is because it won't work with gcc-3.4 which is installed already. Is there something I need to tell them to change to make it go, or is it possible to find...

How to print pthread_t

Searched, but don't come across a satisfying answer. I know there's no a portable way to print a pthread_t. How do you do it in your app? UDP: Actually I don't need pthread_t, but some small numeric id, identifying in debug message different threads. On my system (64 bit RHEL 5.3) it's defined as unsigned long int, so it's big n...

Linux Sort command

Hello, I would like to know which sorting algorithm the linux SORT command uses? ...

A Development Machine in VirtualBox - (Debian-min vs ArchLinux vs recommend-one).

I have few years of exp on linux, mainly ubuntu (dual-boot). Now i am shifting to windows, and installing linux in VirtualBox (PUEL). I am looking for a light-weight distro for development machine setup. Thought of using debian-unstable-minimum, and installing build-essentials, openbox(or a little more feature light-WM, ps recommend), ss...