Blogs

Importing Python Modules

The import and from-import statements are somewhat confusion for beginners to Python.
Here we will discuss some common issues related to import and from-import.
Python have 3 different ways to import modules.
1. import statement
2. from statement
3. builtin __import__ function

import X imports the module X, and creates a reference to that module in the current namespace.So you have to use X.name to refer to things defined in module X.
from X import * imports the module X, and creates references in the current namespace to all public objects defined by that module (that is, everything that doesn’t have a name starting with “_”) hence you can simply use a plain name to refer to things defined in module X. Since X itself is not defined, so X.name doesn’t work.
from X import a, b, c imports the module X, and creates references in the current namespace to the given objects i.e a,b,c.

mysqli_report function

mysqli_report() is a nice function for improving your queries and code during development and testing phase. On the basis of the flags it reports errors from mysqli function calls or queries which don't use an index (or use a bad index).

The flags are :
MYSQLI_REPORT_OFF Turns reporting off
MYSQLI_REPORT_ERROR Report errors from mysqli function calls
MYSQLI_REPORT_STRICT Report warnings from mysqli function calls
MYSQLI_REPORT_INDEX Report if no index or bad index was used in a query
MYSQLI_REPORT_ALL Set all options (report all)

bool mysqli_report ( int $flags )

Let's say if you are having:

mysqli_report(MYSQLI_REPORT_ALL ^ MYSQLI_REPORT_STRICT)

normal errors are generated instead of exceptions.

MySQL Performance Schema

MySQL Performance Schema is a feature for monitoring MySQL Server execution at a low level.Performance Schema is intended to provide access to useful information about server execution while having minimal impact on server performance
Performance Schema has these characteristics:
1.Performance Schema provides a way to inspect internal execution of the server at runtime.
2.Performance Schema monitors server events.
3.Performance Schema events are distinct from events written to the server's binary log (which describe data modifications) and Event Scheduler events (which are a type of stored program).
4.The PERFORMANCE_SCHEMA storage engine collects event data using “instrumentation points” in server source code.
5.Performance Schema configuration can be modified dynamically by updating tables in the performance_schema database via SQL statements. Configuration changes affect data collection immediately.

mysqldump command for csv file

The following command create two files in /tmp folder mytable.sql and mytable.txt. The sql file have the table creation schema and the txt file have the records of the mytable table with comma delimited fields.

$mysqldump -u user -p --fields-terminated-by=',' --tab=/tmp mydatabase mytable

NOTE: --tab option works only if the mysql client and the mysql server are running on the same machine.

Omitting the 'mytable' part in the above command will export all tables in the database, one table per file

Website Interface and Information Architercure for SEO

I believe website information architecture and page layout is an important part of an SEO strategies. As I'm a Software Engineer with a strong background in user-centered design (UCD), my opinion shouldn't astoundment anyone.

Web site's information architecture is the bottom line of successful information retrieval. And not just for popular Web search engines either. Search engines are only one part of information retrieval. A scent of information and sense of place are also key areas of information retrieval. As I've reviewed more Web analytics data, my assessment has only grown stronger to favour SEO website architecture.

If a house has a strong footing, it will be there for a long time. Without one, the house will belly up rather quickly. It's the same for a Web site. SEO should be about building that strong foundation, not chasing algorithms and capitalize on search engines. Start with a strong foundation. Furnishings can always be added, refined, and removed.

Cumulus Tag Cloud

Kiran Says

I love work environment which is:

Informal yet professional
Demanding yet rewarding
Challenging yet inspiring
Mediocrity is not an option
Having fun is serious business
Making mistakes is human
Forgiveness is Company Policy

Travelling Sucks