最近积攒的一点开源资源

>> mono项目中的WebBrowser控件,支持Gecko/WebKit两个核心。
Motivation: WebBrowser control for MWF/动力:MWF中的WebBrowser
注:
1. MWF指的是Mono WinForms吗?
2. 如果不是COM扩展,应该是不支持window.external扩展了吧

>> Android SDK: Embed a WebView with the WebKit Engine
Android SDK: Embed a WebView with the WebKit Engine
注:
1.这个已经由@ln_bo 测试过。不过在某些版本的国产平板上apk包出现解析错误,有可能是SDK版本的问题吧。过一段时间正式做技术准备的时候再详细测试。
2.需要参考的资料:
2.1 public class WebView
2.2 Web Apps Overview
3.看这段代码中是最后一个类MyWebChromeClient,应该是可以支持callback的。WebViewDemo.java

>>stackato
ActiveState公司悄悄出品的私有PaaS。它基于CloudFoundry
注:
1. Architecture Diagram: Stackato as a micro cloud

2. Architecture Diagram: Stackato on vSphere or hosted with an IaaS

3. 它还可以提供一个Sandbox,详细内容看这里:
4. 或者下载一份虚拟机映像,服务器版本的VM是基于Ubuntu Linux Server 10.04.3 LTS的,需要64位器,4G以上内容,并且需要至少3G以上的磁盘空间。
5.文档很详细Quick Start。安装好虚拟机之后直接http访问访问bridge ip也会给出Stackato Document
6. 开发支持Clojure/Java/Node.js/Perl/PHP/Python/Ruby
7. Copy-cat的话就看这个:github stackato-samples或者Sample Applications。后面的直接可以看到例子和README说明。

VS2010编译VP8

在编译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 — Logic-less templates

MUSTACHE(5)MUSTACHE MANUALMUSTACHE(5)
NAME/名称
mustache — Logic-less templates./少逻辑模板。

SYNOPSIS/摘要
A typical Mustache template:/一个典型的mustache模板:

Hello {{name}}
You have just won ${{value}}!
{{#in_ca}}
Well, ${{taxed_value}}, after taxes.
{{/in_ca}}
Given the following hash:/给定下面的hash数据:

{
“name”: “Chris”,
“value”: 10000,
“taxed_value”: 10000 – (10000 * 0.4),
“in_ca”: true
}

Will produce the following:/将会产生下面的结果:

Hello Chris
You have just won $10000!
Well, $6000.0, after taxes.

DESCRIPTION/描述
Mustache can be used for HTML, config files, source code – anything. It works by expanding tags in a template using values provided in a hash or object./Mustache可以用来产生HTML,配置文件,源码或者任何东西。它通过使用hash或者对象中的数据扩展模板中的标签来工作。

We call it “logic-less” because there are no if statements, else clauses, or for loops. Instead there are only tags. Some tags are replaced with a value, some nothing, and others a series of values. This document explains the different types of Mustache tags./我们称其为“无逻辑”,因为它没有if语句,else子句或者for循环。除此之外,仅有标签。一些标签会被值来替换,或者被替换成空,其它情况会产生一系列值。本文档解释了Mustache标签的不同类型。

TAG TYPES/标签类型
Tags are indicated by the double mustaches. {{person}} is a tag, as is {{#person}}. In both examples, we’d refer to person as the key or tag key. Let’s talk about the different types of tags.标签由双的胡子{}组成(这东西象胡子吗?)。{{person}}是一个标签,就象{{#person}}。这两个例子中,我们会认为person是一个键值或者是标签键。让我们来谈谈标签的类型吧。

Variables/变量
The most basic tag type is the variable. A {{name}} tag in a basic template will try to find the name key in the current context. If there is no name key, nothing will be rendered./最基本的标签类型就是变量。在基本的模板中出现的{{name}}标签会试图在当前的上下文中寻找名为name的键值。如果没有这个键值,则不会有任何内容会被渲染。

All variables are HTML escaped by default. If you want to return unescaped HTML, use the triple mustache: {{{name}}}./所有的变量缺省地都是HTML转义的。如果要你想返回未转义的HTML内容,可以使用三联标签:{{{name}}}。

You can also use & to unescape a variable: {{& name}}. This may be useful when changing delimiters (see “Set Delimiter” below)./你也可以使用&符号来非转义一个变量,如{{&name}}.这个在改变了分隔符的时候会非常有用(见下“设置分隔符”)。

By default a variable “miss” returns an empty string. This can usually be configured in your Mustache library. The Ruby version of Mustache supports raising an exception in this situation, for instance./默认的一个变量找不到时将返回一个空字符串。这个通常会在你的Mustache库配置。例如,Ruby版本的Mustacle支持在这种情况下抛出异常。

Template:/模板

* {{name}}
* {{age}}
* {{company}}
* {{{company}}}
Hash:/数据

{
“name”: “Chris”,
“company”: “GitHub
}
Output:/输出

* Chris
*
* <b>GitHub</b>
* <strong>GitHub</strong>

Sections/小节
Sections render blocks of text one or more times, depending on the value of the key in the current context./小节会将文本块渲染一次或者多次,这个要看在当前上下文中的键的值的情况。

A section begins with a pound and ends with a slash. That is, {{#person}} begins a “person” section while {{/person}} ends it./一个小节由#号标签开始,用/号标签结束。即:{{#person}会开始一个person小节,然后用{{/person}}结束。

The behavior of the section is determined by the value of the key./小节的行为取决于指定键的值。

False Values or Empty Lists/否定值或者空的列表

If the person key exists and has a value of false or an empty list, the HTML between the pound and slash will not be displayed./如果person键存在,但是有个否定值或者是一个空的列表,则在#和/之间的HTML内容不会被显示。

Template:/模板:

Shown.
{{#nothin}}
Never shown!
{{/nothin}}
Hash:/数据

{
“person”: true,
}
Output:

Shown.
Non-Empty Lists/非空列表

If the person key exists and has a non-false value, the HTML between the pound and slash will be rendered and displayed one or more times./如果一个person键存在,并且有一个非空的值,则在#和/标签之间的内容就会被渲染和显示一次或者多次。

When the value is a non-empty list, the text in the block will be displayed once for each item in the list. The context of the block will be set to the current item for each iteration. In this way we can loop over collections./当值是非空列表中的时候,块中的文本内容会按列表中的条目每一条显示一次。块的上下文会在每一次迭代的时候被设置成当前的条目。在这种情况下我们就可以对那些值进行循环了。

Template:/模板:

{{#repo}}
{{name}}
{{/repo}}
Hash:/值:

{
“repo”: [
{ “name”: “resque” },
{ “name”: “hub” },
{ “name”: “rip” },
]
}
Output:/输出:

resque
hub
rip
Lambdas/匿名

When the value is a callable object, such as a function or lambda, the object will be invoked and passed the block of text. The text passed is the literal block, unrendered. {{tags}} will not have been expanded – the lambda should do that on its own. In this way you can implement filters or caching./当那个值是一个可调用的对象的时候,比如一个函数或者匿名函数,该对象就会被调用,然后对应块的文本内容就会被传入。传入原始块的文本内容不会被渲染。{{tags}}不会被扩展,在它基础上的匿名函数会被调用。这种情况下你可以实现过滤或者缓存。

Template:/模板:

{{#wrapped}}
{{name}} is awesome.
{{/wrapped}}
Hash:/值:

{
“name”: “Willy”,
“wrapped”: function() {
return function(text) {
return “” + render(text) + “
}
}
}
Output:/输出:

Willy is awesome.
Non-False Values/非否定值

When the value is non-false but not a list, it will be used as the context for a single rendering of the block./当一个变量是一个非否定值,但是不是一个列表,它会在块渲染时被当做上下文使用。

Template:/模板:

{{#person?}}
Hi {{name}}!
{{/person?}}
Hash:/值:

{
“person?”: { “name”: “Jon” }
}
Output:/输出:

Hi Jon!
Inverted Sections/反转的小节
An inverted section begins with a caret (hat) and ends with a slash. That is {{^person}} begins a “person” inverted section while {{/person}} ends it.反转的小节会以^(帽子)符号开始,以/号结束。即:{{^person}}开始了一个反转的person小节,用{{/person}}结束。

While sections can be used to render text one or more times based on the value of the key, inverted sections may render text once based on the inverse value of the key. That is, they will be rendered if the key doesn’t exist, is false, or is an empty list.就象小节会根据键的值将渲染内容渲染一次或者多次,一个反转的小节会在值相反的情况下渲染文本内容一次。即,它会在键值不存在,是否的情况或者是空列表的情况下才会被渲染。

Template:/模板:

{{#repo}}
{{name}}
{{/repo}}
{{^repo}}
No repos 🙁
{{/repo}}
Hash:/值:

{
“repo”: []
}
Output:/输出

No repos 🙁
Comments/注释
Comments begin with a bang and are ignored. The following template:/注释以感叹号开始,内容会被忽略,如下面模板:

Today{{! ignore me }}.

Will render as follows:/这个模板将被渲染如下:

Today.

Comments may contain newlines./注释中可以包含换行。

Partials/局部模板
Partials begin with a greater than sign, like {{> box}}./局部模板会由一个大于号开始,象{{>box}}。

Partials are rendered at runtime (as opposed to compile time), so recursive partials are possible. Just avoid infinite loops./局部模板会在运行时(与编译时相对)被渲染,所以递归的局部模板是可能的。仅仅需要避免无限循环。

They also inherit the calling context. Whereas in ERB you may have this:/它们也继承了调用的上下文。就象在RoR的ERB模板中你可以做的一样:

< %= partial :next_more, :start => start, :size => size %>
Mustache requires only this:/在Mustache模板中只需要:

{{> next_more}}
Why? Because the next_more.mustache file will inherit the size and start methods from the calling context./这是为什么呢?因为next_more.mustache文件会在上下文中继承size和start方法。

In this way you may want to think of partials as includes, or template expansion, even though it’s not literally true./这种情况下你可能想认为局部模板就是包含,模板扩展,不过它确切来说不是对的。

For example, this template and partial:/例如,下面的模板和局部模板:

base.mustache:

Names

{{#names}}
{{> user}}
{{/names}}

user.mustache:
{{name}}
Can be thought of as a single, expanded template:/这个user.mustache局部模板可以用来做为扩展模板的一个单独的部分,即:

Names

{{#names}}
{{name}}
{{/names}}
Set Delimiter/设置分隔符
Set Delimiter tags start with an equal sign and change the tag delimiters from {{ and }} to custom strings./设置分隔符标签会由等号标志开始,将标签分隔符从{{和}}修改成缺省的字符串。

Consider the following contrived example:/请看下面巧妙的例子:

* {{default_tags}}
{{=< % %>=}}
* < % erb_style_tags %>
< %={{ }}=%>
* {{ default_tags_again }}
Here we have a list with three items. The first item uses the default tag style, the second uses erb style as defined by the Set Delimiter tag, and the third returns to the default style after yet another Set Delimiter declaration.

According to ctemplates, this “is useful for languages like TeX, where double-braces may occur in the text and are awkward to use for markup.”

Custom delimiters may not contain whitespace or the equals sign.

COPYRIGHT/版权
Mustache is Copyright (C) 2009 Chris Wanstrath

Original CTemplate by Google

SEE ALSO/参见
mustache(1), mustache(7), http://mustache.github.com/

DEFUNKTAPRIL 2010MUSTACHE(5)

http://mustache.github.com/mustache.5.html

小注:胡乱翻译,有问题请反馈。多谢。