The Chinese National Day Golden Week, and other holiday-shifting craziness

October 1st is the National Day of the People’s Republic of China.

十月一日是中华人民共和国国庆日。

In the United States and Canada, statuary holidays like this tend to be on Mondays and Fridays, which creates a “long weekend”. The National Day in China, however, is a little different. The whole country do no work for a whole week! Many take vacations, so people call this the “golden week”. As a result, the tourist spots become crammed with people, all the expressways get congested from one end to another, and plane tickets sell out (I don’t know how are the trains doing). Hardly a way to take a relaxing vacation.

在美国和加拿大,这样的法定假日大多都在周一和周五,这样的安排创建了“长周末”。但中国国庆有些不一样。举国上下一周七天全部放假!许多人会去旅游,所以人们称这是“黄金周”。于是,旅游点看到挤满的人山人海,高速公路从一端堵车堵到另一端,而订机票也成了不可能的任务 (我不知道铁路那边怎么样)。完全没有放松的假日。

But the National Day is only a 3-day statuary holiday, so how is it possible that everybody takes a week-long vacation? The keyword here is “transferred holidays”: weekends that are swapped with days in the “golden week”. The State Council publishes a notice every year (like this one for 2014), deciding which rest days are swapped with which working days. Then add another weekend that would fall inside the golden week, and tada! You get a 7-day holiday.

但国庆法定只放三天假,怎么会所有人连休七天呢?这里的关键字是 “调休”:用平常的周末,与黄金周中的工作日对调。国务院每年会发布一份通知,决定哪些休息天与工作日对调。再加上黄金周里本来就有的周末,连休七天的假期就这么产生了!

The drawback is of course, you still need to work these two days transferred out. Before 2014, that means working 7 days in a row. For 2014, the days are shifted from a week before and a week after, so only two weeks of working 6 days in a row.

当然,调出去的那两天还是要工作的。2014年之前这意味着有七天要不休息连轴转。2014年调休,是从前一周和后一周各调一天,所以只要两周连续工作六天就好。

The same holiday transfer is also applied to the Spring Festival, which is like Christmas in that it’s a traditional time for family gatherings; applied to a country that has as many people as China, this results in even bigger traffic every year. Before 2007 this is also applied to the International Labor Day on May the 1st; after 2007, Labor Day is no longer a 7-day holiday. Instead, three traditional Chinese holidays are now designated as new statuary holidays (Qingming, Dragon Boat, and Mid-Autumn festivals). For 2014, all three fall between Friday and Monday, making these also “long weekends”.

调休不止在国庆,也对春节使用;春节有些像圣诞节,两个都算是传统的合家团聚的节日。对于有中国这样人口众多的国家,其结果就是春运。2007 年之前,在五一国际劳动节也调休 (美国、加拿大的劳动节在九月份)。2007 年之后,五一不再休整周,而将清明、端午和中秋,设成新的法定假日。2014 年,这三个节日都在周五和周一之间,中国也有了自己的 “长周末”。

In the three holidays, the Dragon Boat festival and the Mid-Autumn festival are based on the traditional Chinese calendar, in which every month is 30 days; so the dates on the Gregorian calendar fluctuates each year. (Instead of leap days, the traditional calendar has leap months.) But the Qingming festival is always April 4th or April 5th; this is because it’s observed 15 days after the Spring Equinox, and the Gregorian calendar is designed to track the seasons, and the Spring Equinox in particular very accurately.

这三个假日中,端午和中秋的日期都是根据传统农历的;农历每个月都是30天,于是在格里高利历 (公历) 上的日期每年都有变化。但清明每年都是四月4日或四月5日,原因是清明总是在春分后15天,而格里高利历设计上是准确跟踪季节变化的,特别是每年春分的日期。

New glasses!

Got new glasses yesterday. They are -1.75, Nearly the same prescription as my last pair of glasses, which are -1.50 and -1.75, but without astigmatism correction this time.

昨天拿到了新眼镜。度数是175,和我上次的眼镜度数150/175基本一样,但是新眼镜没有矫正散光。

The new frame (okay, it’s one of these “frameless” styles) is harder than the old one, which should stop the glass from deforming and sliding off my nose. The lens are Canon-branded asphrical lens, and are kind of pricey. Hopefully they would last a while, as long as I remember donning and doffing with both hands.

新眼镜架(无框算是眼镜架吗?)材料比上次的要硬,应该会避免眼镜和旧的一样变形,每天从鼻梁上滑下来。镜片是佳能牌的非球面镜片,算是有点贵。希望能够多可以用几年,只要记得戴上拿下的时候双手就好了。

Then after picking up the glasses we went to Nici. They are a German brand of plushies, where I got my fox pencil case. They also have their own take on My Little Pony G4 plushies. And very adorable snow leopard slippers and messenger bags, although the bags aren’t very practical. Then to IKEA to see chairs. Ended up buying a bunch of unrelated stuff of course, including a pepper grinder.

拿完眼镜我们去了 Nici 绒毛玩具店,那里还有他们自己设计的 MLP 4代的玩具,以及很可爱的雪豹拖鞋和单肩包,虽然单肩包并不实用。接下来去宜家看床垫和椅子,当然最后买了一堆不相关的东西,包括胡椒磨。

I wanted to write something more substantial, but unfortunately going through IKEA took the whole afternoon, so that’s all from me this week :< 本来想写点更长的东西,但是可惜去宜家用了整天,所以这星期就这些。

Finally got taxes done.

Whew. That took a while.

Mostly because I haven’t filed taxes for 2010, 2011 and 2012 as well, so I’d have to be filing 4 years of taxes at once. But, the tax situation for these years are simple, and I had help. So it was very quick.

Filling out taxes wasn’t hard, almost quite boring, but there is a lot of detail. I keep finding mistakes when I checked and checked again.

The situation for 2013 was more complicated because I had to file for CPP and QPP refunds. Altogether it took a couple of hours to get all the forms done.

Then I had to go to school and print things out. The tax forms have scripts in them, which Evince didn’t run, so the numbers didn’t line up properly, and I thought that simply opening them in Adobe Reader would fix that. Turns out that Adobe Reader sees the files were edited on a different computer and disabled editing (bad Adobe!). Had to re-type everything in.

In total the taxes for 4 years ended up about 64 pages. Not too bad I guess.

Howto: Get Second Life Running with Shaders on Intel Linux Graphics


Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in /home/public/wordpress/wp-content/plugins/wp-syntax/wp-syntax.php on line 383

Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in /home/public/wordpress/wp-content/plugins/wp-syntax/wp-syntax.php on line 383

Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in /home/public/wordpress/wp-content/plugins/wp-syntax/wp-syntax.php on line 383

Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in /home/public/wordpress/wp-content/plugins/wp-syntax/wp-syntax.php on line 383

Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in /home/public/wordpress/wp-content/plugins/wp-syntax/wp-syntax.php on line 383

Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in /home/public/wordpress/wp-content/plugins/wp-syntax/wp-syntax.php on line 383

Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in /home/public/wordpress/wp-content/plugins/wp-syntax/wp-syntax.php on line 383

Just got a new laptop: System76 Galago Ultrapro, with Intel Iris Pro graphics. So far, despite some shortcomings, I’m liking it. Programs spring to action, and Dota 2 runs with all the eye candies. But Second Life refuses to load any Shaders, and as a result, the screen looks like it’s from ten years ago.

Snapshot_016

So I had to roll my own viewer 🙂 After messing with stuff for two days, I’ve finally got Windlight atmospheric shaders working. Here’s how:

(Note:  I use Kokua as my primary viewer, so this guide might not 100% match the official release; but most of the stuff is common to all viewers.)

First you need to get the source and compile successfully. Instructions are avaliable on the Second Life wiki, although they aren’t very clear.

First problem is that gcc 4.8, the default for Ubuntu 13.10, complains about “array subscript is above array bounds [-Werror=array-bounds]”. This is most likely a false alarm, so use gcc 4.7:

CC=gcc-4.7 CXX=g++-4.7 AUTOBUILD_PLATFORM_OVERRIDE='linux64' kokua-autobuild/bin/autobuild configure -c RelWithDebInfoOS -- -DLL_TESTS=OFF

(remove AUTOBUILD_PLATFORM_OVERRIDE='linux64') if you’re building the official viewer – it doesn’t support 64-bit Linux that well.

gcc 4.7 still complains about truncating precision, so add explicit casts:

diff -r 4581f8365e7d indra/newview/llworld.cpp
--- a/indra/newview/llworld.cpp	Tue Mar 25 18:54:59 2014 -0500
+++ b/indra/newview/llworld.cpp	Sat Apr 05 19:59:19 2014 -0400
@@ -1427,8 +1427,8 @@
 	center_y = min_y + (wy &gt;&gt; 1);
 
 	S32 add_boundary[4] = {
-		512 - (max_x - (rwidth - 256) - region_x),
-		512 - (max_y - (rwidth - 256) - region_y),
+		512 - (max_x - (rwidth - 256) - (S32)region_x),
+		512 - (max_y - (rwidth - 256) - (S32)region_y),
 		512 - ((S32)region_x - min_x),
 		512 - ((S32)region_y - min_y) };

Now we got the viewer to compile. But this is only the beginning. We need to make a few changes.

First, a few shaders in Second Life use requires some shader extensions. But by OpenGL spec, #extension must come before all non-preprocessing directives… and yes, that includes comments! Other drivers would silently accept those, but Mesa considers that to be a bug in SL (see https://bugs.freedesktop.org/show_bug.cgi?id=69226).

The proper way would be reading the shader files and moving all the #extensions to the front of the shader. For now, I’ll just use this hack that works for non-deferred shaders:

diff -r 4581f8365e7d indra/llrender/llshadermgr.cpp
--- a/indra/llrender/llshadermgr.cpp	Tue Mar 25 18:54:59 2014 -0500
+++ b/indra/llrender/llshadermgr.cpp	Sat Apr 05 19:59:19 2014 -0400
@@ -629,8 +629,8 @@
 			text[count++] = strdup("#version 130\n");
 
 			//some implementations of GLSL 1.30 require integer precision be explicitly declared
-			text[count++] = strdup("precision mediump int;\n");
-			text[count++] = strdup("precision highp float;\n");
+			//text[count++] = strdup("precision mediump int;\n");
+			//text[count++] = strdup("precision highp float;\n");
 		}
 		else
 		{ //set version to 400
@@ -859,6 +859,7 @@

And then we need to edit the shaders to move the extension directive before comments:

diff -r 4581f8365e7d indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl
--- a/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl	Tue Mar 25 18:54:59 2014 -0500
+++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl	Sat Apr 05 19:59:19 2014 -0400
@@ -1,3 +1,5 @@
+#extension GL_ARB_texture_rectangle : enable
+
 /** 
  * @file glowExtractF.glsl
  *
@@ -23,7 +25,7 @@
  * $/LicenseInfo$
  */
 
-#extension GL_ARB_texture_rectangle : enable
+
 
 #ifdef DEFINE_GL_FRAGCOLOR
 out vec4 frag_color;
diff -r 4581f8365e7d indra/newview/app_settings/shaders/class1/interface/downsampleDepthRectF.glsl
--- a/indra/newview/app_settings/shaders/class1/interface/downsampleDepthRectF.glsl	Tue Mar 25 18:54:59 2014 -0500
+++ b/indra/newview/app_settings/shaders/class1/interface/downsampleDepthRectF.glsl	Sat Apr 05 19:59:19 2014 -0400
@@ -1,3 +1,4 @@
+#extension GL_ARB_texture_rectangle : enable
 /** 
  * @file debugF.glsl
  *
@@ -23,7 +24,7 @@
  * $/LicenseInfo$
  */
 
-#extension GL_ARB_texture_rectangle : enable
+
 
 #ifdef DEFINE_GL_FRAGCOLOR
 out vec4 frag_color;
diff -r 4581f8365e7d indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl
--- a/indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl	Tue Mar 25 18:54:59 2014 -0500
+++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl	Sat Apr 05 19:59:19 2014 -0400
@@ -1,3 +1,4 @@
+#extension GL_ARB_texture_rectangle : enable
 /** 
  * @file glowcombineF.glsl
  *
@@ -29,7 +30,7 @@
 #define frag_color gl_FragColor
 #endif
 
-#extension GL_ARB_texture_rectangle : enable
+
 
 uniform sampler2D glowMap;
 uniform sampler2DRect screenMap;
diff -r 4581f8365e7d indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl
--- a/indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl	Tue Mar 25 18:54:59 2014 -0500
+++ b/indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl	Sat Apr 05 19:59:19 2014 -0400
@@ -1,3 +1,4 @@
+#extension GL_ARB_texture_rectangle : enable
 /** 
  * @file splattexturerectF.glsl
  *
@@ -23,7 +24,7 @@
  * $/LicenseInfo$
  */
 
-#extension GL_ARB_texture_rectangle : enable
+
 
 #ifdef DEFINE_GL_FRAGCOLOR
 out vec4 frag_color;

Now we need to edit the launcher script, otherwise LibGL won’t be able to find the graphics drivers.

diff -r 4581f8365e7d indra/newview/linux_tools/wrapper.sh
--- a/indra/newview/linux_tools/wrapper.sh	Tue Mar 25 18:54:59 2014 -0500
+++ b/indra/newview/linux_tools/wrapper.sh	Sat Apr 05 19:59:19 2014 -0400
@@ -65,8 +65,11 @@
 MULTIARCH_ERR=$?
 if [ $MULTIARCH_ERR -eq 0 ]; then
     echo 'Multi-arch support detected.'
-    MULTIARCH_GL_DRIVERS="/usr/lib/${I386_MULTIARCH}/dri"
+    AMD64_MULTIARCH="$(dpkg-architecture -aamd64 -qDEB_HOST_MULTIARCH 2>/dev/null)"
+    
+    MULTIARCH_GL_DRIVERS="/usr/lib/${AMD64_MULTIARCH}/dri:/usr/lib/${I386_MULTIARCH}/dri"
     export LIBGL_DRIVERS_PATH="${LIBGL_DRIVERS_PATH}:${MULTIARCH_GL_DRIVERS}:/usr/lib64/dri:/usr/lib32/dri:/usr/lib/dri"
+    echo ${LIBGL_DRIVERS_PATH}
 else
     export LIBGL_DRIVERS_PATH="${LIBGL_DRIVERS_PATH}:/usr/lib64/dri:/usr/lib32/dri:/usr/lib/dri"
 fi

Almost done! Now we need to mark Mesa as “supported”, so viewer will enable shaders:

diff -r 4581f8365e7d indra/newview/gpu_table.txt
--- a/indra/newview/gpu_table.txt	Tue Mar 25 18:54:59 2014 -0500
+++ b/indra/newview/gpu_table.txt	Sat Apr 05 21:03:49 2014 -0400
@@ -345,7 +345,7 @@
 Intel B45/B43							.*Intel.*B4.*										1	1	1	2.1
 Intel 3D-Analyze						.*Intel.*3D-Analyze.*								2	1	0	0
 Matrox									.*Matrox.*											0	0	0	0
-Mesa									.*Mesa.*											1	0	1	3
+Mesa									.*Mesa.*											1	1	1	3
 Gallium									.*Gallium.*											1	1	1	2.1
 NVIDIA GeForce Pre-Release				.*NVIDIA .*GeForce[ ]Pre-Release.*					2	1	1	3.3
 NVIDIA D1xP1							.*NVIDIA .*D1[0-4]P1.*								0	0	0	0

Turn on cubemap, else there will be an assert error if you enable transparent water:

diff -r 4581f8365e7d indra/newview/featuretable_linux.txt
--- a/indra/newview/featuretable_linux.txt	Tue Mar 25 18:54:59 2014 -0500
+++ b/indra/newview/featuretable_linux.txt	Sat Apr 05 21:03:49 2014 -0400
@@ -441,7 +441,7 @@
 list Intel
 RenderAnisotropic			1	0
 // Avoid some Intel crashes on Linux
-RenderCubeMap				0	0
+RenderCubeMap				1	0
 RenderFSAASamples			1	0
 
 list GeForce2

Finally if you’re building Kokua, you might need to comment out these so you can open the preferences box:

diff -r 4581f8365e7d indra/newview/llfloaterpreference.cpp
--- a/indra/newview/llfloaterpreference.cpp	Tue Mar 25 18:54:59 2014 -0500
+++ b/indra/newview/llfloaterpreference.cpp	Sat Apr 05 21:03:49 2014 -0400
@@ -600,9 +600,9 @@
 
 void LLFloaterPreference::onShowStreamMetadataChanged()
 {
-	BOOL enable = gSavedSettings.getBOOL("ShowStreamMetadata");
-
-	getChild&lt;llcheckboxctrl&gt;("ShowStreamName")->setEnabled(enable);
+//	BOOL enable = gSavedSettings.getBOOL("ShowStreamMetadata");
+//
+//	getChild&lt;llcheckboxctrl&gt;("ShowStreamName")->setEnabled(enable);
 }

All done! Now enjoy your Iris Pro Graphics ^.^
Snapshot_008_g

Tidied up the Blog a little bit 稍微打扫了一下这个日志

今天看了一下这个网站的账户情况。为了架设这个网络日志,每年大约花费$20美元。(相当便宜。)
Today I looked at the billing usage of this website. It costs about $20 to host this website for a year. (That’s quite affordable.)

从2004年12月在 MSN Spaces 上开设 Kir’s Corner到现在2014年,这篇是第201篇日志。虽说不多,但也不少。
Since the frist post on MSN Spaces in December 2004, to 2014 now, this is the 201st post. That’s not many, but still quite a lot!

另外,今天还安装了 WP Super Cache,一个Wordpress缓存插件。……事实上,加载速度并不慢,也并没有什么人读这个日志,为什么安装缓存呢?
Also installed WP Super Cache today. … why install a cache plugin, if the load speed isn’t slow, and nobody reads this?

在NearlyFreeSpeech.net架设个人网站的好处是只须按网站利用情况付款。访客不多的话,就不用付很多钱。
The great thing about hosting a personal website on NearlyFreeSpeech.net is that you only pay for what the website uses. If there aren’t many visitors, you don’t have to may much.

可是各种机器人网络发送垃圾邮件,相当占用网站资源,止又止不住,相当烦人。
But there are many bots that send spam emails, consuming resources. They can’t be blocked either, so it’s super annoying.

Screenshot from 2014-04-05 18:06:25-fs8

一年前开始NearlyFreeSpeech.net 开始实验按处理器使用时间收费。虽然目前处理器资源收费是免除的,但是从去年12月开始,网站正不断遭受机器人攻击。页面访问数从原来每月1000-5000次,增长到2月的102417次。而且大部分访问来自同一个国家,只访问同一个页面。
From a year ago NearlyFreeSpeech.net starts to experiment with billing according to processor usage. Even though currently the fee is waived, the site is currently being targeted by spam botnets. Page hits was between 1000-5000 normally, but in February 102471 pages were requested. Most visits were from a single (large) country, and only visiting the same page.

After installing WP Super Cache, static pages are served to people who are not logged in and haven’t posted a comment, without running PHP. Hopefully this will bring the resource use of the website down.
安装了WP Super Cache之后,当没有留言过的访客访问时,服务器会跳过 PHP 直接发送静态网页。希望这样资源使用率会降低。