Thursday, June 14, 2012

Linux creator Linus Torvalds shares Millennium Technology Prize

Congratulation to Linus Torvalds!

The BBC reports that Linus has co-won the Millennium Technology Prize.  They also runs an interview with him.

Sunday, June 10, 2012

Interview with Patrick Volkerding of Slackware

LinuxQuestions has an interview with Patrick Volkerding, the creator of Slackware.

Slackware is my favorite Linux distribution.  My first encounter with Linux was through Slackware around 1994.  I still remember the days that I went to school's computer lab with a stack of floppy disks to download the latest release, it was frustrated with the lousy floppy disks, I had to write two disks for each disk image just in case one of them failed.

Since then I have used Suse, Redhat, Debian, etc occasionally, every time I have to come back to Slackware for its simplicity and elegant style of system management scripts.  From Slackware I have learned lots and have supported it through my subscription to the DVD.

I wish every Slackware supporters would do a subscription to show the appreciation for Patrick's great work if finance is not a problem.

Saturday, June 9, 2012

Ada Unbounded String and Vector Container

Just to get myself to familiar with the Vector container and Unbounded String, I wrote the follow small test program:
-- test unbounded string with vector

with Ada.Text_IO; use Ada.Text_IO;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Containers.Vectors;
With Ada.Text_IO.Unbounded_IO;
with Ada.Command_Line; use Ada.Command_Line;

procedure ubt is
   package My_Vector is new Ada.Containers.Vectors (Natural,
     Unbounded_String);
   use My_Vector;
   package SUIO renames Ada.Text_IO.Unbounded_IO;

   -- read input file and add each line into str_pool till file end
   procedure read_input (str_pool : in out My_Vector.Vector;
                         File     : File_Type) is
   begin
      loop
         str_pool.Append (SUIO.Get_Line (File));
      end loop;
   exception
      when End_Error =>
         null;
   end read_input;

   File : File_Type;
   str_pool : My_Vector.Vector;
begin
   Put_Line ("Argument 1 is : " & Argument (1));
   Open (File, In_File, Argument (1));
   read_input (str_pool, File);
   Close (File);

   Put_Line ("Total line: " & str_pool.Length'Img);
   Put_Line ("File content:");
   for i in  0 .. Integer(str_pool.Length) - 1 loop
      SUIO.Put_Line (str_pool.Element(Integer(i)));
   end loop;

   str_pool.Clear;
end ubt;

Compile it with
gnatmake ubt
It reads the input file line by line and stores them into the Vector container, then prints out the lines.

Reference: Ada.Containers.Vectors

Friday, June 8, 2012

TeX and TeXiA

I have been quite fond of TeX and LaTeX since my first encounter of it.  The type set document looks the best and professional compare with other word processors.  But it is hard to use when you trying to change the default way of text layout.  The TeX macro language is quite hard to understand even I myself am professional programmer.

Over the years, I would like to see if I could come out a better one, but due to various reasons and my own laziness,  there is no progress.  I finally set myself to start a little bit by re-implementing the TeX engine in Ada - TeXiA, for the purpose to understand how TeX work internally and learning the Ada programming language at the same time.  The progress is slow, currently the project just started and not yet reach section 100 of TeX: The Program (Massachusetts: Addison-Wesley, 1986). ISBN 0-201-13437-3.

I found the programming style of TeX, the literate programming introduced by Donald Knuth, hard to follow for me.  I'm not a smart guy as Donald.  I have to refer to a few C implementations to understand the whole picture: the texlive web2c version, yytex and Common TeX.

There are several other projects that related to computer typesetting are quite interesting:

水調歌頭

宋 蘇軾
丙辰中秋歡飲達旦,大醉作此篇,兼懷子由

明月幾時有?把酒問青天。
不知天上宮闕,今夕是何年。
我欲乘風歸去,又恐瓊樓玉宇,高處不勝寒, 起舞弄清影,何似在人間。
轉朱閣,抵綺戶,照無眠。
不應有恨,何事長向別時圓。
人有悲歡離合,月有陰晴圓缺,此事古難全。
但願人長久,千里共嬋娟。

涼州詞

王翰

葡萄美酒夜光杯 欲飲琵琶馬上催
醉臥沙場君莫笑 古來征戰幾人回

涼州詞

王之渙

黃河遠上白雲間,
一片孤城萬仞山。
羌笛何須怨楊柳,
春風不度玉門關。

送元二使安西

王維

渭城朝雨浥輕塵, 客舍青青柳色新。
勸君更盡一杯酒, 西出陽關無故人。

Thursday, June 7, 2012

别董大

唐-高適

千里黃雲白日曛,
北風吹雁雪紛紛。
莫愁前路無知己,
天下誰人不識君?