跳至主要内容

博文

目前显示的是 九月, 2012的博文

symfony2.0 to 2.1

在windows 下安装symfony标准版本的lib有问题,原因是composer装不上,有人提供了一个方法,摘自google group: a) Change into a directory in your path like  cd /usr/local/bin Get Composer  curl -s  http://getcomposer.org/ installer  | php Make the phar executable  chmod a+x composer.phar b)  $ curl -s https://getcomposer.org/ installer | php $ sudo mv composer.phar /usr/local/bin/composer c) Run  git clone  https://github.com/composer/ composer.git Download the  composer.phar  executable Run Composer to get the dependencies:  cd composer && php ../composer.phar install You can now run Composer by executing the  bin/composer  script:  php /path/to/composer/bin/composer 我在windows7下成功的用第三个方法安装了composer,然后安装symfony lib: D:\workspace\symfony_prospection>php composer.phar install 前提是这个composer.phar 是保存在symfony_prosepection里面的。

find and findby

"find" works only for a single id. If you want to query for a set of id's you can use "findBy" $em = $this->getDoctrine()->getEntityManager(); $em->getRepository('AcmeUserBundle:User').find($id); $em->getRepository('AcmeBannieresBundle:BannerCity')->findBy(array('id' =>$banners));

background-image

/* background-size is only for css3, so, ie8 do not support it. * bacdground-size contain is different from background-size: 100%, auto; or something like that, * contain will stretch the photo, with auto will not. // need to initialize the first and respond to the change. var h=$('#img_detail_hidden').height(); var w=$('#img_detail_hidden').width(); if (h>w && h>348){ $("#imagDetail").css('background-size','auto 100%'); }else if (w>h && w>342){ $("#imagDetail").css('background-size','100% auto'); }else{ $("#imagDetail").css('background-size','auto auto'); } $('#img_detail_hidden').load(function(){ var h=$(this).height(); var w=$(this).width(); if (h>w && h>348){ $("#imagDetail").css('background-size','auto 100%'); }else if (w>h && w>342){ $("#imagDetail").css(

css table 下的div 不能继承table width

今天该spoop 的popup,发现一个很奇怪的问题, http://www.spoop.fr/Cantal-15-lanobre-5330-annonce-1,50-order,0,desc-recherche-tc,pc,pr_act,Vend,Cherche,Loue,Troque,Donne_sm,1_section,rechercher_onglet,ville 这个是一个实验,当div中有一个长的字符串并且没有空格,也就不能正常分行显示的时候,即便你设定word-wrap可以打断字符串,但是它还是显示成一行。 但是如果把这个table改成div,它的width是会被正确继承的: http://www.spoop.fr/Cantal-15-lanobre-5330-annonce-1,50-order,0,desc-recherche-tc,pc,pr_act,Vend,Cherche,Loue,Troque,Donne_sm,1_section,rechercher_onglet,ville 你说这就是哪个脑残非要用table来显示用div显示的东西,我操啊。而且即便是你给每一个td,tr加上width:100%都不行,td,tr,根本不鸟它的father。

google sitemap generator

如果遇到这样的错误: This installation updates the Apache configuration file. To find that file, the installer needs the location of the Apache binary (httpd) or control script (apachectl). The binary or control script that you specify must support the -V option. What is the location of the Apache binary or control script? [/usr/sbin/apache2] Can't determine Group directive for Apache. 但是你 /usr/sbin/apache2 -V 又是能够找到的话,用下面的命令安装: ./install.sh -g www-data -c /etc/apache2/apache2.conf -t /usr/sbin/apache2ctl

css for ie

http://html5boilerplate.com/ is a good css framework http://css-tricks.com/how-to-create-an-ie-only-stylesheet/ Another explanation is more better: http://stackoverflow.com/questions/814219/how-to-target-ie7-ie8-with-css-valid-code Explicitly Target IE versions without hacks using HTML and CSS Use this approach if you don't want hacks in your CSS. Add a browser-unique class to the element so you can select based on browser later. Example Then in your CSS you can very strictly access your target browser. Example . ie6 body { border : 1px solid red ; } . ie7 body { border : 1px solid blue ; } For more information check out  http://html5boilerplate.com/ Target IE versions with CSS "Hacks" More to your point, here are the hacks that let you target IE versions. Use "\9" to target IE8 and below. Use "*" to target IE7 and below. Use "_" to target IE6. Example: body {

flash cross domain interaction.

When an attempt is made to load content into a SWF file at runtime, the request is subject to the Flash Player security model, which is in place to protect users and website owners. As part of this model, Flash Player by default prevents cross-domain loading of data, but allows cross-domain sending of data. in stack overflow, it says : This is a security measure in Flash. You can configure your remote server to accept these requests, however, by including a file called crossdomain.xml in your server's HTML root. The file should look something like this: you can read this article: http://www.adobe.com/devnet/flashplayer/articles/cross_domain_policy.html

weather api

12-09-2012 , well, after a study, a  CORS (cross origin resource sharing) is not allowed in IE 9, so  we can never use javascript to do this, google weather is depracated. use yahoo weather api instead.  before, we can use a google api like this: foreach ($this->codep as $value) { if ($value==null || $value=="") continue; $fp = @fopen("http://www.google.com/ig/api?weather=". $value.",france", "r"); break; } if (!$fp){ return false; } $gt = ""; while (!feof($fp) ) { $gt .= fgets($fp, 4096); } $p1 = strpos($gt, " "); $p2 = strpos($gt, " "); $gt2 = substr($gt, $p1, ($p2 - $p1)); preg_match("/humidity data=\"Humidity: ([^\"]*)%\"/", $gt2, $humidite); preg_match("/wind_condition data=\"Wind: ([^\"]*) at ([^\"]*) mph\"/", $gt2, $vent); preg_match("/icon data=\"([^\"]*)\"/", $gt2, $l

RegExp 的若干问题

Instead of using the  /regex/g  syntax, you can construct a new  RegExp  object: var re = new RegExp ( "regex" , "g" ); You can dynamically create regex objects this way. Then you will do: "mystring" . replace ( re , "newstring" ); jQuery.validator.addMethod( "regex", function(value, element, regexp) { var re = new RegExp(regexp,"g"); return this.optional(element) || re.test(value); }, "Please check your input." ); will return true or false

jquery on 的问题

return false  from  within a jQuery event handler  is effectively the same as calling both  e.preventDefault and  e.stopPropagation  on the passed  jQuery.Event object. e.preventDefault()  will prevent the default event from occuring,  e.stopPropagation()  will prevent the evet from bubbling up and  return false  will do both. Note that this behaviour differs from  normal  (non-jQuery) event handlers, in which, notably,  return false   does  not  stop the event from bubbling up . 所以on前半部分的selector必须是静态的。

event.preventDefault 和 return false 的比较

return false from within a jQuery event handler is effectively the same as calling both e.preventDefault and e.stopPropagation on the passed jQuery.Event object. e.preventDefault() will prevent the default event from occuring, e.stopPropagation() will prevent the event from bubbling up and return false will do both. Note that this behaviour differs from normal (non-jQuery) event handlers, in which, notably, return false does not stop the event from bubbling up. 综上所述,return false 并不能完美的执行 取消默认动作的指令,经过测试,jquery的function 中,IE 8 用return false 是不行的,比如submit 表单,会提交2此,但是在firefox,chrome,IE9 中都是可行的。