<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>克己服人，礼智谦让！</title>
	<atom:link href="http://www.lhelper.org/newblog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.lhelper.org/newblog</link>
	<description>吕克让的资料库</description>
	<lastBuildDate>Fri, 18 May 2012 06:05:31 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>在PhotoShop中对图片进行二值化处理</title>
		<link>http://www.lhelper.org/newblog/?p=467</link>
		<comments>http://www.lhelper.org/newblog/?p=467#comments</comments>
		<pubDate>Fri, 18 May 2012 06:05:31 +0000</pubDate>
		<dc:creator>lhelper</dc:creator>
				<category><![CDATA[未分类]]></category>

		<guid isPermaLink="false">http://www.lhelper.org/newblog/?p=467</guid>
		<description><![CDATA[其实PhotoShop中是有二值化这种图片处理的。操作步骤：
Image->Adjustments->Threshold (英文版)
图像->调整->阈值 (中文版)
然后调整阈值色阶就可以看到二值化的效果了。
参考：http://www.newsmth.net/nForum/article/CG_Design/2264
]]></description>
			<content:encoded><![CDATA[<p>其实PhotoShop中是有二值化这种图片处理的。操作步骤：<br />
Image->Adjustments->Threshold (英文版)<br />
图像->调整->阈值 (中文版)<br />
然后调整阈值色阶就可以看到二值化的效果了。<a href="http://www.lhelper.org/newblog/wp-content/uploads/2012/05/Photoshop_Binary_image.png"><img src="http://www.lhelper.org/newblog/wp-content/uploads/2012/05/Photoshop_Binary_image.png" alt="PhotoShop二值化图片" title="Photoshop_Binary_image" width="701" height="329" class="alignnone size-full wp-image-468" /></a></p>
<p>参考：http://www.newsmth.net/nForum/article/CG_Design/2264</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lhelper.org/newblog/?feed=rss2&amp;p=467</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FFmpeg安装</title>
		<link>http://www.lhelper.org/newblog/?p=454</link>
		<comments>http://www.lhelper.org/newblog/?p=454#comments</comments>
		<pubDate>Fri, 27 Apr 2012 06:54:44 +0000</pubDate>
		<dc:creator>lhelper</dc:creator>
				<category><![CDATA[未分类]]></category>

		<guid isPermaLink="false">http://www.lhelper.org/newblog/?p=454</guid>
		<description><![CDATA[本文记录的是FFmpeg 0.9版本的安装过程。0.9版的FFmpeg开始支持H.264的F4V。
在安装FFmpeg之前需要先安装Yasm(NASM assembler under the “new” BSD License)和各种所需的视频音频的编解码库。

安装yasm (后续lib，如libxvid，需要yams 1.0以上的版本)
http://www.tortall.net/projects/yasm/
安装OpenCORE and VisualOn libraries

安装 OpenCORE AMR （包括AMR-NB decoding/encoding and AMR-WB decoding）
安装 VisualOn AAC encoder library (代替libfaac)
安装 VisualOn AMR-WB encoder library
http://sourceforge.net/projects/opencore-amr/files/ (3个都需要)
http://sourceforge.net/projects/opencore-amr/files/vo-aacenc/
http://sourceforge.net/projects/opencore-amr/files/vo-amrwbenc/
http://sourceforge.net/projects/opencore-amr/files/opencore-amr/

安装LAME (MPEG Audio Layer III (MP3) encoder)
http://lame.sourceforge.net/
http://sourceforge.net/projects/lame/files/lame/3.99/
#安装libvpx (VP8 encoder)
#http://www.webmproject.org/
#http://www.webmproject.org/code/releases/
安装x264 (H.264/MPEG-4 AVC video encoder)
http://www.videolan.org/developers/x264.html
ftp://ftp.videolan.org/pub/x264/snapshots/last_x264.tar.bz2
安装libvorbis (音频)
http://www.xiph.org/downloads/ (需要libogg和libvorbis)
http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz
http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.2.tar.gz
安装libxvid (视频)
http://www.xvid.org/Xvid-Codec.2.0.html
http://downloads.xvid.org/downloads/xvidcore-1.3.2.tar.gz
安装ffmpeg
http://www.ffmpeg.org/download.html
http://www.ffmpeg.org/releases/ffmpeg-0.9.tar.gz （选择FFmpeg Releases）
编译选项(支持H.264的F4V)
./configure --enable-shared --enable-gpl --enable-version3 --enable-nonfree --disable-doc --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-aacenc [...]]]></description>
			<content:encoded><![CDATA[<p>本文记录的是FFmpeg 0.9版本的安装过程。0.9版的FFmpeg开始支持H.264的F4V。</p>
<p>在安装FFmpeg之前需要先安装Yasm(<a href="http://nasm.sf.net/">NASM assembler</a> under the <a href="http://github.com/yasm/yasm/blob/master/BSD.txt">“new” BSD License</a>)和各种所需的视频音频的编解码库。</p>
<ol>
<li>安装yasm (后续lib，如libxvid，需要yams 1.0以上的版本)
<p>http://www.tortall.net/projects/yasm/</li>
<li>安装OpenCORE and VisualOn libraries
<ul>
<li>安装 OpenCORE AMR （包括AMR-NB decoding/encoding and AMR-WB decoding）</li>
<li>安装 VisualOn AAC encoder library (代替libfaac)</li>
<li>安装 VisualOn AMR-WB encoder library</li>
<p>http://sourceforge.net/projects/opencore-amr/files/ (3个都需要)</p>
<p>http://sourceforge.net/projects/opencore-amr/files/vo-aacenc/</p>
<p>http://sourceforge.net/projects/opencore-amr/files/vo-amrwbenc/</p>
<p>http://sourceforge.net/projects/opencore-amr/files/opencore-amr/</ul>
</li>
<li>安装LAME (MPEG Audio Layer III (MP3) encoder)
<p>http://lame.sourceforge.net/</p>
<p>http://sourceforge.net/projects/lame/files/lame/3.99/</li>
<li>#安装libvpx (VP8 encoder)<br />
#http://www.webmproject.org/<br />
#http://www.webmproject.org/code/releases/</li>
<li>安装x264 (H.264/MPEG-4 AVC video encoder)
<p>http://www.videolan.org/developers/x264.html</p>
<p>ftp://ftp.videolan.org/pub/x264/snapshots/last_x264.tar.bz2</li>
<li>安装libvorbis (音频)<br />
http://www.xiph.org/downloads/ (需要libogg和libvorbis)</p>
<p>http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz</p>
<p>http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.2.tar.gz</li>
<li>安装libxvid (视频)
<p>http://www.xvid.org/Xvid-Codec.2.0.html</p>
<p>http://downloads.xvid.org/downloads/xvidcore-1.3.2.tar.gz</li>
<li>安装ffmpeg
<p>http://www.ffmpeg.org/download.html</p>
<p>http://www.ffmpeg.org/releases/ffmpeg-0.9.tar.gz （选择FFmpeg Releases）</p>
<p>编译选项(支持H.264的F4V)</p>
<pre name="code" class="c">./configure --enable-shared --enable-gpl --enable-version3 --enable-nonfree --disable-doc --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libmp3lame --enable-libx264 --enable-libvorbis --enable-libxvid --disable-ffserver --disable-ffplay</pre>
<p>查看编译结果</p>
<pre name="code" class="c">
$ ffmpeg -version
ffmpeg version 0.9, Copyright (c) 2000-2011 the FFmpeg developers
  built on Feb  1 2012 18:37:47 with gcc 4.1.2 20080704 (Red Hat 4.1.2-46)
  configuration: --prefix=/usr/local/ffmpeg --enable-shared --enable-gpl --enable-version3 --enable-nonfree --disable-doc --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libmp3lame --enable-libx264 --enable-libvorbis --enable-libxvid --disable-ffserver --disable-ffplay
  libavutil    51. 32. 0 / 51. 32. 0
  libavcodec   53. 42. 0 / 53. 42. 0
  libavformat  53. 24. 0 / 53. 24. 0
  libavdevice  53.  4. 0 / 53.  4. 0
  libavfilter   2. 53. 0 /  2. 53. 0
  libswscale    2.  1. 0 /  2.  1. 0
  libpostproc  51.  2. 0 / 51.  2. 0
</pre>
</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.lhelper.org/newblog/?feed=rss2&amp;p=454</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>禁用Google拼音(Google Pinyin)的自动更新(AutoUpdate)</title>
		<link>http://www.lhelper.org/newblog/?p=450</link>
		<comments>http://www.lhelper.org/newblog/?p=450#comments</comments>
		<pubDate>Wed, 18 Apr 2012 02:36:19 +0000</pubDate>
		<dc:creator>lhelper</dc:creator>
				<category><![CDATA[未分类]]></category>

		<guid isPermaLink="false">http://www.lhelper.org/newblog/?p=450</guid>
		<description><![CDATA[缺省情况下Google拼音每天都会运行一次自动更新(AutoUpdate)程序，检查是否有更新的版本。如果你想禁用Google拼音的自动更新功能或是想调整自动更新的频率的话，可以参考下面的方法：
运行注册表编辑器(regedit.exe)，进入如下项：
HKEY_LOCAL_MACHINE\SOFTWARE\Google\Google Pinyin 2
在&#8217;Google Pinyin 2&#8242;下有下面两个项：
Autoupdate #更新Google Pinyin的主体程序
Autoupdate Sysdict #看名字应该是更新系统字典用的
Autoupdate项下面包括以下Key：
[HKEY_LOCAL_MACHINE\SOFTWARE\Google\Google Pinyin 2\Autoupdate]
&#8220;InstalledVersion&#8220;=&#8221;2.3.13.82&#8243;
&#8220;UpdateURL&#8220;=&#8221;https://tools.google.com/service/update&#8221;
&#8220;AppPath&#8220;=&#8221;C:\\Documents and Settings\\lhelper\\Application Data\\Google\\Google Pinyin 2&#8243;
&#8220;AvailableVersion&#8220;=&#8221;2.6.18.100&#8243;
&#8220;AvailableURL&#8220;=&#8221;http://dl.google.com/pinyin/v2/2.6.18.100/GooglePinyinInstaller.exe&#8221;
&#8220;LaunchAction&#8220;=&#8221;execute-wait&#8221;
&#8220;LaunchTarget&#8220;=&#8221;GooglePinyinInstaller.exe&#8221;
&#8220;UpdateInterval&#8220;=dword:00015180
&#8220;NextUpdate&#8220;=dword:4f8e6354
&#8220;DownloadedVersion&#8220;=&#8221;2.3.13.82&#8243;
&#8220;PackagePath&#8220;=&#8221;C:\\Documents and Settings\\lhelper\\Application Data\\Google\\Google Pinyin 2\\pinyin-2.3.13.82\\&#8221;
&#8220;LaunchParameter&#8220;=&#8221;&#8211;update&#8221;
其中的UpdateInterva和NextUpdate和自动更新的运行时间有关：
UpdateInterval: 设置运行自动更新的时间间隔，单位秒，缺省值为86400(十六进制值为0&#215;00015180)秒，即1天。
NextUpdate: 设置下次运行自动更新的时间，是一个时间戳，精确到秒，如上面的0&#215;4f8e6354(十进制值为1334731604)，表示的时间为2012-04-18 14:46:44
可以通过修改这个值来禁用Google拼音的自动更新：
1) 把UpdateInterval改为604800(一周)或259200(30天)
2) 把NextUpdate改为1325347261(2012-01-01 00:01:01)
如果你还想禁用/调整其他Google软件/服务的自动更新功能的话，您可以参考：
How to Customize or Disable Google Update
http://googlesystem.blogspot.com/2009/05/customize-or-disable-google-update.html
Google Update Releases Update Controls 
http://google-opensource.blogspot.com/2009/05/google-update-releases-update-controls.html
]]></description>
			<content:encoded><![CDATA[<p>缺省情况下Google拼音每天都会运行一次自动更新(AutoUpdate)程序，检查是否有更新的版本。如果你想禁用Google拼音的自动更新功能或是想调整自动更新的频率的话，可以参考下面的方法：</p>
<p>运行注册表编辑器(regedit.exe)，进入如下项：<br />
HKEY_LOCAL_MACHINE\SOFTWARE\Google\Google Pinyin 2</p>
<p>在&#8217;Google Pinyin 2&#8242;下有下面两个项：<br />
<strong>Autoupdate</strong> #更新Google Pinyin的主体程序<br />
<strong>Autoupdate Sysdict</strong> #看名字应该是更新系统字典用的</p>
<p>Autoupdate项下面包括以下Key：<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Google\Google Pinyin 2\Autoupdate]<br />
&#8220;<strong>InstalledVersion</strong>&#8220;=&#8221;2.3.13.82&#8243;<br />
&#8220;<strong>UpdateURL</strong>&#8220;=&#8221;https://tools.google.com/service/update&#8221;<br />
&#8220;<strong>AppPath</strong>&#8220;=&#8221;C:\\Documents and Settings\\lhelper\\Application Data\\Google\\Google Pinyin 2&#8243;<br />
&#8220;<strong>AvailableVersion</strong>&#8220;=&#8221;2.6.18.100&#8243;<br />
&#8220;<strong>AvailableURL</strong>&#8220;=&#8221;http://dl.google.com/pinyin/v2/2.6.18.100/GooglePinyinInstaller.exe&#8221;<br />
&#8220;<strong>LaunchAction</strong>&#8220;=&#8221;execute-wait&#8221;<br />
&#8220;<strong>LaunchTarget</strong>&#8220;=&#8221;GooglePinyinInstaller.exe&#8221;<br />
&#8220;<strong>UpdateInterval</strong>&#8220;=dword:00015180<br />
&#8220;<strong>NextUpdate</strong>&#8220;=dword:4f8e6354<br />
&#8220;<strong>DownloadedVersion</strong>&#8220;=&#8221;2.3.13.82&#8243;<br />
&#8220;<strong>PackagePath</strong>&#8220;=&#8221;C:\\Documents and Settings\\lhelper\\Application Data\\Google\\Google Pinyin 2\\pinyin-2.3.13.82\\&#8221;<br />
&#8220;<strong>LaunchParameter</strong>&#8220;=&#8221;&#8211;update&#8221;</p>
<p>其中的UpdateInterva和NextUpdate和自动更新的运行时间有关：<br />
UpdateInterval: 设置运行自动更新的时间间隔，单位秒，缺省值为86400(十六进制值为0&#215;00015180)秒，即1天。<br />
NextUpdate: 设置下次运行自动更新的时间，是一个时间戳，精确到秒，如上面的0&#215;4f8e6354(十进制值为1334731604)，表示的时间为2012-04-18 14:46:44</p>
<p>可以通过修改这个值来禁用Google拼音的自动更新：<br />
1) 把<strong>UpdateInterval</strong>改为604800(一周)或259200(30天)<br />
2) 把<strong>NextUpdate</strong>改为1325347261(2012-01-01 00:01:01)</p>
<p>如果你还想禁用/调整其他Google软件/服务的自动更新功能的话，您可以参考：<br />
How to Customize or Disable Google Update</p>
<p>http://googlesystem.blogspot.com/2009/05/customize-or-disable-google-update.html</p>
<p>Google Update Releases Update Controls </p>
<p>http://google-opensource.blogspot.com/2009/05/google-update-releases-update-controls.html</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lhelper.org/newblog/?feed=rss2&amp;p=450</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Solaris系统部署自启动服务</title>
		<link>http://www.lhelper.org/newblog/?p=448</link>
		<comments>http://www.lhelper.org/newblog/?p=448#comments</comments>
		<pubDate>Mon, 09 Apr 2012 03:23:19 +0000</pubDate>
		<dc:creator>lhelper</dc:creator>
				<category><![CDATA[未分类]]></category>

		<guid isPermaLink="false">http://www.lhelper.org/newblog/?p=448</guid>
		<description><![CDATA[简单记录一下
启动服务的脚本
/etc/init.d/your.service.sh 
Linux系统部署自启动服务的方法
# /sbin/chkconfig &#8211;add your.service.sh
注：安全的设置请查询详细文档
Solaris系统部署自启动服务
# chown -fhR root:sys /etc/init.d/your.service.sh
# chmod 755  /etc/init.d/your.service.sh
# ln -s /etc/init.d/filebrowser.soufun.com.sh /etc/rc0.d/K17yourservice
# ln -s /etc/init.d/filebrowser.soufun.com.sh /etc/rc3.d/S90yourservice
注：安全的设置请查询详细文档
]]></description>
			<content:encoded><![CDATA[<p>简单记录一下</p>
<p>启动服务的脚本<br />
/etc/init.d/your.service.sh </p>
<p>Linux系统部署自启动服务的方法<br />
# /sbin/chkconfig &#8211;add your.service.sh<br />
注：安全的设置请查询详细文档</p>
<p>Solaris系统部署自启动服务<br />
# chown -fhR root:sys /etc/init.d/your.service.sh<br />
# chmod 755  /etc/init.d/your.service.sh<br />
# ln -s /etc/init.d/filebrowser.soufun.com.sh /etc/rc0.d/K17yourservice<br />
# ln -s /etc/init.d/filebrowser.soufun.com.sh /etc/rc3.d/S90yourservice<br />
注：安全的设置请查询详细文档</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lhelper.org/newblog/?feed=rss2&amp;p=448</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GraphicsMagick 1.3.13之前版本的SyncBlob方法的一个BUG</title>
		<link>http://www.lhelper.org/newblog/?p=439</link>
		<comments>http://www.lhelper.org/newblog/?p=439#comments</comments>
		<pubDate>Thu, 05 Jan 2012 11:58:34 +0000</pubDate>
		<dc:creator>lhelper</dc:creator>
				<category><![CDATA[未分类]]></category>

		<guid isPermaLink="false">http://www.lhelper.org/newblog/?p=439</guid>
		<description><![CDATA[BUG描述：
GraphicsMagick在处理多帧(multi-frames)图片(如GIF动画)时SyncBlob方法会修改后续帧的blob指针的指向：全部指向第一帧的blob!
如果后续处理过程中又调用到了SyncNextImageInList方法，继而SyncNextImageInList在调用ReferenceBlob的时候就会抛出下面的异常，从而导致进程退出：

server: ../GraphicsMagick-1.3.12/magick/semaphore.c:526: LockSemaphoreInfo: Assertion `semaphore_info->signature == 0xabacadabUL' failed.

注意：直接调用GraphicsMagick的gm命令处理处理多帧gif不会遇到上面的LockSemaphore异常；异常是发生在当你调用GraphicsMagick的API处理图片并试图获取图片的Blob数据的情况。
GraphicsMagick 1.3.12版本中的SyncBlob方法：

/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                               [...]]]></description>
			<content:encoded><![CDATA[<p>BUG描述：</p>
<p>GraphicsMagick在处理多帧(multi-frames)图片(如GIF动画)时SyncBlob方法会修改后续帧的blob指针的指向：全部指向第一帧的blob!</p>
<p>如果后续处理过程中又调用到了SyncNextImageInList方法，继而SyncNextImageInList在调用ReferenceBlob的时候就会抛出下面的异常，从而导致进程退出：</p>
<pre name="code" class="c">
server: ../GraphicsMagick-1.3.12/magick/semaphore.c:526: LockSemaphoreInfo: Assertion `semaphore_info->signature == 0xabacadabUL' failed.
</pre>
<p>注意：直接调用GraphicsMagick的gm命令处理处理多帧gif不会遇到上面的LockSemaphore异常；异常是发生在当你调用GraphicsMagick的API处理图片并试图获取图片的Blob数据的情况。</p>
<p>GraphicsMagick 1.3.12版本中的SyncBlob方法：</p>
<pre name="code" class="c">
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%                                                                             %
%                                                                             %
+  S y n c B l o b                                                            %
%                                                                             %
%                                                                             %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  SyncBlob() flushes the datastream if it is a file or synchonizes the data
%  attributes if it is an blob.
%
%  The format of the SyncBlob method is:
%
%      int SyncBlob(Image *image)
%
%  A description of each parameter follows:
%
%    o status:  Method SyncBlob returns 0 on success; otherwise,  it
%      returns -1 and set errno to indicate the error.
%
%    o image: The image.
%
%
*/
static int SyncBlob(Image *image)
{
  int
    status;

  register Image
    *p;

  assert(image != (Image *) NULL);
  assert(image->signature == MagickSignature);
  assert(image->blob != (BlobInfo *) NULL);
  assert(image->blob->type != UndefinedStream);
  for (p=image; p->previous != (Image *) NULL; p=p->previous);
  // 以下3行代码修改了后续帧的blob指针的指向：全部指向第一帧的blob
  for ( ; p->next != (Image *) NULL; p=p->next)
    if (p->blob != image->blob)
      *p->blob=(*image->blob);
  status=0;
  switch (image->blob->type)
  {
    case UndefinedStream:
      break;
    case FileStream:
    case StandardStream:
    case PipeStream:
    {
      status=fflush(image->blob->file);
      break;
    }
    case ZipStream:
    {
#if defined(HasZLIB)
      status=gzflush(image->blob->file,Z_SYNC_FLUSH);
#endif
      break;
    }
    case BZipStream:
    {
#if defined(HasBZLIB)
      status=BZ2_bzflush(image->blob->file);
#endif
      break;
    }
    case BlobStream:
      break;
  }
  return(status);
}
</pre>
<p>修复方法：<br />
1) 升级GraphicsMagick到更新的版本(<a href="http://www.graphicsmagick.org/NEWS.html#december-24-2011">2011-12-24 GraphicsMagick发布了1.3.13版本</a>)<br />
2) 手工剔除SyncBlob方法中的第4049～4052行（未经测试！）</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lhelper.org/newblog/?feed=rss2&amp;p=439</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>利用Unsharp Mask(USM)提高缩略图的质量(清晰度)</title>
		<link>http://www.lhelper.org/newblog/?p=422</link>
		<comments>http://www.lhelper.org/newblog/?p=422#comments</comments>
		<pubDate>Mon, 12 Dec 2011 10:07:15 +0000</pubDate>
		<dc:creator>lhelper</dc:creator>
				<category><![CDATA[未分类]]></category>

		<guid isPermaLink="false">http://www.lhelper.org/newblog/?p=422</guid>
		<description><![CDATA[Unsharp masking的介绍
Unsharp Mask(USM)，有人翻译为“非锐化遮罩”，也有人翻译为“虚化掩模锐化”，即在进行锐化计算的过程中，可对边缘进行锐化处理，而对色调连续的部分予以保护，达到既进行锐化，又不产生噪点的目的。
Unsharp Mask(USM)处理图片的实例：
详见：Sharpening: Unsharp Mask

function on(butname){document.getElementById(butname).className='on';}
function off(butname){document.getElementById(butname).className='off';}


/* OnMouseoverButtons */
.on, .off { cursor: pointer; }
.on { color: #c70; }
.off { color: #ccc; }








Original
Unsharp Mask
Sharpened



(Unsharp mask brightened slightly to increase visibility)

Unsharp Mask参数设置
详见：Unsharp Mask: suggested starting values by Simon Mackie
Scott Kelby suggests using the following settings as starting points for Unsharp Mask (USM) in Photoshop. Give them [...]]]></description>
			<content:encoded><![CDATA[<h2><a href="http://en.wikipedia.org/wiki/Unsharp_masking">Unsharp masking</a>的介绍</h2>
<p>Unsharp Mask(USM)，有人翻译为“非锐化遮罩”，也有人翻译为“虚化掩模锐化”，即在进行锐化计算的过程中，可对边缘进行锐化处理，而对色调连续的部分予以保护，达到既进行锐化，又不产生噪点的目的。</p>
<h2>Unsharp Mask(USM)处理图片的实例：</h2>
<p>详见：<a href="http://www.cambridgeincolour.com/tutorials/unsharp-mask.htm">Sharpening: Unsharp Mask</a><br />
<script>
function on(butname){document.getElementById(butname).className='on';}
function off(butname){document.getElementById(butname).className='off';}
</script></p>
<style>
/* OnMouseoverButtons */
.on, .off { cursor: pointer; }
.on { color: #c70; }
.off { color: #ccc; }
</style>
<div class="center">
<table class="t1" width="300">
<tbody>
<tr>
<td colspan="3" height="320"><img name="image1" src="http://images.cambridgeincolour.com/tutorials/unsharpmask_man-orig.jpg" alt="Unsharp Mask Example Image" title="" width="226" height="300"></td>
</tr>
<tr>
<td id="b1" class="on">Original</td>
<td id="b2" class="off"><span onmouseover="off('b1'); on('b2'); image1.src='http://images.cambridgeincolour.com/tutorials/unsharpmask_man-usm.jpg';" onmouseout="on('b1'); off('b2'); image1.src='http://images.cambridgeincolour.com/tutorials/unsharpmask_man-orig.jpg';">Unsharp Mask</span></td>
<td id="b3" class="off"><span onmouseover="off('b1'); on('b3'); image1.src='http://images.cambridgeincolour.com/tutorials/unsharpmask_man-final.jpg';" onmouseout="on('b1'); off('b3'); image1.src='http://images.cambridgeincolour.com/tutorials/unsharpmask_man-orig.jpg';">Sharpened</span></td>
</tr>
</tbody>
</table>
<p class="note">(Unsharp mask brightened slightly to increase visibility)</p>
</div>
<h2>Unsharp Mask参数设置</h2>
<p>详见：<a href="http://www.photographyjam.com/blog/40/unsharp-mask-suggested-starting-values">Unsharp Mask: suggested starting values</a> by Simon Mackie</p>
<p>Scott Kelby suggests using the following settings as starting points for Unsharp Mask (USM) in Photoshop. Give them a go:</p>
<table border="1">
<tr>
<td>Subject</td>
<td>Amount</td>
<td>Radius</td>
<td>Threshold</td>
</tr>
<tr>
<td>Soft subjects</td>
<td>150</td>
<td>1</td>
<td>10</td>
</tr>
<tr>
<td>Portraits</td>
<td>75</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>Moderate sharpening</td>
<td>225</td>
<td>0.5</td>
<td>0</td>
</tr>
<tr>
<td>Maximum sharpening</td>
<td>65</td>
<td>4</td>
<td>3</td>
</tr>
<tr>
<td>All-purpose sharpening</td>
<td>85</td>
<td>1</td>
<td>4</td>
</tr>
<tr>
<td>preparing for Web</td>
<td>400</td>
<td>0.3</td>
<td>0</td>
</tr>
</table>
<p>Remember that these are just guidelines &#8211; oversharpened images always look terrible. Try these as a starting point, but if you get symptoms of oversharpening (grain in the image, and &#8220;halos&#8221; around objects), back off a little bit. And always check the image at at least 100% zoom.</p>
<h2>GraphicsMagick &#038; Unsharp Mask</h2>
<p>$ /usr/local/GraphicsMagick/bin/gm convert -quality 85 -unsharp 0.5&#215;1.0+0.8+0.03 original.jpg usm.jpg</p>
<div style="margin: auto;">
<h4><a id="unsharp"></a>-unsharp <em class="arg">radius</em><br />-unsharp <em class="arg">radius</em>x<em class="arg">sigma</em>{<em class="arg">+amount</em>}{<em class="arg">+threshold</em>}</h4>
</div>
<table style="background-color:#FFFFE0; margin-left:40px; margin-right:40px; width:88%">
<tbody>
<tr>
<td style="width:75%">sharpen the image with an unsharp mask operator.</td>
<td style="text-align:right;"></td>
</tr>
</tbody>
</table>
<p>The <a href="#unsharp">-unsharp</a> option sharpens an image. The image is convolved with a Gaussian operator of the given radius and standard deviation (sigma). For reasonable results, radius should be larger than sigma. Use a radius of 0 to have the method select a suitable radius.</p>
<p>The parameters are:</p>
<pre class="text">   radius     The radius of the Gaussian, in pixels,  not counting the center
              pixel (default 0).
   sigma      The standard deviation of the Gaussian, in pixels (default 1.0).
   amount     The fraction of the difference between the original and the blur
              image that is added back into the original (default 1.0).
   threshold  The threshold, as a fraction of <em class="QR">QuantumRange</em>, needed to apply the
              difference amount (default 0.05).
</pre>
<h2>Unsharp Mask for PHP</h2>
<ul>
<li><a href="http://vikjavev.no/computing/ump.php">Unsharp Mask for PHP</a></li>
<li><a href="http://phpthumb.sourceforge.net/">phpThumb()</a>
<li><a href="http://www.binarymoon.co.uk/projects/timthumb/">TimThumb</a>
</ul>
<h2>后记</h2>
<p>针对小尺寸的缩略图(120&#215;120以下)，测试了几种Unsharp Mask的参数组合，最后觉得还是Torstein Hønsi总结的效果更好一些：</p>
<table border="1">
<tr>
<td style="text-align:right">Amount: </td>
<td style="text-align:right">80</td>
<td>(typically 50 &#8211; 200)</td>
</tr>
<tr>
<td style="text-align:right">Radius: </td>
<td style="text-align:right">0.5</td>
<td>(typically 0.5 &#8211; 1)</td>
</tr>
<tr>
<td style="text-align:right">Threshold: </td>
<td style="text-align:right">3</td>
<td>(typically 0 &#8211; 5)</td>
</tr>
</table>
<p>附：<a href="/dev/UnsharpMask.php.html">UnsharpMask.php</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lhelper.org/newblog/?feed=rss2&amp;p=422</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Resin的 &#8216;Invocation miss ratio&#8217;比较高的情况下可以适当调小invocation-cache-size</title>
		<link>http://www.lhelper.org/newblog/?p=417</link>
		<comments>http://www.lhelper.org/newblog/?p=417#comments</comments>
		<pubDate>Wed, 23 Nov 2011 12:09:23 +0000</pubDate>
		<dc:creator>lhelper</dc:creator>
				<category><![CDATA[未分类]]></category>

		<guid isPermaLink="false">http://www.lhelper.org/newblog/?p=417</guid>
		<description><![CDATA[invocation-cache-size 的缺省值是64*1024，即64K，于是LruCache$CacheItem的capacity是64*1024*2，即128K，如果每个LruCache$CacheItem占用2KB的空间的话，那么这么大的LruCache最多会占用128K*2KB，也就是256MB的Heap空间

  public LruCache(int initialCapacity, boolean isStatistics)
  {
    int capacity;

    for (capacity = 16; capacity < 2 * initialCapacity; capacity *= 2) {
    }

    _entries = new CacheItem[capacity];
    _prime = Primes.getBiggestPrime(_entries.length);

    _locks = new Object[(_entries.length [...]]]></description>
			<content:encoded><![CDATA[<p>invocation-cache-size 的缺省值是64*1024，即64K，于是LruCache$CacheItem的capacity是64*1024*2，即128K，如果每个LruCache$CacheItem占用2KB的空间的话，那么这么大的LruCache最多会占用128K*2KB，也就是256MB的Heap空间</p>
<pre name="code" class="java">
  public LruCache(int initialCapacity, boolean isStatistics)
  {
    int capacity;

    for (capacity = 16; capacity < 2 * initialCapacity; capacity *= 2) {
    }

    _entries = new CacheItem[capacity];
    _prime = Primes.getBiggestPrime(_entries.length);

    _locks = new Object[(_entries.length >> 3) + 1];
    for (int i = 0; i < _locks.length; i++) {
      _locks[i] = new Object();
    }

    _capacity = initialCapacity;
    _capacity1 = _capacity / 2;

    if (_capacity > 32)
      _lruTimeout = _capacity / 32;
    else
      _lruTimeout = 1;

    _isEnableStatistics = isStatistics;

    /*
    if (isStatistics) {
      _hitCount = new AtomicLong();
      _missCount = new AtomicLong();
    }
    */
  }
</pre>
<p>注意观察Resin的 &#8216;Invocation miss ratio&#8217;，如果这个值比较高的话，说明invocationCache的命中率很低，这个时候可以适当调小invocation-cache-size参数：</p>
<pre name="code" class="xml">
  &lt;cluster id="app-tier"&gt;
    &lt;!-- sets the content root for the cluster, relative to resin.root --&gt;
    &lt;root-directory&gt;.&lt;/root-directory&gt;

    &lt;invocation-cache-size&gt;32&lt;/invocation-cache-size&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.lhelper.org/newblog/?feed=rss2&amp;p=417</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>利用JMAP+MAT分析Java Heap Dump</title>
		<link>http://www.lhelper.org/newblog/?p=409</link>
		<comments>http://www.lhelper.org/newblog/?p=409#comments</comments>
		<pubDate>Wed, 19 Oct 2011 04:28:27 +0000</pubDate>
		<dc:creator>lhelper</dc:creator>
				<category><![CDATA[未分类]]></category>
		<category><![CDATA[jhat]]></category>
		<category><![CDATA[jmap]]></category>
		<category><![CDATA[MAT]]></category>

		<guid isPermaLink="false">http://www.lhelper.org/newblog/?p=409</guid>
		<description><![CDATA[如果你的Heap Dump文件超过了几百MB，那就不要再寄希望于jhat了，因为jhat需要数倍于dump文件的内存。这个时候你可以用MAT(Memory Analyzer)，用MAT你可以在有2GB可用内存的机器上分析大约1GB左右的Dump文件。
生成Heap Dump文件的方法：
JMAP(Java Memory Map)
方法一：让运行中的JVM生成Dump文件
/usr/java/jdk/bin/jmap -F -dump:format=b,file=/path/to/heap/dump/heap.bin PID
方法二：让JVM在遇到OOM(OutOfMemoryError)时生成Dump文件
-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/path/to/heap/dump
用jhat分析Dump文件
注：只有在Dump文件比较小的时候才适合用jhat分析Dump文件
jhat(Java Heap Analysis Tool)
jhat -stack false -refs false -J-Xmx2g /path/to/heap/dump/heap.bin
用MAT分析Dump文件
MAT(Memory Analyzer)
http://www.eclipse.org/mat/
安装MAT插件
]]></description>
			<content:encoded><![CDATA[<p>如果你的Heap Dump文件超过了几百MB，那就不要再寄希望于jhat了，因为jhat需要数倍于dump文件的内存。这个时候你可以用<a href="http://www.eclipse.org/mat/">MAT(Memory Analyzer)</a>，用MAT你可以在有2GB可用内存的机器上分析大约1GB左右的Dump文件。</p>
<p>生成Heap Dump文件的方法：</p>
<p>JMAP(Java Memory Map)</p>
<p>方法一：让运行中的JVM生成Dump文件<br />
/usr/java/jdk/bin/jmap -F -dump:format=b,file=/path/to/heap/dump/heap.bin PID</p>
<p>方法二：让JVM在遇到OOM(OutOfMemoryError)时生成Dump文件<br />
-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/path/to/heap/dump</p>
<p>用jhat分析Dump文件<br />
注：只有在Dump文件比较小的时候才适合用jhat分析Dump文件<br />
jhat(Java Heap Analysis Tool)<br />
jhat -stack false -refs false -J-Xmx2g /path/to/heap/dump/heap.bin</p>
<p>用MAT分析Dump文件<br />
MAT(Memory Analyzer)</p>
<p>http://www.eclipse.org/mat/</p>
<p>安装MAT插件</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lhelper.org/newblog/?feed=rss2&amp;p=409</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>在SunOS系统安装cvs客户端</title>
		<link>http://www.lhelper.org/newblog/?p=394</link>
		<comments>http://www.lhelper.org/newblog/?p=394#comments</comments>
		<pubDate>Tue, 20 Sep 2011 04:38:51 +0000</pubDate>
		<dc:creator>lhelper</dc:creator>
				<category><![CDATA[notes]]></category>

		<guid isPermaLink="false">http://www.lhelper.org/newblog/?p=394</guid>
		<description><![CDATA[根据系统的类型选择对应的发行版
$ uname -a
SunOS xxxxxx 5.10 Generic_141445-09 i86pc i386 i86pc
CVS 
http://ftp.gnu.org/non-gnu/cvs/binary/stable/
$ mkdir bin
$ cd bin
$ wget http://ftp.gnu.org/non-gnu/cvs/binary/stable/x86-sunos/cvs-1.11.21-SunOS-5.8-i386.gz
$ gunzip cvs-1.11.21-SunOS-5.8-i386.gz
$ ln -s cvs-1.11.21-SunOS-5.8-i386 cvs
]]></description>
			<content:encoded><![CDATA[<p>根据系统的类型选择对应的发行版</p>
<p>$ uname -a<br />
SunOS xxxxxx 5.10 Generic_141445-09 i86pc i386 i86pc</p>
<p>CVS </p>
<p>http://ftp.gnu.org/non-gnu/cvs/binary/stable/</p>
<p>$ mkdir bin<br />
$ cd bin<br />
$ wget http://ftp.gnu.org/non-gnu/cvs/binary/stable/x86-sunos/cvs-1.11.21-SunOS-5.8-i386.gz<br />
$ gunzip cvs-1.11.21-SunOS-5.8-i386.gz<br />
$ ln -s cvs-1.11.21-SunOS-5.8-i386 cvs</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lhelper.org/newblog/?feed=rss2&amp;p=394</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>高负载下mod_caucho模块偶尔返回503错误</title>
		<link>http://www.lhelper.org/newblog/?p=351</link>
		<comments>http://www.lhelper.org/newblog/?p=351#comments</comments>
		<pubDate>Fri, 13 May 2011 06:07:03 +0000</pubDate>
		<dc:creator>lhelper</dc:creator>
				<category><![CDATA[未分类]]></category>

		<guid isPermaLink="false">http://www.lhelper.org/newblog/?p=351</guid>
		<description><![CDATA[环境：Resin-2.1.17 + Apache-2.2.4，Resin编译为apache的一个module
现象：一个请求，apache日志里是503，而resin的日志里是200
apache的日志片段
219.239.xx.xxx &#8211; - [13/May/2011:09:15:06 +0800] &#8220;GET /newsreload?act=reload&#38;path=/www/indices/news-test-all/index/sameNewsNum.txt HTTP/1.0&#8243; 503 323 &#8220;-&#8221; &#8220;Wget/1.10.2 (Red Hat modified)&#8221;
resin的日志片段
219.239.xx.xxx - &#8211; [13/May/2011:09:15:08 +0800] &#8220;GET /newsreload?act=reload&#38;path=/www/indices/news-test-all/index/sameNewsNum.txt HTTP/1.0&#8243; 200 0 &#8220;-&#8221; &#8220;Wget/1.10.2 (Red Hat modified)&#8221;
分析mod_caucho的代码：




mod_caucho.c

/**
 * Handle a request.
 */
static int
caucho_request(request_rec *r)
{
   ...
   reuse = write_request(&#38;s, r, config, &#38;keepalive, session_index, backup_index);
   ...
  if [...]]]></description>
			<content:encoded><![CDATA[<p>环境：Resin-2.1.17 + Apache-2.2.4，Resin编译为apache的一个module</p>
<p>现象：一个请求，apache日志里是503，而resin的日志里是200</p>
<div id="_mcePaste">apache的日志片段</div>
<div>219.239.xx.xxx &#8211; - [13/May/2011:09:15:06 +0800] &#8220;GET /newsreload?act=reload&amp;path=/www/indices/news-test-all/index/sameNewsNum.txt HTTP/1.0&#8243; 503 323 &#8220;-&#8221; &#8220;Wget/1.10.2 (Red Hat modified)&#8221;</div>
<div>resin的日志片段<br />
219.239.xx.xxx - &#8211; [13/May/2011:09:15:08 +0800] &#8220;GET /newsreload?act=reload&amp;path=/www/indices/news-test-all/index/sameNewsNum.txt HTTP/1.0&#8243; 200 0 &#8220;-&#8221; &#8220;Wget/1.10.2 (Red Hat modified)&#8221;</div>
<p>分析mod_caucho的代码：</p>
<table>
<tbody>
<tr>
<td>
mod_caucho.c</p>
<pre name="code" class="c">
/**
 * Handle a request.
 */
static int
caucho_request(request_rec *r)
{
   ...
   reuse = write_request(&amp;s, r, config, &amp;keepalive, session_index, backup_index);
   ...
  if (reuse == CSE_END || reuse == CSE_CLOSE)
    return OK;
  else
    return HTTP_SERVICE_UNAVAILABLE;
}

/**
 * handles a client request
 */
static int
write_request(stream_t *s, request_rec *r, config_t *config,
              int *keepalive, int session_index, int backup_index)
{
   ...
  code = send_data(s, r, CSE_END, keepalive);
  write_length = s-&gt;write_length;

  return code;
}

/**
 * Copy data from the JVM to the browser.
 */
static int
send_data(stream_t *s, request_rec *r, int ack, int *keepalive)
{
   ...
    switch (code) {
   ...
    case CSE_DATA:
      if (cse_write_response(s, len, r) &lt; 0)
        return -1;
   ...
}

/**
 * Writes a response from srun to the client
 */
static int
cse_write_response(stream_t *s, int len, request_rec *r)
{
  while (len &gt; 0) {
    int sublen;
    int writelen;
    int sentlen;

    if (s-&gt;read_offset &gt;= s-&gt;read_length &amp;&amp; cse_fill_buffer(s) &lt; 0)
      return -1;

    sublen = s-&gt;read_length - s-&gt;read_offset;
    if (len &lt; sublen)
      sublen = len;

    writelen = sublen;
    while (writelen &gt; 0) {
      sentlen = ap_rwrite(s-&gt;read_buf + s-&gt;read_offset, writelen, r);
      if (sentlen &lt; 0) {
        cse_close(s, "write");
        return -1;
      }

      writelen -= sublen;
    }

    s-&gt;read_offset += sublen;
    len -= sublen;
  }

  return 1;
}</pre>
</td>
</tr>
</tbody>
</table>
<p>参见：http://www.google.com/search?q=mod_caucho+503</p>
<p>解决方法：<br />
避免Apache + mod_caucho + Resin 的方式，尽量用反向代理 + Resin的方式，同时注意分离对动态资源和静态资源的请求，尽量避免让Resin负责对静态文件的请求。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lhelper.org/newblog/?feed=rss2&amp;p=351</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

