[ Top page ]

Main | March 2008 »

November 2007 Archives

November 16, 2007


Circular layout of radio buttons to a Web page using Perl

Sometimes it is necessary to layout radio buttons freely on a Web page. I once performed an experiment, in which I asked the human subjects to answer the sound direction and distance after hearing a spatialized sound. For this purpose, I used a Web page that contained radio buttons. The subjects answered by clicking one of the buttons. This method enables free layout of buttons, e.g., circular or any other layout, but the layout must be decided carefully not to overlay them with other contents. So, when it is possible to layout the buttons in an easier method, for example by a table, this method should not be used.



Perl database (tie) generation from text

A simplified database can be handled easily using tie() of Perl, instead of using heavy-duty databases such as relational databases. When using tie(), hashes can be tied to an external database and the hashes can be permanent. However, in contrast to heavy-duty databases, it is not possible to write to the database in parallel and the performance is probably lower. So it is suited for prototypes but not suted for real use.

Microsoft Excel is often used when creating a data group such as a database or data to be entered to a database. So, we often want to enter data created by Excel or another program, for example, by outputting it to a tab-separated text. The following program is an example for such task.



Simplified XML interface using Perl -- conversion of table-style data representation between hash and XML

A good method for building exact XML interface is use XML API. However, it is easier to use Perl's pattern macth function to create a simpler XML (like) interface. In an exact XML interface, a text line may contain any number of tags, and a content enclosed by a beginning and ending tags. However, if we can add a restriction to this syntax, we can handle XML documents in an easier method. Such a simplified XML processing might not be encouraged, but it is convenient when building a simple prototype.


Network and communication

A program that "kicks" a UDP port using Perl

When connecting multiple computers to a network and making the computers communicate each other through the network, it is convenient to start the communication by kicking a port of the application on one of the computers. For this purpose, I wrote a program that sends a UDP (User Datagram Protocol) message that has no content. (It is easy to replace UDP by TCP, but the receiver program will be a little more complicated.)



Purpose of this blog

The purpose of this "blog" is to introduce my programming tips.



Recording and sending linear voice using Perl

A Perl program that sends a voice stream using RTP (Real-time Transport Protocol) is show below. The default codec for input voice is 16-bit linear, but u-Law (G.711) and some other codecs can be used. The port numbers and the IP address of the receiver are specified in this program ($REMOTE_PORT_RTP, $LOCAL_PORT_RTP, $ip, etc.). RTCP (Real-Time Control Protocol) can also be handled, but no specific control is intended. A detailed description will be given in future, but it will be explained when it becomes necessary.


Network and communication

Receiving and playing linear voice (VoIP) using Perl

A program that receives a two-channel (i.e., stereo) voice by RTP (Real-time Transport Protocol) and that plays by audio. The sound is 16-bit linear by default, but u-Law (G.711) or other codecs can be used. The port number used for receiving the voice is specified in the program (i.e., $IN_PORT_RTP). A detailed description will be given in future, but it will be explained when it becomes necessary.


About November 2007

This page contains all entries posted to Small and Large Stones of Programming in November 2007. They are listed from oldest to newest.

March 2008 is the next archive.

Many more can be found on the main index page or by looking through the archives.

Creative Commons License
This weblog is licensed under a Creative Commons License.
Powered by Movable Type