Mysql proxy - prepared statements NOT WORKING

post by Nikola on 2015-05-21 22:40:34

If you came across problems with Mysql proxy prepared statements that are not working and there is not way to solve (unless you are lua and mysql proxy developer) this (especially if you are using rw-splitting.lua). I read all internet on this matter and without deeper understanding there is just no copy and paste solution.

If you got error like:

"Unknown prepared statement handler (1) given to mysqld_stmt_execute"
and if you use rw-splitting.lua this erro...

How split mysql queries so select goes to slave servers and update/insert/delete goes to master?

post by Nikola on 2015-04-03 15:30:31

Reason for choosing mysql-proxy is that i want to split sql traffic so selects goes to slaves. Everybody was telling me that this is just not possible and I need some third api that will accept selects and route them to slaves and everything else goes to master. Then i discovered mysql-proxy.

This is few thing you need to know:

1) Never use mysql proxy from official repository for your linux distro. That is just outdated and will not work in most cases. In time that I am wr...

Installing Docker on Gentoo - kernel problems

post by Nikola on 2015-03-27 14:32:16

Since I like Gentoo linux al my dedicated servers are running on Gentoo. However everyone knows that Gentoo is a little bit more complicated then apt-get install or similar. All packages are compiled just for your architecture.

This were my errors:

ERROR: setup
  CONFIG_DEVPTS_MULTIPLE_INSTANCES:	 is not set when it should be.
  CONFIG_CGROUP_DEVICE:	 is not set when it should be.
  CONFIG_CGROUP_FREEZER:	 is not set when it should be.
  CONFIG_CGROUP_SCHED:	 is not set...
                
            

How to get next message UID with Dovecot PreAuth and python?

post by Nikola on 2015-01-09 19:13:01

This is update to my Blog post about Procmail and Python pipe script. I need in my app next message UID for some user. Problem with this is I do not know user password (since it is encrpyted) and I can not use python imaplib to get that next UID.

First I tried to parse dovecot-uidlist file and get next UID but that was bad solution since dovecot-uidlist is updat...

Procmail pipe python script

post by Nikola on 2015-01-09 19:10:35

I am doing some project for my self just for fun (simple webmail). Few years back I was doing the same thing but with PHP and it turns out that doing that in PHP was just nightmare. Every next page in webmail took about 3 secs to load and that is not so good as far as I am concern. Last year I started learning Python. Imaplib methods are just simple in Python and you have Python intrepreter so you can test everything without opening IDE.

In my mind in order to have fast webmail I dec...

Flask and Jinja comments recursion

post by Nikola on 2015-01-09 19:06:50

I was always having problems with recursions. It is not that they are hard but how to display them. In Flask and Jinja recursion is easy as long as you have good model defined since Jinja has a great recursion method implemented. You can download latest release of this blog in file that is attache dot this post.

This is simple recursion for this blog comments. In my Comment model I have something like this:

from models import db
from models.Post import Post
import time
cla...
                
            

Flask and SqlAlchemy - how to delete and how to insert into many to many relation

post by Nikola on 2015-01-09 19:05:06

While coding this blog I used ManyToMany relation in between Post and Tag entity. Since I am coming from Doctrine background this was no news to me. But I was stuck for two hours finding answers to this questions:

1) How to delete from that third table where actual values of Post and Tag are stored?

2) How to insert to that third table without defining entity (PostTag)?

I am not using plural in Table names or Entities because we are talking about Single object.

Wit...

Flask microblog

post by Nikola on 2015-01-09 19:02:03

For a long time I was trying to do some blogging. Since other people blogs were so helpful to me in my development (Python, PHP, Mysql, Cocoa, Objective C) I decided to share this blog source on git hub and from now on when I come to a problem I will also do posting.

Address is https://github.com/goors/flask-microblog. You can find there Mysql Eer model along with code.

Writing custom functions for Jinja (Flask)

post by Nikola on 2015-01-09 18:59:57

I always have a need to do some last minute changes to my vars on front end (FE).

Since I am using Phalcon for php development Phalcon and twig template engine has a simple way of define custom function in view Phalocn Di which can then be accessed on FE. I was trying to do something similar on this blog.

In this blog I am using that cutom Jinja functio...

Docker containers running as daemon and few more things

post by Nikola on 2015-01-09 18:58:10

I got some answers regarding daemons, processes, connecting containers together.

First of all I switched to Supervisor (apt-get install supervisor) in order to maintain container processes.
Supervisor is great and you do not have to do some dirty hacks in order to run processes.

This is just example how to have apache in one docker container and mysql in other container.
In apache container I have virtual host that use mod_wsgi (it is a python flask app).

1) I start...