Add a new blog
April 26

EC2 with no space for tmp file to start apache or mysql

It will come to the time that you won't be able to run any command that is required creating tmp file when you have no space on your EC2 instance. Once it happens, you can't even start/restart web server or mysql.   Run following 2 commands to check your disk status:  $ df -h $ df -i  df -i . checks your inodes. what are...

February 23

MySQL sql_mode - Get and Set sql_mode Settings to solve

Check your current sql_mode SELECT @@GLOBAL.sql_mode;          or,  SELECT @@sql_mode; Edit your my.cnf and remove  "ONLY_FULL_GROUP_BY". if you don't have sql_mode, just add sql_mode to .conf. Restart mysql server. sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION ...

January 20

Update to latest stable version of node in an easy way

Check your current version $ node -v Install n with npm $ sudo npm install -g n Update your version with one of the following options # install/update the stable node release $ sudo n stable  #install/update the latest node release $ sudo n latest  #install/update the latest LTS node release $ sudo n lts  Check your version again $ node -v ...

January 13

Setup Firebase FCM for push notification

1. create an account for Firebase FCM 2. create one app for ios and download GoogleService-Info.plist 3. create one app for android and download google-services.json Follow this document to complete the setup:  ttps:// ...

January 6

Search and update / replace part of text with MySQL

Update / replace text with mysql. UPDATE tbl_name SET     field_name = REPLACE(field_name,         "string_to_find",         "string_to_replace") WHERE     conditions; where state can be optional. ...

December 16

Data types in Python 3

Numbers     Integers: Like in math, integers in computer programming are whole numbers that can be positive, negative, or 0 (…, -1, 0, 1, …). An integer can also be known as an int. As with other programming languages, you should not use commas in numbers of four digits or more, so when you write 1,000 in your program, write it...

December 16

How To Slice Strings in Python 3 by Index

S a m m y S h a r k ! 0 1 2 3 4 5 6 7 8 9 10 11 Accessing Characters by Positive Index Number print(ss[4])  ==>  y Accessing Characters by Negative Index Number print(ss[-3])  ==>  r Slicing Strings print(ss[6:11])  =>  Shark print(ss[:5])  ==>  Sammy print(ss[7:])  ==>  hark! print(ss[-4:-1])  ==>  ark Specifying Stride while Slicing Strings print(ss[6:11])  ==>  Shark print(ss[6:11:1])  ==> Shark print(ss[0:12:2])  ==>  SmySak print(ss[0:12:4])  ==>  Sya print(ss[::4])  ==>  Sya print(ss[::-1])  ==>  !krahS ymmaS print(ss[::-2])  ==>  !rh ma Counting Methods print(len(ss))  ==>  12 print(len("Let's print the length of this string."))  ==>  38 print(ss.count("a"))  ==> 2 print(ss.count("s"))  ==>  0 likes =...

December 11

Simple Python Flask Rest API

Setup project folder: $ mkdir flask-rest-api; cd flask-rest-api $ python3 -m venv venv $ source venv/bin/activate Check your env, make sure it is the version that you should run on:  $ python -V; pip -V Install flask and packages: $ pip install flask flask-sqlalchemy marshmallow psycopg2-binary Generate freeze requirement text file: $ pip3 freeze > requirements.txt  Create your file $ touch Use any code editor to work on your project.  ...

December 10

Run your Python Flask app with existing Apache server

If you already have an EC2 with Apache, you can use it to run your Python Flask app. Install and Enable mod_wsgi: $ sudo apt-get install libapache2-mod-wsgi-py3 python-dev $ sudo a2enmod wsgi  Create a Flask app if you don't have one. See my other blog for create / run flask app.  Configure and Enable a New Virtual Host: $ sudo nano /etc/apache2/sites-available/MyFlaskApp.conf Add the following conf code...

Send us a message. We will reply as soon as we can.