跳至主要内容

博文

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

mysql dump and restore a database

backup: # mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql restore: # mysql -u root -p[root_password] [database_name] < dumpfilename.sql so if you wanna to see a detail of thie topic. see: http://www.thegeekstuff.com/2008/09/backup-and-restore-mysql-database-using-mysqldump/

设计模式 笔记

文章请参考: http://caterpillar.onlyfun.net/Gossip/DesignPattern/index.html -> 表示类的继承 1.factory f -> concreateF p->concreatP f.createP concreateF.createP(return new concreateP) 2.abstract factory: af af->cf1 af->cf2 apa->pa1 apa->pa2 apb->pb1 apb->pb2 cf1.createA(return new pa1) cf1.createB(return new pb1) cf2.createA(return new pa2) cf2.createB(return new pb2) 3.singleton A A::instance(){ return this.instance or this.instance=new A} 使用: a=A::instance() 4.builder 最简单的例子: 1: //Client同时充当了Director的角色 2: StringBuilder builder = new StringBuilder(); 3: builder.Append( "happyhippy" ); 4: builder.Append( ".cnblogs" ); 5: builder.Append( ".com" ); 6: //返回string对象:happyhippy.cnblogs.com 7: builder.ToString(); builder模式主要是有个build part的过程,这个过程叫director,它build的参数,顺序不同都是不同的结果,而abstract factory没有这个过程 这句话解释的最好: 客户端调用:director负责发布命令,builder才负责真正的生产,所以向builder要产品而不是director //调

about free sms api

No, there is no free SMS API - beware of people offering one! Full answer: This does depend on your country. In over 99% of countries,  No , there is no free SMS API. If there was, spammers would make SMS unusable. USA  has an odd exception to this rule, as most of their mobile companies charge the message recipient. This means they can offer  email-to-SMS gateways , and occasionally a free API. You can use these for free, though the gateways are very unreliable, and mobile users will often block these messages, since spammers use this route. In every country you will see many, many companies who will  appear  to send SMS for free, sometimes with an API. These companies exist to make money, and in most countries SMS costs them money, so they will do at least one of these: intercept your messages and phone numbers, for  resale ,  spam ,  fraud  or  phishing inserting adverts in the SMS or in the interface giving a free sample only and sometimes they are only wrapping the

工作合同 , 离职,工会 相关

转自战法: 平常受主管和同事歧视和欺负,准备把他们告到 Prud'hommes, 所以最近和工会的人走的比较近,学会如何 monter un dossier, 和一些保护自己的方法,特别想跟大家分享。 1. Il faut acter 也就是说,如果同事对你有行为或言语上的 Harcèlement, 当下不要过激,但是一定要给主管发一封邮件。 邮件可以保存下来作为证据。 邮件是 Daté 的,可以记录时间日期。 只要邮件是你发的,对方回不回都无所谓,因为你已经公开表示了不满。 如果是言语骚扰,邮件里一定要引用同事骚扰你的原话。 邮件不要有攻击性,你的请求一定是合理的,但是让对方很难回复。比如我主管不批我的RTT,因为他说“RTT不能半天半天的批”,于是工会的哥们帮我起草了一封邮件,就说“我这个月想提交RTT申请的时候,惊讶地发现四月份的申请被拒了。我不明白,全公司的员工都可以请半天的RTT,为什么我不行?而且你已经批了我三月份两个半天RTT的申请。“ 2. Prise d'acte 如果公司没有很好的履行合同,没有支付工资,同事对你有骚扰,甚至是暴力,等等,你就可以立刻终止你的合同。 这个很厉害,不要轻易使用。因为如果法官判定你的请求不合理,就要赔偿公司 Préavis 的钱。 相关链接: http://vosdroits.service-public.fr/F24409.xhtml http://www.journaldunet.com/management/pratique/contrats/4643/la-prise-d-acte.html http://www.juritravail.com/Actualite/prise-acte-rupture-par-salarie/Id/2136  (prise d'acte 和 démission 的区别) 3. 保存邮件 最好是把你所有的邮件都保存在U盘上,备份在自己家的电脑,以免公司突然给你来个 mise à pied, 你就没办法带走任何证据了。但是千万不要大张旗鼓地做,要不然公司就会怀疑你要做什么对公司不好的事。 4. 最有,一些有用链接: http://vosdroits.service-public.fr/particuliers/N19806.xh

recursively set diretory or file privileges.

To recursively give  directories  read&execute privileges: find /path/to/base/dir -type d -exec chmod 755 {} + To recursively give  files  read privileges: find /path/to/base/dir -type f -exec chmod 644 {} + Or, if there are many objects to process: chmod 755 $(find /path/to/base/dir -type d) chmod 644 $(find /path/to/base/dir -type f) Or, to reduce  chmod  spawning: find /path/to/base/dir -type d -print0 | xargs -0 chmod 755 find /path/to/base/dir -type f -print0 | xargs -0 chmod 644

ubuntu install redmine

after the installation of redmine, it is always very slow. redmin 2.1 this modification can solve the problem. http://www.redmine.org/projects/redmine/wiki/HowTo_configure_Apache_to_run_Redmine this is an aticle for older version of redmine. simply do this after the installation:(suppose you install in /opt/redmine-2.1/) cp configuration.yml.example configuration.yml vi /etc/apache2/site-enable/redmine add :         RailsEnv production         RailsBaseURI /redmine normally this works. There is another article talk about this: http://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_in_Ubuntu My own configuration is : /etc/apache2/sites-enabled/redmine #the two parameter is for private server and do not close the idle process to get a more quick response. PassengerPoolIdleTime 0 PassengerMaxPreloaderIdleTime 0 DocumentRoot "/opt/redmine-2.1/public" ServerName redmine.addepi.fr ServerAdmin webmaster@addepi.fr

sonata admin bundle problem

As well know, i have found it a long time ago and it never really solved. if you set this in your config.yml: framework: csrf_protection: enabled: false well ,you will receive this error: The option "csrf_protection" does not exist. Known options are: "virtual", "error_bubbling", "empty_data", "data", "data_class", "trim", "required", "read_only", "max_length", "pattern", "property_path", "by_reference", "error_bubbling", "error_mapping", "label", "attr", "invalid_message" and so on... This problem is reported for sonata admin group, but i didn't see the solution. so just remove the enabled false. Anyway, if you do not define the csrf protection, it will not apply automatically. So this will not be a really problem for the existing project.