Archive

Archive for the ‘Operating Systems’ Category

Bash http_proxy: from a user environment to sudo one

October 14, 2010 9 comments

Hi. Sometimes you can’t connect directly to internet, because you have to go through a proxy (i.e. working environment).
Did you ever have to set up an http proxy on linux shell in order to (i.e) download a new package or manually update your distribution with a packet manager?
If so, you need to be a superuser. If you use the “sudo” command, you will probably stumbled across the inability to export variables from the user environment to the “sudo” one.
Read more…

Categories: Bash, GNU/Linux Tags: , , ,

Win32 API: Passing Socket with IPC method

October 13, 2010 1 comment

Hi. In this post I talk to you how to correctly pass a socket created in a parent process to a child process in Microsoft 9x systems.
If you have ever written a multi-process concurrent server in a Unix environment, you may have noticed that the passage of the socket between parent and son processes takes place directly. That is, the child inherits the variables of his parent, also including the file descriptor associated with the socket.

Read more…

Ricoh Drivers for Ubuntu 10.10

October 12, 2010 Leave a comment

If you try to compile r5u870 driver for Ricoh webcams under Ubuntu 10.10 you’ll fail due to a recent renaming of some functions in the linux kernel.

In particular:

usb_buffer_alloc() is renamed to usb_alloc_coherent()
usb_buffer_free()  is renamed to usb_free_coherent()

For more information: http://kerneltrap.org/mailarchive/git-commits-head/2010/4/30/32383

To avoid this problem, make this substitution in the usbcam_util.c file that can be found here: ttp://www.palmix.org/download/r5u870_k2.6.30_i386.tar.bz2

Categories: GNU/Linux Tags: , , ,

Something about AMQP

October 11, 2010 Leave a comment

Hello,

If you haven’t heard nothing about Enterprise Messaging i suggest you  read the related wikipedia’s article http://en.wikipedia.org/wiki/Enterprise_messaging_system. In this article I will introduce the Advanced Messaging Queuing Protocol and some of his concepts.

Before all why talking about AMQP?  Because is the first open standard for the Enterprise Messaging; in a enterprise environment the integration is necessary and an open solution is needed especially because this kind of solution should be leveraged from any language and platform; JMS doesn’t do it very well because of his java dependence and his terms of license: JMS-like interface cannot legally be provided for non-Java platforms.

Continuing talking about AMQP, it supports this kind of message distributions:

  • Store-and-forward with many writers and one reader
  • Transaction distribution with many writers and many readers
  • Publish-subscribe with many writers and many readers
  • Content-based routing with many writers and many readers
  • Queued file transfer with many writers and many readers
  • Point-to-point connection between two peers

This standard is thought to have small and modular model therefore his task is splitted in two main roles, Exchange and  Message queue. This choice made available three main features:

  • The ability to create arbitrary exchange and message queue types
  • The ability to wire exchanges and message queues together to create any required message-processing system
  • The ability to control this completely through the protocol.

A Message queue is a storage entity, it can store messages in memory or in disk  and must provide messages to consumers applications, is described by some proprierties:

  • private or shared
  • durable or transient
  • permanent or temporary

The standard does not define directly entities like  Store and Forward queue or Pub-Sub queue, these entities are created trough Message queue’s attribute.

The Exchange entity takes messages from Applications Messages Producer and routes them to the Message Queue according to criteria called “bindings”. Bindings are therefore the relationship between Exchanges and the and Messages queues.

These are the basic concepts you need to know about AMQP model, in the next post i’ll  introduce you to qpid, an apache’s software project that fully respect this standard and we’ll try it with some source code examples.

Debian Release Name

October 9, 2010 Leave a comment

Hi. Today Today I leardned about the relationship between the name of the Debian’ releases and the names of the characters of “toy Story”. So I want to explain it to you.
The names of the Debian’ releases come from “Toy Story”, the famous Pixar’s film (link). This is true since the release 1.1, released in the 1996. By this time, Bruce Perens had taken over leadership of the Project from Ian Murdock and Bruce was working as system programmer at Pixar.
Read more…

Categories: Bullshit, GNU/Linux Tags: , ,

inet_ntop() for Win32

October 9, 2010 3 comments

Like 4 years ago I made a little project for the operating system 2 class. I had to write an application capable of handling multiple file transfers for both Win32 and Linux. During the coding of the socket-side of the application I encountered an awkward problem: why the hell win32 does not have a compatibility function for the inet_ntop()?

Only recently, for Vista and 7, Microsoft introduced the InetNtop() function: http://tinyurl.com/3xrwaer

If you have to write something that needs to run on XP too (that still seems to be the most used operating system for home users: http://tinyurl.com/2w5ed8n ) just try this code :)


const char* inet_ntop(int af, const void* src, char* dst, int cnt){

	struct sockaddr_in srcaddr;

	memset(&srcaddr, 0, sizeof(struct sockaddr_in));
	memcpy(&(srcaddr.sin_addr), src, sizeof(srcaddr.sin_addr));

	srcaddr.sin_family = af;
	if (WSAAddressToString((struct sockaddr*) &srcaddr, sizeof(struct sockaddr_in), 0, dst, (LPDWORD) &cnt) != 0) {
		DWORD rv = WSAGetLastError();
		printf("WSAAddressToString() : %d\n",rv);
		return NULL;
	}
	return dst;
}

Timeout on Named Pipes

October 8, 2010 1 comment

Hi. In this post, I will show you how make a timeouted namedpipe with the WIN32 API: the msdn’s manual doesn’t explain how to do it.
The named pipes are an IPC’s method by which we can send data to an other process (like a son process).
Read more…

Thinkpad IBM audio buttons

October 6, 2010 Leave a comment

Hi.
Do you have an ibm thinkpad?
Do you have gnome?
Do you have ubuntu?
You can not associate the hardware audio buttons with the volume indicator?
The most likely solution is to add ONE of the following lines to the “/etc/rc.local” file:

cp /sys/devices/platform/thinkpad_acpi/hotkey_all_mask /sys/devices/platform/thinkpad_acpi/hotkey_mask

Or:

echo 0x00ffffff > /proc/acpi/ibm/hotkey

… and, maybe, the buttons will work… :)

Follow

Get every new post delivered to your Inbox.