среда, 26 сентября 2012 г.

bash, colored output

Params:
Linux A230512 3.2.0-31-generic #50-Ubuntu SMP Fri Sep 7 16:16:45 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
Qt: 4.8.1

KDE Development Platform: 4.8.5 (4.8.5)
Yakuake: 2.9.8


Problem:
Need colored bash output.

Solution:
Edit your ~/.bashrc configuration file.
Find this parameter force_color_prompt and set it to yes.
force_color_prompt=yes

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

Enable $HTTP_SERVER_VARS and $HTTP_GET_VARS in PHP5

Params:
PHP 5.3.10-1ubuntu3.2 with Suhosin-Patch

Problem:
In php4 project not defined variables $HTTP_SERVER_VARS and $HTTP_GET_VARS

Solution:
Enable php directives register_globals and register_long_arrays
You can do it in your php.ini configuration file, but the best way do it in .htaccess file in your specific project.

понедельник, 10 сентября 2012 г.

Git remove submodule

Params:
git version 1.7.9.5

Problem:
Bundles DoctrineFixturesBundle and DoctrineMigrationsBundle has changed repository URLs and namespaces. So I can't update submodules.

Solution:
1) Remove appropriate sections in .git/config file:
pattern: git config -f .git/config --remove-section submodule.$submodulepath
> git config -f .git/config --remove-section submodule.vendor/bundles/Symfony/Bundle/DoctrineFixturesBundle
> git config -f .git/config --remove-section submodule.vendor/bundles/Symfony/Bundle/DoctrineMigrationsBundle
It also remove appropriate sections in .gitmodules file, if not, use this command:
pattern: git config -f .gitmodules --remove-section submodule.$submodulepath
2) pattern: git rm --cached $submodulepath
> git rm --cached vendor/bundles/Symfony/Bundle/DoctrineFixturesBundle
> git rm --cached vendor/bundles/Symfony/Bundle/DoctrineMigrationsBundle

3) Commit this changes:
> git commit -m "Remove submodules DoctrineFixturesBundle and DoctrineMigrationsBundle"

Midnight Commander color scheme and code highlight

Params:
Linux A230512 3.2.0-29-generic #46-Ubuntu SMP Fri Jul 27 17:03:23 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
GNU Midnight Commander 4.8.1

Problem:
Need another color scheme and code highlightes in Midnight Commander.

Solution:
Configuration file for mc-4.8.1 located here:
~/.config/mc/ini

1) Enable code highlightes in mc editor.
Change highlight parameter in mc config file to 1:
editor_syntax_highlighting=1
May be you need to copy misc/filehighlight.ini file from mc source to /etc/mc directory.

2) Apply custom color scheme. 
Set appropriate parameter:
[Color]
base_color=lightgray,default:normal=lightgray,default:selected=black,green:marked=yellow,default:markselect=white,green:errors=white,red:menu=lightgray,default:reverse=black,lightgray:dnormal=white,default:dfocus=black,green:dhotnormal=brightgreen,default:dhotfocus=brightgreen,green:viewunderline=brightred,default:menuhot=yellow,default:menusel=white,black:menuhotsel=yellow,black:helpnormal=black,lightgray:helpitalic=red,lightgray:helpbold=blue,lightgray:helplink=black,cyan:helpslink=yellow,default:gauge=white,black:input=black,green:directory=white,default:executable=brightgreen,default:link=brightcyan,default:stalelink=brightred,default:device=brightmagenta,default:core=red,default:special=black,default:editnormal=lightgray,default:editbold=yellow,default:editmarked=black,cyan:errdhotnormal=yellow,red:errdhotfocus=yellow,lightgray

!!! IMPORTANT !!!  - use nano or vi or ... to edit mc ini file, but not internal mc-editor,
otherwise your changes will be lost
!

PS: Thanks to this post author. 

http://plug-and-pray.blogspot.com/2009/09/editing-midnight-commanders-color.html
Her color scheme is beauty.

пятница, 7 сентября 2012 г.

Composer time out error

Params:
php5.3

Problem:
Error while installing dependencies. Command:
> php composer.phar install
returned the error:
[Composer\Downloader\TransportException]
......... file could not be downloaded: failed to open stream: Connection timed out


Solution:
Set higher timeout for composer, run command:
> COMPOSER_PROCESS_TIMEOUT=1000 php composer.phar install
If you get error again try to set higher timeout. For example 3000 against 1000.



четверг, 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>