Archive for November, 2007

称谓的变迁

Chris wonders about the origins of 爸 and 妈 and their usage in daily life.

The 爹、娘、爷、大、爸、妈 stuff fascinates me as well. Different environment calls for different characters. My take is that it has a lot to do with the class status thingy after liberation: the 非农业户口 (non-agricultural) class and 农业户口(agricultural) class.

Kids growing up as 农业 villagers in the 70’s, at least in my region, I suspect nationally as well, don’t call their parents 爸 and 妈. Instead, they call them whatever parents were called before the Liberation, or even before the first Republic was established in 1911, I suspect. Kids growing up 非农业, commonly viewed as being borne with a silver spoon in their mouths, almost always call their parents 爸 and 妈. In fact, any 农业 children who made a 爸妈 attempt were immediately suspected as “acting white“. In my local dialect, we call them 装洋 or 装洋哄(not sure if the last character is right, or even if there is a character for it).

I’ve always called my parents 大 (first tone. 爷 is also common) and 娘 (kinda between first tone and second tone, mostly first). Husband calls his wife 孩娘. Wife calls hubby 孩爷. I’ve noticed that children born in the 80’s and after, agricultural or not, use 爸妈.

I really want to find out the source of 爸 and 妈. Could they be new characters invented/introduced after the 新文化运动? Or they have always been there but I just don’t know due to my ignorance? I have never seen 爸妈 in what meager amount of 古文 that I’ve read. I looked for a copy of 《说文解字》while in Beijing in August, but didn’t find it in the bookstore I visited. Maybe I should have looked for 《康熙字典》instead.

Above is a slightly edited comment I left at Chris’ backup blog.

Comments (13)

Get the documents out of SharePoint database

I recently helped a client to get the WSS 3.0 documents out, as the client’s SharePoint is broken and we couldn’t get it fixed in short time, but they really want the Word, Excel, and pdf documents out of there.

WSS 3.0, Windows SharePoint Services, uses Sql Server for data storage. The Sql Server version WSS uses is the Embedded Edition. By default, microsoft##ssee is what you will see listed in services. Usually, Sql Server client tools are not installed on the server. Therefore, it is difficult to control those files. So we installed Sql Server Management Studio on this box.

Then we had a hard time connecting to the instance. It turned out we can only connect to the SharePoint WSS 3.0 databases via named pipe. I used Windows authentication and put in \\.\pipe\mssql$microsoft##ssee\sql\query as server name, and finally got in.

For SharePoint, there are at least 2 databases involved: the configuration database, and the content database. By default, they are located at c:\windows\SYSMSI\SSEE\MSSQL.2005\MSSQL\Data

I then moved the content database to a regular Sql Server 2005 server, and decided to write a little program to suck the documents outside of the database. It turns out that somebody has already written the program. Follow the link here to get the C# source code of the program. Note that the sql statement used should be the one listed below, as mention at comment No. 9 of that post:

com.CommandText = “select [AllDocs].[DirName], [AllDocs].[LeafName], [AllDocStreams].[Content] from [AllDocs],[AllDocStreams] where (LeafName like ‘%.doc’ or LeafName like ‘%.xls’ or LeafName like ‘%.pdf’ or LeafName like ‘%.ppt’) and [AllDocStreams].[Content] is not NULL and [AllDocs].[Id] = [AllDocStreams].[Id]”;

Enjoy!

Comments

2007年夏北京之行流水帐之三

在北京的那几天我起得都比较早。这天早上我走到北边的隆福寺早市逛了逛。

似乎有一些小时候从季庄到公社逢会赶集的感觉。我生于71年,并且十几岁农转非之前,住在季庄的草屋里,对公社的概念并不陌生。是早市,大部分的商贩在兜售水果、蔬菜、早点、生活用品等。他们有的神情漠然,有的在拉呱,有的忙着应付顾客。早市上至少有两种水果我叫不上名字。问了一下,一种叫榴莲。现在已经记不清另一种的名字了。我原想在一家小摊上喝点豆腐脑,吃几个煎包。因为太早,他找不开零钱。之后我走进一个小店,吃了豆浆泡油条。久违了,我的豆汁和油条。

和小贩聊天很有意思。一方面,他们知道我是中国人,这从口音和相貌都能看出来。另一方面,因为对新版纸币的不熟而造成的数钱时的笨拙,又或许我的举止因在美国生活太久而有所不同,并且对于生活的理解和把握可能还停留在十几年前的水平上,他们看我好像有我刚从桃花源中走出的怪怪的感觉。

我们这天的目的地是颐和园。上了出租后,司机怂恿我们去东岳庙,并说安南都到那儿上过香。我以前从没听说过北京东岳庙。但我们这天行程轻松,就决定去。从司机的热情及我们下车后的行为来看,由于东岳庙是新景点,他可能有回扣。或许我是以小人之心度君子之腹。

以下是在东岳庙照的相片。

东岳庙

东岳庙

东岳庙后,我们去了颐和园。那儿真不错。还记得我94-95混迹于北京时到过颐和园,但好像当时整个昆明湖都上冻了。

画廊
Summer Palace

佛香阁
Summer Palace

昆明湖
Summer Palace

苏州街
Summer Palace

苏州街里有个抽签算命的小门面。儿子抽了一签,抽到“平安是福,喜乐人生”。算命的老先生叫张苦乐,以此写了条幅。老先生北京人,懂几个英文单词,并且用得恰到好处。临走时,我告诉他我是山东人,他小吃一惊,因为他从我的普通话推测我是北京人。

Summer Palace

菊花茶,太座很喜欢这个。
Summer Palace

因为前一天吃饭的不便,我带着太座和儿子去了一家素菜馆,很不错。这个网站罗列了北京的一些素菜馆。我还在网上读到有一家素菜馆叫荷塘月色,下次来时再说吧。

天厨妙香
010-62797078、62780859、89833390
海淀区清华东门外,创业大厦一层

素菜 Dishes from a vegetarian restaurant in HaiDian Qu
天厨妙香素菜

天厨妙香素菜

太座和儿子对这壶茶不感兴趣,基本上被我包圆了。
天厨妙香素菜

Comments (4)

When was the statistics last refreshed

Working with a few clients, I’ve noticed some issues with statistics in Sql Server 2005 not being updated frequently, even if auto stats is turned on at the database level and table level. I’ve noticed this often enough for me to cook up a quick script.

Initially I thought that sys.stats catalog view might have this information, but no. It can tell you if a particular stat is created automatically. So I decided to use the sp_autostats system stored procedure to get that ifmortion out. This should also work for Sql Server 2000.

SET NOCOUNT ON

DECLARE @TableName varchar(50)

PRINT ‘——– Stats Updates Report ——–’

DECLARE Table_Cursor CURSOR fast_forward FOR
SELECT name
FROM sysobjects
WHERE xtype = ‘U’
ORDER BY name

OPEN Table_Cursor

FETCH NEXT FROM Table_Cursor
INTO @TableName

WHILE @@FETCH_STATUS = 0
BEGIN

select @TableName

exec sp_autostats @TableName
— Get the next record.
FETCH NEXT FROM Table_Cursor
INTO @TableName
END

CLOSE Table_Cursor
DEALLOCATE Table_Cursor
GO

Comments

BCP In automation script

A while ago I wrote an article on code generation using Sql. The script I gave in that article can generate BCP (in and out) scripts automatically.

I helped out a friend recently, and thought I would share the WMI/VBScript I cooked up with you. This script assumes that all files within a folder need to go to one table, and the layout of the comma delimited files match the structure of the table. It also uses trusted authentication. It can be easily customized for more advanced BCP tasks. Enjoy!

strComputer = "."
'Directory name. Don't put the back slash here
strDirectory = "C:MyDirectoryWhereCsvFilesAre"
'Instance Name
strInstance = "MySqlServerInstance"
'Table Name
strTableName = "MyDb.dbo.MyTable"

Set objWMIService = GetObject("winmgmts:\" & strComputer & "rootcimv2")
Set oShell = CreateObject("WScript.Shell")

Set colFiles = objWMIService.ExecQuery _
    ("ASSOCIATORS OF {Win32_Directory.Name='" & strDirectory & "'} Where " _
        & "ResultClass = CIM_DataFile")

For Each objFile In colFiles
    strCommand = "bcp " & strTableName & " in " & chr(34) & strDirectory & "\" & objFile.FileName & "." & objFile.Extension & chr(34) & " -c -T -S " & strInstance & " -t " & chr(34) & "," & chr(34)
    'msgbox strCommand
    oShell.Run strCommand, 0, True
Next

Comments