Friday, May 13, 2011

网上问诊单

     首先声明,如有以下十一种人之一者请不要填写:

1、不信中�的人 .

2、���有疑�的人 .

3、自以�是的人 , 又要吃西�又要吃中�的人 .

4、懂一���中� , ����方指指��的人 .

5、拿到�方 , 不按�吃的人 .

6、拿到�方 , 到了�房抓� , ����此方太� , ��不行 , 要加那��等 , 立刻就�定不拿�了 , 或回������方�� , 此�笨蛋不要治 , �於��草型 , 完全不知道自己在作什� . ��不是�� , 他干���治� , �也信 , �在有�笨拙 .

7、不���建�的人 , 以�吃�就好了 , 比如: 肝硬化是由喝酒引起 , 吃中�後 , 仍然不戒酒 , 如何�好呢?

8、重��同一��的人 , 表示他不相信你了 . 不可治 . (我在看病�都ㄧ定��解�病情�病人�, 但是再次���病人居然�� , 吃��是�什�? 你��不�人 , 不相信就不要�看中� , 何必如此害自己呢?)

9、一有重病 , 只要人�什�好 , 就立刻去做 , �果�吃一大堆� , 此�有疾病�投�的人不要治 .

10、平�吃一大推不必要的�或�他命的人 , 生病��看�� , �身��一�囊 , ��求����何�可吃 , 何�不可吃 , ��人除了本身疾病外 , 又自己增添�多本�根本不存在的����生 , 千�不要看 .

11、吃药有效 , 不坚�吃的人

以上十一�人 , 奉�所有中�� , 千�不要去治 , 此�病人你就算是治好也不�感�你 , 他���你是蒙到的 , 治不好就都是你的� , �不�去���什�自己�得到此病 , �人�什��有此病 , 只�怪�生不好 . 但是如果他�是去看西�� , �度就一百八十度��了 , 完全�西�的� , 就像一�口袋中的�物一� , 主人�食什�就吃什� , 乖巧的要死 , 就算�果是死於西�之手 , 他�也不�去怪罪西� , 家����在抬病患��出院� , 列�向西�致�意的 ..

中医网上诊病,失去了四诊的望、闻、切三诊,为准确诊断,有效治疗,请问病患者详细填写下面内容(连同注意、说明全部复制,以便查阅),有则选择,无则删除。

1、请详细填写下列条目——

性别:

生辰:(公元)年月日时

籍贯: 

婚否:

职业:

身高:

体重: 

腰围:

肤色:

主要症状:

发病经过:

治疗经过(尽量详细一点):

西医病名:

是否长期用过激素:

是否大量用过消炎药:

是否做过内脏手术:

2、请选择下列部位身体状态(将所无状态删除)——

脉(左:快,慢,有力,无力,粗,细,浮,沉,松,紧,停顿,时快时慢)

(右:快,慢,有力,无力,粗,细,浮,沉,松,紧,停顿,时快时慢)

面(红,黄,白,黑,青):

眼(瞳仁色灰;白睛色青,色黄;有血丝,有瘀斑,有隆起,有黑点,眼下色青,眼皮肿):

舌(肥大,瘦,尖红,滑湿,有齿痕,干,苔腻,黄苔,白苔,中有裂纹,舌下筋脉曲张):

齿(整齐,龃龉,有缝,颜色,大,长,齿痛,活动,有斑,无力)

耳(鸣,聋,痒,痛,流水,左,右):

目(干涩,昏花,眩晕,流泪,痛,痒,左,右):

口(苦,干,酸,无味,溃疡,流涎):

鼻(不通,流涕,凉,热,左孔,右孔):

咽(干,痛,痒,吞咽困难):

胸(满,闷,胀,痛,骨痛,热,凉):

乳(胀,痛,增生,肿块,左,右):

胁(胀,痛,热,凉,左,右):

腹(胀,满,痛,肿,硬):

外阴(肿,胀,痛,热,凉,如烧,坠胀,挛缩):

心(烦,悸,慌,紧,痛,凉,热,跳快):

心下(满,闷,堵,胀,烧):

胃(胀,痛,满,酸,凉,热):

头(痛,晕,麻,木,昏,沉重):

项(僵,痛,酸重,不能转动):

肩(痛,凝,沉重,萎缩,凉,热,左,右):

臂(痛,麻,木,胀,酸,颤,凉,热,左,右):

手(凉,热,干,出汗,麻,颤,指痛,甲痛,萎缩,左,右):

背(痛,酸,重,胀,凉,热,左,右):

腰(酸,重,痛,胀,凉,热,左,右,中间):

腿(痛,酸,重,麻,木,肿,胀,僵,软,凉,热,左,右,内侧,外侧):

膝(痛,肿,凉,热,软,骨痛,无力,左,右):

足(痛,胀,麻,木,软,凉,热,左,右):

跟(痛,凉,热,麻,胀,左,右):

足趾(麻,痛,胀,凉,热,左,右,部位):

3、请选择与下列项目对应的身体状况(必选)——

饮(多,少,喜凉,喜热,喜温,喜酸,喜辣,喜苦,喜咸,喜甜):

食(多,少,喜米,喜面,喜粥,喜油腻,厌油腻):

睡眠(多,少,失眠,多睡,多梦,易醒):

大便(干,湿,粘,便秘,失禁,色黑,色黄,色白,溏泻,一日一次,一日数次,数日一次):

小便(多,少,不畅,不禁,色黄,色白,次数多,次数少):

房事(有,无,多,少,阳亢,阳痿,早泄,手淫,曾堕胎):

月经(先期,后期,多,少,暗,红,淡,浓稠,清稀,有血块,痛经,漏泻):

白带(有,无,多,少,白,黄,腥,臭):

4、请回答身体经常有如下哪些症状——

(发热,出汗,怕冷,怕风,怕热,哮,喘,咳,气短,有痰,打嗝,呕逆,恶心,腹泻,便血,尿血,吐血,鼻血,牙龈出血,烦躁,肢体震颤,肢体僵硬,乏力倦怠,头重脚轻,少气懒言,嗜卧,厌卧,半身不遂,时冷时热,长期低烧,淋巴节肿大,胸骨刺痛,站立觉累,静脉曲张,骨发空,骨发热,梦遗,早泄,阳痿,不孕)

5、七情何者为重——

(喜悦,愤怒,忧郁,思虑,悲伤,恐惧,惊悸)

如何知道你的身体是否健康,有以下五通标准。

饮食通:不偏食,有良好的嗅觉、味觉及食觉。口润不渴,亦可及时补充水分。

休息通:休息每日在七八个小时左右,午时有一小时的午睡时间,夜有梦但不多,睡眠深。醒后精力充沛。

大小便通:大小便正常,每日晨起有一次大便,不干不稀,通畅,五分钟可解决问题。小便清,无泡沫,无杂质。小便与饮水量成正比。

体力通:体力充沛,能够胜任一般劳动,不感到疲劳,过重体力劳动,半小时左右能休息过来

阳气通:身体温暧,手足温暧,身不畏寒,无上火现象,有正常的性能力。     

公布秘方,比一比,看谁的【生肌散】效果更好?(zhuanzai)

公布秘方,这是我用了十多年的生肌散,效果很好,公开给大家,欢迎各位拿秘方来比较效果高低!

人中白(炙)30g  象皮(砂炒泡)50g  乳香30g  滑石粉30g  血竭30g  白芨30g

共研细末,撒于创口处

主治:一切伤口、溃疡,久不愈合,效神速!


Thursday, May 05, 2011

肥胖的原因与减肥

    人体肥胖的原因,一是身体的垃圾不能及时清理,堆集在细胞和组织空隙,或与人体脂肪同处,垃圾和它所吸收的水分增加了人的体重,并使人的精神倦怠,气色黄浊。本质的原因则是年龄大或疾病造成的脏腑功能减弱,新成代谢不足及内分泌不调所引起;二是饮食不节,营养过剩,又因阳气不足,不能将多余的营养转化为动能,或转化为元精收藏(纳气归肾或曰潜阳)。反而使之化为脂肪存贮于人体组织间隙或体内空处。

减肥的方法一般有节食、运动和药物治疗等。节食对营养过剩引起的肥胖有一定作用,但对新成代谢不足或内分泌不调引起的肥胖效果不佳,且节食不能太过,否则影响人体的正常能量供给;运动有助于过剩营养的消耗并排除一些体内垃圾,但运动同时也促进代谢垃圾的产生,人如果阳气不足,运动消耗的阳气不能及时恢复和补充,运动增加的垃圾不能及时排除,反而使身体更差而益增肥胖。所以运动减肥只能针对内体较好而缺乏运动的人。但不管运动或节食,都很辛苦,大多数人都不能坚持,而且坚持了也不一定见效,所以人们更期望药物减肥。目前,国内外药物减肥的方法很多。一是厌食法,服用一些药物,让人不想吃东西,产生减肥的作用。肥是减了但对人身体的破坏很大,可谓本未倒置,得不偿失。且一旦不服药,肥胖又会回来。二是脱水法或曰排毒法。即服用具有泄泻作用的药物,使人增加排泄而减重。实际上只是排水,即减去了人体细胞和组织包括垃圾与脂肪的水分,毒(拉圾)和脂肪并没少,却会造成人正常生理需要的水分也不能满足,而影响了人的身体健康。停药后,垃圾与脂肪的水分得到补充,重量又回来了。且因人的身体变弱,会产生更多的垃圾和脂肪,人的体重迅速反弹,并将逐渐超过服药之前。

    正确的减肥方法只有一种,即保护和提升人体的阳气(即元气)。人体的阳气增加后,排毒(垃圾)功能和利用营养能力增强,产生和积聚的垃圾与脂肪少,并能排除积存的体内垃圾和燃烧利用体内脂肪,故能减肥。现代人普遍阳气不足。原因包括:夜生活过度,饮酒过度,纵情过度,焦虑过大,喜食冷饮,动辄服用清热药物和抗生素(寒性)等等。只有尽量克服以上毛病,才能保护好自身阳气。提升人体阳气的方法有:1、内体好而运动少的人可选择运动减肥(运动可增加人的阳气水平)。2、药物调节人体功能,扶助阳气,使清气能升,浊气能降。药方:

    党参15克、白术15克、干姜15克、甘草10克、肉桂8克、山楂肉15克。煎汤服用。(因病引起的肥胖,当先解决病根,再谈减肥。)

    服药后出现头晕,身酸无力,排便增加等等不舒服状,都是正常的。是在排垃圾,排完就好了。到时你发现你很容易的就这样减了肥,没有付作用不说,而且还美了容,健了身。感到身轻体健、饮食有味、睡眠加深、气色变好、工作精力增强、心情倍加愉悦。

    赞曰:莫道减肥难,岐路千万般;一旦方法对,玉环变飞燕。 

    补充说明:本减肥方可以长期吃,有双向调节的作用,可使胖者变瘦,瘦者变胖;有肥减肥,无肥强身。开始时排浅层毒素,减肥速度较快。但过后一段时间,可能反而会有增加体重或体积的现象,但不必惊奇,这是深层垃圾吸收水分造成的。继续吃药,垃圾就会排出,从而达到真正减肥而不反弹的目的。

Wednesday, April 27, 2011

办公室养生之――松肩(脾胃虚弱,面色晦暗者请进)


办公室养生之——松肩(脾胃虚弱,面色晦暗者请进)
  
   
  
  不经常运动的人,特别是办公室工作人员,因为用电脑的缘故,双肩容易紧张而不能松沉,乃至影响到颈椎和整个后背,好像背着重物。从外表看来,这类人双肩习惯性上耸,即所谓的“架肩”,长此下去脾胃之气容易积滞,进而面色苍白,四肢瘦弱,抑或是虚胖,体力不佳,从中医角度来看,这些均是脾胃虚弱,气机壅滞所导致的。因为双肩为中焦气血流通的要津,明代李�的《医学入门》中保养导引的方法中“开关法”和“起脾法”均是用松肩的方法以调理脾胃之气。一般人上肢用力往往力量锁在肩关节而透不到双手,但是传统锻炼方法则要求松肩,力量在肩关节不停留直接贯通到双手,如太极拳、形意拳、八卦掌等均有如此要求。下面为大家介绍一种锻炼双肩的方法,打通肩部的滞涩,恢复气血流通。
  
   
  
  1预备式:坐在椅子上或放松站立均可,两手交叉抱胸。
  
  2 摇肩:左右转圈摇摆,肘尖的轨迹呈“∞”字形,大约100次。
  
  3 转肩:两手自然下垂,手指自然伸直,肩膀用力由后向前转圈(后—上—前—下—后);之后由前向后转圈,各100次。要领:动作缓慢柔和,手臂放松,垂直下坠,好像挂在肩膀上的钟摆一样,丝毫不着力。
  
  4 开肩:本动作是在走路过程中完成的,走路时双手随步伐前后摆动,像解放军叔叔的“齐步走”。手的摆动的水平高度在肚脐和胸之间,大约在中脘、上脘的位置。要领:步伐不要太快,要像散步一样放松,手臂像钟摆一样摆动,手指自然伸直,全身放松。
  
  以上动作1、2、3可连续做,每次大约半小时,适合于办公室工作人员疲劳时缓解压力,放松身心。动作4可在上下班走路时做,每次最好持续半小时。
  
   
  
  动作效应:
  
  锻炼一般在10分钟后就会感觉肩关节周围发热,30分钟后会感到整个背部包括颈椎,都会有温热的感觉,说明通过运动阳经气血通畅,颈椎、肩周、失眠、头痛等疾病会得到缓解。在做动作半小时后,手指会有温暖而柔软的感觉,说明手三阴经逐渐通畅,心、肺、脑血管疾病都会有所减轻。
  
  本方法简单,但是功效卓著,长期锻炼可以增进食欲,健壮脾胃,增强体格。我们看看为什么参过军的人体质都比一般人要好?他们面色红润、声音洪亮、精神面貌和体力都是非常棒!包括大学生军训,我的一个同班同学军训后连晕车都治好了。其中一个重要的原因,那就是天天齐步走,暗合妙道,松开双肩,脾胃之气调畅,中焦脾胃是后天之本,它一旦强壮,自然有病祛病无病强身了。晕车本是脾胃病,用这种方法治疗自然会收到良好的效果。
  
   
  
  小建议:办公室工作人员,精神压力比较大,工作长时期不活动,难免心情郁闷,进而影响脾胃功能,食欲不振,消化不良,面色萎黄,睡眠不香。遇到这种情况,您可以在饭前饭后、睡觉之前花十分钟做一下松肩,使气血运行通畅,如果持之以恒,食欲逐渐就会旺盛,睡眠自然就会香甜。

Friday, February 18, 2011

Unknown record property / related component "profile" on "sfGuardUser"

If you got this error:

500 | Internal Server Error | Doctrine_Record_UnknownPropertyException Unknown record property / related component "user" on "sfGuardUserProfile"

You are lucky, this error bothered me for a long time, but now you know the answer!

user_id in Profile must be interger(4)

the important part is (4)

if you don't have it in the schema, you will get the error above.

example:

sfGuardUserProfile:   columns:     user_id: {type: integer(4)}     email: {type: string(100), email: true}     favorite_color: {type: string(100)}   indexes:     user_id_fk_idx:       fields: [user_id]   relations:     User:       class: sfGuardUser       local: user_id       foreign: id       type: one       foreignType: one       foreignAlias: Profile


keywords:

symfony 1.4 sfGuardUser Profile sfDoctrineGuardPlugin


--
Kindest Regards,

Zhen Sun

Tuesday, November 16, 2010

李子暘:“通胀”这把火玩不得

诱导大量错误投资,周期性地制造出经济危机,导致社会财富的巨额浪费,甚至酿成政治危机,这才是通胀最大的社会危害。
  李子暘
  经济学者,铅笔经济研究社理事
  最近通胀的话题很热闹,但舆论中关于通胀的常识性谬误很多,这里只拣两个最重要的来说说。
  谬误一:要用CPI(消费者物价指数)来衡量是否有通胀,通胀有多少。
  这个说法的错误有两层。第一层:CPI是可任意制定的指数。CPI,是一些消费品的价格加总计算。这些商品价格上涨了,就说CPI上涨了,还会煞有介事地计算出是百分之几点几。这些商品价格没有上涨,就说CPI没变,没有通胀。显然,选择哪些商品列入CPI的清单,功夫很深。想掩盖通胀,只要选择那些价格很少或没有变化的商品。至于涨价很凶的商品,只要将其排除到CPI以外即可。比如房价,虽然是许多居民支出中的大头,但从来就不列入CPI。
  政府的第二招是:就算列入CPI的商品价格上涨,也可以通过价格管制来应对。CPI当然不会按照黑市价格来计算。因此,如果某商品被列入CPI清单,企业家投资时一定要谨慎。该商品的价格很可能会受到政府管制。投资的企业家,分分钟可能被政府和公众指为乱涨价的奸商,成为通胀的替罪羊。
  即使CPI的计算是完备和公正的,能如实反映商品和服务的价格变化,它也不是衡量通胀的好指标。
  通货膨胀,从字面含义和经济原理上看,都是指货币数量增加,并没有物价上涨的含义。无论物价是否上涨,只要流通中的货币量增加了,就发生了通胀。用物价是否上涨来衡量是否有通胀,就好像用是否得了高血压、糖尿病来衡量一个人是否需要减肥。不是所有的肥胖者都必定得了高血压、糖尿病,但肥胖者必定体重超标。有体重一个指标就够了。
  同样,衡量通胀是否存在,只需看货币量是否增加,而不能等到物价上涨再来谈论通胀。等到物价上涨,再设法抑制通胀,为时已晚。
  谬误二:通胀的危害是造成物价上涨。
  从政府决策层,到经济学家和公众,都对此深信不疑。相应的政策后果就是:如果通胀造成的物价上涨没有超出社会容忍度,那为了刺激经济增长,不妨玩玩通胀。
  甚至还有经济学家主张提高通胀的社会容忍度,简直是一派胡言!
  如果通胀增发的货币在瞬间到达每个人,那就只是币值改变而已,但通胀的真实过程不是这样的。
  通胀增发出来的货币,是通过某个入口进入经济体的。现在,主要是通过银行贷款这个入口。于是,有机会从银行贷款的人,就先拿到了货币。而挣工资的广大民众,则较晚拿到增发的货币,甚至根本拿不到。那些先拿到货币的人自然好处多多。他们就像是可以合法使用伪钞的人。通胀就是把别人的财富偷偷地转移到这些人手中。
  可见,通胀是在全社会范围内公然进行的掠夺和财富再分配,而且是从大众向少数人转移财富,使贫者愈贫,富者愈富。这是通胀真正的社会危害,远比物价上涨恶劣得多。
  除此之外,通胀往往通过政府人为压低利率进行。压低了利率,银行就可以发放更多的贷款,就会有更多的货币进入流通。对普通人来说,银行升降几个百分点的利率,影响不大。但对产业投资来说,那几个百分点的利率变化是很关键的。
  投资10亿的项目,利率升降1%,就意味着每年成本增减1000万。利率的高低,直接决定了这个项目是合算还是不合算。人为压低利率,许多原本不合算的项目就会变得合算。这些项目所需要的各种原料能源供应,还会诱使一大批上下游项目投资上马。
  但低于市场利率的低利率是不可持续的。增发的货币,经过一段时间,会通过各种渠道,流到更多的社会成员手中,推动物价的普遍上涨,并形成政治压力。
  政治压力之下,政府只能选择提高银行利率,减少贷款量,减少流通中的货币量。这时,两难局面就出现了。
  要么,继续实行通胀政策,结果是物价飞涨,甚至民不聊生;要么,停止通胀政策,结果是大量错误的投资暴露出来,许多企业破产,员工失业,这就是经济危机和经济萧条。
  诱导大量错误投资,周期性地制造出经济危机,导致社会财富的巨额浪费,甚至酿成政治危机,这才是通胀最大的社会危害。
  那些以为通胀只意味着物价上涨的人,认识不到通胀真正的危害,就像小孩子不懂火的厉害一样。于是,他们也就像小孩玩火一样玩通胀。形容他们处境的最好比喻就是:盲人骑瞎马,夜半临深渊。
  可叹的是,他们的愚蠢,将由全体社会成员负责。大声疾呼让他们立即停止玩火,难道不是我们必须要做的事情吗?

Saturday, September 11, 2010

custom form formatter/decorators

symfony 1.4 form

custom form formatter/decorators

class xxxForm extends BaseXxxForm
{
  public function configure()
  {
    $myDecorator = new myListFormDecorator($this->getWidgetSchema());
    $this->widgetSchema->addFormFormatter('custom', $myDecorator);
    $this->widgetSchema->setFormFormatterName('custom');
  }
}

class myListFormDecorator extends sfWidgetFormSchemaFormatter {
  protected
    $rowFormat = "
      %hidden_fields% %field% %help%
    ",
    $helpFormat = '<div class="help">%help%</div>',
    $errorRowFormat = "%error%",
    $errorListFormatInARow = " ",
    $errorRowFormatInARow = " ",
    $namedErrorRowFormatInARow = " ",
    $decoratorFormat = "%content%";
}// decorator class

Friday, July 23, 2010

HTTPS and SSL Setup Step-by-Step Guide « Nurul Islam

HTTPS and SSL Setup Step-by-Step Guide « Nurul Islam

(attention: only restart apache when requested.)

I have tried to enable SSL on localhost . I found a solution on wampserver forum . You can try this :)

****************
****Step1****** -> Create SSL Certificate and Key
****************

1a) Open the DOS command window and change directory to bin directory of wamp apache directory by using the DOS command without quotes: “cd /d c:\” and then “cd wamp\bin\apache\apache2.2.8\bin”. apache2.2.8 should be changed to what apache folder your wamp server has.

After done, the DOS prompt should look like: C:\wamp\bin\apache\apache2.2.8\bin>

1b) Create a server key with 1024 bits encryption. You should enter this command without quotes:
“openssl genrsa -des3 -out server.key 1024″. It’ll ask you a pass phrase, just enter it. ‘
1c) Remove the pass phrase from the RSA private key (while keeping a backup copy of the original file). Enter this command without quotes: “copy server.key server.key.org” and then “openssl rsa -in server.key.org -out server.key”. It’ll ask you the pass phrase, just type it.

1d) Create a self-signed Certificate (X509 structure) with the RSA key you just created. Enter the command without quotes: “openssl req -new -x509 -nodes -sha1 -days 365 -key server.key -out server.crt -config C:\wamp\bin\apache\apache2.2.8\conf\openssl.cnf”.

You’ll fill in the information after entering this command. The correct location of config file, openssl.cnf may need to be changed. In windows, you won’t see “.cnf” extension of the file openssl, but in DOS you’ll see the full name openssl.cnf.

****************
***** Step2***** -> Copy the server.key and server.crt files.
****************

2a) In the conf folder of apache2.2.8 folder, create two folders named as ssl.key and ssl.crt

2b) copy the server.key file to ssl.key folder and server.crt file to ssl.crt

****************
****Step3****** -> Edit the httpd.conf file and php.ini
****************

3a) In httpd.conf file, remove the comment ‘#’ at the line which says: LoadModule ssl_module
modules/mod_ssl.so

3b) In httpd.conf, remove the comment ‘#’ at the line which says: Include
conf/extra/httpd_ssl.conf
Then move that line after this block ….

3c) open the php.ini file located in apache2.2….\bin folder, remove the comment ‘;’ at the line
which says: extension=php_openssl.dll

***************
****Step4***** -> Edit the httpd_ssl.conf file in the folder name, extra
***************

4a) Find the line which says “SSLMutex ….” and change it to “SSLMutex default” without quotes

4b) Find the line which says: . Right after it, change the line which says “DocumentRoot …” to DocumentRoot “C:/wamp/www/” with quotes. Change the line “ErrorLog….” to Errorlog logs/sslerror_log. Change the line “TransferLog ….” to TransferLog logs/sslaccess_log

4c) SSL crt file: Change the line “SSLCertificateFile ….” to SSLCertificateFile “conf/ssl.crt/server.crt”

4d) SSL key file: Change the line “SSLCertificateKeyFile ….” to SSLCertificateKeyFile “conf/ssl.key/server.key”

4e) Change the line which says or something similar to and add the following lines inside those … tags:

Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all

4f) Make sure the line CustomLog “logs/ssl_request_log” \
is uncommented (remove the #). This step is suggested by wmorse1.

**************
****Step5**** In the previous DOS Command windows, enter httpd -t . If it displays Sysntax is OK, then
************** go to Step 6. If not, then correct the wrong syntax and redo step 5.

**************
****Step6***** -> Restart the Apache server
***************

**************
****Step7**** -> if restart is successful, then open the browser and enter “https://localhost” without
************** quotes.

*************************
****Step8 (Optional)**** -> If you want to allow world wide web access to your HTTPS secure server, then
************** ********** in the httpd_ssl.conf file, change the line which says ‘ServerName localhost:443′ to ‘ServerName www.yourwebsitename.com:443′ without quotes. yourwebsitename is your registered internet domain name. If you don’t have it, then just use your WAN IP address. For example ‘ServerName 99.238.53.105:443′. Make sure these setups are correct to allow outside access to secured www server.

8.a The DocumentRoot you modified in step 4b points to the correct website folder on your
computer.

8.b If your computer’s connected to the router, setup the router to allow port 443 forwarding to your
computer.

8.c If your computer has a firewall enabled or behind a network firewall, set up the firewall to allow
incoming port 443 connection

And finally

Thursday, February 11, 2010

ullWiki - Show - Upgrade ullright to symfony 1.3/1.4

Currently: sfLoader::loadHelpers('I18N');
Should be: Use the same methods from the sfApplicationConfiguration object.
sfContext::getInstance()->getConfiguration()->loadHelpers('Debug','Other1','Other2')

ullWiki - Show - Upgrade ullright to symfony 1.3/1.4

Tuesday, February 09, 2010

Where is the ajax documentation ?

Ajax removed in Symfony 1.3, 1.4 due to they don't want to relied on a third-party platform. Fortunately there are plugins that return the functionality into symfony 1.3 and 1.4.

For you specific problem, have a look at
http://forum.symfony-project.org/index.php/t/23998/
http://forum.symfony-project.org/index.php/t/24736/
http://forum.symfony-project.org/index.php/t/24117/

symfony framework forum: General discussion => Where is the ajax documentation ?

escaping_strategy

Enables and defines the policy of the output escaping feature (see Chapter 7). Set it to off if you don't use the $sf_data container in your templates.

The Definitive Guide to symfony | Chapter 19 - Mastering Symfony's Configuration Files | symfony | Web PHP Framework

using link_to for non-symfony links is no longer possible

using link_to for non-symfony links is no longer possible in favour of the
new functionality. In fact, link_to was never intended for cases like this:

[php]
// does no longer work
"alert('js')"); ?>

// use this instead
Link

Changeset 27177 - symfony - Trac

Tuesday, January 26, 2010

增广贤文

古训《增广贤文》

                                       

昔时贤文,诲汝谆谆,集韵增文,多见多闻。
观今宜鉴古,无古不成今。
知己知彼,将心比心。
酒逢知己饮,诗向会人吟。
相识满天下,知心能几人。
相逢好似初相识,到老终无怨恨心。
近水知鱼性,近山识鸟音。
易涨易退山溪水,易反易覆小人心。
运去金成铁,时来铁似金,读书须用意,一字值千金。
逢人且说三分话,未可全抛一片心。
有意栽花花不发,无心插柳柳成阴。
画虎画皮难画骨,知人知面不知心。
钱财如粪土,仁义值千金。
流水下滩非有意,白云出岫本无心。
当时若不登高望,谁信东流海洋深。
路遥知马力,事久见人心。
两人一般心,无钱堪买金,一人一般心,有钱难买针。
相见易得好,久住难为人。
马行无力皆因瘦,人不风流只为贫。
饶人不是痴汉,痴汉不会饶人。
是亲不是亲,非亲却是亲。
美不美,乡中水,亲不亲,故乡人。
莺花犹怕春光老,岂可教人枉度春。
相逢不饮空归去,洞口桃花也笑人。
红粉佳人休使老,风流浪子莫教贫。
在家不会迎宾客,出外方知少主人。
黄金无假,阿魏无真。
客来主不顾,应恐是痴人。
贫居闹市无人问,富在深山有远亲。
谁人背后无人说,哪个人前不说人。
有钱道真语,无钱语不真。
不信但看筵中酒,杯杯先劝有钱人。
闹里有钱,静处安身。
来如风雨,去似微尘。
长江后浪推前浪,世上新人赶旧人。
近水楼台先得月,向阳花木早逢春。
莫道君行早,更有早行人。
莫信直中直,须防仁不仁。
山中有直树,世上无直人。
自恨枝无叶,莫怨太阳偏。
大家都是命,半点不由人。
一年之计在于春,一日之计在于寅,一家之计在于和,一生之计在于勤。
责人之心责己,恕己之心恕人。
守口如瓶,防意如城。
宁可人负我,切莫我负人。
再三须慎意,第一莫欺心。
虎生犹可近,人熟不堪亲。
来说是非者,便是是非人。
远水难救近火,远亲不如近邻。
有茶有酒多兄弟,急难何曾见一人。
人情似纸张张薄,世事如棋局局新。
山中也有千年树,世上难逢百岁人。
力微休负重,言轻莫劝人。
无钱休入众,遭难莫寻亲。
平生莫作皱眉事,世上应无切齿人。
士者国之宝,儒为席上珍。
若要断酒法,醒眼看醉人。
求人须求大丈夫,济人须济急时无。
渴时一滴如甘露,醉后添杯不如无。
久住令人贱,频来亲也疏。
酒中不语真君子,财上分明大丈夫。
出家如初,成佛有余。
积金千两,不如明解经书。
养子不教如养驴,养女不教如养猪。
有田不耕仓廪虚,有书不读子孙愚。
仓廪虚兮岁月乏,子孙愚兮礼义疏。
同君一席话,胜读十年书。
人不通今古,马牛如襟裾。
茫茫四海人无数,哪个男儿是丈夫。
白酒酿成缘好客,黄金散尽为收书。
救人一命,胜造七级浮屠。
城门失火,殃及池鱼。
庭前生瑞草,好事不如无。
欲求生富贵,须下死工夫。
百年成之不足,一旦败之有余。
人心似铁,官法如炉。
善化不足,恶化有余。
水太清则无鱼,人至察则无徒。
知者减半,省者全无。
在家由父,出家从夫。
痴人畏妇,贤女敬夫。
是非终日有,不听自然无。
宁可正而不足,不可邪而有余。
宁可信其有,不可信其无。
竹篱茅舍风光好,道院僧堂终不如。
命里有时终须有,命里无时莫强求。
道院迎仙客,书堂隐相儒。
庭栽栖凤竹,池养化龙鱼。
结交须胜己,似我不如无。
但看三五日,相见不如初。
人情似水分高下,世事如云任卷舒。
会说说都是,不会说无礼。
磨刀恨不利,刀利伤人指。
求财恨不得,财多害自己。
知足常足,终身不辱。
知止常止,终身不耻。
有福伤财,无福伤己。
差之毫厘,失之千里。
若登高必自卑,若涉远必自迩。
三思而行,再思可矣。
使口不如自走,求人不如求己。
小时是兄弟,长大各乡里。
妒财莫妒食,怨生莫怨死。
人见白头嗔,我见白头喜。
多少少年亡,不到白头死。
墙有逢,壁有耳。
好事不出门,恶事传千里。
贼是小人,知过君子。
君子固穷,小人穷斯滥也。
贫穷自在,富贵多忧。
不以我为德,反以我为仇。
宁向直中取,不可曲中求。
人无远虑,必有近忧。
知我者为我心忧,不知我者谓我何求。
晴天不肯去,只待雨淋头。
成事莫说,覆水难收。
是非只为多开口,烦恼皆因强出头。
忍得一时之气,免得百日之忧。
近来学得乌龟法,得缩头时且缩头。
惧法朝朝乐,欺公日日忧。
人生一世,草生一春。
黑发不知勤学早,看看又是白头翁。
月到十五光明少,人到中年万事休。
儿孙自有儿孙福,莫为儿孙作马牛。
人生不满百,常怀千岁忧。
今朝有酒今朝醉,明日愁来明日忧。
路逢险处难回避,事到头来不自由。
药能医假病,酒不解真愁。
人贫不语,水平不流。
一家有女百家求,一马不行百马忧。
有花方酌酒,无月不登楼。
三杯通大道,一醉解千愁。
深山毕竟藏猛虎,大海终须纳细流。
惜花须检点,爱月不梳头。
大抵选他肌骨好,不擦红粉也风流。
受恩深处宜先退,得意浓时便可休。
莫待是非来入耳,从前恩爱反为仇。
留得五湖明月在,不愁无处下金钩。
休别有鱼处,莫恋浅滩头。
去时终须去,再三留不住。
忍一句,息一怒,饶一着,退一步。
三十不豪,四十不富,五十将来寻死路。
生不论魂,死不认尸。
父母恩深终有别,夫妻义重也分离。
人生似鸟同林宿,大限来时各自飞。
人善被人欺,马善被人骑。
人无横财不富,马无野草不肥。
人恶人怕天不怕,人善人欺天不欺。
善恶到头终有报,只争来早与来迟。
黄河尚有澄清日,岂可人无得运时。
得宠思辱,安居虑危。
念念有如临敌日,心心常似过桥时。
英雄行险道,富贵似花枝。
人情莫道春光好,只怕秋来有冷时。
送君千里,终须一别。
但将冷眼看螃蟹,看你横行到几时。
见事莫说,问事不知。
闲事休管,无事早归。
假缎染就真红色,也被旁人说是非。
善事可作,恶事莫为。
许人一物,千金不移。
龙生龙子,虎生豹儿。
龙游浅水遭虾戏,虎落平阳被犬欺。
一举首登龙虎榜,十年身到风凰池。
十年窗下无人问,一举成名天下知。
酒债寻常行处有,人生七十古来稀。
养儿待老,积谷防饥。
鸡豚狗彘之畜,无失其时。
数家之口,可以无饥矣。
常将有日思无日,莫把无时当有时。
时来风送腾王阁,运去雷轰荐福碑。
入门休问荣枯事,观看容颜便得知。
官清书吏瘦,神灵庙祝肥。
息却雷霆之怒,罢却虎狼之威。
饶人算人之本,输人算人之机。
好言难得,恶语易施。
一言既出,驷马难追。
道吾好者是吾贼,道吾恶者是吾师。
路逢侠客须呈剑,不是才人莫献诗。
三人同行,必有我师,择其善者而从之,其不善者而改之。
少壮不努力,老大徒悲伤。
人有善愿,天必佑之。
莫饮卯时酒,昏昏醉到酉。
莫骂酉时妻,一夜受孤凄。
种麻得麻,种豆得豆。
天眼恢恢,疏而不漏。
见官莫向前,做客莫在后。
宁添一斗,莫添一口。
螳螂捕蝉,岂知黄雀在后。
不求金玉重重贵,但愿儿孙个个贤。
一日夫妻,百世姻缘。
百世修来同船渡,千世修来共枕眠。
杀人一万,自损三千。
伤人一语,利如刀割。
枯木逢春犹再发,人无两度再少年。
未晚先投宿,鸡鸣早看天。
将相胸前堪走马,公候肚里好撑船。
富人思来年,穷人思眼前。
世上若要人情好,赊去物件莫取钱。
死生有命,富贵在天。
击石原有火,不击乃无烟。
为学始知道,不学亦徒然。
莫笑他人老,终须还到老。
但能依本分,终须无烦恼。
君子爱财,取之有道。
贞妇爱色,纳之以礼。
善有善报,恶有恶报。
不是不报,日子不到。
人而无信,不知其可也。
一人道好,千人传实。
凡事要好,须问三老。
若争小可,便失大道。
年年防饥,夜夜防盗。
学者如禾如稻,不学者如蒿如草。
遇饮酒时须饮酒,得高歌处且高歌。
因风吹火,用力不多。
不因渔父引,怎得见波涛。
无求到处人情好,不饮从他酒价高。
知事少时烦恼少,识人多处是非多。
入山不怕伤人虎,只怕人情两面刀。
强中更有强中手,恶人须用恶人磨。
会使不在家豪富,风流不用着衣多。
光阴似箭,日月如梭。
天时不如地利,地利不如人和。
黄金未为贵,安乐值钱多。
世上万般皆下品,思量唯有读书高。
世间好语书说尽,天下名山僧占多。
为善最乐,为恶难逃。
羊有跪乳之恩,鸦有反哺之义。
你急他未急,人闲心不闲。
隐恶扬善,执其两端。
妻贤夫祸少,子孝父心宽。
既坠釜甑,反顾无益。
翻覆之水,收之实难。
人生知足何时足,人老偷闲且是闲。
但有绿杨堪系马,处处有路透长安。
见者易,学者难。
莫将容易得,便作等闲看。
用心计较般般错,退步思量事事难。
道路各别,养家一般。
从俭入奢易,从奢入俭难。
知音说与知音听,不是知音莫与弹。
点石化为金,人心犹未足。
信了肚,卖了屋。
他人观花,不涉你目。
他人碌碌,不涉你足。
谁人不爱子孙贤,谁人不爱千钟粟。
莫把真心空计较,五行不是这题目。
与人不和,劝人养鹅。
与人不睦,劝人架屋。
但行好事,莫问前程。
河狭水急,人急计生。
明知山有虎,莫向虎山行。
路不行不到,事不为不成。
人不劝不善,钟不打不鸣。
无钱方断酒,临老始看经。
点塔七层,不如暗处一灯。
万事劝人休瞒昧,举头三尺有神明。
但存方寸土,留与子孙耕。
灭却心头火,剔起佛前灯。
惺惺常不足,懵懵作公卿。
众星朗朗,不如孤月独明。
兄弟相害,不如自生。
合理可作,小利莫争。
牡丹花好空入目,枣花虽小结实成。
欺老莫欺小,欺人心不明。
随分耕锄收地利,他时饱满谢苍天。
得忍且忍,得耐且耐。
不忍不耐,小事成大。
相论逞英雄,家计渐渐退。
贤妇令夫贵,恶妇令夫败。
一人有庆,兆民咸赖。
人老心未老,人穷志莫穷。
人无千日好,花无百日红。
杀人可恕,情理难容。
乍富不知新受用,乍贫难改旧家风。
座上客常满,樽中酒不空。
屋漏更遭连年雨,行船又遇打头风。
笋因落箨方成竹,鱼为奔波始化龙。
记得少年骑竹马,看看又是白头翁。
礼义生于富足,盗贼出于贫穷。
天上众星皆拱北,世间无水不朝东。
君子安平,达人知命。
忠言逆耳利于行,良药苦口利于病。
顺天者存,逆天者亡。
人为财死,鸟为食亡。
夫妻相合好,琴瑟与笙簧。
有儿贫不久,无子富不长。
善必寿老,恶必早亡。
爽口食多偏作药,快心事过恐生殃。
富贵定要安本分,贫穷不必枉思量。
画水无风空作浪,绣花虽好不闻香。
贪他一斗米,失却半年粮。
争他一脚豚,反失一肘羊。
龙归晚洞云犹湿,麝过春山草木香。
平生只会量人短,何不回头把自量。
见善如不及,见恶如探汤。
人贫志短,马瘦毛长。
自家心里急,他人未知忙。
贫无达士将金赠,病有高人说药方。
触来莫与说,事过心清凉。
秋至满山多秀色,春来无处不花香。
凡人不可貌相,海水不可斗量。
清清之水,为土所防。
济济之士,为酒所伤。
蒿草之下,或有兰香。
茅茨之屋,或有侯王。
无限朱门生饿殍,几多白屋出卿。
醉后乾坤大,壶中日月长。
万事皆已定,浮生空白茫。
千里送毫毛,礼轻仁义重。
一人传虚,百人传实。
世事明如镜,前程暗似漆。
光阴黄金难买,一世如驹过隙。
良田万倾,日食一升。
大厦千间,夜眠八尺。
千经万典,孝义为先。
一字入公门,九牛拖不出。
衙门八字开,有理无钱莫进来。
富从升合起,贫因不算来。
家中无才子,官从何处来。
万事不由人计较,一生都是命安排。
急行慢行,前程只有多少路。
人间私语,天闻若雷。
暗室亏心,神目如电。
一毫之恶,劝人莫作。
一毫之善,与人方便。
欺人是祸,饶人是福。
天眼恢恢,报应甚速。
圣贤言语,神钦鬼伏。
人各有心,心各有见。
口说不如身逢,耳闻不如目见。
养军千日,用在一朝。
国清才子贵,家富小儿骄。
利刀割体痕易合,恶语伤人恨不消。
公道世间唯白发,贵人头上不曾饶。
有钱堪出众,无衣懒出门。
为官须作相,及第必争先。
苗从地发,树向枝分。
父子和而家不退,兄弟和而家不分。
官有正条,民有和约。
闲时不烧香,急时抱佛脚。
幸生太平无事日,恐逢年老不多时。
国乱思良将,家贫思贤妻。
池塘积水须防旱,田地勤耕足养家。
根深不怕风摇动,树正无愁月影斜。
奉劝君子,各宜守己。
只此程式,万无一失。
增广贤文

Friday, June 06, 2008

using FusionCharts

example of using FustionCharts in Symfony project

create folder swf in /web
then copy Column3D.swf to it, /web/swf/Column3D.swf
then create the data file in it, /web/swf/Data.xml

in your application page, ie: dashboard/index insert

      <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="900" height="300" id="Column3D" >
         <param name="movie" value="/swf/Column3D.swf" />
         <param name="FlashVars" value="&dataURL=/swf/Data.xml">
         <param name="quality" value="high" />
         <embed src="/swf/Column3D.swf" flashVars="&dataURL=/swf/Data.xml" quality="high" width="900" height="300" name="Column3D" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
      </object>

it's using relative path, the data and flash file are relative to the index.php in web folder (or frontend_dev.php)

Thursday, May 15, 2008

symfony sync

when the project get into production stage, upload the site and upgrade becoming a big problem.

symfony using rsync to do it.

more reference is on:

http://www.symfony-project.org/askeet/1_0/22

http://www.symfony-project.org/forum/index.php/m/50719/?srch=rsync#msg_50719

the 2nd link above is about the solution in Windows

Monday, May 05, 2008

how to get s3 work with symfony

I've tried the s3 plugin, but had no luck. So I started to use the example from IBM on http://www.ibm.com/developerworks/library/os-php-amzmm/index.html
actually, this example is very similar to the official example on http://developer.amazonwebservices.com/connect/entry.jspa?externalID=847&categoryID=137
there's some problem, the solution is on: http://developer.amazonwebservices.com/connect/thread.jspa?threadID=17692

I added the s3 class into lib\myTools.php
installed PEAR package: Crypt_HMAC and HTTP_Request

made 2 changes:
replace 'DATE_RFC822' with 'S3_DATE_RFC822' as my version of PHP (5.2.0) won't allow me to redefine this variable.
commented below out:
/*
        if ( strlen( $contenttypestring ) )

            $contenttypestring = $contenttypestring.",application/x-www-form-urlencoded";

        else if ( $verb == "PUT" )

            $contenttypestring = "application/x-www-form-urlencoded";
*/

Friday, May 02, 2008

symfony amazons3 plugin

this plugin is now on: http://trac.symfony-project.com/wiki/sfAmazonS3Plugin
but you cannot install it if you follow the instruction on the page.

to install it, refer to: http://www.mail-archive.com/symfony-users@googlegroups.com/msg04571.html

or do my way:
create an empty folder on desktop
right click and use svn to checkout
http://svn.symfony-project.com/plugins/sfAmazonS3FSPlugin

and save it as
plugins/sfAmazonS3FSPlugin

Wednesday, April 23, 2008

useful string trim function

/**
 * Cut string to n symbols and add delim but do not break words.
 *
 * Example:
 * <code>
 *  $string = 'this sentence is way too long';
 *  echo neat_trim($string, 16);
 * </code>
 *
 * Output: 'this sentence is…'
 *
 * @access public
 * @param string string we are operating with
 * @param integer character count to cut to
 * @param string|NULL delimiter. Default: '…'
 * @return string processed string
 **/

function neat_trim($str, $n, $delim='…') {
   $len = strlen($str);
   if ($len > $n) {
       preg_match('/(.{' . $n . '}.*?)\b/', $str, $matches);
       return rtrim($matches[1]) . $delim;
   }
   else {
       return $str;
   }
}

Wednesday, April 16, 2008

how to user symfony sfAjaxUploaderPlugin

This is from symfony forum

http://www.symfony-project.org/forum/index.php/mv/msg/9279/0/40/

for more information, please check the post.




It looks to me like many people having problems using this plugin, and for good reasons. It is not the best plugin around and it was built very quickly, but it can be used.

To help you all I have made a small demo project which I friezed and attached.

The project was build by init a new project, then init an application called "test" and then init module called "test".


The index template contains the form with a file input field to be uploaded.



Theses are the changes done to various files:

filters.yml:


rendering: ~
web_debug: ~
security: ~

# generally, you will want to insert your own filters here
ajaxUploader:
class: AjaxUploaderFilter

cache: ~
common: ~
flash: ~
execution: ~




settings.yml:


prod:
.settings:
no_script_name: on

dev:
.settings:
error_reporting:

web_debug: on
cache: off
no_script_name: off
etag: off

test:
.settings:
error_reporting:
cache: off
web_debug: off
no_script_name: off
etag: off

all:
.settings:
enabled_modules: [default, ajaxUploader]




view.yml


default:
http_metas:
content-type: text/html

metas:
title: symfony project
robots: index, follow
description: symfony project
keywords: symfony, project
language: en

stylesheets: [main]

javascripts: [%SF_PROTOTYPE_WEB_DIR%/js/prototype, /sfAjaxUploaderPlugin/js/ajaxUploader]

has_layout: on
layout: layout





There is no code in the actions, only some templates.

The index template is a form with file field:




'myAjaxUploader()',
'update' => 'target_div',
'url' => 'test/upload',
)); ?>









and the response template just echos some info:


getParameter('name'))) {
echo "file " . $sf_request->getParameter('name') . " was uploaded";
} else {
echo "no file was uploaded";
}
?>





The AjaxUploaderHelper.php was buggy (as few of you have noticed). It should be:

url_for("ajaxUploader/uploader") . "?name=$name", "name"=>"ajaxUploader", "frameborder"=>0, "width"=>320, "height"=>25), true)
. tag("/iframe") . input_hidden_tag($name);
}

?>





And thats it, AJAX uploads!

symfony get insert_id

To get the last inserted record id in symfony, you can do as below:

$newHistory = new History();
$newHistory->setUpdateTime($now);
$newHistory->save();
$newHistory->getId()

Wednesday, April 02, 2008

Symfony Cheat Sheets Index

Cheat Sheets Index

This page lists all the know cheat cheets dealing with symfony.

Official

User-contributed

TopicAuthorEnglishPortuguêsEspañolFrançais Deutsch
Directory Structure and CLI Andréia BohnerJPG PDF JPG PDF JPG PDF JPG PDF JPG PDF
ViewAndréia BohnerPDF
View: Partials, Components, Slots and Component Slots Andréia BohnerPDF
Form HelpersAndréia BohnerJPG PDF JPG PDF
Javascript and Ajax HelpersAndréia Bohner PDFPDF
Server ValidationAndréia BohnerPDF PDF
ModelAndréia BohnerPDF
Model: SchemaAndréia BohnerPDF
Lime Unit & Functional TestingBenjamin MeynellPDF
ORMAndréia BohnerJPG PDF PDF
Criteria/Criterion/RSAndréia BohnerPDF

Tuesday, April 01, 2008

deploying a Symfony 1.0 project to a shared hosting envirnoment without Symfony installed

Deploying 1.0 To A Shared Host

This page describes a method of deploying a Symfony 1.0 project to a shared hosting envirnoment without Symfony installed.

Prerequisites

In order for this method to work, you need to meet the following conditions:

  • A Shared Host with PHP5
  • A functional copy of the project you plan to deploy in a local environment with Symfony 1.0 installed
  • An FTP account to the host you plan to deploy to.

Preparing Your Local Project

Several things need to be dealt with before beginning to upload.

  1. Update Symfony - Make sure that you're using the latest update of Symfony 1.0 (at the time of this writing the most recent update is 1.0beta1). For example, if you are using a pear install of Symfony 1.0beta1 on linux, you might execute this command:
    sudo pear upgrade symfony/symfony-beta
  2. Update Project - If you've recently updated your symfony install, be sure to update the project for the new version:
    symfony upgrade 1.0
  3. Freeze Project - Now comes the easy part. When you freeze a project, like we're about to do, Symfony automatically packages the current pear libraries into the project directories and updates the configuration to point to these internal libraries. This tool has several purposes, of which easing deployment is one of the most useful. So, just issue the command in your root project directory, and watch the magic happen:
    symfony freeze

You will then see a long list of things which Symfony is doing, most of which involve copying files to their new locations. Most of these will be in the lib/ and data/ directories, but there are a few in other places, such as the web/ directory.

Preparing Your Host Space

Directory Structure

Most shared hosting companies provide you with a base directory where you may upload your files. A standard layout for the subdirectory structure looks like this:

/
+-/public_ftp
+-/public_html
+-/tmp

There may be other folders, but they are not important to us.

Uploading the Files

Uploading the files is really quite easy, provided you know how to use an FTP client. If not, I would suggest you go read up on them, as they are very useful tools.

All you need to do is upload the following directories to the root folder of your webspace (Note: Do not upload the files into your public_html or similar folder. This is a severe security risk'''):

/
+-/apps
+-/cache
+-/config
+-/data
+-/lib
+-/log
+-/plugins (Optional, depending upon whether you have any plugins installed)

The next thing you need to do is upload the files in your project web/ directory into your remote public_html/ directory, or whatever directory you have that fulfills the function of holding your publically-viewable files.

/web/*    =>    /public_html/

Permissions

Now that you've uploaded the files, you need to ensure that the permissions of certain folders didn't get messed up while uploading.

symfony fix-perms
  • /cache : This folder should have world-writable permissions (777)
  • /log : This folder should have world-writable permissions (777)
  • All others: The other folders and file should be world-readable and executable (755)

Miscellaneous

There are a few other things you might want to do now that you're mostly finished.

Dev Controllers

I would definitely recommend that you deleted the dev controllers (/public_html/*_dev.php), since they are not needed and have the potential to deliver unwanted information to anyone attempting to hack your website.

Plugin Web Directories

Depending upon the method of installing your plugins and the platform you have developed your project on, the plugin web/ directories may need attending to. Generally if they worked on your local system, they'll work on your host, but if you encounter broken images and an absence of certain javascript files and stylesheets, then you may need to fix this. You have two options:

  1. If you are on a host that supports symlinks, you can create symlinks from the main public_html directory to the plugin web directories.
  2. The universal method of fixing a problem like this is to simply copy the contents of the plugin web/ directories into your main public_html/ directory.

Problems

Problem with stylesheet (css)

If the link to stylesheet doesn't work, add the following line to index.php:

$_SERVER['SCRIPT_NAME']='/index.php';

Based on this thread (OVH context).

Other

If you experience problems with this, simply ask on the forums or mailing list and you will most likely get an answer soon.

Wednesday, March 26, 2008

symfony simple blog plugin conflict

if you use symfony simple blog plugin ( sfSimpleBlog )
you cannot define your other php name as Job in schema, ie:

jobs:
_attributes: { phpName: Job, idMethod: native }

you can use jobs as below or change to something else

jobs:
_attributes: { phpName: Jobs, idMethod: native }

otherwise you will not be able to load the simple blog admin after you
rebuild the model

Thursday, March 20, 2008

how to deal with enum in symfony

type: enum

Simulating an enum column type in the model

As enum is a MySQL specific type, you cannot have a column of type
enum in your schema.yml (which is database-independent). One solution
to simulate it is to create another table to store the different
possible values. But the Model class offer an alternative solution
that is probably more elegant.

please see detail on: http://www.symfony-project.org/snippets/snippet/107

useful docs of symfony

URL http://andreiabohner.files.wordpress.com/2007/08/sfmodelfirstpartrefcard.pdf
this is about database model, the files, locations and etc

URL http://andreiabohner.files.wordpress.com/2007/09/sfmodelsecondpartrefcard.pdf
this is about database schema, it's a detailed example of schema.yml with explanation of  each item.

URL http://andreiabohner.files.wordpress.com/2008/01/sfmodelcriteriacriterionrsrefcard_enus.pdf
this is about the criteria / criterion / RS
full doc and example

useful docs of symfony

refer to http://pools.jp/2007/06/24/symfony-schema-yml-propel-%E6%8A%BD%E8%B1%A1%E8%A1%A8%E7%8F%BE/
source is Japanese, it's about how the schema.yml defines the column types. Simple form is copied from the source below, for more details, refer to the source.


mysql symfony(schema.yml)
varchar VARCHAR
tinyint TINYINT
text LONGVARCHAR
date DATE
smallint SMALLINT
mediumint SMALLINT
int INTEGER
bigint BIGINT
float FLOAT
datetime TIMESTAMP
timestamp TIMESTAMP
time TIME
year INTEGER
char CHAR
tinybolb BINARY
tinytext VARCHAR
blob VARBINARY
mediumbob VARBINARY
mediumtext LONGVARCHAR
longblob VARBINARY
longtext LONGVARCHAR
enum CHAR
set CHAR
bool TINYINT
decimal DECIMAL

Tuesday, March 11, 2008

symfony propel-load-data

symfony propel-load-data

Loading data from fixtures can be extremely useful to pre-populate
your database so you have something to test and code with. I
frequently use the propel-load-data task in two ways, the first when
altering the schema, and the second to add some new data on top of
whats in the database.

This will rebuild your db and model from schema.yml, insert the new
structure into your db, and load data from the fixtures in
/data/fixtures:

./symfony propel-build-all-load frontend

To load in additional data from a specific fixture file, you can use
this command:

./symfony propel-load-data frontend dev data/fixtures/[filename].yml append

Tuesday, March 04, 2008

symfony sfGuard

when install the plugin sfGuard, if you have problem when running
propel-load-data to import the init data.
use the following command:
symfony propel-load-data frontend

the common error is asking for the app name, but if you use your
project name you'll remain the error. so use frontend instead of you
project name.

Monday, February 18, 2008

symfony askeet tutorial

day 12

add

<?php echo link_to('Forgot your password?', '@user_require_password') ?>

to the login form, under wrong password div

at the end of the tutorial, you'll have the function not exist error:
Call to undefined function form_error()

you just need add <?php use_helper('Validation'); ?> to top of
user/passwordRequestSuccess.php

symfony askeet tutorial

on day8,

add <?php use_helper('Javascript') ?> right be4 </header>


then add

<div id="login" style="display: none">
<h2>Please sign-in first</h2>

<?php echo link_to_function('cancel', visual_effect('blind_up',
'login', array('duration' => 0.5))) ?>

<?php echo form_tag('user/login', 'id=loginform') ?>
nickname: <?php echo input_tag('nickname') ?><br />
password: <?php echo input_password_tag('password') ?><br />
<?php echo input_hidden_tag('referer', $sf_params->get('referer')
? $sf_params->get('referer') : $sf_request->getUri()) ?>
<?php echo submit_tag('login') ?>
</form>
</div>

right be4
<div id="content">

"Have the form appear when a non-authenticated user clicks an interested link"

askeet/lib/helper/UserHelper.php

should be

askeet/apps/frontend/lib/helper/UserHelper.php

on day9, "Modify the templates"

in showSuccess.php
change <?php echo $question->getBody() ?>
to <?php echo $question->getHtmlBody() ?>


in _list.php
change <?php echo truncate_text($question->getBody(), 200) ?>
to <?php echo truncate_text(strip_tags($question->getHtmlBody()), 200) ?>


day10

isInterestedIn() is created in askeet\lib\model\User.php

the refactoring is, in user/action

change

public function executeInterested()
{
$this->question =
QuestionPeer::retrieveByPk($this->getRequestParameter('id'));
$this->forward404Unless($this->question);

$user = $this->getUser()->getSubscriber();

$interest = new Interest();
$interest->setQuestion($this->question);
$interest->setUser($user);
$interest->save();
}

to

public function executeInterested()
{
$this->question =
QuestionPeer::retrieveByPk($this->getRequestParameter('id'));
$this->forward404Unless($this->question);

$this->getUser()->getSubscriber()->isInterestedIn($this->question);
}


another refactoring is, in UserHelper.php
change
return link_to_function('interested?', visual_effect('blind_down',
'login', array('duration' => 0.5)));
to
return link_to_login('interested?');

update modules/sidebar/templates/defaultSuccess.php
to
<?php use_helper('User') ?>

<?php echo link_to_login('ask a new question', '@add_question') ?>

<ul>
<li><?php echo link_to('popular questions', '@popular_questions') ?>
<li><?php echo link_to('latest questions', '@recent_questions') ?></li>
<li><?php echo link_to('latest answers', '@recent_answers') ?></li>
</ul>

symfony askeet tutorial

finally get the symfony ajax installation correctly.

this should be for day1 but i found the problem on day8 when i need ajax.

bascially 2 points: wamp has 2 php.ini files AND the pear path is point to c:\php5\pear\

more reference to read

http://www.symfony-project.org/forum/index.php?t=msg&&th=5339&goto=22910
http://trac.symfony-project.com/wiki/SymfonyOnWAMP

also, a chinese reference:
http://www.watir.cn/?p=18

Friday, February 15, 2008

symfony askeet tutorial

day 7 problem solved, seems i had problem in previous day 5. i did all from day 2-7, it's all fine.

got problem in day 8, after add the ajax, got fatal error.
solution is found in forum at:  http://www.symfony-project.org/forum/index.php/m/22875/
pay attention to the last reply, that's the solution i take. also found a bug report regarding to the fatal error, seems it's about the PK

--
Kindest Regards,

Zhen Sun

Thursday, February 14, 2008

symfony askeet tutorial

on day7, got problem to show the user profile. need sort out.

when 'we can also link to a user profile from a question', solve 'Don't forget to declare the use of the Date helper in _list.php.' by add <?php use_helper('Date', 'Global') ?> on top  of _list.php, I guess add <?php use_helper('Date') ?> would work too.

when add sidebar

on the view.yml

default:
components:
sidebar: [sidebar, default]


actually just need

components:
sidebar: [sidebar, default]

otherwise there's 2 default keywords in the yml file and get a non-css and non-sidebar page


the user profile problem remains, even after checked the askeet SVN repository. will need a further investigation later.

Wednesday, February 13, 2008

symfony askeet tutorial

this is the first day on the tutorial.

in the tutorial, day4 takes sometime to learn, a lot of reference to read.

day5's last piece is not correct. need rename the downloaded _question_list.php to _list.php, also you'd better copy the content from previous listSuccess.php and get rid of the <h1></h1> part to the _list.php

actually, just create the _list.php, then copy the content from listSuccess.php, delete the line of <h1></h1>

then change the listSuccess.php content to
<h1>popular questions</h1>

<?php echo include_partial('list', array('question_pager' => $question_pager)) ?>

day6,

when add the secureity.yml
all:
is_secure: on
credentials: subscriber

make sure you read the notes, and change on to off

public
function handleErrorLogin()
{
return sfView::SUCCESS;
}

don't forget to add this method to user actions.classe.php to handle the error.

Tuesday, February 12, 2008

learning symfony

follow the tutorial, build imagegallery db, and modify config/database.yml and propel.ini.

when run the last step symfony propel-generate-crud backend images Image

got error Unable to scafford unexistant model 'Image'

look like i didn't setup the Image model. so i leave this tutorial alone and go back to do the symfony site official tutorail on http://www.symfony-project.org/tutorial/1_0/my-first-project

called

My first symfony project

first problem when create the model, need enable extension=php_xsl.dll of PHP

still have the same error, but doesn't matter. seems the model is still created and

http://localhost/sf_sandbox/web/frontend_dev.php/pos
http://localhost/sf_sandbox/web/frontend_dev.php/comment

work fine.

when u add validation onto the comment form, the instruction is

Now to finish, open again the modules/comment/templates/editSuccess.php template and insert at the top:

actually, it means insert to the top of the table, right after <tbody>


on the change the URL aspect part, there's a little problem of modifying the template, tutorial is not totally correct, you'd better have a look the final result image and finger out how to modify the template. the part modify the table cells.

this example is completed finally, but it is far from master it.