Tuesday, June 10, 2008

Erlang: parallelism without modifying code

The Erlang programming language has been getting popular among programmers, for the capability of handling massive number of connections, such as the chat server used in Facebook.

One of the basic ideas of Erlang are that minimizing the side effect of assignments by prohibiting multiple assignments into the same variable. At first this looks a rigid restriction and memory-consuming practice, but once you learn the native list structure of Erlang (mostly the same as in the Lisp language) and the tail-recursion control flow, writing the Erlang code is not too difficult, while retaining the conciseness and the performance.

I've written a code of parallel mapping of a function to a list. The word mapping means applying the same function to each member of the source list and obtaining the results which retains the same sequence as in the source list. If the function does not have side effects (such as changing the values of shared data structures), the operation can be parallelized by splitting the list into the smaller sublists and invoking the mapping process for each sublist.

Erlang has the supporting libraries of invoking a process in a distributed Erlang node running in multiple computers, so the parallel mapping function is the simplest but very powerful tool to experience the collective computing power of parallelism.

The code is available here as a tar archive, of one file of Erlang source code.

Saturday, May 17, 2008

Installing FreeBSD 6.3 and 7.0 to Panasonic CF-R4

I had difficulties installing FreeBSD 6.3-RELEASE and 7.0-RELEASE to Panasonic Note PC CF-R4. This machine has been known for having an incompatible BIOS which prevents FreeBSD BTX 1.01 or earlier to boot.

Recent FreeBSD 8.0-CURRENT snapshot ISO images are with BTX 1.02, which allows CF-R4 booting from USB CD-ROM drives. So I tested the following procedure for the 6.3 and 7.0 releases and the both releases were successfully installed:

  • boot from a CD-R(W) with 8.0-CURRENT-200805-i386-bootonly.iso (or later)
  • exit the boot prompt screen to the loader prompt (by pressing 6) before the 8.0 kernel boots itself
  • enter unload to clear the loaded (8.0) kernel
  • replace the CD-R(W) in the drive to the target installation image (e.g., Disc 1 of 6.3/7.0-RELEASE)
  • enter boot-conf to load the target kernel and install

I think this is the compatibility problem of BTX. I also think this is so far the easiest way to boot from the USB CD-ROM drive for CF-R4, because generating ISO images for previous releases with the compatible BTX loader will be a big hassle. You may give it a try if you want to boot from a USB flash memory.

Saturday, April 26, 2008

Learning Erlang

I've been learning the Erlang programming language.

I've tested an IPv6 address-to-domain-name conversion for the reverse lookups. I made a presentation at the 1000speakers:4 conference on April 26, 2008. The presentation slide set in PDF is here.

Wednesday, April 9, 2008

The days of Neuro Net Recordings

Neuro Net Recordings (NNR), an online techno-music distribution project, is one of the most important music projects of my life. Many music files of NNR have been available at archive.org as a part of the open source music archive. It was founded by Tomotoshi "Ackie" Akiyama and other core members including myself, in 1994. I was the Internet Archivist, or the one who handled the online distribution channels over Internet.

NNR had the free online distribution policy from the beginning: NNR had the non-exclusive distibution rights of the music files in the various available formats on the Internet. It was quite similar to the Creative Commons BY-NC-ND license, which means preserving the author's credit, non-profit use only, and changes not allowed during redistribution.

NNR was not really a for-profit label, but most of the albums of NNR Active Potential Series were distributed by cassette tapes with reasonable price (JPY500 for Active Potential Number 0). NNR also released one CD album called Neural Networks Vol. 1 in 1996. So NNR was really an independent label, though NNR consistently distributed the music files towards the potential listeners on the Internet. NNR once had a redistribution agreement with FranceMP3.com. Jean-François Fecteau has been a long-time supporter of NNR activities, and he has played NNR tunes many times in his program Le Vestibule from CFOU-FM in Trois-Rivières, Québec, Canada.

The distribution format NNR chosen were RealAudio, MPEG-1, Ogg Vorbis, and MP3 finally, because MP3 technology license owners allowed exemption of the MP3 technology royalty fee to the business with USD100000 or less annual revenue. Ackie kindly sent me the past DATs for mastering NNR cassette tapes, so I rebuilt and remastered the CD-R master discs from the DATs. I learned the remastering skills using Syntrillium's Cool Edit (now Adobe Audition) and other tools.

I also performed real-time streaming events called Neuro Net Radio twice on 1998 and 1999, which were actually DJing from my house over RealAudio streaming, playing only NNR tunes to avoid dealing copyright issues with the copyright holders.

Many professional music creators contributed to the NNR music archive before and during they became really professional. Some of the artists are: NISH, Leopaldon, Takuya Kitani, and Warping Allergen. I find many NNR contributors are still actively seeking their other opportunities in their lives.

In the age of iTunes and Amazon.com MP3, no professional musician can survive without distributing their music online. Streaming music radio stations like Soma FM are doing competitive business. Many people in the so-called music industry, however, still do not accept online media, and I feel quite sad about it. I've already been fed up with the stagnated copyright issues in Japanese music scene either. So I decided to quit distributing NNR files on my own in 2004. Fortunately, archive.org generously provides the storage space and other goodies to the free-music distributors, so I decided to put NNR and my music pieces there in 2007.

I know my talent on music is quite limited and is not competitive enough to survive as a professional musician. But I also believe that does not limit my rights to freely distribute my own music. I've learned a lot through my NNR activities and I appreciate all those who helped NNR.

Fumi Yamazaki suggested me to write this, as a case study of Creative Commons activities in Japan. Thanks, Fumi.

Friday, April 4, 2008

META refreshing considered spamdexing

I am writing this as a memo for myself, and a message to Blogger.com reviewers of my old (blocked) blog at macrofield.blogspot.com.

I realize the whole issue is about Meta refreshing of HTML. This has been a common practice for a long time to redirect users from an old page to a new page. The problem of this practice, however, is that users will have difficulties on intervening the redirection.

I embedded a Meta-refreshing tag in my old (now blocked) blog for an automatic redirection. As seen in the Blogger.com's definition of spam blog, this redirection is considered spamdexing, a violation of Blogger.com service terms.

I think no one likes spamming any more and neither do I, but I should confess that I didn't study well on how Meta-refreshing is considered abusive these days in the HTML writing practice. I will remove the embedded META tag as soon as Blogger.com allows me to reedit the contents, or to be specific, to reedit the layout HTML tags of the old blog of mine.

And I suggest you all to stop using Meta refreshing. Being misunderstood as a spamdexing is doing nothing good for you, whatever your intention might be.

Possible false detection of spamming on Blogger.com

This is an administrative announcement.

Due to the automatic classification of possible blog abuse on Blogger.com, the old URL of this blog, macrofield.blogspot.com. has been disabled by Blogger.com. I've already requested Blogger.com to unlock the contents under the old URL. I will make a necessary fix ASAP. I'm sorry for the inconvenience.

Note: on July 2008, I have confirmed this blockage has been dropped.

Sunday, March 23, 2008

Gauche: yet another Scheme-a-tic diagram of programming (self-)education

I feel programmers in the 21th century prefer so-called dynamic, scripting or light-weight programming languages to the good-old static, compilation-based, and heavy-weight ones. In this sense, I belong to the old-style programmers, who like C, awk, and simple Bourne Shell. So far the most complex light-weight language I've used is Perl.

I like definitive or pre-defined syntax and keywords than those which may change the meanings by the programmer's definition, because the dynamic definition will make the program too complicated. Maybe my brain is losing flexibility, but I'd rather want to read something which can be easily decoded than the cryptic ones.

I didn't have a chance to formally learn programming, however, during my education. This is both good and bad: the good thing is that you don't have to spend time on learning subjects which you won't use throughout the rest of your life; and the bad thing is that you may have no chance to know the coding practice much efficient than what you usually write.

Some programming languages still irritate me. I should confess I don't like Prolog. I will be a very poor programmer if I have to write only rules between the objects than the way of moving around and cutting and pasting them. Thinking about the backtracking facility is a nightmare for me. I'm 99.9% (if not 100%) filled with the idea that every statement of a programming language will have a side effect, or may cause changes of the contents of the preallocated memory space. I still don't believe in the idea that no assignment is needed for a real-world computing.

I still think, however, the idea of functional languages which is focused on the relationship of data than copying and manipulating them back and forth, is an essential part of the modern computer programming. Abstraction work of data often simplifies the complex problems. Writing things in recursion than an arbitrary loop will simplify the code and often makes it efficient.

Recently I've learned many young programmers are learning a lot from LISP and Scheme, and I've heard some of them have learned Scheme in their formal education process. I welcome that trend and I hope it continues to grow, because in the real-world programming paradigm there's large room for optimization by introducing Scheme-style abstraction, such as describing an XML document in an S expression.

Gauche, an implementation of Scheme by Shiro Kawai and other developers, is a well-balanced mixture of the LISP-Scheme tradition of simplicity and a Perl-like feature, such as being able to handle Unicode, regular expressions, network sockets, and simple byte-aligned buffer structures which is essential for network programming.

Gauche is a viable alternative to scripting languages like Perl; and it's still a Scheme implementation, so an old-minded programmer like me has many things to learn and enjoy. Gauche has a lot of modules or external libraries to handle real-world problems, such as manipulating database engines and HTML/XML data structures. It took me only three hours to rewrite a Japanese input method server program in C by Gauche, thanks to the modules. Gauche and Scheme designers also know that programmers want to use assignments, so an old-headed guy like me didn't have to scratch the head forever.

In 1989, when I first met a Symbolics LISP machine, it didn't attract me much because the machine was something completely different from the UNIX workstations, which I wanted to use to communicate with my friends and gurus. I realize, however, things have changed a lot now; you can play around and even solve the real-world issues on a LISP-Scheme processing environment like Gauche. The vast increase of processing power including the CPU speed and the amount of main memory make this possible for everyone. And I think it's a new Scheme-a-tic diagram for a competitive programmer; you will become much more productive after learning practical data abstraction.