推荐一电视软件:LiveStation

到其网站http://www.livestation.com下载了Linux版,是传统的run文件安装方式,安装还是挺简单的,虽然安装文件有点大。程序界面比较漂亮,打开配置窗口可以看出是用QT的。
虽然是国外的软件,但发现缓冲速度很快,当然,节目主要还是外语台,CNN、Fox这些不会少,不过细心一搜,还是有凤凰、TVB这些华语台的,虽然没PPStream那么丰富,清晰度还可以。
PT's Technical Blog, about Ubuntu, Linux or C/C++, Java, Python or whatever geek, for PT's detemined to be a real geek......


什么是代码?什么是程序?
上了两年多的大学计算机专业,现在看这问题,实在感慨。
代码也许是书上的一段文字,程序也许是磁盘上的一个文件,老师们在给你讲述它的原理,它的结构,却从未提及它的本质。程序怎么出来的?从代码编译出来的。代码怎么出来的?人写出来的。人怎么会写代码?想出来的。思想是怎么出来的?这......
程序的本质,是人的创造力,也就是那所谓1%的灵感。这里有个很哲学的问题,貌似课本的说法是,量变会引起质变,而我得提醒,“引起”的意思是“可能会,可能不会,并不一定会”。“程序 = 算法 + 数据结构”这个说法,很明显地低估了等号左边的重量。
然而反观我们的高等教育,从一段代码里面挖掉几行,让你填空,瞧一瞧上下文,哦,有些地方差不多的,把语句抄过来,好,编译通过,实验课完了,回去写实验报告吧,下星期交。
原来现在的大学教育就是低能儿童智力开发。
我想,即使让学生们自己去开发个人品计算器、人名打架器,学生们的收获也要比啃上那几本砖头书多,至少他们知道自己能够创造东西,而不是只会学东西。
PS:《偷天换日》(The Italian Job)电影里有这么一个人,他抢了别人的金子,却不知道如何去构造自己的梦想,买到了别人想要的一切,却不知道自己想要什么,我想,这是一个人最大的悲剧。不是说,知识也是财富么,如果缺乏创造能力,即使占有再多的知识,又有何用呢?
1. get a icon file name "logo.ico"
2. create an file name "logo.rc", contain a line:
1 ICON "icon.ico"3. run : (windres was include in Mingw)
windres logo.rc logo.o4. link the "logo.o" file together with other object files to the final exe file.
I found that programming gtk+ plays a lot of tricks. I implemented "editable treeview cells" today in my program, after spending quite a while looking up for examples on Google. The most I wanted to say is that, the Gtk manual was detailed enough, but it never tells you how to do, which makes me so desperate sometimes......
The solution was written in a tutorial, http://scentric.net/tutorial/sec-editable-cells.html
there seems quite several GTK tutorials, but most of their contents were duplicated, though I always learn the tricks from them... ^_^
Note:
renderer = gtk_cell_renderer_text_new();
...
g_object_set_data(G_OBJECT(renderer), "my_column_num", GUINT_TO_POINTER(COLUMN_NAME));
...
renderer = gtk_cell_renderer_text_new();
...
g_object_set_data(G_OBJECT(renderer), "my_column_num", GUINT_TO_POINTER(COLUMN_YEAR_OF_BIRTH));
...
the "renderer" must be create several times in this trick, for a object couldn't carry the same property in different value twice, itn's it?
Labels: Editable Treeview Cell, gtk+
今天又奋战gtk的文档,看着别人写的旧版example代码,用GtkBuilder的方法重写,实现了一个自己想要的TreeView List。最后想在TreeView中加入一个右键菜单,却想不到小小的popup menu就给我设了两大难关。
首先找来找去没有见到有right-click的signal,Google了一下,从Maillist里面的解答找到头绪,由GtkWidget的button_press_event来实现。GTK+ Reference Manual里面一点都没提到这个信号,原来这个button指鼠标的button,键盘的键叫做key……
http://mail.gnome.org/archives/gtk-list/2002-August/msg00119.html
button_press_event emits when any mouse button pressed, when handling with this signal, use a callback prototype in this way:
and you can determine which button was press with event->button (values 1,2,3...3 stands for the right button, 1 for left and 2 for middle), and if you want give this signal back to the widget, just return FALSE.gboolean callback (GtkWidget *widget,
GdkEventButton *event,
gpointer data);
tree->menu = GTK_WIDGET ( gtk_builder_get_object (builder, "menu1") );弹出窗口:
gtk_menu_popup (GTK_MENU(user_data->menu), NULL, NULL, NULL, NULL, event->button, event->time);郁闷的事情来了,程序运行的时候提示:
(tree:28254): GLib-GObject-WARNING **: invalid unclassed pointer in cast to `GtkMenu'在Reference里面看了半天,注意到GtkBuilder Description的一段话:
(tree:28254): Gtk-CRITICAL **: gtk_menu_popup: assertion `GTK_IS_MENU (menu)' failed
A GtkBuilder holds a reference to all objects that it has constructed and drops these references when it is finalized. This finalization can cause the destruction of non-widget objects or widgets which are not contained in a toplevel window. For toplevel windows constructed by a builder, it is the responsibility of the user to call gtk_widget_destroy() to get rid of them and all the widgets they contain.在Glade3里面看到,popup menu不属于toplevel的window,看来小menu在g_object_unref (G_OBJECT (builder));的时候被收回去了……可是怎么解决呢?总不能不收了builder吧,builder占的内存可不小的,很容易造成内存泄漏……
g_object_ref ()
gpointer g_object_ref (gpointer object);Increases the reference count of
object.
The reference count really mean something, worth to read about it carefully. I just add one more statement after getting the menu widget:
g_object_ref ((gpointer)tree->menu);Yes,the whole world goes the right way now!!!!
Labels: gtk, gtk_builder, GTK_IS_MENU, popup menu, right click