Python: How to setup virtual environment?

Different projects in python may require different modules and its dependencies. Also, there may be a necessity that certain projects be run on newer/older python releases hence introducing version conflicts. Virtual environment is a tool that helps you manage these scenarios.

To install virtualenv, use pip

$ pip install virtualenv

Now, create a virtual environment “myenv”

$ virtualenv myenv

To use the virtual environment, key in

$ source myenv/bin/activate

(if in windows, key in “myenv\Scripts\activate“)

The name of your virtual environment will appear on the left of the prompt

(myenv) …$

To exit out of the virtual environment, key in

$ deactivate

Share it onShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

MySQL Error: Got a packet bigger than ‘max_allowed_packet’ bytes

When trying to import large SQL dump, you often get the above message. Remedy for this issue is to increase the packet size of MySQL’s daemon by setting a packet size of max_allowed_packet. Sudo to your account and set the following

root $ mysql -u admin -p

mysql> set global net_buffer_length=1000000;

mysql> set global max_allowed_packet=1000000000;

In the command line, issue the command

$ mysql –max_allowed_packet=128M -uUSER -pPASSWORD database < database.sql.dump

Share it onShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Wireframesketcher – Tool for prototyping

Wireframing is one of the most valuable phase of any application development process. Understanding requirements from customers is the key step to project success. When this process is done with a right wireframing tools such as WireframeSketcher, PowerMockUp, Gliffy (some of the tools that I experimented this year) it helps designers produce quintessential designs in short span of time and developers understand finer details of the design elements.

As a startup, I was using paper-and-pencil model for wireframe creation to take down requirements, visually portray design concepts and straighten project objectives for creating web applications. Going with the traditional method of prototyping had its own drawbacks and the four major ones are
a) flexibility to change or tweak the prototypes built in short duration
b) re-usability of the prototypes built in the past to save time
c) option to develop prototypes in online and offline mode
d) easy options to save, export prototypes in digital formats
Continue Reading…

Share it onShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

PHP Fatal error: Class ‘DOMDocument’ not found

When setting up applications such as Magento you may come across the error message “PHP Fatal error: Class ‘DOMDocument’ not found …” in your apache server log files

Reason for the error is missing log files. Issue the commands below to fix the issue

$ yum -y install php-xml php-devel

$ service httpd reload

Share it onShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Mysql: Another MySQL daemon already running with the same unix socket.

After VPS reboot, you may encounter this issue and the fix is simple. Follow these stops to prevent this error.

$ service mysqld stop

$ mv /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock.bak

$ service mysqld start

Share it onShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

YEOMAN – Yo, Grunt, Bower – Power tools for front-end developers

Yeoman is a tool for modern workflow to aid front-end web application development. Yeoman consists of three tools to manage this workflow and has generators available for Angular, Backbone and a collection of over 100+ other projects

+ Grunt – It is the builder and utility component that helps automate repitive tasks, script minification, javascript task compiler, compiling sass, coffee script
+ Yo – It is the code generator component that helps in scaffolding, writing boilerplate code, install some grunt tasks
+ Bower – It is the package manager for web and it helps fetch javascript library and/or javascript/css frameworks and its dependencies. This is similar to Maven for java.
Share it onShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

How to find the collation and character set of MySQL tables?

To find the collation of tables within MySQL database, you can use one of the commands listed below

mysql> show table status from exampledb;

mysql> SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, COLLATION_NAME FROM INFORMATION_SCHEMA.COLUMNS where TABLE_SCHEMA=’exampledb’;

 

To find the character set used in a MySQL table

mysql> SELECT tbl.table_name, CCSA.character_set_name FROM information_schema.`TABLES` tbl, information_schema.COLLATION_CHARACTER_SET_APPLICABILITY CCSA WHERE CCSA.collation_name = tbl.table_collation AND tbl.table_schema = “schemaname”;

Share it onShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

How to find the MySQL collation and character set?

To find the collation of a database

mysql> SELECT DEFAULT_COLLATION_NAME FROM information_schema.SCHEMATA WHERE SCHEMA_NAME = ‘exampledb’ LIMIT 1;

+————————+
| DEFAULT_COLLATION_NAME |
+————————+
| utf8_general_ci |
+————————+

 

To find the characterset of a MySQL database

mysql> SELECT default_character_set_name FROM information_schema.SCHEMATA S WHERE schema_name = “exampledb”;

Share it onShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Sudo, Visudo -bash: visudo: command not found

Visudo is needed to make modifications to the sudoers file. In a fresh install of CentOS “sudoers” file is not normally found. To install visudo issue the command

$ yum -y install sudo

As a sys admin, you need to be careful when performing tasks with root privileges. To be cautious, you can create a new user and assign him with root privileges using “visudo”

$ /usr/sbin/visudo

# User privilege specification
root ALL=(ALL) ALL
test ALL=(ALL) ALL

In the above file, test is a new user created with root privileges. In order for the “test” user to have root privileges, command “sudo” should be used. It prevents the user from issuing any commands that can cause system wide havoc and it also logs the command inside “/var/log/secure” for review

Share it onShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

PostgreSQL: Create database, connect and list (command line)

Changing host configuration
$ vi /var/lib/pgsql/8.4/data/pg_hba.conf

Add postgresql to startup process
$ chkconfig postgresql-8.4 on

Start postgresql service
$ service postgresql-8.4 start

Access postgresql
$ su – postgresql
$ psql

Create database
postgres-# create database test

List databases
postgres-# \list

Exit postgresql
postgres-# \q (or \quit)

Connect to database
postgres-# \c test (\connect test)

Share it onShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn
Kurinchi Calendar
November 2017
M T W T F S S
« Oct    
 12345
6789101112
13141516171819
20212223242526
27282930