Cookie Consent by Free Privacy Policy Generator Page 4 of 7 for Home | Igor Moiseev

Igor Moiseev Applied mathematician, Web Developer

Clone repository from Subversion to Git

Here we discus how to migrate the Subversion repository into a new Git repository. We’ll do it with a handy git svn utility. We will refer Gitlab/Github as the destination Git server.

Create a new project on Gitlab: https://\<gitlab-address\>/projects/new and clone it into your local machine

git svn clone https://<svn-address>/<projectname>
cd <projectname>
git remote add origin<projectname>.git
git push -u origin master

Now backup your SVN project folder

cp -raux <projectname> <projectname>.`date +'%Y%m%d'`

And remove .svn folders

cd <projectname>
rm -rf `find . -type d -name .svn`

Init GIT

git init

Config GIT

git config --global "Full Name"
git config --global ""

Check the remote url

git config remote.origin.url

Change the remote origin

git config remote.origin.url git@<gitlab-url>:<username>/<projectname>.git

Create a .gitignore file

echo "<projectname>.sublime*" > .gitignore

Add files

git add .

Commit il progetto

git commit -m "init <projectname>"
[master 820fe97] init <projectname>

Pull and merge from remote

git pull

Push into remote

git push -u origin master

Apache2: AH01630: client denied by server configuration

The Apache web server of the version 2.4 introduces a new style for <VirtualHost> configuration, in particular the <Directory> syntax is not compatible anymore with the previous one 2.2.

The old styled configuration valid in the Apache <= 2.2 version

<VirtualHost *:80>


    <Directory "/var/www/html/">
        Options MultiViews FollowSymLinks
        AllowOverride all
        Order allow,deny
        Allow from all



the modification is introduced in the part

Order allow,deny
Allow from all

the new way to describe the access permitions is reduced to just one line

Require all granted

finally the correct <VirtualHost> configuration will look like the following

<VirtualHost *:80>

    DirectoryIndex index.html index.php index.htm
    DocumentRoot /var/www/html/

    <Directory "/var/www/html/">
        Options MultiViews FollowSymLinks
        AllowOverride all
        Require all granted

    # Logfiles
    ErrorLog  /var/log/apache2/
    CustomLog /var/log/apache2/ combined

Fail2Ban starting 200/error on Ubuntu 10.04 or older

If you get this sudden error in the fail2ban.log

2015-04-20 11:13:17,722 fail2ban.jail   : INFO   Jail 'apache-honeypot' started
2015-04-20 11:13:17,739 fail2ban.actions.action: ERROR  iptables -N fail2ban-apache-honeypot
iptables -A fail2ban-apache-honeypot -j RETURN
iptables -I INPUT -p tcp -m multiport --dports apache-honeypot -j fail2ban-apache-honeypot returned 200

most likely you have spotted the character length limitation on the chain name.

I’ve discovered that the limit is 16 for the chain name length, but Fail2Ban prefixes it with fail2ban- string which eats so precious 9 characters so the only 7 remaining.

To solve this issue you need to rename the iptables action to something like name=HONEY

$ cat /etc/fail2ban/jail.conf

enabled  = enable
filter   = apache-honeypot
action   = iptables-allports[name=HONEY, protocol=all]
logpath  = /var/log/asterisk/full
maxretry = 3
bantime  = 600

Thas it! The issue is observed on Fail2Ban ver. 0.8 or older.

My current projects

Elliptic functions for Matlab and Octave

Star  Fork

The Matlab script implementations of Elliptic integrals of three types, Jacobi’s elliptic functions and Jacobi theta functions of four types.

The main GOAL of the project is to provide the natural Matlab scripts WITHOUT external library calls like Maple and others. All scripts are developed to accept tensors as arguments and almost all of them have their complex versions. Performance and complete control on the execution are the main features.


Email2DB for PHP

Star  Fork

Email2DB parses the email schema into the relational schema. It supports major SQL engines: MySQL, PostgreSQL, Microsoft SQL server and MongoDB support will be rolled down latter.

Build Status  Gitter

Tech Blog

Star   Fork

This is a public space for thoughts on MySQL and PostgreSQL. Ceph’s Storage clustering and KVM virtualization. Programming with NodeJS and PHP. Hacking with RaspberryPI and Arduino. Please feel free to modify any text in it.


Learning NoSQL, PHP and Linux

Series of lessons on Linux, Apache, Databases, Git, NoSQL, PHP and scalability of the application.

Part 1: Linux, Web server and Database

Configuring Linux

Now we see how to setup the development environment. First download Linux (for ex. Linux Mint and install on Pen Drive following this tutorial

You may wish to install it as the second OS on your PC, see the manual

When the Linux is up and running,

Linux Mint

the first to do is to upgrade it to the final release

$ sudo apt-get update; sudo apt-get dselect-upgrade

and reboot.

Statring with shell

What is “the shell” and why bother? The shell is a program that takes your commands from the keyboard and gives them to the operating system to perform. Nowadays, we have graphical user interfaces (GUIs) in addition to command line interfaces (CLIs) such as the shell. To open one simply click “Menu” and type “terminal”

Terminal in Linux Mint

So why bother? 95% of servers is running Linux, most of them are headless – without GUI!

Linux Server Share in Internet

So as we’ve seen before simple command like this one

$ sudo apt-get update; sudo apt-get dselect-upgrade

upgrades the entire operating system, or installs the web server

$ sudo apt-get install apache2

Package managing apt-get

APT, the Advanced Packaging Tool, provide rapid, practical, and efficient way to install packages that would manage dependencies automatically and take care of their configuration files while upgrading.


Installation commands

$ sudo apt-get install <package name>

Maintenance commands

Update sources

apt-get update

Upgrade all installed packages

apt-get upgrade

Upgrade all installed packages and tell APT to use “smart” conflict resolution system, and it will attempt to upgrade the most important packages as kernel etc.

apt-get dselect-upgrade

Remove package

apt-get remove <package_name>

Search available package

apt-cache search <search_term>

Search for installed package

dpkg -l *<search_term>*


GIT is a distributed revision control system with an emphasis on speed, data integrity, and support for distributed, non-linear workflows. Git was initially designed and developed by Linus Torvalds for Linux kernel development in 2005, and has since become the most widely adopted version control system for software development.

$ sudo apt-get install git-core


GitHub is a web-based Git repository hosting service, which offers all of the distributed revision control and source code management (SCM) functionality of Git as well as adding its own features.

GitHub for Mac And Windows

GitHub offers very handy utilities for Mac and Windows that enables managing repositories via graphical interface.

  • GitHub for Mac:
  • GitHub for Windows:

GitHub for Mac

Editors and IDE

For Web development there is a big choice of editors and IDE-s available. Let’s consider some of them

Sublime Text

Sublime Text is a sophisticated text editor for code, markup and prose. You’ll love the slick user interface, extraordinary features and amazing performance.

Sublime Text

NetBeans IDE

NetBeans provides full IDE functionality and is a typical choice for PHP web development.

NetBeans IDE


Exercise 1

Please install Apache web server and create “Hello world” page.

Exercise 2

Install GIT. Register un account su GitHub and Install the GIT Gui.

Exercise 4

Please install MySQL server, MySQL PHPMyAdmin and MySQL Workbench. Create test database.

Exercise 5

Clone repository and configure Apache and MySQL to run application.


$ sudo a2enmon rewrite
  • permit path rewrite
$ sudo nano /etc/apache2/sites-enabled/000-default.conf

<VirtualHost *:80>


    <Directory /var/www/html>
            Options FollowSymLinks
            AllowOverride All
            Order allow,deny
            Allow from all


  • clone repository into cellar folder
/var/www/html$ sudo git clone cellar`

Exercise 6 (advanced, requires knowledge of basics of NodeJS e NPM)

Install Ghost Blogging platfowm and create one post


Part 2: RESTful Web Services

Web Server

At first install Apache web server, we suppose Ubuntu 14.04 installed on server,

$ sudo apt-get install apache2

Then let’s assume the name of the website is, so we configure Apache to serve content for this website from the folder /var/www/html/

$ sudo nano /etc/apache2/sites-available/

And put the VirtualHost description

<VirtualHost *:80>

    DirectoryIndex index.html index.php index.htm
    DocumentRoot /var/www/html/

    <Directory "/var/www/html/">
        Options MultiViews FollowSymLinks
        AllowOverride all
        Order allow,deny
        Allow from all

    # Logfiles
    ErrorLog  /var/log/apache2/
    CustomLog /var/log/apache2/ combined

Create corresponding folders

$ sudo mkdir -p /var/www/html/ /var/log/apache2/

and enable the website

$ sudo a2ensite 
Your choices are: 000-default default-ssl
Which site(s) do you want to enable (wildcards ok)?
Enabling site
To activate the new configuration, you need to run:
  service apache2 reload

then reload conf

$ sudo service apache2 reload

PHP Composer

Here we’ll see how to create a simple PHP web service with the help of Composer. Composer is a tool for dependency management in PHP. It allows you to declare the dependent libraries your project needs and it will install them in your project for you.

$ cd /var/www/html & rm -rf

now clone the source code

$ /var/www/html$ sudo git clone

Switch to the folder of the project

$ cd 

And switch to “Hello world” branch

$ git checkout -b hello-world origin/hello-world

Install composer

$ sudo curl -sS | sudo php

and configure dependences

$ sudo ./composer.phar install

The latter will create folder vendor in current folder, that will contains all PHP libraries that our project will depend on.

PHP Server

To run the application just simply switch to public

$ cd public

and start built-in web server on localhost.

$ php -S localhost:8080

Note, the built-in web server is available only for version of PHP >5.4.

Now open browser on https://localhost:8080/hello/world or try it via telnet

$ telnet localhost 8080
Connected to localhost.
Escape character is '^]'.
GET /hello/world HTTP/1.1
host: localhost

HTTP/1.1 200 OK
Host: localhost
Connection: close
X-Powered-By: PHP/5.5.9-1ubuntu4.6
Content-Type: text/html

Hello, world

Project Learning NoSQL e PHP

Project Learning NoSQL e PHP,, contains a number of branches. After previous step we find ourselves at hello-world branch.

/var/www/html/ (models)$ git branch
* hello-world

You need to explore the project in the following order

  • hello-world: basic routing and functionality
  • controllers: introduction of Controller and advanced routing
  • models: introduction of Models and Doctrine ORM

To switch between branches you need to execute

$ git checkout -b hello-world origin/hello-world
$ git checkout -b controllers origin/controllers
$ git checkout -b models origin/models

After every switch you need to update libraries with

$ ./composer.phar update

Part 3: Databases NoSQL vs SQL is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means to earn fees when linking to and affiliated sites.