четверг, 6 сентября 2012 г.

KnpMenuBundle and Twitter Bootstrap styles

Params:
Symfony2.1 RC2 and appropriate KnpMenuBundle
Twitter Bootstrap 2.1

Problem:
Need to customize Menu by Bootstrap css classes.
For example, I need to add attribute class="nav" to <ul> element of generated menu.

Solution:
Using methods setAttribute(), setChildrenAttributes(), ...
Example:
$menu = $factory->createItem('root');
$menu->setChildrenAttributes(array('class' => 'nav'));
$menu->addChild('Home', array('route' => 'bst_app_homepage'));
...
The output will be:
<ul class="nav">
   <li>...</li>
</ul>

пятница, 31 августа 2012 г.

Symfony2 composer install error

Params:
PHP 5.3.10-1ubuntu3.2
Symfony 2.1 RC2

Problem:
After command
> php composer.phar install
I have error:
Your requirements could not be resolved to an installable set of packages.
  Problem 1
    - Installation request for jms/security-extra-bundle == 1.2.9999999.9999999-dev -> satisfiable by jms/security-extra-bundle 1.2.x-dev.
    - Can only install one of: jms/security-extra-bundle dev-master, jms/security-extra-bundle 1.2.x-dev.
    - Installation request for jms/security-extra-bundle == 9999999-dev -> satisfiable by jms/security-extra-bundle dev-master.

Solution:
1) Remove composer.lock file from your project directory
   > rm composer.lock
2) Re-install all packages again, run command:
   > php composer.phar install

It will take some time, but the problem will be solved.

вторник, 29 мая 2012 г.

пятница, 18 мая 2012 г.

Enable Apache mod_status in Gentoo

Params:
OS: Linux solar 3.1.6-gentoo #16 SMP Thu Jan 5 14:49:10 GMT 2012 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 3800+ AuthenticAMD GNU/Linux
Apache-2.2

Problem:
I need enable apache module mod_status.


Solution:
Edit apache conf file: "/etc/conf.d/apache2"
Add option "-D STATUS" to the directive "APACHE2_OPTS"
Example string:
APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE -D PHP5 -D STATUS"

Restart apache and follow here "http://localhost/server-status"

суббота, 10 марта 2012 г.

Magento cms home page with products and pager

Params:
Magento 1.6.0

Problem:
Display products on home page with pager.

Solution:
Without programming you can display products only from one category.
Edit home page in admin panel of your shop.
Admin panel -> CMS -> Pages -> Home page
Insert into "Design" tab the following code
<reference name="content">
<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
   <action method="setCategoryId">
      <category_id>18</category_id>
   </action>
   <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
      <block type="page/html_pager" name="product_list_toolbar_pager"/>
   </block>
   <action method="setToolbarBlockName">
      <name>product_list_toolbar</name>
   </action>
</block>
</reference>
Change the category_id value for your needs.

четверг, 23 февраля 2012 г.

Gentoo install libgtk-x11-2.0.so.0

Params:
OS: Linux solar 3.1.6-gentoo #16 SMP Thu Jan 5 14:49:10 GMT 2012 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 3800+ AuthenticAMD GNU/Linux

Problem:
I trying to run LDOCE5 and have this error:
Error while loading shared libraries: libgtk-x11-2.0.so.0
32bit applications need 32bit libraries, but I have 64bit system.

Solution: 
Many 32bit libraries on 64bit gentoo you can install with package app-emulation/emul-linux-x86-gtklibs. Also this package has needed libgtk-x11-2.0.so.0
> emerge app-emulation/emul-linux-x86-gtklibs  -av

суббота, 18 февраля 2012 г.

Enable MySQL query cache, in Gentoo

Params:

   - OS: Linux solar 3.1.6-gentoo #16 SMP Thu Jan 5 14:49:10 GMT 2012 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 3800+ AuthenticAMD GNU/Linux
   - MySQL: mysql  Ver 14.14 Distrib 5.1.61, for pc-linux-gnu (x86_64) using readline 5.1

Problem:
No problem :) I need to enable query cache in mysql for testing my site with high load.

Solution:
Edit mysql config file "/etc/mysql/my.cnf".
Add those options to the "[mysqld]" section:
query-cache-type = 1
query-cache-size = 10M

Restart mysql daemon:
/etc/init.d/mysql restart

To check cache enabled or not, run this query:
show variables like '%query_cache%';
And you will see that (and other options):
have_query_cache YES
query_cache_type ON