Leeladharan Achar - alias - leelu ~ blogging...hola mi amigos.. The Blog

Leeladharan Achar - leelu Blog. Hola mi amigos!

Installing and Enabling mod_geoip2 on Apache 2 (centOS 7)

To install mod_geoip2 extension for Apache2 please follow below steps

Make sure you have gcc installed

Execute below command to install all development tools (which includes gcc as well)

yum groupinstall 'Development Tools' 

Now let's install GeoIP development package

yum install geoip-devel 

If above package is not installed then you might get Error as below , when you ...

More ...

Installing PyCharm Community on 32 or 64 bit Fedora 21/22/23

As root user, create a file pycharm.repo in /etc/yum.repos.d/

vi /etc/yum.repos.d/pycharm.repo 

and add below content and save the .repo file

[phracek-PyCharm] name=Copr repo for PyCharm owned by phracek baseurl=https://copr-be.cloud.fedoraproject.org/results/phracek/PyCharm/fedora-$releasever-$basearch/ skip_if_unavailable=True gpgcheck=1 gpgkey=https://copr-be.cloud.fedoraproject.org/results/phracek/PyCharm/pubkey.gpg enabled=1 enabled_metadata=1 

Now to install pycharm community version, execute below commands

dnf copr enable phracek/PyCharm dnf install pycharm-community 

That's all thanks :)

More ...

MySQL master-slave replication

Step-by-step: how to setup MySQL Database replication

This tutorial will go through the setup of MySQL database replication. I will also talk about how to get everything working smoothly again after a server crash, or if you wish to switch databases. I will try to explain what is going on behind the scenes for every step (something I've found missing ...

More ...

Create INSERT stmt FROM SELECT - PostgreSQL

 select 'INSERT INTO schema.user(email,first_name,last_name,password,state,country,interest,phone_number,address1,address2,city,pincode,created_date,modified_date,role,activation_token,activation_token_requested) VALUES (''' || email || ''',''' || first_name || ''',''' || last_name || ''',''' || password || ''',''' || state || ''',''' || country || ''',''' || interest || ''',''' || phone_number || ''',''' || address1 || ''',''' || address2 || ''',''' || city || ''',''' || pincode || ''',''' || created_date || ''',''' || ... 

                        
More ...

SQLAlchemy query with OR/AND/like common filters

Some of the most common operators used in filter() method SQLAlchemy

equals:

query.filter(User.name == 'leela') 

not equals:

query.filter(User.name != 'leela') 

LIKE:

query.filter(User.name.like('%leela%')) 

IN:

query.filter(User.name.in_(['leela', 'akshay', 'santanu'])) # works with query objects too: query.filter(User.name.in_(session.query(User.name).filter(User.name.like('%santanu%')))) 

NOT IN:

query.filter(~User.name.in_(['lee', 'sonal', 'akshay'])) 

IS NULL:

filter(User.name == None) 

IS NOT NULL:

filter(User.name != None) 

AND:

from sqlalchemy import ... 

                        
More ...