跳至主要内容

博文

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

symfony2 SQLLoger memory leak problem

recently i have problem when i trying to import a large text file(about 80M)into database by Doctrine and symfony2. Well, i always got a "out of memory" exception. After some searching job, i found this: Commands are run in prod env by default but have debug enabled, it's  different than the app.php that is prod but where debug is  disabled ...  So using "php app/console xxx:xxx --no-debug" fixed the leaks because  there was no more SQLLogger.  An other solution was to use inside my Command:  $configuration = $this->em->getConnection()-> getConfiguration();  $configuration->setSQLLogger( null);  and the answer is this; Disabling the logger is the only solution. its probably not very useful to have the logger enabled in console aswell, but i dont see an immediate solution to fixing this. You can of course do $em->getconfiguration()-> setSQLLogger(null); in the command So well there is no way to do it in a dev environment.

how to set jquery datatable cloumn width combine with a text-overflow.

If you wanna to cut the text in a column  some thing like: td{ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } Then you must set the table as </> table.dataTable { table-layout: fixed; } And if you set table-layout:fixed, you can never use "aoColumns": [ { "sWidth": "20%" }, { "sWidth": "15%" }, { "sWidth": "20%" }, { "sWidth": "15%" }, { "sWidth": "5%" }, { "sWidth": "5%" }, { "sWidth": "10%" }, { "sWidth": "5%" }, { "sWidth": "5%"} ] Because this is a dynamic setting for th,So you need add somthing like this:      <colgroup>         <col style="width:10%">         <col style="width:20%">                 <col style="width:15%">         <col style="width:10%">       

symfony2 Jsonresponse

if you wanna to encode a json object as the json response, you must set all the property of this objec in public, or it will not work. Like this: class JsonResponseData{ public $msg; public $data; public $errMsg; public function setMsg($msg){ $this->msg=$msg; } public function get(){ return $this->msg; } public function setData($data){ $this->data=$data; } public function getData(){ return $this->data; } public function setErrMsg($errMsg){ $this->errMsg=$errMsg; } public function getErrMsg(){ return $this->errMsg; } } before i set them in private, and i always get a void response object. after i set them to public ,everything works fine.

how to install imagemaick and php_imagick.dll in windows

1. check vredist_x64 and vredist_x86 is installed correctly. 2. install the correct version of imagemagic and php_imagick.dll, if you got "module not found " inthe folder you are sure your dll is in  it, maybe is your imagemagic and php_imageik.dll is not fit. at least: this for sure works: I have Imagick working on Win7 x64 with PHP 5.4 (only tested commandline, but Apache should work) using the beta libraries as compiled and hosted here:  http://www.peewit.fr/imagick/ I installed ImageMagick via the ImageMagick-6.8.0-7-Q16-windows-dll.exe file on the  http://imagemagick.spd.co.il/binaries/

接着说

咱接着昨天的 举那个铁轨的例子不是想说对还是错,只是想批驳一个观点: 所谓功利主义,是会认为救7个人那边是对的,而救一个人是不对的,7大于一嘛,但是如果根据我们的共识和推论,你不能说救一个人是错的。 这是个比方,这里可以推广到很多方面,如果各位也能认同我的“没人能评价救哪一边是对的”这个共识,那么我就可以推广一下这个共识了,也许你们会觉得我的推广不对,那么请告诉我是我推论的方法不对呢还是这个共识不对。 群体利益高于个人利益: 这是扯蛋。 公共利益高于个人利益: 依然是扯蛋,且不说这“公共”二字包含了多少私心。 作为一个个体来讲,如果他有这样的意愿为群体或者公共付出,那是他的事,你没有任何理由也没有任何道德高度去批评一个人,仅仅是因为他没有为群体或者公共利益而舍弃自身的利益。 人生来是平等的,又包含了另外一个意义。 打个比方吧,我们住在村子里,有个二傻长的比较壮,他说,你们没人给我你们1/2的收入,我拿去做投资,赚了就分你们一些。且不说每个人是否有这个意愿去投资,但是我想每个人都还是想知道自己投的钱是谁在管,也就是,每个人应该有权利选择谁来管这个投资。我相信没人会愿意把钱给一个谁也不认识的人来管,跟何况投的钱收回来的时候都没见过,这种模式那不叫投资,那叫抢劫。我想谁也不喜欢被抢劫。对于每一个社会的个体来说,如果我们必须要交税,以维护种群的延续,那么他们应该有权利选择交给谁,这就是著名的 “ 无代表,不纳税  ”。没有人代表我,我就有权力不纳税,这不是法律规定的,这是我们的共识决定的。且问,你们可曾有一丁点认为这是对的? 其次,如果连选择代表需要发出的声音都不能够有的时候,这已经不是所谓的平等的问题了,最多不过是”做稳了的奴隶“,因为奴隶的实质就是:你的一切都是奴隶主给予的。且看我为何如此说: 土地是国有的,有偿租用给你, 发展是土共的功劳,没有它,哪里有发展, 美好生活是土共改革开放带来的,没有土共的政策,拿来今天你们的小资生活? 扯蛋,扯蛋,我tmd真蛋疼。 土地本来就是我们的,你丫抢走了还要卖给我,卖还jb不一次卖,只能租,租还不能随别让别人用,还要交各种钱才能让别人用,什么玩意 发展跟土共有一毛钱关系,丫最多就是一老爷,大地主家有余粮了是tm老爷种出来的?能少收点租子就谢天谢地了。 美好生活,就算有,那也是你们这帮2b加班,

property not found error

As far as I can tell there's a problem here, because any call to app/console initialises the container, which warms up Proxies (unless cache is primed), which depends on ORM metadata. Let say you switch branches and want to clear cache/metadata by calling app/console cache:clear or doctrine:cache:clear-metadata, that will result in ReflectionException if cached metadata no longer matches entities. I tried to finds ways around it and clarify it on IRC with no luck, so I'm raising this as a potential bug. this is a bug report, and today i got a similar one. après la mise à jour de nouveau, le module modération ne fonction plus, operation pour la mise à jour: composer dump-autoload --optimize php app/console assets:install php app/console assetic:dump --no-debug svn commit sur serveur: rm app/cache/prod -rf log: require(/home/admin/app/cache/prod/doctrine/orm/Proxies/__CG__AcmeModerationBundleEntityModerationObjectStatus.php): il ne trouve pas le factory, donc, php

javascript unit test framework introducing, from stackoverflow:

see:  http://stackoverflow.com/questions/300855/looking-for-a-better-javascript-unit-test-tool Buster.js Very similar server/client concept as JsTestDriver (see further down). Except that the server is built with JavaScript (node.js) instead of Java, and the API follows JS best practices to a much higher degree. A browser JavaScript testing toolkit. It does browser testing with browser automation (think JsTestDriver), qunit style static html page testing, testing in headless browsers (phantomjs, jsdom, ...), and more. Take a look at  the overview ! A Node.js testing toolkit. You get the same test case library, assertion library, etc. This is also great for hybrid browser and Node.js code. Write your test case with Buster.JS and run it both in Node.js and in a real browser. Screencast:  Buster.js Getting started  (2:45) pros : Uses node.js, so compatible with Win/OS X/Linux Run tests from browser or headless with PhantomJS (soon) Run on multiple clients at once Suppo

mysql groupby and having

SELECT words , COUNT (*) AS cnt FROM words GROUP BY word HAVING COUNT (*) > 1 by doctrine: $qb = $this->getEntityManager()->createQueryBuilder(); $qb ->select(array( 'u.id', 'u.name', 'u.reseller_code', 'u.first_name', 'u.last_name', 'u.email', 'u.country', 'COUNT(a) as numam', 'SUM(IF(a.activity_year = :year, a.activity_value, 0)) as sumay', 'SUM(IF(a.activity_year = :year AND a.activity_month = :month, a.activity_value, 0)) as sumam' )) ->from('MyBundle:User', 'u') ->leftJoin('u.activities', 'a') ->groupBy('u.id') ->orderBy('u.name', 'ASC') ->setParameter('month', $month) ->setParameter('year', $year)

chrome extension Error: attempting to use a disconnected prot object

if you get this error: Port error: Could not establish connection. Receiving end does not exist. miscellaneous_bindings:236 chromeHidden.Port.dispatchOnDisconnect miscellaneous_bindings:236 Uncaught Error: Attempting to use a disconnected port object miscellaneous_bindings:58 PortImpl.postMessage miscellaneous_bindings:58 responseCallback miscellaneous_bindings:143 xhr.onreadystatechange That means you have make some mistake as this discussed: This is caused when a connection get closed. For example if you open a tab that has the content_script injected, it opens a connection, the tab is closed, and then the background_page tries to pass a message. It will fail because the tab is no longer active to receive the message. In your case I would guess that as tabs close and new tabs open you are attempting to post messages with the old tabId instead of creating a new connection to the new tab. I would recommend reading through the  long-lived connections s

phpunit test get error: No tests found in class "xxx" , solution

if you get this error, like me use this: use Symfony\Component\HttpFoundation\Request; abstract class BaseControllerTestCase extends WebTestCase { ... } if you do not add the abstract infront of it, it will consider this class contains some test case, but in fact this class is not used to test, just a extend of webtestcase. So to avoid this error, you need add abstract for this class. Anyway, this class will never generate an object.

how to use viriable text for dialog buttion of jquery ui

Referring to  http://jqueryui.com/demos/dialog/  you can see there are 2 alternate ways of defining the buttons, one is what you are using here, the second is using arrays. var button1 = 'Ok' ; var button2 = 'Not Ok' ; $ ( ".selector" ). dialog ({ buttons : [ { text : button1 , click : function () { $ ( this ). dialog ( "close" ); } }, { text : button2 , click : function () { $ ( this ). dialog ( 'close' ); } } ] });

ubuntu mount error

How to Resolve “mount error(12): Cannot allocate memory” on a Windows Share October 18th, 2010   | Tags:  CIFS ,  Linux ,  Samba ,  Ubuntu ,  Windows If you mount a Windows 7 share using Samba/CIFS you may run into “mount error(12): Cannot allocate memory” if you are using very large files on the Windows machine. Looks like in certain situations Windows needs to be told to run as a file server and to expect large files. You can read more details at  Large Files are locking up Windows 7 32 bit and 64 bit , but the solution is to make two registry edits and then restart a service: Set “HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\LargeSystemCache” to “1″. Set “HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\Size” to “3″. Restart the “server” service. Once you have done that you should be able to mount the share using a command like “sudo mount -a” or just reboot the Linux machine. form  http://thelinuxexperiment.com/guinea

读“战争与无代表不纳税”后感

见: http://cn.nytimes.com/article/china/2013/04/09/cc09xiaohan/ 先生真知灼见,中国人总想着自己去占那个高高在上的位置,却从没想过把那个高高在上的椅子腿给锯了。父亲早年总说,要是我在那个位置,怎样怎样。其实我很早就想说,你要是能在那个位置,你可能比现在那位还令人恶心。虽然没说出来,道理是一样的。革命了!, 阿Q如此想,就可以把姨太太们都抢过来,却从来没有想过姨太太们怎么想。一个没有钱的政府才有可能是个好政府,一个求爷爷告奶奶的政府才有可能是个好政府。正如文章里所说的,这是一种契约关系,买房是所有的人,卖方恰恰是政府,如果买方不得不买卖方的东西,而且完全没有定价权,也没有售后服务和质量保证,以及保证质量保证的方法的话,那只能说卖方是个强盗。如果你见强盗过的很好也想做强盗的话,那只能说你也很有做强盗的潜质,尽管你说你如果当上强盗头子会给老弱病残留上二两粥,那你还是个不折不扣的强盗。 如果99%的人都仰望着那条高高在上的黄椅子,恩,现在变成红椅子,那99%的人注定了就是趴在地上的屁民。