Friday, 29 May 2009

HOWTO[zen-cart]: disable random on homepage

At beginning.
Copy featured_products.php / new_products.php from /includes/modules/ to /includes/modules/YOURTEMPLATE, then start to edit it.

1. append "order by featured_sort_id DESC" to the two select statements

2. change ExecuteRandomMulti() to Execute()

3. change MoveNextRandom() to MoveNext()

Tuesday, 26 May 2009

The procedure of Zen-cart display home page

1) tpl_main_page.php
++++++++++++++
require($body_code);
----------------------

2) $body_code is defined in /includes/templates/template_default/common/main_template_vars.php
Here, firstly check whether it's overridden or not by the current template. If not (/not exist overridden main_template_vars.php, then load the default tpl_SOME_PAGE_default.php)
 
3) If overridden, in the zen-cart pages system, /includes/modules/pages/index/main_template_vars.php defines which tpl file should be loaded to display the home page.
  • tpl_index_categories.php // $category_depth=='nested' 有子分类
  • tpl_index_product_list.php // $category_depth=='products' || zen_check_url_get_terms() 列出所有
  • tpl_index_default.php // the default tpl_SOME_PAGE_default.php 主页默认内容

HOWTO: Add css for IE within zen-cart

1) Prepare a css file for IE, called ie7.css, located in /includes/templates/template_default/my

2) Add the following codes:
+++++++++++++++++++++++++++++++
echo '<!--[if lte IE 7]><link rel="stylesheet" href="' . $template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'my') . '/ie7.css" />'."\n".'<![endif]-->';
-------------------------------------------------

around the following codes in /includes/templates/template_default/common/html_header.php
+++++++++++++++++++++++++++++++
/**

 * load all template-specific stylesheets, named like "style*.css", alphabetically

 */

  $directory_array = $template->get_template_part($template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css'), '/^style/', '.css');

  while(list ($key, $value) = each($directory_array)) {

    echo '<link rel="stylesheet" type="text/css" href="' . $template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css') . '/' . $value . '" />'."\n";

  }
---------------------------------------------------

HOWTO: The Zen Cart Execution Process

Zen Cart, like most open-source code, is a largly undocumented.
Luckily for us, it also has a habit of mixing in much of it's
program/application logic with it's actual HTML design, so it's not
only undocumented, it's also hard to browse the HTML code. To top it
off, it also has a dynamic template loader, which means that the
program logic and HTML templates could be in any one of four different
directories. Also undocumented, and of dubious usefullness.



The result is that it's not only difficult to browse through the
program logic and HTML code, but you often don't even know which files
are going to get loaded.



This document is an attempt to sort through the overarching structure of how Zen Cart tends to work.



index.php steps:



Here's where all of action begins.
  1. it loads 'includes/application_top.php'
  2. if $main_page isn't set, it gets set to 'index'
  3. if the directory 'includes/modules/pages/$main_page' doesn't exist, $main_page gets set to 'index'
  4. it loads all of the files starting with 'header_php' in 'includes/modules/pages/$main_page'
  5. now it loads 'html_header.php' from the first first place it finds it from the following directories
    1. includes/templates/mytemplate/$main_page/
    2. includes/templates/template_default/$main_page/
    3. includes/templates/mytemplate/common/
    4. includes/templates/template_default/common/

  6. now it does the same thing for finding and loading 'main_template_vars.php'
  7. now it does the same thing for finding and loading 'tpl_main_page.php'
  8. Finally it displays the '</html>' tag. Why display it here when the '<html>' tag is displayed somewhere else? Who knows.


application_top.php steps:


This file will load in all of general definitions used site-wide,
initialize some site-wide classes ($template, $db) and do other general
stuff.

html_header.php steps:



The default html_header.php file will simply create all of the HTML up to the </head> tag
It loads 'includes/modules/meta_tags.php', which uses a bloated switch statement to figure out what the site's title, meta-keywords, and meta-description should be.
It tries to find the css directory, and loads in it all stylesheets that begin with 'style' and end with '.css'
It does the same thing for the jscript directory, and tries to load all files that begin with 'jscript_' and end with '.js'

main_template_vars.php steps:



it simply sets $body_code to the first of:
  1. includes/modules/pages/$main_page/main_template_vars.php
  2. includes/templates/mytemplate/$main_page/tpl_{$main_page}_default.php
  3. includes/templates/template_default/$main_page/tpl_{$main_page}_default.php
  4. includes/templates/mytemplate/templates/tpl_{$main_page}_default.php
  5. includes/templates/template_default/templates/tpl_{$main_page}_default.php

that's it.

tpl_main_page.php steps:



this file lays out the basic page.
  1. <body>
  2. loads the 'includes/modules/header.php' file
  3. if the left column is enabled, it loads 'includes/modules/column_left.php'
  4. it loads the file set in $body_code
  5. if the right column is enabled, it loads 'includes/modules/column_right.php'
  6. loads 'includes/modules/footer.php'
  7. </body>


includes/modules/pages/$main_page/main_template_vars.php steps:

this
is where the meat of the actual content if loaded and displayed.
it typically does all of the program logic first, sets all of the
necessary variables, and then loads the template file. As usual, the
template file is loaded from the first of the following:
  1. includes/templates/mytemplate/$main_page/
  2. includes/templates/template_default/$main_page/
  3. includes/templates/mytemplate/templates/
  4. includes/templates/template_default/templates/

The standard is that the template file will be named 'tpl_SOMENAME.php'. Note that it doesn't end with '_default.php'. The undocumented naming convention is that files that end with '_default.php' are files that get loaded with it can't find the 'includes/modules/pages/$main_page/main_template_vars.php' file.

tpl_{$main_page}_default.php steps:

If it doesn't find the
above file and it instead finds a tpl_*_default.php file, then it means
that all of the program logic and variables will be mixed up with the
actual displayed HTML code. In Zen-Cart's defense, this generally means
that there's not a lot of program logic to be had here, hardly any
really, but it's still damn annoying to be mixing the program logic
with design. No sir, I don't like it one bit.

Future Updates



Eventually this document will also cover the process by which the program loads in the language files, such as "english.php" and the content files like "privacy.php" and "conditions.php."
The Zen Cart creators actually created these files with the idea that
they would be a part of your custom template, which is a clear
violation of the content/design seperation.



This document will also cover sideboxes (which requires a whole
nother custom template directory). As an interesting sidenote, when you
switch to a new template, all of the sideboxes get turned off. The
level of user-unfriendliness of Zen Cart is amazing to me sometimes.


This article is from: http://lifefeed.net/zencart/program_process.php

Saturday, 16 May 2009

HOWTO: [MAC] Move User to a different partition

Move User to a different partition

As we have hopefully set up a separate partition for our private data, here’s the bash-way of moving a home. (based on this article)

  1. in 'Disk Utility' to setup a new partition with 'Mac OS Extended (Journaled)' format, I call it 'home'.
  2. copy the whole home to your new partition:

    # sudo su -
    # cp -Rp /Users/username /Volumes/username
  3. Now we use Directory Services which can be accessed by dscl (Directory Services Command Line):

    # sudo su -
    # dscl localhost
    > cd /Local/Default/Users
    > change username dsAttrTypeNative:home /Users/username /Volumes/home/username> exit

Reboot, verify if your user data is at the new spot and then delete it from the old spot (/Users/username).

Wednesday, 13 May 2009

HOWTO: hide 隐藏 SHOPEX footer 'powered by shopex'

Shopex use zend encoder to protect their commercial product. To run it, the 'zend-optimiser' is needed for decoding. Some web servers do not provide this module, such as ONE.COM. Therefore, to remove this 'footer' slogan, you must have their license the override the encoded php file.

Here is a hack to remove this 'powered by shopex' from footer, using 'mootools', which is coming with shopex installation automatically.

  1. go to /themes/THEME NAME/block/footer.html.
    Use '<div id="footer_remove">' and '</div>' to surround the '<{foot}>'
  2. go to /themes/THEME NAME/block/header.html.
    Add the following javascript after '<{head}>'
    ================


    <script type="text/javascript">



    window.addEvent('domready', function() {

    var fa=$('footer_remove').getElements('a[href^=http://store.shopex.cn/rating]');

    fa.setStyle('display', 'none');



    var fb=fa.getNext('span');

    fb.setStyle('display', 'none');});

    });



    </script>



    ================

Tuesday, 12 May 2009

HOWTO[mac]: php.ini for both xdebug and zenddebugger in both Eclipse and M(L)AMP

Note: Either zenddebugger or xdebug is not included by default, (all-in-one PDT saying zenddebugger is included), You'd better check and install from software update in Eclipse.

xdebug.so: can be extract from the dmg file of Komodo .
zenddebugger: from zend or pdt (issued from zend), or http://downloads.zend.com/pdt/server-debugger/

Note: Sometime, when the debugger is changed, the xdebug will not work any more on that project. Copy all the files into a new php project, it will work fine. This seems that the some of the project properties are changed during debuger is changed. (so far, don't know which modified property cause this issue). Refactor, such as rename, the project name will fix it.

The content in the end of php.ini

;========================================
[Zend]
zend_optimizer.optimization_level=15
zend_extension_manager.optimizer=/Applications/MAMP/bin/php5/zend/lib/Optimizer-3.3.3
zend_optimizer.version=3.3.3

;----------------------- to be removed; it never runs well with this line
;zend_extension=/Applications/MAMP/bin/php5/zend/lib/ZendExtensionManager.so
;-----------------------

[ZendDebugger]
zend_extension=/Applications/MAMP/bin/php5/zend/lib/ZendDebugger.so

; Sometime, to enable Zend Debugger, Xdebug need to be disabled in php.ini; vice versa.



[xdebug]
zend_extension=/Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20050922/xdebug.so
;xdebug.file_link_format="txmt://open?url=file://%f&line=%1"
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.idekey=

Monday, 4 May 2009

曾国藩的修身艺术-男儿自立,必须有倔强之气

男儿自立,必须有倔强之气

少年当有狂者进取之趣

从砥砺自己的品性开始



性格决定命运,抱负决定成就,良好的品性是成功的前提。在优秀的领导者身上,我们总是能发现许多优秀的特质。但是这个世界上并没有天生的领导。这些特质无一不是从修养中来的。自我修养,是领导者走向成功的起点。早年的曾国藩同平常人一样,也有很多缺点,然而他凭借着自己的修身工夫,确立了良好的品格。他的成功,在很大程度上取决于他的修身艺术。那么,曾国藩在修身上有哪些值得我们借鉴的地方呢?曾国藩修身艺术,其实无非三条:第一,倔强;第二,进取;第三,有恒。




男儿自立 必须有倔强之气



曾国藩的性格,受他的祖父曾玉屏和他的母亲江氏的影响很大。曾玉屏常对家人说的一句话,就是“以懦弱无刚四字为大耻”。这句话对曾国藩影响很大,做了两江总督之后,他还以祖父的这句话教自己的弟弟,并认为“男儿自立,必须有倔强之气”。他说:

“倔强”二字,却不可少。功业文章,教需要有这两个字贯注于其中,否则柔靡不能成一事。孟子所说的“至刚”,孔子所说的“贞固”,都是从“倔强”两个字中做出。我们兄弟受母亲的性格影响,好处也正在于倔强。



  • 男儿自立,必须有倔强之气。



曾 国藩的倔强性格,在他最初出来带兵的时候表现得最为突出。他是以在籍侍郎的身份出来带兵的,没有地盘,无粮饷,事事仰给于人。偏偏曾国藩又是勇于任事之 人,因而与地方官员势同水火,屡屡发生冲突。加上初期与太平军作战屡战屡败,更是使他的处境雪上加霜。然而在与官场政敌和与太平天国的双重博斗中,他却养 成了一种咬牙立志、不肯认输的脾气。他自己将之称之为“打脱牙,和血吞”的“挺”字功夫。他曾经夫子自道说:

李申夫曾经说我与人怄气从来不说出,而是特别能忍耐,一步步寻求自强之道,因而引用俗话说:好汉打掉了牙,和血吞下去。这正是我咬牙立志的诀窍。我曾经被京城中的权贵所唾骂,被长沙官场所唾骂,被江西官场所唾骂,也经历过岳州之败,靖港之败,湖口之败,被打掉牙的时候多了,没有一次不是连血一块吞下去的。

又说:

我办理湘军水师,一败于靖港,再败于湖口,将士们都愿意离开水师而做陆军。但我咬紧牙关将局面维持了下来,而后终于有了重振的机会。安庆没有合围的时候,祁门大营十分危急,黄德的局势也很危险,大家都建议我撤安庆之围,以支援祁门、黄德,但我咬紧牙关不撤,终于打下了安庆。至于南京是一个方圆百里的大城,易守难攻,我却以孤军将南京围了起来,大家都说恐怕要蹈前面清军的覆辙了,然而咬着牙坚持下来,最后竟然立了大功。

他甚至还说自己要写一部“挺经”,将自己的体会教给后人。对于自己的倔强,曾国藩十分自负。有一次当他的心腹幕僚赵烈文说起李鸿章“遇到事机不顺的时候,不能一定像曾国藩一样坚韧的时候,曾国藩立即非常得意地说:我死了以后,应当谥为文韧公,这是邵位西说的,足下知道吗?



  • 倔强并不是刚愎自用



所以曾国藩强调,“强”字必须以“明”字为基础。他在给弟弟的信中说:

“强”字原是美德,我以前寄信也说“明强”二字断不可少。只是“强”字须从“明”字做出,然后才会有始有终。如果全不明白,一味蛮横,等到别人折之以道理,证之以后效,又重新俯首认输,这就是前强而后弱。这就是京城所说的瞎闹。

担 当大事,全在于明、强这两个字。所有的事,没有志气和刚强都是无法成功的。即使是修身齐家,也必须以明强为根本。“难禁风浪”这四个字说得很好,我把它再 送给你。自古以来,豪杰之士都以这四个字为大忌。我家祖父教人,也以“懦弱无刚”四个字为大耻。所以男儿自立于世,一定要有倔强之气。



  • “强”字须从“明”字做出



什么是“明”?就是要明于事,明于理,明于人,明于己。曾国藩曾经有过一段十分精辟的论述:

办事要以明字为第一要义。明有两种,一种叫高明,一种叫精明。同一个地方,只有登上高山的人才看得遥远,只有登上城墙的人才觉得空旷,这就是高明。同一件东西,凭空估计不如用秤称的准确,用眼打量不如用尺量的准确,这就是精明。

以明为基础的倔强,其实就是一种定见,是一种看清问题后坚持到底的决心。李瀚章曾经说曾国藩“过人之处,在于坚持定见,不为浮议所摇。”曾国藩自己也常说,办事“不要固执己见,也不要轻易听从别人的言论。必须确实看清了利害所在,尔后再放弃自己的意见。”所以倔强的表现之一就是要有定见。



  • 看清问题之后要坚持到底



同时,倔强与谦退也不是矛盾的。曾国藩说:

天地之道,刚柔互用,不可偏废。太柔了则成不事,太刚了则就会折断。刚并不是指的蛮横,敢于进取而已;柔并不是指的卑弱,虚心谦让而已。



  • 天地之道,刚柔互用,不可偏废



他还说:

知道自己的过失,就立即自己承认,自己改正,而没有丝毫的掩饰之心,这是最难的事情。豪杰之所以成为豪杰,圣贤之所以成为圣贤,就是在这些地方光明磊落,超出常人。

的确,勇于承认错误并改正错误,同样也需要倔强之气,同样是豪杰的作为。




曾国藩的为官之道,说白了,就是一种智慧。而这种智慧,主要是来自于中国传 统文化。曾国藩确实是一个悟透了中国文化的人,他的为人行事,也无不体现出中国文化的影响。他的以天下为己任,明显体现出儒生的进取精神;他的“花未全开 月未圆”、“晚场善退”,明显体现出道家的影响;他的治乱世用重典,学的是所谓的“申商之术”,他的俭以奉身、勤以治事,则明显体现出的是墨家的影响。 儒、道、法、墨四家的思想,在曾国藩身上都得到了充分的体现。

从文化的角度来说,曾国藩就是传统文化的化身。他非常善于将性理之学与经世致用结合贯通,他讲究人生理想, 讲求精神境界,讲求道德修养与自我完善,他的反省内求,日新又新,磨砺意志,勤俭刻苦,力戒虚骄,以恒为本等修身原则,在很大程度上体现了中华民族的优秀 美德。他以一介儒生,居然将燃烧了大半个中国的太平天国革命的烈火给扑灭了下去,这其中自然也有他成功的经验。曾国藩是一个理学家,他有深厚的传统文化底 蕴,但又绝对不是一个书呆子。毛泽东曾经说:“吾于近人,独服曾国藩。观其收拾洪杨一役,完美无缺,设使易以他人,岂能若是?”陈毅元帅也说过:“曾国藩 用兵很有一套,在军事上很值得研究。”其实何止是军事,曾国藩为官一生,他的“以天下为己任”的追求(当然他的“天下”毕竟是清王朝的“天下”),他的忧 患意识,他的打脱牙和血吞的刚毅精神,他对子弟、子女的教育方法,他在逆境之中所表现出来的政治智慧,都是很值得研究的。尤其是曾国藩是一个很善于概括的 人,他在不经意中留下的许多话,充满了哲理性,可以说既是他为官一生的经验总结,也体现了传统文化的深厚之所在。这些话,完全是可以当作格言来读的。毛泽 东在论述如何继承传统时提出了一条基本的原则,就是“取其精华,弃其糟粕”。对于曾国藩,我们同样可以采取这样的方法。

曾国藩是一个活生 生的人,他有他的局限,他有他的缺点。他的彷徨,他的郁闷,他的内心矛盾,他的焦虑紧张,都与普通人没有什么区别。他三次自杀,他屡战屡败,他是在不他断 地与自我作战的历程中一步步地完成他的“功业”的。他的成功,从根本上来说,还是出于那坚韧不拔的精神。梁启超在评价曾国藩时曾有过一段非常精譬的话。我 们就以这段话,来为我们的这个专题打一个结。梁启超说:

曾国藩并没有超群绝伦的才华。在当时的著名人物中,他可以说是最不聪明的一个。他 的一生,也一直在逆境之中,然而他立德、立功、立言,达到了古人所说的三不朽的境界,他的成就震古烁今,没有一个人能跟他,这是什么原因呢?他一生得力的 地方,在于立志自拔于流俗,而困而知,而勉而行,历尽百千险阻而不屈服;他不求近效,铢积寸累,受之以虚,将之以勤,植之以刚,贞之以恒,帅之以诚,勇猛 精进,坚苦卓绝,如此而已!如此而已!

Thursday, 30 April 2009

@, in PHP

To supresses error reporting.

Sometmes functions are called with "@' in front of them -
E.g. $somevar = @mail($to,$subject,$msg);

Friday, 24 April 2009

HOWTO: firefox cannot save username & password on hotmail.com

If it just happens on that site try clearing the hotmail cookies. Select Tools > Options > Privacy - In the Cookies section click "Show Cookies..." to access the option for removing cookies.

If you can not use the "remember me" option on other sites as well, a likely cause is the file that stores cookies is corrupt. To test this close Firefox, go to your profile folder and rename cookies.sqlite to cookies.tmp
Restart Firefox, log into those sites and then see if it remembers the logins.

Also make sure that cookies are being accepted and not being deleted when Firefox closes. Go to Tools > Options > Privacy, on that dialog you can make sure that cookies are being accepted, then in the private data section make sure that Firefox is not set to delete cookies when Firefox closes. Also click on the Exceptions button in the cookies section to make sure cookies from those sites are not being blocked.

Next check any internet security software to make sure it is not blocking or deleting cookies. Some internet security software has privacy options that can block or delete cookies.

Monday, 20 April 2009

My MAC applications

Large files:
xcode developer
mactex
ilife
iwork
Photoshop cs4 trial
Dreamweaver cs4 trial

Plugins:
x11-2.3.2.1
NTFS-3g (http://www.ntfs-3g.org/)

Server:
pdt-all-in-one-macosx-carbon-2.0.0GA.tar.gz
MAMP_1.7.2
Joomla_1.5.10-Stable-Full_Package

Others:
Adobe reader
Adobe flash player
Adium_1.3.3
Calaboration_1.0.2 (iCal sync with Google Calendar)
Cyperduck
Evernote
ffmpegX (video converter, 3gp to mp4/avi etc.)
Fink
Firefox
ID3Mod2_V49
JavaForMacosx10.5
Lyx
Macports
MacVim
Messenger (Microsoft)
Openoffice
Picasamac
Realplayer
Speed download (buy)
Textmate (buy)
TheUnarchiver
VLC
Vuze
Xee

Sunday, 19 April 2009

MAC: X11 on Mac 10.5.6

The X11 download on apple.com is for Panther 'only'. So it will never be installed successfully. You will get the error prompt like "You cannot install X11 on this volume. A newer version of this software already exists on this volume."

Your best bet for staying current with bugfixes is to install the latest X11 package (at the moment X11 2.3.0) released by the Xquartz project, which contains Xquartz-1.4.2-apple5, and includes many fixes outside of Xquartz. Afterwards, just install the latest binary versions of Xquartz released periodically as fixes are being made. To see the complete list of changes in release X11-2.3.0, please go here.

After this installation, run the x11.app from /Application/Utilities/, then run terminal from the X11 Application menu. In this xterm based terminal you can run those x11 applications installed by macports or fink, also run those like gimp which need x11 environment.

For example:
1) run gedit
gedit
2) run gimp
open -a gimp or open /Applications/Gimp.app

Saturday, 18 April 2009

MAC: startup item

1. Accounts settings in System Preferences. There is a tab called "Login Items".

2. All the system's start up items (as opposed to login items) should be located in a folder named StartupItems in your hard drive's /Library.

Friday, 17 April 2009

Mac 10.5.6 on PC (ipc osx86 10.5.6 on Dell dimension 5150)

Spec:
========
Dell Dimension 5150:
DIMENSION 5150 PENTIUM D 805 DUAL CORE
AUDIO INTEGRATED HDA 7.1 DOLBY DIGITAL C
GRAPHICS CARD ATI RADEON X300 SE 128MB H
INTEL PRO/100 VE NETWORK CONNECTION (ETHERNET)


ISO:
========
IPC OSX86 10.5.6 PPF5 FINAL
Burn it using the lowest speed is important.
The supported hardware list: http://www.ihackintosh.com/2009/02/ipc-osx86-1056-final-ppf5-complete-driver-list/

Intallation options:
========
try not to select extra driver and patches, which can be installed easily after successful installation.

To remove kext cache in 10.5.6 or later just run:
sudo rm -rf /System/Library/Extensions.mkext

Kernel: 9.5 voodoo (the default kernel 9.6 will bring black screen; After upgrade to 10.5.7, the voodoo kernel need to be reinstalled)
ethernet driver: intel pro/100 ve (tips for your particular device: modifying Info.plist)
audio: the patch or driver coming with this iso doesn't work for my Dell Dimension 5150, the available driver is here.
video: typing '-x "Graphics Mode"="1280x1024x32@85" as boot flag to change the screen resolution. More details are here.
Alternatively, using ATI 9700 driver as the driver for x300, this will remove small square around mouse, but still no QE support in Leopard. + ATI Radeon x300 PCI-Ex Callisto v.008 to change the screen resolution.

patch:
seatbelt (to solve mounting dmg file kernel panic issue)
shutdown (seems not work properly)
"NTFS-3g (http://www.ntfs-3g.org/)" can be installed later as a software

Sleep problem: (I did both together, so far don't know which fixed this problem. This happened when I upgrade to 10.5.7)
1) try to remove useless ATI and Gefore kext from /System/Library/Extensions.
2) GMA driver ( I removed the ATI VGA card, because it doesn't support Quartz Extreme. )

Softwares:
Here

Monday, 13 April 2009

BUG: f-spot uploading photos to flickr

F-spot will suspend when uploading photos to flickr.

Fix:
===========
sudo ifconfig wlan0 mtu 1450
then try to upload again.
Where MTU = Maximum transmission unit

====================
TWEAKING MTU SETTINGS


As you become more experienced with Linux you maybe want to fine tune your internet connection settings . . . . .

The default of 1460 bytes per packet can vary with the connection, distro or hardware you have.
On some systems you can have better results with low MTU settings and some with high MTU settings, you will just have to see and try what works best for you.

Here is how you can change the MTU settings for your network interface:

First have a look on how the settings are now:

CODE
# ifconfig eth0

And you will get something similar to this:

QUOTE = ifconfig
eth0 Link encap:Ethernet HWaddr 00:07:95:XX:XX:59
inet addr:10.0.0.152 Bcast:10.0.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:29861 errors:0 dropped:0 overruns:0 frame:0
TX packets:26784 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6378900 (6.0 Mb) TX bytes:2889677 (2.7 Mb)
Interrupt:11 Base address:0xd400


Now we will test another setting ( MTU 1460 ):
CODE
# ifconfig eth0 mtu 1460

And see if you get better results . . . No ? Well, try again
CODE
# ifconfig eth0 mtu 1300

or

CODE
# ifconfig eth0 mtu 1200


Now imagine you found the value you want to make permanent: MTU 1250 , pull up the file "/etc/sysconfig/network-scripts/ifcfg-eth0" and make it read:

QUOTE = /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
MTU=1250
BOOTPROTO=dhcp
NETMASK=255.255.255.0
ONBOOT=yes
METRIC=10


After the next boot the MTU settings will be on 1250

dual boot configuration within XP

When Linux or Mac os86 installed on the disk, where Windows has been installed before, some time it's not set dual boot by defalt. This is the fix, only using the funtion coming along with xp.

Fix:
====================
in Dos, type:
diskpart
list disk
select disk 0
list part
select part 3 // could be different depending on your partitions
active
exit
======================

Saturday, 4 April 2009

HOWTO: gtalk in pidgin

Force old (port 5223) SSL: Checked
Allow plaintext auth over unencrypted streams: Un-Checked
Connect Port: 443
Connect Server: talk.google.com
Proxy type: Use Global Proxy Settings

Tuesday, 31 March 2009

HOWTO: outer DIV can not cover element with FLOAT style

Normally, all the content in the outer DIV will inherit the css styles from it, such as background.
But when the float style is used for inner tag, this part of content may come out of the outer DIV. Also, if you are using Firebug in Firefox, when your mouse is hovering on the outer DIV, the browser then will not cover all the parts inside the DIV.

All are because the FLOAT style.


In this article, Simple Clearing of Floats, 4 methods are intorduced to fix this 'bug', which appears in Firefox, Chrome, while not in IE, this did supprise me. Normally IE is more buggy in my opinion.

My favorite method is to append the outer style with 'overflow:auto'. Then, the floated part will be covered by the outer DIV, no matter the background issue or the selection problem in Firebug.


See also: (other conflicts with some attributes)
text-align for normal div tag ( this will not work 100% in table with align attribute, this will be ignored) and align attribute for table: here

style of marquee in div ( style of div will not work 100%)

Sunday, 29 March 2009

40 Beautiful PSD Slicing Websites

From: http://designmovesme.com/40-beautiful-slicing-websites/

March 27, 2009

Correctly slicing a PSD into XHTML & CSS is an art that takes time to master. If development and coding is not your thing, there are companies that will take your web design file and bring it to life. There are several factors to consider when choosing a PSD slicing company, and one of them is the design of their own site. If their design appears to be low quality, what is their code going to be like? In this article, I’ve listed 40 PSD slicing companies with beautifully designed sites.

40 Beautiful PSD Slicing Websites

Nifty XHTML

PSD to HTML

MediaGirl

Markup4U

markmeup

HTML Burger

Feather Code

The Designer’s Chop Shop

CSS Rockstars

CSS Ninjas

CMSthemer

The Choppr

247xhtml

9xhtml

YummyCSS

XHTML Team

XHTML Slicer

XHTML Slice

xHTML Master

XHTMLized

XHTMLiT

WPfromPSD

WPCoder

We Do Markup

W3 Markup

ThemeSlice

SnobbySlice

Slice’r'us

Slice&Go

RetroXHTML

QualityXHTML

PSD to WordPress

psdtolife

PSD to Any

PsdSlicing

Psdslicer

PSDgator

PSD2HTML

PixelCrayons

Outline to Design

Tuesday, 24 March 2009

Javascipt onload confclits

Normally there are two ways to run javascipt when html page is loaded:

  1. window.onload=INLINE_FUNCTION_NAME, is normally used to make specific javascript runnable when the html document is loaded.
  2. general javascript function, like "function FUNCTION_NAME() {... }; FUNCTION_NAME();"
The problem of method 1) is that one page only can have one onload function. there are always conflicts in Joomla or drupal which use a lot of javascript for functions.

The problem of method 2) is that when the function started, maybe the html document is not fully loaded.

FIX
===============================
To solve this, 'domready' from mootools helps a lot and improves the loading speed very much. See domready vs load.
Insert mootool.js (optional for Joomla, But required for local html test)
---------------------------------------------------
<script type="text/javascript" src="mootools.js">
</script>

---------------------------------------------------
You should go to mootools.net to download the latest mootools.js.

My photo
London, United Kingdom
twitter.com/zhengxin

Facebook & Twitter