存档

‘技巧’ 分类的存档

跨越浏览器的d3.js图表显示

2012年1月22日 没有评论
No Gravatar

最近一段时间对正在采用的图表组件不满意了。看过d3.js之后,别的图表显示确实很难入眼。问题的难度是d3.js采用的SVG技术导致它只能在几种浏览器里使用,在我们客户大量使用的IE,特别是IE6的客户里很难显示正常。SVG之于IE的问题要想解决有几个思路:
一个可以想像的方式是采用svgweb,不过在调试的时候发现IE在加载d3.js经常出非常小且2的问题。比如一个函数里使用了两次while(++i < j)之后,d3.js就不能正常载入,提示的错误居然是“缺少’)'”。
二一个是在后端生成图片,这样就不存在SVG格式的问题了。这个世界近两年来流行的node.js可以在后台执行javascript,这让人有柳暗花明的感觉。
第三个方式是我们后端生成svg文件,前端使用svgweb加载。

沿着第一个思路太耗费时间,不符合想快速解决问题的思路。所以第二、三个方法做了重点测试。
首先可以参照的方法是d3.js里自带的node-canvas例子us-counties。如果将这个图片通过http输出到客户端第二个方法的技术问题就解决了。
然后是@mattbaker提交的gist 1511770,这个例子通过node.js完成了svg文件的生成。加上svgweb,在IE里显示svg图表的问题也就完全不存在了。
@mattbaker提供的gist 1509145提供了直接通过http输出png图片的例子。
我们聊加改造,其实是去除了一些功能就可以得到如下代码:

var http = require('http'),
    url = require('url'),
    jsdom = require('jsdom'),
    child_proc = require('child_process'),
    w = 400,
    h = 400,
    scripts = ["file://"+__dirname+"/../d3.min.js",
               "file://"+__dirname+"/../d3.layout.min.js",
               "file://"+__dirname+"/pie.js"],
    htmlStub = '<!DOCTYPE html><div id="pie" style="width:'+w+'px;height:'+h+'px;"></div>';

http.createServer(function (req, res) {
  var values = (url.parse(req.url, true).query['values'] || ".5,.5")
        .split(",")
        .map(function(v){return parseFloat(v)});
  // 去除生成图片的代码
  //convert.stdout.on('data', function (data) {
  //  res.write(data);
  //});
  //convert.on('exit', function(code) {
  //  res.end();
  //});

  jsdom.env({features:{QuerySelector:true}, html:htmlStub, scripts:scripts, done:function(errors, window) {
    var svgsrc = window.insertPie("#pie", w, h, values).innerHTML;
    //jsdom's domToHTML will lowercase element names
    svgsrc = svgsrc.replace(/radialgradient/g,'radialGradient');
    res.writeHead(200, {'Content-Type': 'image/svg+xml'});
    res.write(svgsrc);
    res.end();
  // 去除生成图片的代码
  //  convert.stdin.write(svgsrc);
  //  convert.stdin.end();
  }});
}).listen(8888, "0.0.0.0");

console.log('Pie SVG server running at http://127.0.0.1:8888/');
console.log('ex. http://127.0.0.1:8888/?values=.4,.3,.2,.1');

用node.js运行后,使用下面页面即可:

<!DOCTYPE html>
<html>
  <!-- Tests using the OBJECT syntax to embed an SVG file -->

  <head>

    <!-- Optional meta tag; if left off, we default to only using the Flash
         renderer for Internet Explorer and using native support on other
         browsers. You can force the Flash renderer for all browsers by
         setting the META tag below to true. -->
    <!-- meta name="svg.render.forceflash" content="true" / -->  <!-- disabled  -->

    <script src="../../src/svg.js" data-path="../../src/"></script>
  </head>

  <body>
    <h1>Tests using the OBJECT syntax to embed an SVG file</h1>

    <!--[if !IE]>-->
      <object data="http://localhost:8888/?values=.4,.3,.2,.1" type="image/svg+xml"
              width="1250" height="750" id="mySVGObject"> <!--<![endif]-->
    <!--[if lt IE 9]>
      <object src="http://localhost:8888/?values=.4,.3,.2,.1" classid="image/svg+xml"
              width="1250" height="750" id="mySVGObject"> <![endif]-->
    <!--[if gte IE 9]>
      <object data="http://localhost:8888/?values=.4,.3,.2,.1" type="image/svg+xml"
              width="1250" height="750" id="mySVGObject"> <![endif]-->
      </object>

    <h1>Test HTML H1</h1>
  </body>
</html>

龙年将至,发文记之,期待腾飞。

分类: Coding, Linux, Ubuntu, 技巧 标签: ,

VS2010编译VP8

2011年8月30日 没有评论
No Gravatar

在编译VP8的过程中遇到点问题,Windows编译个东西累死个人。

* /cyddrive/c/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin

*./vcvars32.bat amd64

源码使用这里的:http://code.google.com/p/webm/downloads/list

msys比较简单,可以按http://www.webmproject.org/code/build-prerequisites/这里的来,也直接使用svn检出这个,或者访问下载:

http://src.chromium.org/svn/trunk/deps/third_party/mingw

下载这个文件:mingw-get-inst-20101030.exe

安装的时候

在Repository Catalogues时选择:Download lastest repository catalogues

在Select Components时选择:C++ Compiler/MSYS Basic System之类

C:\MinGW\msys\1.0\msys.bat可以创建一个桌面快捷方式

C:\MinGW\msys\1.0\etc中的fstab中可以加入用户可以访问的文件系统。比如你的源代码在D:

可以增加

D:\ /src

记得yasm要在Microsoft VC目录中,比如C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin,这个路径也要加到PATH环境变量里。

配置64位vs10环境,不过脚本最高支持到vs9

./configure –target= x86_64-win64-vs9

$ ./configure --target=x86_64-win64-vs9
Configuring selected codecs
  enabling vp8_encoder
  enabling vp8_decoder
Configuring for target 'x86_64-win64-vs9'
  enabling x86_64
  enabling runtime_cpu_detect
  enabling mmx
  enabling sse
  enabling sse2
  enabling sse3
  enabling ssse3
  enabling sse4_1
  using yasm
  disabling ccache
  enabling postproc
Bypassing toolchain for environment detection.
Creating makefiles for x86_64-win64-vs9 libs
Creating makefiles for x86_64-win64-vs9 examples
Creating makefiles for x86_64-win64-vs9 docs
Creating makefiles for x86_64-win64-vs9 solution

在VS的vpx项目设置中yasm的包含路径我去掉了.才好用***。这个问题值得注意。
可以参考的信息:
./configure参数

Usage: configure [options]
Options:

Build options:
--help                      print this message
--log=yes|no|FILE           file configure log is written to [config.err]
--target=TARGET             target platform tuple [generic-gnu]
--cpu=CPU                   optimize for a specific cpu rather than a family
--extra-cflags=ECFLAGS      add ECFLAGS to CFLAGS []
--enable-extra-warnings     emit harmless warnings (always non-fatal)
--enable-werror             treat warnings as errors, if possible
(not available with all compilers)
--disable-optimizations     turn on/off compiler optimization flags
--enable-pic                turn on/off Position Independent Code
--enable-ccache             turn on/off compiler cache
--enable-debug              enable/disable debug mode
--enable-gprof              enable/disable gprof profiling instrumentation
--enable-gcov               enable/disable gcov coverage instrumentation

Install options:
--enable-install-docs       control whether docs are installed
--disable-install-bins      control whether binaries are installed
--disable-install-libs      control whether libraries are installed
--enable-install-srcs       control whether sources are installed

Advanced options:
--disable-libs                  don't build libraries
--disable-examples              don't build examples
--libc=PATH                     path to alternate libc
--as={yasm|nasm|auto}           use specified assembler [auto, yasm preferred]
--disable-fast-unaligned        don't use unaligned accesses, even when
supported by hardware [auto]
--enable-codec-srcs             in/exclude codec library source code
--enable-debug-libs             in/exclude debug version of libraries
--disable-md5                   support for output of checksum data
--enable-static-msvcrt          use static MSVCRT (VS builds only)
--enable-vp8                    VP8 codec support
--enable-internal-stats         output of encoder internal stats for debug, if supported (encoders)
--enable-mem-tracker            track memory usage
--enable-postproc               postprocessing
--disable-multithread           multithreaded encoding and decoding.
--disable-spatial-resampling    spatial sampling (scaling) support
--enable-realtime-only          enable this option while building for real-time encoding
--enable-error-concealment      enable this option to get a decoder which is able to conceal losses
--enable-runtime-cpu-detect     runtime cpu detection
--enable-shared                 shared library support
--disable-static                static library support
--enable-small                  favor smaller size over speed
--enable-postproc-visualizer    macro block / block level visualizers

Codecs:
Codecs can be selectively enabled or disabled individually, or by family:
--disable-<codec>
is equivalent to:
--disable-<codec>-encoder
--disable-<codec>-decoder

Codecs available in this distribution:
vp8:    encoder    decoder

NOTES:
Object files are built at the place where configure is launched.

All boolean options can be negated. The default value is the opposite
of that shown above. If the option --disable-foo is listed, then
the default value for foo is enabled.

Supported targets:
armv5te-linux-rvct       armv5te-linux-gcc        armv5te-none-rvct
armv5te-symbian-gcc
armv6-darwin-gcc         armv6-linux-rvct         armv6-linux-gcc
armv6-none-rvct          armv6-symbian-gcc
iwmmxt-linux-rvct        iwmmxt-linux-gcc
iwmmxt2-linux-rvct       iwmmxt2-linux-gcc
armv7-darwin-gcc         armv7-linux-rvct         armv7-linux-gcc
armv7-none-rvct
mips32-linux-gcc
ppc32-darwin8-gcc        ppc32-darwin9-gcc        ppc32-linux-gcc
ppc64-darwin8-gcc        ppc64-darwin9-gcc        ppc64-linux-gcc
sparc-solaris-gcc
x86-darwin8-gcc          x86-darwin8-icc          x86-darwin9-gcc
x86-darwin9-icc          x86-linux-gcc            x86-linux-icc
x86-solaris-gcc          x86-win32-gcc            x86-win32-vs7
x86-win32-vs8            x86-win32-vs9
x86_64-darwin9-gcc       x86_64-darwin10-gcc      x86_64-linux-gcc
x86_64-linux-icc         x86_64-solaris-gcc       x86_64-win64-vs8
x86_64-win64-vs9
universal-darwin8-gcc    universal-darwin9-gcc
generic-gnu

终于搞定了。需要将vpx项目中yasm的include设置,从.;..\src直接修改成一个路径,可以是绝对路径或者直接使用..\src。.不需要特别指出。

 

参考:

1. vs2010编译vp8

2. VP8视频格式初探

3. WebM Source Code

4.WebM downloads list

5.YASM

6. Using MSYS

7. depot_tools

8. msys-cn

9. MSYS wiki

10. MSys的安装和使用

11. 直接下载MSYS

12. http://www.optimasc.com/products/dex/index.html

13. http://www.ioncannon.net/meta/1128/compiling-webm-ffmpeg-windows/

14. http://videojs.com/

15. http://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Software_encoder_feature_comparison

16. http://alex.jurkiewi.cz/blog/2010/cross-compiling-x264-for-win32-on-ubuntu-linux

17. http://micksam7.com/blog/2010/webm-ffmpeg-win32-build/

18. http://code.google.com/p/gwd/source/browse/trunk/third_party_mods/libvpx/source/config/mac/x64/vpx_config.asm?r=9

19. http://x264.fushizen.eu/

20. http://doom10.org/index.php?topic=3.0

21. http://www.videolan.org/developers/x264.html

22.http://bbs.chinavideo.org/viewthread.php?tid=6945&highlight=VS2008

23. https://wiki.mozilla.org/WebM/Updating_libvpx

24.

 

 

 

 

mustache(5)例子测试

2011年8月15日 1 条评论
No Gravatar

1. 典型模板

模板demo1.mustache

Hello {{name}}
You have just won ${{value}}!
{{#in_ca}}
Well, ${{taxed_value}}, after taxes.
{{/in_ca}}

数据demo1.yml

---
"name": "Chris"
"value": 10000
"taxed_value": 10000 - (10000 * 0.4)
"in_ca": true
---

命令

/var/lib/gems/1.8/bin/mustache demo1.yml demo1.mustache

输出

Hello Chris
You have just won $10000!
Well, $10000-(10000*0.4), after taxes.

注意yml中的格式,:后面有空格
2. 转义和非转义

模板demo2.mustache

* {{name}}
* {{age}}
* {{company}}
* {{{company}}}

数据demo2.yml

---
"name": "Chris"
"company": "<b>GitHub</b>"
---

命令:

/var/lib/gems/1.8/bin/mustache demo2.yml demo2.mustache

输出:

* Chris
*
* &lt;b&gt;GitHub&lt;/b&gt;
* <b>GitHub</b>

3.小节

模板demo3.mustache

Shown.
{{#nothin}}
  Never shown!
{{/nothin}}

数据demo3.yml

---
"person": true
---

命令,还可以用下面方式:

cat demo3.yml demo3.mustache | /var/lib/gems/1.8/bin/mustache

输出:

Shown.

4. 非空列表

模板demo4.mustache

{{#repo}}
  <b>{{name}}</b>
{{/repo}}

数据

---
"repo":
- "name": "resque"
- "name": "hub"
- "name": "rip"
---

命令

/var/lib/gems/1.8/bin/mustache demo4.yml demo4.mustache

输出

  <b>resque</b>
  <b>hub</b>
  <b>rip</b>

5. 匿名函数

模板demo5.mustache

{{#wrapped}}
  {{name}} is awesome.
{{/wrapped}}

数据demo5.yml

---
"name": "Willy"
"wrapped": function() {
    return function(text) {
      return "<b>" + render(text) + "</b>"
    }
  }
---

命令

/var/lib/gems/1.8/bin/mustache demo5.yml demo5.mustache

输出

Willy is awesome.

6. 非否定值

模板demo6.mustache

{{#person?}}
  Hi {{name}}!
{{/person?}}

数据 demo6.yml

---
"person?":
- "name": "Jon"
---

命令

/var/lib/gems/1.8/bin/mustache demo6.yml demo6.mustache

输出

  Hi Jon!

7. 反转小节

模板demo7.mustache

{{#repo}}
  <b>{{name}}</b>
{{/repo}}
{{^repo}}
  No repos :(
{{/repo}}

数据demo7.yml

---
"repo": []
---

命令

/var/lib/gems/1.8/bin/mustache demo7.yml demo7.mustache

输出

  No repos :( 

8. 注释

模板demo8.mustache

<h1>Today{{! ignore me }}.</h1>

命令

/var/lib/gems/1.8/bin/mustache demo8.mustache

输出

<h1>Today.</h1>

上面模板就是写成下面这样也是相同的输出:

<h1>Today{{! ignore me
This is a comment test!!!
Test row!!!!
}}.</h1>

9. 局部模板

模板base.mustache

<h2>Names</h2>
{{#repo}}
  {{> user}}
{{/repo}}

局部模板user.mustache

<strong>{{name}}</strong>

数据用demo4.yml

命令

/var/lib/gems/1.8/bin/mustache demo4.yml base.mustache

输出

<h2>Names</h2>
  <strong>resque</strong>
  <strong>hub</strong>
  <strong>rip</strong>

10. 设置分隔符

模板setdelimiter.mustache

* {{default_tags}}
{{=<% %>=}}
{{name}}
<%name%>
* <% erb_style_tags %>
<%={{ }}=%>
<%name%>
{{name}}
* {{ default_tags_again }}

命令

/var/lib/gems/1.8/bin/mustache setdelimiter.mustache

输出

*
{{name}}

*
<%name%>

*

11.

分类: Linux, Ubuntu, 技巧 标签: , ,

也许差根线

2011年8月15日 没有评论
No Gravatar

在没有确认之前,很难想到一个故障的导致不是因为操作系统安装问题,不是因为PC硬件问题,而只是一根VGA线。

今天来了新人,准备的PC还是老样子。兼容机,内存8G,独立显卡,全高清显示器。拟安装Ubuntu 11.04系统,因为单位的路由是海蜘蛛的免费版本,偶尔的广告让apt-get update时获取的信息有问题,经常更新失败,所以继续让它跑Ubuntu 11.10。

安装很顺利,出现的问题也很简单。显示卡可以驱动上,但是显示器一直检测不出来,分辨率只能上到1024*768。。。

以为是显卡问题,本来想换。后来有人提议换个DVI线是否可以,结果换上后就好了。把那条线换给原来用DVI线的,发现问题是一样的。居然还有线的问题。。。好在作为IT公司,大把的VGA线在备用库里。

分类: Linux, Ubuntu, 技巧 标签: ,

Install Google Earth on Ubuntu

2011年7月30日 没有评论
No Gravatar

Dowload Google Earth

0. sudo apt-get install googleearth-package
1. lsb-core
2. sudo ln -s /lib/ld-linux.so.2 /lib/ld-lsb.so.3
3. Finally, it is looking for at least one shared library which is in the /opt/google-earth directory. One thing to do would be to identify the library "libgoogleearth_free.so", and copy it to a library director, like usr/local/lib. Then re-run ldconfig.
4. sudo ldconfig -v

参考:

1. http://www.google.bj/support/forum/p/earth/thread?tid=144696eab7d5a9c7&hl=en

2. http://www.google.ru/support/forum/p/earth/thread?tid=144696eab7d5a9c7&hl=en
3. http://www.google.com/support/forum/p/earth/thread?tid=1c9a3aff0171738e&hl=en
4. https://help.ubuntu.com/community/GoogleEarth

5. http://tombuntu.com/index.php/2010/05/02/how-to-install-google-earth-in-ubuntu-10-04/

6. http://www.linuxidc.com/Linux/2009-02/18415.htm
7. http://www.linuxidc.com/Linux/2009-02/18415.htm

8.

网站设计-小企业常犯的错误之Top 5

2011年7月27日 没有评论
No Gravatar

前几天看到这篇关于网站设计的文章:Top 5 Web Design Mistakes Small Businesses Make,挺有用,就想翻译下来。英语水平是不怎么样,但是只要自己能看懂,也不错。

翻的时候把原文也转过来了。无外乎两个原因,一个是方便大家帮我挑挑错误,另一个是这原文想直接看到也有点不易。

This post originally appeared on the American Express OPEN Forum, where Mashable regularly contributes articles about leveraging social media and technology in small business.
本文最初发表在American Express OPEN(美国运通????开放)论坛上。在那里经常会汇编发表一些关于在小企业中应用社会媒体和技术的文章。

If you’re a small business owner, your website is the central hub of your company, and it’s a pivotal part of your marketing and branding.
如果你是一个小企业的所有者,你的网站是你企业的中心枢纽,并且,它是你营销和品牌的关键部分。

Potential customers visit your site specifically for its content, meaning its appearance and usability are critical to its success and how those users view your company. However, getting your web design wrong can have a negative impact on your business.
潜在的顾客会因为你网站的内容访问你的网站,这意味着网站的外观和可用性会对它是否成功和用户如何看待你的企业造成重要的影响。然而,错误 的的网站设计可能对你的企业造成负面的影响。

Here are 5 common web design mistakes you must avoid to create a great user experience and grow your bottom line.
这里有5个常见的网站设计错误,是为了创建非常好的用户体验和拓展你的底线,你必须要避免的。

1. Poor Navigation 失败的导航

 

Many small businesses fail to make navigation a priority, but without careful attention to how people navigate your site, you could unintentionally be creating a frustrating experience for any potential visitor. People visit your site for specific information, and if they cannot find it they will quickly go elsewhere, leaving with the impression that your business is disorganized in more than just its website.

许多小企业在使导航更优先的方面很失败,如果没有仔细注意人们如何浏览您的网站,你可能会无意中给任何潜在的访问者创造一个令人沮丧的经历。人们因为特定的信息访问你的网站,如果他们无法找到它,他们很快就会去其他地方,留下的是你的企业是杂乱无章的印象,而不仅仅是你的网站。

A good navigation structure should be seamless and will keep visitors on your site longer, which means potentially more readers, subscribers, sales or leads — whichever is your primary objective.

一个良好的导航结构应该是无缝的,将使您网站的访问者停留的时间更长,这意味着潜在的更多的读者,订阅者,销售或线索 - 这些都是您的首要目标。

Website navigation affects both usability and accessibility, so it’s important to make it a primary concern. Most websites and blogs use common navigational techniques that are expected by the average visitor. The pages and sections of the site should be easy and logical for visitors to maneuver. Don’t make your visitors think about how to navigate your site; it should be effortless and natural.

网站导航影响对可用性和可访问性都会造成影响,所以重要的是要将它首先关注在内。大多数网站和博客使用普通访问者常见的导航技术。对于该网站的网页和章节对于访问者来说应该容易和逻辑。不要让您的访问者思考如何浏览您的网站,它应该轻松和自然。

There are several principles you can follow to create an effective navigation structure:

创建一个有效的导航结构,有几条原则你可以遵循:

* Use icons to aid navigation. They’re both visually appealing and easy to use and understand.

使用图标来帮助导航。它们将提升视觉吸引力,更容易使用和理解。
* Create logical groups of related links, with the most important links on the top-level navigation bar and functional (dashboard, account, settings, etc.) and legal (copyright, privacy, terms) located elsewhere.

创建相关键接的逻辑分级,将最重要的链接放在最顶层的导航条上,功能(工作台、账户、设置等)和版权信息等放在其它地方。
* Provide location information so users know where they are on any given page and how to proceed to another area of the website. This can be achieved by using Breadcrumb navigation.

提供位置信息,这样用户在任何一个给定的页面都可以知道他们在哪儿,并且如何进入该网站的另一个区域。这可以通过使用面包屑式(痕迹)导航来完成。

2. No Clear Calls To Action 没有清晰的立刻行动指引(这个可以称为是标语或者口号吗?)

The fundamental error of many small business websites is the lack of a clear call to action. We’ve all seen bland small-business brochure websites with nothing but endless descriptive paragraphs. If you aren’t leading users to commit to an action (buy a product, contact you or subscribe, for example), then you are losing them.

许多小型企业网站的基本错误是缺乏一个明确的行动指引。我们都见过那种平淡无奇的小企业小册样式的网站,上面除了无穷无尽的描述段落一无所是。如果你不能引导用户提交一个的行动(比如购买产品,与您联系或认购),那么你就失去他们。

Driving traffic to your website is important, but that traffic is useless if your primary call to action is a plain “click here” link buried in a sea of text. Call-to-action buttons are a great way to grab the user’s attention, and these buttons can be the key to higher conversions. Investing time and consideration into creating successful calls to action can help guide users and address their needs while achieving your own business goals.

提高网站的访问流量是重要的,但如果你的这种行动指引只是平谈的“点击这里”,并且链接到了一个被埋藏在文本海洋中的链接,那么这种流量是无用的。行动指引按钮是抓住用户注意力的一个非常棒的方式,这些按钮,是较高的转换的关键所在。投入时间和考虑创建成功能的行动指引,可以帮助指导用户,并满足他们的需求,同时实现自己的业务目标。

It’s important to keep the following best practices in mind when creating an optimal call to action:

在创造一个优化的行动指引时,遵守下面的最佳实践是非常重要的:

* The design of a call to action can be broken down into 4 simple elements — size, shape, color, and position. Each plays a vital part in determining how effective the call to action is in directing the user.

设计一个行动指引,可以分解成4个简单的元素 - 大小,形状,颜色,和位置。在确定指导用户行动指引对于他们来说是多有有效时,每一部分都是要害。

* Don’t make your users work or think, or they’ll leave. It’s not that they aren’t smart, it’s that they want access to information quickly without spending unnecessary time searching for it.

不要让你的用户的做或思考,否则他们就会离开。这不是他们不聪明,他们希望快速获得的信息而没有在如何找到它上面花费不必要的时间。

* Don’t overdo it with multiple, competing calls to action on every page. Decide what your primary target is and then define a clear objective per page. Your content should have answered, “What’s in it for me?” and your call to action should now answer, “What do I do now?”

不要在每一页上都设计多个、有竞争关系的行动指引。决定你的主要目标是什么,然后为每页定义一个明确的目标。您的内容应该答案,“我里面有什么?”,而您的行动指引现在应该回答,“我现在要做什么?”

3. Color & Contrast 颜色和对比度

Color and contrast aren’t usually high up on the list of priorities for a small business owner when it comes to creating a website. But it should be, because if your website text does not have sufficient contrast compared to its background, people will have difficulty reading your content, especially people with poor vision or color-blindness.

色彩和对比度对于小企业主来说,当他们创建一个网站的时候,通常不会出现在优先事项清单上。但是,是这样,如果你的网站文本和它的背景相比没有足够的对比度,当人们会阅读你的内容的时候会有困难,尤其是视力低下或色盲的人。

Aside from plain readability, color and contrast are important because they can be used to create visual interest and direct the attention of the user. It can equally be effective in organizing and defining the flow and hierarchy of a page, and it’s therefore an essential principle to pay attention to during the design process. Here are some tips:

除了普通的可读性,颜色和对比度非常重要,因为它们可以用来创造视觉趣味和引导用户的关注。它同样可以被有效地组织和定义流程和页面的层次结构,因此,它是在设计程中需要注意的一项基本原则。这里有一些提示:

* Using a free a Color Contrast tool (which conforms to accepted standards) you can easily check to see how the contrast on your website measures up.

使用一个免费的色彩对比工具(符合公认的标准),你可以轻松地衡量您网站上的反差。

* Research how major sites use color and contrast to improve readability and highlight specific sections, and use this knowledge to experiment with color schemes.

研究各大网站是如何使用色彩和对比度的,来提高可读性、突出显示特定的的部分,和使用这方面知识来试验配色方案。

* One of best ways to enhance contrast is by creating size differences between elements, making some things appear larger than others. This works especially well within a minimal color scheme, and it means you don’t have to necessarily rely on color.

加强对比度的最好方法之一,是通过创建元素之间的大小差异,使得有些东西显示得比其它的大。这在少量颜色方案中会有特别好的作用,意味着你没有必然依靠颜色。

4. Content, Content, Content 内容,内容,内容

People visit your website for its content, and how that is structured is a huge factor in its success or failure. Unfortunately, an overwhelming number of small businesses get so caught up in overloading the user with information that they overlook how that information is presented.

人们因为网站的内容而访问它,它是如何组织的是在其成败的巨大因素。不幸的是,绝大多数的小企业追捧的是给用户提供了过程的信息,他们忽视了如何来展示这些信息。

Most people do not read unless it’s absolutely necessary, and they prefer to scan through information quickly to get to the points of interest. This is why it’s so important to establish a strong visual content hierarchy so users can quickly scan your site and sifting through relevant information. A logical content hierarchy also acts as a guide through each page and creates a more enjoyable user experience.

大多数人除非必要,是会阅读的,他们更喜欢通过快速地信息扫描来获取兴趣点。这是为什么建立一种强烈的视觉内容层次结构是如此的重要,它可以使用户可以快速地扫描您的网站,并进行相关的信息筛选。一个逻辑内容层次结构也可以用作每一页的指南,并创建一个更愉快的用户体验。

So when focusing on your content, it’s best to keep in mind these three tips:

因此,在您的内容为重点时,最好要记住这三个秘诀:

* White space is possibly the most important factor to consider. It will allow the user to focus on the meaningful content within each section.

空白可能是需要考虑的最重要因素。这将允许用户在各个段落中将重点放在有意义的内容之上。

* Break up lengthy pieces of information into digestible blocks of text, utilizing headings, sub-headings, bullets, blockquotes and paragraphs.

将冗长的信息分解成易消化的文本块,利用标题,小标题,公告牌,引文和段落。

* Readable content is important, so use a good line height that is large enough to make content scannable. Margins and letter spacing also need to be taken into consideration.

可读的内容是很重要的,所以用良好的线高,它应该大到足以使内容可扫描。边距和字母间距也需要考虑。

When talking about content, spelling and grammar cannot be underestimated.

提及内容的时候,拼写和语法时也不能被低估。

5. Clutter 混乱

We all know at least one small business website that seems to include everything but the proverbial kitchen sink. Many small business owners tend to cram as much as they can onto a single page — the end result is a busy, cluttered and unreadable page.

我们都知道至少有一个小型企业网站,似乎包含一切,但是看来却像厨房水槽。许多小型企业所有者往往向单一页面中塞进尽可能多的内容 - 最终的结果是一个繁忙,混乱和无法读取的页面。

The more extraneous items there are on a web page, the more unprofessional it looks, and it becomes overwhelming, confusing and distracting for the user. A cluttered website will also affect traffic because visitors won’t return if they can’t understand or follow the content, which leads to low traffic, a high bounce rate and possibly a poor Page Rank.

在一个页面上无关的条目越多,它看起来就越不专业,让人头疼,会让用户混乱和分心。杂乱的网站也将影响网站的流量,因为访问客如果不能解或者关注那些内容,他们就不会再次访问,这导致了低流量、高跳出率,并可能是导致一个极差网页排名。

Clutter also applies to images. Too many can be a huge distraction and just plain annoying. Images should be used to illustrate, capture attention and guide the user where required.

混乱也适用于对图像。太多了会导致非常的分散和让人心烦。图片应该使用说明,吸引用户注意,并将他们导向他们所需要的内容。

Follow these guidelines for a more streamlined visitor experience:

遵循下面这些可以提供更有效的访问者体验的准则:

* Challenge every item on each page and ask, “Does it really need to be there? Does it serve a specific purpose? Can I live without it?”

质疑每一页上的每个条目,并要求“它是否真的需要在那里?它是否为了特定目的呢?我是不是可以没有它?”

* The key is to aid the visitor in finding the information they’re looking for, so make sure to differentiate between areas of content, advertisements and promotions.

关键是要帮助访问者找到他们正在寻找的信息,所以请一定要区分内容区域,广告和促销领域的区别。

* Prioritize your content and decide what is the most important to your visitor and potential customer — and sell it well.

优先考虑你的内容,并决定哪些对于你的访问者和潜在的客户是重要的,然后好好地卖掉它。

Even the greatest content can become lost in a mess of words and graphics, so de-cluttering is essential.

即使最好的内容也可以迷失在乱七八糟的文字和图形之中,所以去除混乱是必不可少的。

These are just five web design mistakes that many small businesses make. What other mistakes have you noticed on small business websites?

这是仅仅是五个小企业进行网页设计的错误。你注意到了小企业的网站还有什么其他的错误吗?

参照:
1. Top 5 Web Design Mistakes Small Businesses Make
2.

Switch to our mobile site