Thursday, December 17, 2015

Python :: Spammed word Validator or Blocked Spammed Word

Python :: Spammed word Validator or Blocked Spammed Word :-

def is_spammed(content):
    content = " "+content.lower()+" "
    spamword_list = ['call girls','Escort Service','sex','spam']
    for x in spamword_list:
        if " "+x+" " in content:
            return True
    return False

is_spammed("this is spam word") // return True

Wednesday, December 16, 2015

Django :: ...(remaining elements truncated)... Issue

Django :: ...(remaining elements truncated)... Issue :-

Problem :: ...(remaining elements truncated)... data was saved into mysql db ?

Why Occurs :: Because of List object was trying to saved into field of mysql db by python str() function due to which it truncate list and replace larger list data to ...(remaining elements truncated)...

Soln :- Replace str() to list()

Mysql :: How can I dump a specific table or set of tables without including the rest of the db tables?

Mysql :: How can I dump a specific table or set of tables without including the rest of the db tables?

Soln:-

mysql -u -p -e 'show tables like "_%"' | grep -v Tables_in | xargs mysqldump -u -p 

mysql dump data only :-
mysqldump --no-create-info

mysql dump structure only :-
mysqldump --no-data

Tuesday, November 17, 2015

Ubantu 14.10 : apache2 not starting after purge and re-install

Problem :- I am trying to install and run apache2, but after apt-get purge apache2;apt-get install apache2 (as root), I am still missing the file /usr/sbin/apache2.

It show me error :- /usr/sbin/apache2 not found 

Soln :- sudo apt-get install --reinstall apache2 apache2-bin

Thursday, January 15, 2015

#2006 - MySQL server has gone away

Error : #2006 - MySQL server has gone away
 
Soln :-
 
This error is occur due to due to expire of wait_timeout .
 
Just go to mysql server check its wait_timeout :
 
mysql> SHOW  VARIABLES  LIKE  'wait_timeout'
 
mysql> set global wait_timeout = 600 # 10 minute or maximum wait time out you need