Saturday, June 16, 2012

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

别董大

唐-高适

千里黄云白日曛, 
北风吹雁雪纷纷。 
莫愁前路无知己, 
天下谁人不识君?