作者: admin

  • 约稿之作——关于拍电视剧

        有好久没正儿八经写点儿东西了,龙王大哥早就说我该更新博客或者QQ空间,今天刚好妖精也催我下了班写写今天见闻,那俺就别辜负众望,勤快一把,写点字儿上来吧。
        中午大家分拨儿解决午餐这种民生大事:护长率领大部队去吃米线,我们四五个在家吃军官灶,还有老姐俩去吃米米乐快餐。他们一从外面回来就嚷嚷说有剧组到我们单位拍电视剧,名字好像叫做《成家立业》。主要演员有宋春丽,辛柏青等,剧情不详,据说是写上个世纪八十年代的事儿,从演员的装束就可以看出来了,那叫一个土啊,哈哈。听工作人员喊好像是在我们这里拍的是第五集的某些镜头,我不是好事儿的人,没怎么出去看热闹,所以也不后悔没出去吃,晚知道消息。
        之前倒是听说过拍电视剧有多么多么枯燥,因为不了解情况都觉得肯定是他们矫情,认为肯定挺好玩的。这回看了以后才明白,只是一份工作而已,明星们因为有美丽的光环,可能相对轻松些,一般演员和剧组工作人员实在是辛苦乏味得很:导演是最看不得的一个人儿,穿着相当老土的军大衣,有些蓬头垢面,作践得还赶不上民工,反复吵吵着一些我们似懂非懂的词儿,向各部门发号施令;最辛苦的看样子应是是剧务道具一类的了,搬搬扛扛不算还总是重复作业,不过倒是挺有才的,为了避免穿帮居然能把IC卡电话用纸盒子裹住,嘿嘿;演员们脸上都化着妆,可能为了避免在灯光下惨白或者土黄吧,不过粉再厚也还是没法掩盖他们脸上的瑕疵,我们有些八婆地说那个演医生的倒不如让我们护长去呢,肯定比她敞亮还水灵,但是想想人家演个医生也挺不容易,晚上才能拍,早上就化妆了妆跟着等一天,挨着冻还得啃干面包同时不忘背台词儿,哎。
        包括我在内,年龄大一些的都知道宋春丽挺有名,走廊里看见她,觉得跟电视里没什么太大区别,气质蛮不错的。年轻人就对辛柏青情有独钟了,我因为没刻意去看,也不十分清楚他到底是哪一位,回来上网查了一下才知道他就是在《幸福像花儿一样》里面扮演林彬的人儿,跟演员朱媛媛是夫妻,看过他拍的几部片子,感觉蛮好。大家都说要是有邓超和孙俪就好了,简直异想天开,哈哈。
        因为楼上楼下一大帮子剧组人员,我们工作做完也没什么心思看书学习,一会儿看热闹,一会儿自娱自乐,发现我用手机给大家连拍特别搞笑,几个年轻的笑得肚子疼的脸疼的岔气的都有,惹得他们工作人员几次过来请我们要小点声,哈哈哈,反正是挺开心的一下午。
        因为摄制组的原因,我们下班相对早些,回来在键盘上敲敲打打,刚写了一半龙王就上来评论,问我是否混上群众演员,我说还没写完他居然老大不乐意,说没写完发什么发,揪其根源是因为我没有把他的名字改为ROGER,这家伙,要求真多,就是叫龙王,爱咋咋地,哼!
        好了,完活,交差喽,没有稿费还写一包劲,若不是文笔一般还真是不划算了,呵呵……

  • Visual Studio macro function for adding function header automatically

    You could use the macro function to add function header that could use by doxygen.

    It is tested in Visual studio 2008.

        Sub FunctionHeader()
            Dim objEditPt As EditPoint
            Dim currentLine As Integer
            Dim endline As Integer
            Dim findString As String
            Dim findString2 As String
            Dim firstPosition As Integer
            Dim voidPosition As Integer
            Dim BoolPosition As Integer
            Dim PtrPosition As Integer
            Dim lastPosition As Integer

     

            objEditPt = DTE.ActiveDocument.Selection.ActivePoint.CreateEditPoint
            currentLine = objEditPt.Line
            objEditPt.EndOfDocument()
            endLine = objEditPt.Line

            If (endLine > currentLine + 50) Then
                endLine = currentLine + 50
            End If

            findString = objEditPt.GetLines(currentLine, endLine)

            ‘get params with “(” and “)”
            findString2 = “”
            Dim strList As New System.Collections.ArrayList

            Dim findVoid As Boolean = False
            Dim findBool As Boolean = False
            Dim findPtr As Boolean = False

            firstPosition = InStr(findString, “(“)
            voidPosition = InStr(findString, “void”)
            BoolPosition = InStr(findString, “BOOL “)
            PtrPosition = InStr(findString, “* “)
            If (firstPosition >= 1) Then
                If (voidPosition >= 1 And voidPosition < firstPosition) Then
                    findVoid = True
                End If

                If (PtrPosition >= 1 And PtrPosition < firstPosition) Then
                    findPtr = True
                End If

                If (BoolPosition >= 1 And BoolPosition < firstPosition) Then
                    findBool = True
                End If

                lastPosition = InStr(firstPosition, findString, “)”)
                If (lastPosition >= firstPosition) Then
                    findString2 = Mid(findString, firstPosition + 1, lastPosition – firstPosition – 1)
                    strList.AddRange(findString2.Split(“,”c))
                End If
            End If

            DTE.ActiveDocument.Selection.NewLine()
            DTE.ActiveDocument.Selection.Text = “/**”
            DTE.ActiveDocument.Selection.NewLine()
            DTE.ActiveDocument.Selection.Text = “* ”
            DTE.ActiveDocument.Selection.NewLine()
            DTE.ActiveDocument.Selection.Text = “* ”
            DTE.ActiveDocument.Selection.NewLine()

            Dim listCount As Integer
            Dim newString As String

            listCount = strList.Count
            For Each stringElement In strList
                stringElement = Replace(stringElement, vbCr, “”)
                stringElement = Replace(stringElement, vbLf, “”)
                stringElement = Replace(stringElement, vbTab, ” “)
                stringElement = Trim(stringElement)
                If stringElement.Length <= 0 Then
                    Continue For
                End If

                Dim bAsIn = “[in] ”
                If InStr(stringElement, “*”) Then
                    bAsIn = “[out] ”
                End If

                newString = “* @param ” + bAsIn + stringElement + ” : ”
                DTE.ActiveDocument.Selection.Text = newString
                DTE.ActiveDocument.Selection.NewLine()
            Next

            DTE.ActiveDocument.Selection.Text = “* ”
            DTE.ActiveDocument.Selection.NewLine()

            If findVoid Then
                DTE.ActiveDocument.Selection.Text = “* @return void.”
                DTE.ActiveDocument.Selection.NewLine()
            ElseIf findBool Then
                DTE.ActiveDocument.Selection.Text = “* @return True success;”
                DTE.ActiveDocument.Selection.NewLine()
                DTE.ActiveDocument.Selection.Text = ”          False, failed;”
                DTE.ActiveDocument.Selection.NewLine()
            ElseIf findPtr Then
                DTE.ActiveDocument.Selection.Text = “* @return valid pointer; or NULL.”
                DTE.ActiveDocument.Selection.NewLine()
            Else
                DTE.ActiveDocument.Selection.Text = “* @return S_OK : the processing completed successfully;”
                DTE.ActiveDocument.Selection.NewLine()
                DTE.ActiveDocument.Selection.Text = “*         E_POINTER : a NULL pointer parameter was passed;”
                DTE.ActiveDocument.Selection.NewLine()
                DTE.ActiveDocument.Selection.Text = “*         E_FAIL : Some other failure occurred;”
                DTE.ActiveDocument.Selection.NewLine()
            End If

            DTE.ActiveDocument.Selection.Text = “* ”
            DTE.ActiveDocument.Selection.NewLine()
            DTE.ActiveDocument.Selection.Text = “*/”

        End Sub

  • 如何使用google的cpplint.py

    http://code.google.com/p/google-styleguide/ 这是google使用的一个C++代码风格规范,可以作为平常开发的参考。

    作为风格参考,google还推出了一个cpplint.py的脚本,可以用作风格规范检查使用。可以在这里下载

    http://google-styleguide.googlecode.com/svn/trunk/cpplint

    在windows下的使用方法也非常简单,(安装python后)把cpplint.py放在项目目录下,然后进入命令行,敲打命令如下:

    C:\temp\>cpplint.py –output=vs7 test1.cpp

    可以通过cpplint.py –help来查看帮助。注意,命令行参数都是两个横线(–)。

  • strlen与性能问题

    在Tony bai的博客上看到他提起strlen的性能问题,这还真是比较有意思的一个话题。

    我在前一阵专门用两周时间来对代码做优化,问题的起因是我们组有人提出来程序跑的慢,另外使用接口功能的外国同事也提起过几次。关于优化还专门做了一张ppt演示,有空节选一下分享出来。不过有意思的是,最后发现速度的最大瓶颈其实并不是在我们新加了多少功能,而是两方的客户端调用代码都写的太烂了,这种巧合都能碰到一起,太奇妙了。

    印象中BSD的kernal开发人员delphij也曾经提到过strlen,开起google一搜果然如此。strlen这个函数貌似简单容易写,但是里面的花花肠还真不少呢。这也间接的说明了阅读学习经典代码的重要性。

  • 一些google开源的项目介绍

    编程中,经常会用到一些开源库或者项目,比如c++中经常用到的boost。

    google的主要软件架构基于linux,c,c++,java,而且作为一个创新型的公司,他们也经常性的回馈社区一些优秀的代码。在不断的反馈修改中,代码质量得到了提高,用户得到优质服务,这也算是双赢的结果。而且google里面牛人多,写出来的代码质量相对比较高,有很大的学习价值。

    周末无事,搜索code.google.com/p,找到一些有趣的google参与的项目,在这里简单分享一下。有一些开源项目没有列出来,主要因为平台是linux-only或者对项目本身不感兴趣。如果想找完全列表,可以在这里看到:
    http://code.google.com/hosting/projects.html

    另外也可以使用google这个label来搜索code.google.com/p,但是这样也许搜出来的并不一定是google开发的项目。

    ———————————-

    http://code.google.com/p/omaha/

    这是最新放出来的google update的代码,想做windows在线update功能的可以参考。(c++)

    http://code.google.com/p/google-breakpad

    http://code.google.com/p/google-glog/

    breakpad,一个项目的开始需要做一些什么样的基础设施,crash dump和运行logging毫无疑问都是应该有的,这个项目就是负责在crash的时候收集信息,发出crash dump报告的。(c++)

    glog就是用于项目中logging功能的,一般桌面程序不太需要logging,但是对于大规模长时间服务的系统来说,logging功能一定要有,而且要记录足够多的信息。(c++)

    http://code.google.com/p/protobuf/

    protocol buffer,可以用来在跨进程、跨机器,不同操作系统,不同编程语言之间进行数据交换。类似于微软的COM IDL或者XML,但是解析速度更快,需要传输字节数更少。(c++, java, python)

    http://code.google.com/p/chromium/

    google chrome浏览器项目,基于webkit,想自己开发个浏览器,学习这个吧。(c++)

    http://code.google.com/p/google-perftools/

    TCMalloc,heap检测,是一个google用于性能检测的工具。(c++)

    http://code.google.com/p/jaikuengine/

    jaiku是被google收购的微博客服务,类似twitter,但是google买下了以后没有什么动作。在将jaiku移植到appengine平台以后就做出了开源而且不再继续开发的决定,jaiku也就这样了。当然,幸福的还是我们这些程序员。(python)

    http://code.google.com/p/googleappengine/

    这个只是appengine在桌面进行测试运行的项目,相比google服务器上的appengine,肯定还是有着相当大的区别。不过我们也可以从中学到google对于python的使用,不是么?(python)

    http://code.google.com/p/v8/

    google chrome浏览器中的javascript引擎项目。可以单独用作解析javascript,号称速度非常快。(c++)

    http://code.google.com/p/app-engine-site-creator/

    使用appengine建立企业及个人网站的朋友,可以试试这个项目。(python)

    http://code.google.com/p/googlemock/

    http://code.google.com/p/googletest/

    测试框架组合,mock怎么用实话说我也不清楚。

    http://code.google.com/p/google-styleguide/

    google c++编码规范,可以学习学习,网上有中文版的了。

    http://code.google.com/p/google-email-uploader

    outlook邮件上传到gmail,可以学学c#。