How to add apache Basic Auth password

All passwords in the file must be encoded. To do so issue:

  you will be promped for password

Read Me

Restart ubuntu sound system

 

Read Me

Monitor and optimize Firefox memory usage

Type in:

 

Read Me

SVN change repo username

The easiest way to do this is to simply use the –username option on your next checkout or commit. For example: svn commit –username newUser or svn co –username newUser It will then be cached and will be used as the default username for future commands.

Read Me

How to monitor disk activity

How to monitor disk activity under Linux?

if you don’t have it yet:

  Or use

  from sysstat package/

Read Me

Run programs in background in Windows

An equivalent to Linux command:

In Windows:

 

Read Me

How to remove BOM from CSV file with PHP

 

Read Me

Handy commands to show differences between branches in GIT

Handy commands to show differences between branches in GIT:

 

Read Me

Ubuntu failes to sync time

In case local time is not being synchronized with a NTP server and:

returns something like:

The ‚conditionFile is executable’ line means there’s a unfulfilled dependency and /usr/sbin/VboxService file is blocking timesync. We can check what package the file belongs to by running:

As you can see, this file is needed so I will just remove the executable flag and try to restart […]

Read Me

How to disable all form elements without JS

Easy, just place all the elements you want to be disabled inside a <fieldset> like this:  

And that’s it!

Read Me

NTFS USB disk not recognized by Windows

I has a similar case descripben in this article: https://social.technet.microsoft.com/Forums/windows/en-US/1ba097f6-8a0b-43d8-a826-928458c4ba15/change-drive-letter-and-paths-greyed-out-cant-assign-drive-letter?forum=w7itprohardware Disk data has been restored and a new ntfs  partition has been created using fdisk. But windows was unable to mount this drive even though it was readable by the system. This helped me solve this case: 1. cmd 2. Type diskpart. 3. Type

to see a list of disks. 4. Type

(where […]

Read Me

How to turn off annoying Firefox sounds in Ubuntu

Find out what sound is being played. In my case it was:

  playing when trying to send form data again via POST: You can either delete this file or rename it making it unavailable for Firefox, like this:

 

Read Me

Mysql error ‚Row size too large’

Error: „Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.”   Solution: Change your DB structure so that it fits in the InnoDb limits.   Quick fix: Add the following to the my.cnf file under [mysqld] section.

And then execute: ALTER TABLE mdl_lti ROW_FORMAT=Compressed;   […]

Read Me

Serious flaw in GIT

According to https://bugzilla.redhat.com/show_bug.cgi?id=1480386 there’s a serious vulnerability in recent versions of GIT and it’s recommended to update it at least to version. Versions affected: : v2.7.6, v2.8.6, v2.9.5, v2.10.4, v2.11.3, v2.12.4 and v2.13.5. Version recommended for installing: v2.14.1 Unfortunately, Ubuntu 16.04 is far behind and offers only GIT 2.7.4… To update, you should use the official PPA:

 

Read Me

Monitoring disk IO

A great tool for monitoring disk read/writes: iotop

Output shows the exact process using the disk.

Read Me

Overriding nautilus as the default file manager

In Ubuntu nautilus is the default file manager even if you use TDE, KDE or any other desktop environment. From kcontrol:   Even if konqueror is at the top of the list, some applications will still open files and directories through nautilus. This is exceptionally annoying so I’m going to present a quick and effective method how to change that once and for all.  

[…]

Read Me

Sublime remote editing

One of the cool features of Sublime is its ability to work remotely on a project. Let’s assume we have our local project directory:

And a remote one:

Let’s open it with ‚File-Open Folder’ -> /project/abc. Next, we’ll need a commercial plugin ‚SFTP’. To install it:

type in „install package” And select „SFTP”. After installing additional sidebar menu should be available: The first […]

Read Me

SSH pubkey autologin

Instead of logging-in with:

edit or create file:

with the following contents:

From now on it’s possible to omit the -i switch.  

Read Me

Dependency injection container

Recently, for a project I’ve been working on, I had to choose a container bundle that will do the dirty job. The solution is not using any ‚framework’ , so to keep things simple, one of the obvious choice was Pimple: http://pimple.sensiolabs.org/ Although developed in sensiolabs (the same guys behind Symfony) I had a feeling it’s not really what I need… I started researching and trying it on […]

Read Me

Ubuntu install latest PHP7 version

Ubuntu has many outdated packages. That’s why people heavily use ‚external’ repositories. Latest version of PHP at the time of writing is 7.0 even though 7.1.2 has been released over a month ago. 7.1 has a couple of interesting features: http://php.net/manual/en/migration71.new-features.php To install this versin you will have to perform 4 steps: 1. Add repository The ppa:ondrej repo is recommended:

2. Install new PHP

[…]

Read Me

Login with ssh key

How to login to a remote host without knowing the password, but with private key? Having a private key located at the current directory:

   

Read Me

[Symfony] how to create own reusable bundle

1. Create new empty symfony project First, create new empty symfony project

This will create basic symfony project structure for you. 2. Create new bundle Auto-generate vanilla bundle with:

continue with the wizard and answer all the questions . This should also register your new bundle in the app. 3. Develop the bundle Add features to the bundle and commit all the changes. […]

Read Me

Detect fans in Skylake Z170 platform

By default, fans are not detected in most Z170 configurations. The solution is rather simple.

And then re-run sensors-detect. Many new nct6775 related sensors (fans, temperatures and voltages should be now available:   To make this module load after reboot, run:

 

Read Me

[Symfony] Register repository as service

 

Read Me

[Symfony] Query many-to-many relation

Given an Entity Class:

Let’s say you want to query for all the items watched by a user. In your Item Repository:

Repositories are handy but actually, you could also do it without one. Let’s extend Item Entity:

And add getter:

Thanks to this solution, all you need to do in the controller is:

 

Read Me

PHPUnit – how to check for exceptions

If you know your method will (or should) throw an exception under certain circumstances, you may want to write a test to assure it happens. One way is to use PHPUnit annotations:

And the other, the plain old assertion-like statement:

   

Read Me

How to sort Doctrine results with findAll()

Using findAll() it’s impossible to pass another orderby/sort parameter, because findAll definition looks like this:

Instead you can you findBy() which is more complex:

Look at the $orderBy parameter.   So now, when selecting all the records from a repository instead of:

just use:

 

Read Me

Symfony – how to add custom parameter to a service

Given a service with the following definition:

  if you want to pass through a additional parameter (for example a string), like this:

Change your service definition to:

  and then it will be available in the constructor, just like always.  

Read Me

Symfony3 – redirect to the previous location

I encountered the following problem: Given an action deleteAction in a controller I have to redirect to the previous location. Normally this information would be stored in the request headers as the referrer address. It’s tempting to write this:

but you’ll have to repeat yourself everytime you do a redirect. That’s why I decided to move this code to a service:

The requestStack gets injected by Symfony via […]

Read Me

Sharp sign in LaTex

# sign is reserved in LaTex so you have to always escape it: \# There’re acouple of methods to get C# symbol: Regular text: C\# Math environment: $ C\# $ My personal favourite: C\texttt{\#}   Here’s the result for all the versions:

Read Me

PHP script removing bidding products from CENEO

Simple php-cli script to remove bidding products from CENEO, using CENEO API. Script prepared for a Magento shop. Ceneo.xml is a products map that looks like this:

Here’s the script:

 

Read Me

Linux – how many RAM memory modules are installed?

Under Linux, how to check how many RAM modules are installed and what is maximum capacity? As a superuser run:

The output should look like this (for every module, available or not):

 

Read Me

How to completely disable google maps zooming

That’s how.

Read Me

Deploy Symfony3 na home.pl

Na razie w trakcie researchu. Lektura: xhttp://symfony.com/doc/current/deployment.html xhttp://traczewski.pl/instalacja-symfony2-na-serwerze-home-pl/ xhttp://blog.b3k.pl/2014/01/deploy-aplikacji-symfony-2-3-na-home-pl/ xhttp://blog.skirzynski.eu/2014/02/uruchomienie-symfony2-na-home-pl/ xhttp://forum.php.pl/Symfony2Symfony_Instalacja_Symfony_2_na_homepl_t219663.html xhttp://symfonylab.pl/forum/index.php?topic=600.0

Read Me

home.pl Kodowanie znaków MySql w Symfony3

Do poprawnego ustawienia połączenia do bazy MySQL na tym serwerze trzeba zrobić dwie rzeczy: W pliku app/config/config.yml

2.

Po wszystkim trzeba jeszcze wyczyścić cache.

Read Me

Moving files to subdirectory within GIT

Given a GIT repository, how to move files to a new subdirectory? It’s a situation when you have your project inside /project and you want to move all the files to /project/subdir Simply dragging the files to a new subdir will not work because GIT will add the same files twice. All you have to do is:

Please note that mv * will NOT move […]

Read Me Leave comment

How to prohibit text copying in HTML

Or, in general, how to block the user from selecting a text on our site? Here’s the CSS:

Of course, some validation should also be done at the server side.

Read Me Leave comment

Symfony

After playing a little bit with servers and databases in a project I noticed an error in Symfony logs: Failed opening required /var/cache/prod/doctrine/orm/Proxies/__CG__AppBundleEntityUser.php Solution is simple as long it’s a dev environment – delete all the session files!

 

Read Me Leave comment

XDebug could not open the remote debug file

In case your webserver logger reports a similiar error massage: XDebug could not open the remote debug file ‚/var/log/xdebug.log` I noticed that Xdebug log has to be writable for all users:

 

Read Me Leave comment

Dark side panel (Folders) for Sublime3 – Monokai theme

Dark side panel (Folders) for Sublime3 with default Monokai theme. To install place this file inside the ~/.config/sublime-text-3/Packages/User folder. Changes should apply instantly.

   

Read Me Leave comment

Minimal Apache2 VirtualHost config

Here’s my  VirtualHost config for a Symfony application using Apache 2.4.

Then, the symfony application will be available at http://localhost.app Of course, the server name ‚localhost.app’ is unique for every single virtual host (and site). Oh yes, and Ubuntu requires you to specifically ‚enable’ the new site by typing: a2ensite Otherwise, it will not be active, unless of course you’ve created a symlink from […]

Read Me Leave comment

My vagrant devbox

A little update to my vagrant-devbox: added MySQL installation script, added support for Xdebug   Here’s the project: https://bitbucket.org/QWERTY_/vagrant-devbox Tested in Ubuntu 16.04.

Read Me Leave comment

HOW TO install Xdebug, php7, vagrant and Sublime3

I hate to install and configure it but overall it’s a great tool and a necessary one if you want to take debugging to the next level. To stop var_dump-debugging you are going to need: A machine with IDE or PHP editor installed A server featuring Apache and PHP Xdebug package My configuration script Test it all Let’s do it step by step. 1. Preparing PHP editor […]

Read Me Leave comment

Delete vagrant boxes

How to delete an old, unused vagrant box? Simple — thirst list all the boxes:

If you want to remove a box that has many versions like 20160705.0.0 and 20160706.0.0 from the example above, you’ll need to specify the version:

Vagrant does not support removing all the versions of a box.

Read Me Leave comment

How to install latest Vagrant

How to install latest version of Vagrant First, add the repository to ubuntu apt sources:

Then it’s possible to install or update to the latest available version by:

I highly recommend this method rather than manually downloading and dpkg-ing every time a new version comes out.  

Read Me Leave comment

Obsługa YAML w Trinity Desktop (TDE)

Z jakiegoś powodu TDE nie pozwala w łatwy sposób przypisać domyślnego programu do obsługi plików YAML. Można to jednak skonfigurować ręcznie w następujący sposób: Centrum sterowania Skojarzenia plików Kliknij Dodaj: Wprowadź nazwę typu, np. „x-yaml”, „yaml” itp. W prawym panelu ustaw wzorzec dla pliku, tj. „*.yaml” oraz „*.yml” Następnie wybierz program do jego obsługi, w tym przypadku jest to Sublime Po zastosowaniu zmian, pliki z […]

Read Me Leave comment

Pobieranie archiwum strony www

Do tego przyda się napisany w Ruby Wayback Machine Downloader: https://github.com/hartator/wayback-machine-downloader Instalacja jest prosta: gem install wayback_machine_downloader Użycie również, wystarczy podać adres nieistniejącej (lub zarchiwizowanej wersji) strony i gotowe: wayback_machine_downloader http://example.com Sam użyłem kilku dodatkowych ustawień, aby uzyskać konkretną wersję:

Read Me Leave comment

Konwersja wideo do DVD

Konwersja wideo do DVD

Otrzymałem dzisiaj kilka plików z dość nietypowym dla mnie rozszerzeniem .mts (http://fileinfo.com/extension/mts). Zadanie polegało na utworzeniu nośnika DVD, który byłby czytany przez popularne odtwarzacze. Pierwszym krokiem było sprawdzenie jakości otrzymanego materiału:

Jest to więc raczej standardowy materiał Full HD kodowany h264 i ac3. Zwróciłem tylko uwagę na wysoki bitrate, który prawdopodobnie trzeba będzie wymusić, aby nie degradować jakości. Kolejnym krokiem jest  konwersja materiału do formatu […]

Read Me Leave comment