Two hacks about WordPress

July 26th, 2007 Computing No Comments »
  • To exclude page links in the navigation bar in the header.
    I have some pages that I want them to be accessible by the public but not listed in the navigation bar. After some search, I found this effective yet simple solution. What I did is to edit the header.php file in the current theme folder. Locate the function wp_list_pages and add exclude=pageID#,pageID# to its arguments, where pageID#s are the ID numbers of the pages to be hidden. Here is an example:

    <?php wp_list_pages('exclude=123&sort_column=menu_order&depth=1&title_li='); ?>

    where 123 is the ID of the page to be hidden.

    UPDATE: Just found a nice plugin, Page Link Manager, that does the same job in a much neater manner. Besides the option page, an “Include Page in Site Navigation” checkbox will be available when a page is being edited.

  • To exclude pages from the Extended Live Archive.
    I just installed this plugin to display the blog archives. It works very well in a very neat and intuitive way. But I found that it also includes pages by default and I couldn’t find the option to disable it. So I searched again and found a solution in their Flickr forum. What should be edited are two files in the plugin folder: af-extended-live-archive.php and af-extended-live-archive-include.php.
    In these two files, locate the following two expressions in both files

    post_status = 'publish'
    p.post_status = 'publish'

    then change them to

    post_status = 'publish' AND post_type='post'
    p.post_status = 'publish' AND p.post_type='post'

    respectively. That’s it. Now ELA displays posts only.

Share This

Related Posts

Blog upgraded

July 23rd, 2007 Computing No Comments »

Last weekend I spent one night to upgrade this blog from WordPress 1.5.1.3 to 2.2.1. Basically everything goes smoothly except the database character sets issue because there are some Chinese characters in my posts. I searched the web and tried many times and finally it works, though I still don’t know the details because I am really not good at MySQL things. What I did is:

  1. Run SQL query
    show variables like '%character%';

    to check the character sets of the database. If the character_set_database is latin1, change it to utf8 by

    alter database mydb character set utf8;

    where mydb is the name of the database.

  2. Edit wp-config.php, change the line
    define('DB_CHARSET', 'utf8');

    to

    define('DB_CHARSET', '');

These two steps basically solve the Chinese display problem. (References: 1, 2 and 3)

The new version of WordPress is very good, especially the support of widgets and many other improvements from version 1.5.x. I also changed the theme to GlossyBlue 1.4 and modified a little.

Share This

Related Posts

Windows XP system optimization

May 3rd, 2007 Computing No Comments »

The purpose of the following tweaks is to get rid of unnecessary memory eaters to improve the performance of Windows XP system.

Note: perform these tweaks only if you know what you are doing, and always backup. YOU’VE BEEN WARNED.

  • Remove Unnecessary Startup Programs
    Run regedit, locate

    HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/CurrentVersion/Run

    and

    HKEY_CURRENT_USER/SOFTWARE/Microsoft/Windows/CurrentVersion/Run

    and also check Windows Startup program folder, remove unnecessary startup programs installed by some programs or you don’t need them at all.

  • Disable Unnecessary Services
    Control Panel/Administrative Tools/Services or run services.msc to enter services configuration.
    Here’s a good resource for service information in Windows XP SP2 you can refer to before you decide which services to disable.
  • Defragment Pagefile
    A cool little application PageDefrag to accomplish this task.
  • Disable Last Access Update
    Run regedit, locate

    HKEY_LOCAL_MACHINE/System/CurrentControlSet/Control/FileSystem

    right click in a blank area of the window on the right and select DWORD Value, create a new DWORD Value called NtfsDisableLastAccessUpdate, then right click on the new value and select Modify, change the Value Data to 1.

  • Improve Boot Times
    Run regedit, locate

    HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Dfrg/BootOptimizeFunction

    select Enable from the list on the right, right on it and select Modify, change the value to Y to enable.

  • Improve Swapfile Performance
    Run msconfig.exe, click on the System.ini tab, expand the 386enh tab, click on new then in the blank box type ConservativeSwapfileUsage=1.
  • Make Menus Load Faster
    Run regedit, locate HKEY_CURRENT_USER/Control Panel/Desktop, select MenuShowDelay, right click and select Modify, reduce the number to around 100.
  • Improve XP Shutdown Speed
    Run regedit, locate

    HKEY_CURRENT_USER/Control Panel/Desktop

    select WaitToKillAppTimeout, right click and select Modify, change the value to 1000, click OK. Now select HungAppTimeout, right click and select Modify, change the value to 1000, click OK.
    Locate

    HKEY_USERS/.DEFAULT/Control Panel/Desktop

    select WaitToKillAppTimeout, right click and select Modify, change the value to 1000, click OK.
    Locate

    HKEY_LOCAL_MACHINE/System/CurrentControlSet/Control

    select WaitToKillServiceTimeout, right click and select Modify, change the value to 1000, click OK.

  • Disable Unneeded Hardware Devices
    For example, disable modem and wired network card if only wireless network is used.
  • Removing Extra Fonts for Speed
    Control Panel/Fonts, create another folder then move unused fonts to that folder.
Share This

Related Posts

Sequence photography

September 9th, 2006 Photography 2 Comments »

Babies in line
所谓 sequence photography,就是把一连串的动作记录在一张照片上。我是受了包包家照片的启发,但感觉在宝宝不会走的时候不好用而且也没什么乐趣,所以在女儿会走了之后,我迫不及待的做了第一次实践。这个方法是我自己琢磨的,可能还有更好的方法,但这个方法实践后证明是简单而有效的,分以下几步。

  • 构思
    这种照片的特点是除了活动物体外其他部分是固定不变的,而活动物体是连续拍摄几张照片然后叠加进去,所以需要

    • 在构图时应该构思好把最后设想的照片范围全部取进去,而不是分别取景拍几张照片然后贴在一起;
    • 保证每张照片曝光一致,使最后效果是来自同一场景和光线;
    • 保证每张照片焦点不变,这样更加真实。所以你如果是拍摄宝宝朝相机或远离相机走去,那么可能需要考虑一下焦点对哪里,以及景深的问题。作为第一次尝试,我用了最简单的横向走动。
    • 另外,还要构思好你想让活动物体在最后的画面出现的顺序位置,最好不出现重叠。

    为了保证以上各项,需要一个稳固的三脚架,这样可以每张的背景都一样;对焦之后锁定(可以自动对焦后切换到手动对焦,这样焦点就不变了);测光后固定测光值(比如用自动曝光模式测光后,记下曝光组合,切换到手动曝光模式,这样每张照片的曝光值都一样,当然,在第一张和最后一张照片之间,环境光线最好没有显著变化)。

  • 拍摄
    让宝宝在你对好焦距的位置开始走,从你构想好的画面一端走向另一端,并在设想好的位置按下快门。
  • 后期
    在 Photoshop 中,打开刚才拍的这几张照片,比如共四张。从照片4开始,把第3张全选(Ctrl-A),拷贝(Ctrl-C),复制到第4张上,这样第4张就有了两个图层,第3张在上面,第4张在下面。然后,选中第3张,用套索工具,勾选出宝宝,然后反选(Ctrl-Shift-I),此时可以看到选中了除宝宝外的其余部分,删除之(Del)。这时可以初步看到效果了,出现了两个宝宝了。 :) 以下就是重复上面的步骤,把第2张,第1张都拷贝过来,然后套索,反选,删除。用套索时不需要很严格的把宝宝套取出来,可以很宽松的选择周围较大区域,因为有了前面的构思和准备工作,宝宝和背景之间的对应关系在每张照片上应该都是唯一的,这比精细的抠图简单多了。最后合并图层,保存。

总结:我的这个方法就是很简单的利用了Photoshop中的图层叠加功能。这个 Flickr group 专门讨论 sequence photography。

Share This

Related Posts

  • No related posts

焰火拍摄心得

June 28th, 2006 Photography 1 Comment »

(2003年07月09日08:39:19 星期三)

看了一次小小的焰火,虽然不是看过的最漂亮和壮观的,但拍的却是自己比较满意,总结一下心得。

1. 一个稳固的三脚架。这是第一重要的,千万不要怕重而不带,管保回来找后悔药吃(MIT已经有人在找了)。最好是球头的,而且对球头最好有一定要求,后面谈到。

2. 选择拍摄模式。当然是手动曝光,俗称的M档。一般光圈选择你的相机所能达到的最小光圈或次最小,一般在F/8以下。快门速度的选择要根据焰火的情况,这点可能看起来比较玄,但开头拍几张你就明白了。因为我们要记录的是焰火在某段时间里在胶片或感光材料上留下的轨迹,快门的长短决定了轨迹的长短和曝光量。而焰火的展开速度和当时风的速度都影响到在一定时间内轨迹的长短。所以我当晚起先几张基本不能看,最后感觉速度在3.2秒左右比较好,基本在1.6-4秒之间,不同速度也可以得到不同的效果。

3. 选择对焦模式。当然是手动对焦,俗称MF。因为一般焰火都离得比较远,所以手动对焦在无穷远最合适,也会使相机的反应速度加快,因为省去了对焦所需时间,而且往往在夜晚自动对焦会失败。

4. 焦长的选择。我觉得这个不是最重要,各个焦段都可以。

5. 构图和拍摄时机。由于焰火位置的相对不确定性,这点尤其显得重要。我的经验是要有一定的预测,根据上一次的位置,有时甚至通过火箭上升的声音和微弱的轨迹。快门要在爆炸或之前一点开启,太早或太迟都会使轨迹非常短。所以在火箭上升过程中迅速构图,准备好按快门(快门线)是比较重要的。特别是对数码相机相对延时比较严重的情况,掌握提前量更显得重要。此时就显示出球头的重要性了,方便灵活。而且球头最好还要有一定的阻尼,这样不必频繁锁紧而错过很多时机。

6. 为后期考虑。考虑到后期的剪切等,如果是变焦镜头,可以适当在有的时候把焦距推广,留出空白。如果是数码相机的,当然应该用最大象素、最好质量拍,这样便于后期处理,或者打印。

7. 考虑到以上这么多并付诸实践后,其他就交给运气吧。 :)

Share This

Related Posts

  • No related posts


WordPress Theme by Just Skins | Modified by GQSHEN | Hosted by Site5
| 0.284
Copyright © 2005 - 2009 Gradual Quietness. All rights reserved.
Close
E-mail It