跳至主要内容

博文

目前显示的是 六月, 2013的博文

jquery how to hide the select arrow when the ajax return only one option

well, just note it for memo. html: less: /* Select arrow styling */ .address_city_chooser{ >div{ position:relative; display:inline-block; &.disabled{ label:after{ content: ''; width: 23px; height: 23px; position: absolute; display: inline-block; top: 4px; right: 4px; background: #fff; pointer-events: none; } } } } and js: $.get( Routing.generate('prospection_public_city',{'postCode':code,'_locale':currentLang}), function(response){ if(typeof response.error!="undefined"){ $('#errorDialog').html(response.error); $('#errorDialog').dialog('open'); }else{ $(container).html(response); if ($(container).find('option').length<2){ $(container)

jquery validation, how to check a select box is not the default value

1. You can write your own rule! // add the rule here $ . validator . addMethod ( "valueNotEquals" , function ( value , element , arg ){ return arg != value ; }, "Value must not equal arg." ); // configure your validation $ ( "form" ). validate ({ rules : { SelectName : { valueNotEquals : "default" } }, messages : { SelectName : { valueNotEquals : "Please select an item!" } } }); 2. An easier solution has been outlined here:  [jQuery] Validate select box Make the value be empty and add the required attribute id = "select" class = "required" > value = "" > Choose an option value = "option1" > Option1 value = "option2" > Option2 value = "option3" > Option3

css zoom a block

zoom : 145 %; - moz - transform : scale ( 1.45 ); - webkit - transform : scale ( 1.45 ); Zoom and transform scale are not the same thing. They are applied at different times. Zoom is applied before the rendering happens, transform - after. The result of this is if you take a div with width/height = 100% nested inside of another div, with fixed size, if you apply zoom, everything inside your inner zoom will shrink, or grow, but if you apply transform your entire inner div will shrink (even though width/height is set to 100%, they are not going to be 100% after transformation). In my opinion, i think we should use zomm not transform, transform is just resize the element.

rsync exclude some folder or file

example: rsync -avt /home/workspace/symfony2.1_bannieres /home/local_workspace/admin --delete --exclude-from '/home/local_workspace/exclude_admin.txt' suppose we have a exclude file in /home/local_workspace/exclude_admin.txt, and his content is : app/logs app/cache .svn .git this is the article: http://articles.slicehost.com/2007/10/10/rsync-exclude-files-and-folders

css rewrite , concerned with less and yui

I have a problem really odd about css rewrite. suppose we have a css in AcmeTestBundle/Resources/public/css folder, named a.less. In this a.css we have a rule like: background: url(../images/buttons.png) no-repeat top left; which is the AcmeTestBundle/Resources/public/images/button.png, for some ugly reasons, if we use symfony2 assetic, the cssrewrite can not translate it correctly, so we use this commmand first ; php app/console assets:install and then in our layout.twig, we can use this: {% stylesheets 'bundles/acmetest/css/*.less' filter='lessphp,cssrewrite,?yui_css' output='css/test.css' %} {% endstylesheets %} well, the odd thing come, we get a web/css/test.css, and in this file, we have a image link like this: background: url((../../bundles/acmetest/images/buttons.png) no-repeat top left; if your site url is the root of the domain, no problem, like you have a domain name : www.abcefg.com. But,

symfony2 PHP Warning: SessionHandler::close(): Parent session handler is not open when logout

this is an error introduced by php version under 4.11, https://groups.google.com/forum/#!topic/symfony-devs/Q-f0lKT7OZ8 and https://github.com/symfony/symfony/issues/5868 are the bug report, the solution for no way to upgrade  php is : logout: path: fos_user_security_logout target: / invalidate_session: false

awstats

normally installed awstats in ubuntu has a folder in /usr/share/doc/awstats This folder contains the awstats_updateall.pl, which can trigger all the update for all config file in the specific path. So we should not remove these folder from doc. you can bind the awstats by cron.d or logroate , see this example in /etc/logrotate.d/apache2 : prerotate /usr/share/doc/awstats/examples/awstats_updateall.pl -configdir=/etc/awstats -awstatsprog=/usr/lib/cgi-bin/awstats.pl now endscript Sure, here is an good explaination for this topic: http://www.dalouche.com/wordpress/2006/11/22/howto-apache2-awstats-setup-on-debianubuntu-edgy-eft/ normally, we should do both of them, use cron.d and attach it with logrotate, cause logrotate will disable our awstats

jquery change the select box value

we can do this at first: $("#simple_search_bar .cat option[value=0]").prop('selected',true); and there is an article talke about this: The right way to do this depends upon your circumstances. Case 1: No  value  attributes on the  option  elements If your  option  elements don't have  value  attributes  (and you're not worried about the possibility of somebody adding them later and inadvertently breaking your existing code),  then  just use the  .val() method  of the jQuery object wrapping your  select  element. For instance, in the OP's case... $select = $ ( '#cbCategory' ); $select . val ( cat ); // Selects the option with text `cat`, as long as the options don't have // 'value' attributes. Case 2:  Option  elements have  value  attributes If your  option  elements have value attributes (or  value  attributes might be added in the future and you don't want your code to break), then there'

doctrine left inner join /left outer join

RIGHT, INNER, OUTER, JOIN? The difference is in the way tables are joined if there are no common records. JOIN is same as INNER JOIN and means to only show records common to both tables. Whether the records are common is determined by the fields in join clause. For example: FROM t1 JOIN t2 on t1.ID = t2.ID means show only records where the same ID value exists in both tables. LEFT JOIN is same as LEFT OUTER JOIN and means to show all records from left table (i.e. the one that precedes in SQL statement) regardless of the existance of matching records in the right table. RIGHT JOIN is same as RIGHT OUTER JOIN and means opposite of LEFT JOIN, i.e. shows all records from the second (right) table and only matching records from first (left) table.  也就是说: left outer join:不管右边有没有,左边的都选上 right outer join : 不管左边的有没有,右边的都悬赏 join/inner join : 必须两遍都有