Archive for 6月, 2008

28
6

Cluster introduction

Author: keys

A cluster is two or more computers (called nodes or members) that work together to perform a task. There are four major types of clusters:

  • Storage
  • High availability
  • Load balancing
  • High performance

Storage clusters provide a consistent file system image across servers in a cluster, allowing the servers to simultaneously read and write to a single shared file system. A storage cluster simplifies storage administration by limiting the installation and patching of applications to one file system. Also, with a cluster-wide file system, a storage cluster eliminates the need for redundant copies of application data and simplifies backup and disaster recovery.

High-availability clusters provide continuous availability of services by eliminating single points of failure and by failing over services from one cluster node to another in case a node becomes inoperative. Typically, services in a high-availability cluster read and write data (via read-write mounted file systems). Therefore, a high-availability cluster must maintain data integrity as one cluster node takes over control of a service from another cluster node. Node failures in a high-availability cluster are not visible from clients outside the cluster. (High-availability clusters are sometimes referred to as failover clusters.)

Load-balancing clusters dispatch network service requests to multiple cluster nodes to balance the request load among the cluster nodes. Load balancing provides cost-effective scalability because you can match the number of nodes according to load requirements. If a node in a load-balancing cluster becomes inoperative, the load-balancing software detects the failure and redirects requests to other cluster nodes. Node failures in a load-balancing cluster are not visible from clients outside the cluster.  LVS (Linux Virtual Server).

High-performance clusters use cluster nodes to perform concurrent calculations. A high-performance cluster allows applications to work in parallel, therefore enhancing the performance of the applications. (High performance clusters are also referred to as computational clusters or grid computing.)

27
6

之前我发表过一篇文章介绍我们自己的组件/模块生成器,今天在网上偶尔发现国外有一套类似的JOOMLA生成器,他有个显著的特点是生成的类使用extends mosDBTable风格,这样所有的数据库操作都可以使用ORM的方式,并且提交到页面的POST可以直接转化为一个对象,简化所需的操作。这种风格在我们开发过程中应该是积极提倡的。
Joomla Module and Component Maker 演示使用地址:http://www.joomlatexas.com/index.php

25
6

Motools 研究报告

Author: Johnny Walker

之前做JS接触到的大多是dojo,jquery,prototype,WZ之流,多少存在一些问题。

直到接触JOOMLA,发现里面有些很酷的效果,而且性能也很好才发现都是幕后功臣motools也是个不错的东东。

MOTOOLS

特点介绍:

  • style非常干净,采用后期事件注入的方式。页面上全是class 
  • 对变形效果支持好,这是MOTOOLS的核心功能
  • 调用方便,写的代码非常少,而且分离很好
  • 完全的oop风格

核心feature:

Accordion:文字卷帘,可以在一页显示多页信息,点击标签卷帘收缩展开

customEvent:1.对mouse wheel的支持,2. 可以定义全局的特殊方法,比如enter事件的处理,然后做控件-方法绑定即可,使用继承方式来获得系统事件,例如:keyenter 就是原来的系统事件

Element.Events.keyenter = {
 base: ‘keyup’,
 condition: function(e){
  // We can basically put any logic here.
  // In this example we return true, when the pressed key is the
  // Enter-Button so the keyenter event gets fired.
  return e.key==’enter’;
 }
};

绑定过程也非常简单
 $(’myElement’).addEvent(’keyenter’, function(e){
  // We can do everything here: submitting a form, sending an AJAX-Request and so on
  // because it only fires when the user presses the Enter-Button
  e.stop();

  // But instead we only change the text of an element.
  $(’myDivElement’).set(’text’, ‘You pressed enter’).highlight();
 });

SORT/Dynamic Sortables排序

支持drag and drop 的排序。而且item可以runtime 生成

EFFECT:渐变变形/MOTOOLS 精髓

还记得JOOMLA酷酷的黑色弹出框吗?其实那在MOTOOLS不过是一DIV变型,
MOTOOLS支持的变形有morph,erase,tween,start
包括变长度,变颜色,变透明度,位置移动,或者甚至CSS的改变,可贵的是motools支持的全部都是渐变的动画效果

Slide:

变形的衍生功能,可以收缩控件做出某种slide效果,

Mouseenter和Mouse leave:加强的mouseenter和mouse leave,javascript的mouse enter 和leave 一直不太好用,要么不调,要么反复掉,现在MOTOOLS把它增强了。

Json/Ajax:仍然是很干净很简单的style来支持ajax

更多精彩请看源码!我已经把motools的sample一一下载并打包上传了,点击这里下载

 

18
6

joomla精华资源

Author: Johnny Walker

一位joomla老玩家shared的30多个资源网站,大多是免费的。包括以下几类:

  • joomla教程
  • code,design研究
  • joomla 网站评选(可以学习别人,也可以邀请别人来看)
  • 模板,模块,组件资源
  • joomla lancer类

30+ Joomla Tools and Resources

    Joomla

Joomla, formerly known as Mambo, is a popular open source Content Management System (CMS). As with most open source projects, there’s a ton of free tools out there for you to use. We’ve chosen over 30 useful extensions and other tools to make your Joomla life easier. Enjoy.

Don’t forget to check out our post where you can suggest future toolbox topics! (this list came from one of the suggestions) Read the rest of this entry »

17
6

http://sixrevisions.com/tools/faster_web_page/

就是一些测试web page loading performance的东东.

web page的提速一般有以下几个方向:

1. 减少http connection打开的次数, 比如把所有js并成一个, 把所有css并成一个. 使用一个大的PNG把所有图标都放上面, 然后用css里不同的position去控制显示哪个图标, 这些都是尽量减少http connection连接次数

2. 压缩, gzip支持

3. 优化和压缩css和js, 减少空格和换行, 以减少文件大小

4. 减少一个page里包含很多domain下的resource. 避免多余的DNS lookup

5. 还有很多小玩意, 比如让page早点load出来, 在body和head中间flush一下…

17
6

CSS的N多跨平台的Tips, 值得一看, 值得记录一下

You might be interested to check our other related post for some inspiration:

IE Bug Fixes

1- Bug Fix: IE Double Margin Float Bug- It’s an Internet Explorer-exclusive bug wherein an element that is floated – and given a margin in the same direction as the float – ends up with twice the specified margin size. The fix is extremely simple. All you have to do is apply a display: inline rule to your floated element. So you simply go from something like this:

#content {
    float: left;
    width: 500px;
    padding: 10px 15px;
    margin-left: 20px; }

To something like this:

#content {
    float: left;
    width: 500px;
    padding: 10px 15px;
    margin-left: 20px;
    display:inline;
}

CSS Tips


2-Overcoming the Box Model Hack- If you want to specify a width to any div, do NOT specify padding or margins. Just create an inner div with no width set and specify its padding and margins instead. So instead of doing this:

#main-div{
width: 150px;
border: 5px;
padding: 20px;
}

Do something like this:

#main-div{
width: 150px;
}
#main-div div{
border: 5px;
padding: 20px;
}

3-Min-height attribute ignored in IE- “min-height” attribute works well in Firefox but IE ignores it. IE’s height act as FF’s min-height. Note: in IE 7 problem was fixed.

/* for understanding browsers */
.container {
width:20em;
padding:0.5em;
border:1px solid #000;
min-height:8em;
height:auto;
}
/* for Internet Explorer */
/*\*/
* html .container {
height: 8em;
}
/**/

4- Min-Width for IE -A fix for the lack of min-width in Internet Explorer.


Centering a Block Element

5-Centering Block Element- There are multiple techniques for centering a block element; and the choice for the technique depends on whether you have the size set in percentages or in more absolute values.

Centering an entire page’s contents:

body{
text-align: center;
}
#container
{
text-align: left;
width: 960px;
margin: 0 auto;
}

6-Vertical Align with CSS- If you want to know how you can achieve vertical-align functionality the right way, simply specify the line-height for your text the same height as that of the container’s.

#wrapper {
	width:530px;
	height:25px;
	background:url(container.gif) no-repeat left top;
	padding:0px 10px;
}
#wrapper p {
	line-height:25px;
}

Column Issues

7- Top reasons your CSS columns are messed up- An easy-to understand article on how to fix common CSS Column issues with helpful diagrams and code snippets.

CSS Tips


8- The Expanding Box Bug-When you try to create a two-column float layout, IE will create a “float drop”, and it’s caused by having over-sized content in a fixed-width floated div that must fit into a particular spot in the layout. Several possible workarounds are detailed in this post.

CSS Tips


CSS Positioning

9- Understanding CSS Positioning part 1- An interesting series of articles that doesn’t only cover positioning, but also properties that define layout such as display and float, and a preview of the new CSS3 layout modules. The first part will introduce the positioning and display property. Part1, Part2, Part3 gives you a deep understanding of the possibilities you have in positioning.

CSS Tips


10- What is the difference between relative and absolute positioning?- Whether to use relative or absolute positioning can be extremely frustrating to people just getting started with CSS. The answer to this question will add a bit of clarity to this confusion.

#redSquare
{
position: relative;
bottom: 40px;
right: 40px;
}

To get this:

CSS Tips


11-HangTab- Create a Sticky Tag from the Edge of the Browser Window (Even with Centered Content). Check out Panic’s website for their software Coda.

#hang_tab {
position: absolute;
top: 7px;
left: 0px;
width: 157px;
height: 93px;
}

CSS Tips


CSS Float Concept

12- CSS Float Theory: Things You Should Know- SmashingMagazine browsed through dozens of related articles and selected the most important things you should keep in mind developing css-based layouts with floats.

<div> <!-- float container -->
<div style="float:left; width:30%;"><p>Some content</p></div>
<p>Text not inside the float</p>
<div style="clear:both;"></div>
</div>

13- Floatutorial: Simple tutorials on CSS Floats- Floatutorial takes you through the basics of floating elements such as images, drop caps, next and back buttons, image galleries, inline lists and multi-column layouts.

CSS Tips


14- Clear Your Floats - The Right Way- Float clearing can be one of the most frustrating aspects of CSS development, one of the best ways is to use the EasyClearing on your site.

/* EasyClearing http://www.positioniseverything.net/easyclearing.html */
#container:after
{
	content: ".";
	display: block;
	height: 0;
	clear: both;
	visibility: hidden;
}

#container
{display: inline-block;}

/* Hides from IE-mac \*/
* html #container
{height: 1%;}

#container
{display: block;}
/* End hide from IE-mac */

CSS Tips


Easier Rounded Corner Solutions

15- Mike asks the CSS Guy for recommendations on rounded corners- “Simplest way is to use a giant gif, then I’ll markup my box”

<div class="roundBox">
  <p>beautifully-encapsulated paragraph</p>
  <div class="boxBottom"></div>
</div>

“And give it the background”

.roundBox {
  background:transparent url(roundBox.gif) no-repeat top left;
  width:340px;
  padding:20px;
}
.roundBox .boxBottom {
  background:white url(roundBox.gif) no-repeat bottom left;
  font-size:1px;
  line-height:1px;
  height:14px;
  margin:0 -20px -20px -20px;
}

Also Askthecssguy explains the technique used in Google Analytics, which works by leaving a 1px notch in every corner to get the rounded corner effect which is a new way of creating rounded corners without using static images. You can see an example here.

CSS Tips


16-3 Simple Steps in Coding a Rounded Corners Layout- Alen Grakalic’s approach to coding a fixed width, rounded corners layout in 3 simple steps. He also created a demo here.

CSS Tips


CSS Form Issues

17- Tips For Creating Great Web Forms- Cris Coyer shares with us some tips for floating labels, :focus Pseudo Class, using hints and more. He also created the Nice & Simple Contact Form, which he first posted about here.

label {
	float: left;
	text-align: right;
	margin-right: 15px;
	width: 100px;
}

CSS Tips


18- Clean and pure CSS FORM design- For CSS lovers, this tutorial illustrates a proposal about how to design a pure CSS form without using html tables. You can grab the code here.

CSS Tips


19-Autopopulating text input fields with JavaScript- Sometimes we need to explain to users what they are supposed to enter into text input fields. One common workaround when no label can be displayed is to put some placeholder text in the text field and let that act as the label. This tutorial introduces a nice solution, with JavaScript enabled, the label element is hidden and the value of the input element’s title attribute is copied to the value attribute. If JavaScript is disabled, the label is displayed above the text input, which is left empty. A simple demo, where you can see this in action is here.

CSS Tips


Worth checking CSS Tricks

20- Cross browser Horizontal Rule with Background Image- You’d like to create a cross-browser horizontal rule that utilizes a custom image as the content separator.

div.hr {
background: #fff url(myhrimg.gif) no-repeat scroll center;
height: 10px
}
div.hr hr {
display: none
}

Your tag should look like this:

<div class="hr"><hr /></div>

http://www.noupe.com/css/using-css-to-fix-anything-20-common-bugs-and-fixes.html
14
6

今天把Drupal里的Views测试通了, 用起来很好很强大. 只可惜是beta版, 非常多的dependence的module都不得不beta版. Drupal6出来这么久了, 这些module的porting工作进展怎么还这么慢.

今天一个收获, 找到不少发票模版, 以后给客户开局发票方便了.

研究core的api中, 目前暂时感觉很烦很不直观, 不过这种东西, 慢慢摸透潜规则才能看明白. 对里面的hook基本走了一遍, 有点感觉. DB_rewrite那个hook也太强了点…

7
6

搞了一天Drupal

Author: 乌鱼

基本玩熟了, 这种开源项目, 学习方式

  • 首先是尽量用它的default功能, 把它的能力彻底摸透
  • Go through所有的extension和plugin, 熟悉它的社区
  • 抓本电子书快速扫一遍

发现了如下很cool的功能, 确实drupal的灵活度是joomla不可比拟的, 哪怕joomla使用sobi做后端data model.

  • CCK(Content Construction Kit) - 最大的特色plugin了, 自定义dynamic fields
  • 围绕CCK, 有很多plugin, 诸如Email Field, Image Field, Related Node Field 还是个autocomplete
  • Drupal的JS是基于JQuery的, 一个典型的例子就是External Link, 能把在所有externel link变成a link, 同时加上个link icon, 后台还能配置是open new window还是当前window
  • Menu system显然没有joomla的强, 不过有两个比较cool的, 一个是前台的DHTML menu, 一个是后台admin的Super Nav
  • Drupal的体系很好, 万事万物都是Nodes, 只不过拥有不同的”ContentType”, 当自己建立了自己的Content Type, 就可以为这个Content Type设置Fields, 每个Fields还有Content Template与之对应, 可谓相当爽啊
  • Image gallery和缩略图之类的common功能都有, Flash Slide show也有
  • Video的支持有点郁闷了, 作者说要等CCK不是beta的时候, 才会port到6.x上…
  • 有个Image Import功能, 停爽的, 但是不能区分用户, 可能要改改src才能搞定
  • Page Ear, 就是页面右上角mouse放上去象翻书一样翻过来半页, 里面是广告页, 一个flash的plugin, 有点意思
  • 有个Flash Chart的, 不支持drag事件, 不过比image的已经漂亮多了, 看了作者介绍真牛啊, 因为去买了一个Flash Chart, 然后有bug, 对方耽搁了4周, 作者火大了, 就自己搞了一两周做了一个出来, 然后opensource, 那个卖flash chart的公司就没的混了. 说是给人的教训就是, dont piss off your customer. 比较强势, 我喜欢
  • Blog Theme的plugin, 就是可以让不同用户设置不同的theme, 非常符合social networking的需要
  • Friend, FriendFeed plugin, 可以添加好友
  • PM Lite, private message
  • User Points, 因为drupal有内置的Action list,其实是用来做syslog的, 但是这个User points使用这些actions, 然后可以自定义计算公式, 最后能得出成员的分数出来, 很有用的一个plugin
  • User Relationship, 顾名思义
  • Wiki support

从整个过程看出, Drupal的自己功能还是plugin功能, 都强调高度灵活性, 比joomla不是一个级别的. 里面的Action List, ACL, Module的运行方式, 各种Hooks都比Joomla强劲, 但是UI效果确实一般. 不过追求功能的今天, 更重要的其实是你的web能否便利的为用户解决一些困难. Common的UI用户也能接受.. hehe

7
6

Amazon Simple Storage Service (Amazon S3)

简单的读写功能, 比自己搭建大型的数据仓库便宜的多, 在项目还处于prove concept期间, 用这个方案即稳定, 又大大节约硬件和软件成本. 而且有很多现成的api来wrap这个S3服务, 用起来很是方便, 每个月10G的流量才1$左右. 只可惜, 目前只有US和EUR的服务器, 中国用用的话不知道速度几何?

这种online大容量存储(又叫存储服务网络)应该是个趋势, 在未来网络大一统时代, 肯定需要枪毙目前各自为政的小DB们. 应该是超级大计算机集群扮演现在的大小server.

6
6

PHP世界的Cluster

Author: 乌鱼

一直做Java系统的cluster, apache, app server之流,  也曾经考察过.Net环境下windows自己的NLB (Network Load Balance)

现在来到PHP世界, 也有类似的东西, 昨天跟阿蔡聊起来, 就不要忘了, 记录一下

一个是squid http://www.squid-cache.org/ , 一个是操作系统层面的LVS http://www.linuxvirtualserver.org/

这也就解释通了, drupal, joomla, wordpress都把session default保存到数据库里去, 为了方便在cluster环境下工作, 不用在不同机器复制session了