Python Django Profiler / Debugger : django-debug-toolbar

1 Comment

A configurable set of panels that display various debug information about the current request/response.

The Django Debug Toolbar is a configurable set of panels that display various debug information about the current request/response and when clicked, display more details about the panel’s content.

Currently, the following panels have been written and are working:

  • Django version
  • Request timer
  • A list of settings in settings.py
  • Common HTTP headers
  • GET/POST/cookie/session variable display
  • Templates and context used, and their template paths
  • SQL queries including time to execute and links to EXPLAIN each query
  • List of signals, their args and receivers
  • Logging output via Python’s built-in logging, or via the logbook module

There is also one Django management command currently:

  • debugsqlshell: Outputs the SQL that gets executed as you work in the Python interactive shell.

1.)  Install the django debug toolbar with easy install 

E:\>cd python

E:\python>cd Scripts

E:\python\Scripts>easy_install.exe django-debug-toolbar

Searching for django-debug-toolbar

Reading http://pypi.python.org/simple/django-debug-toolbar/

Reading http://robhudson.github.com/django-debug-toolbar/

Reading http://github.com/robhudson/django-debug-toolbar/downloads

Reading http://rob.cogit8.org/blog/2008/Sep/19/introducing-django-debug-toolbar/

Best match: django-debug-toolbar 0.8.5

Downloading http://pypi.python.org/packages/source/d/django-debug-toolbar/django-debug-toolbar-0.8.5.tar.gz#md5=0815d5071bb0628b

85e9915007e053

Processing django-debug-toolbar-0.8.5.tar.gz

Running django-debug-toolbar-0.8.5\setup.py -q bdist_egg –dist-dir c:\docume~1\maheshp\locals~1\temp\easy_install-e1thej\django

ebug-toolbar-0.8.5\egg-dist-tmp-zt7aws

Adding django-debug-toolbar 0.8.5 to easy-install.pth file

Installed e:\python\lib\site-packages\django_debug_toolbar-0.8.5-py2.7.egg

Processing dependencies for django-debug-toolbar

Finished processing dependencies for django-debug-toolbar

E:\python\Scripts>

2.) Change in setting

A.)

Add the following middleware to your project’s settings.py file:

‘debug_toolbar.middleware.DebugToolbarMiddleware’,

B.)

Make sure your IP is listed in the INTERNAL_IPS setting. If you are working locally this will be:

INTERNAL_IPS = (’127.0.0.1′,)

C.)

Add debug_toolbar to your INSTALLED_APPS setting so Django can find the template files associated with the Debug Toolbar.

‘debug_toolbar’,

3.) More information:

http://pypi.python.org/pypi/django-debug-toolbar/

http://packages.python.org/distribute/easy_install.html

http://pypi.python.org/pypi/setuptools

Set / Change / Reset the MySQL root password on Ubuntu Linux

Leave a comment

How reset MySQL password?

IconsPage/IconWarning3.png Following this procedure, you will disable access control on the MySQL server. All connexions will have a root access. It is a good thing to unplug your server from the network or at least disable remote access.

To reset your mysqld password just follow these instructions :

  • Stop the mysql demon process using this command :
     sudo /etc/init.d/mysql stop
  • Start the mysqld demon process using the –skip-grant-tables option with this command
     sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking &

Because you are not checking user privs at this point, it’s safest to disable networking.

  • start the mysql client process using this command
     mysql -u root
  • from the mysql prompt execute this command to be able to change any password
     FLUSH PRIVILEGES;
  • Then reset/update your password
     SET PASSWORD FOR root@'localhost' = PASSWORD('password');
  • If you have a mysql root account that can connect from everywhere, you should also do:
     UPDATE mysql.user SET Password=PASSWORD('newpwd') WHERE User='root';
  • Alternate Method:
     USE mysql 
     UPDATE user SET Password = PASSWORD('newpwd') 
     WHERE Host = 'localhost' AND User = 'root';
  • And if you have a root account that can access from everywhere:
     USE mysql 
     UPDATE user SET Password = PASSWORD('newpwd') 
     WHERE Host = '%' AND User = 'root';

For either method, once have received a message indicating a successful query (one or more rows affected), flush privileges:

 FLUSH PRIVILEGES;

Then stop the mysqld process and relaunch it with the classical way:

 sudo /etc/init.d/mysql stop 
 sudo /etc/init.d/mysql start

Note: This method is not regarded as the securest way of resetting the password. However it works.

References

MySQL 5.0 Reference Manual: How to Reset the Root Password

https://help.ubuntu.com/community/MysqlPasswordReset

http://ubuntu.flowconsult.at/en/mysql-set-change-reset-root-password/

Template Library for CodeIgniter, the PHP Framework

Leave a comment

Template has been verified to work with CodeIgniter 1.7

The Template library, written for the CodeIgniter PHP-framework, is a wrapper for CI’s View implementation. Template is a reaction to the numerous questions from the CI community regarding how one would display multiple views for one controller, and how to embed “views within views” in a standardized fashion. In addition, Template provides extra Views loading capabilities, the ability to utilize any template parser (like Smarty), and shortcuts for including CSS, JavaScript, and other common elements in your final rendered HTML.

Template is right for you if:

  • You feel like using views can be clunky, especially when “embedding” views.
  • You don’t like calling header, footer, and other global views from every Controller method.
  • You prefer having one “master template” that can be changed for any controller in order to meet unique application design needs.
  • You don’t want to drastically alter the way you interface controllers and views.
  • You like clear, thorough documentation on par with CodeIgniter’s User Guide.

Ready to give Template a shot? Download it now and get started.

What’s New in Version 1.4.1?

Version 1.4.1 is mostly a maintenance release, fixing comment and documentation typos. In addition, the 1.4.1 download now ships with its documentation. And finally, the Template class was renamed to work more like a core library so you can extend/overload/replace it in your application libraries folder, among other things.

Download Version 1.4.1

Template’s Approach

Template works by writing to pre-defined regions of a master template. Although you will most often write to your template from a Controller, you can write content to these regions from any part of your application. Content could be a simple string of plain text, HTML, or the results from a View. Regions display by echoing variables placed throughout your master template as desired. Template also lets you use multiple template configurations, making it completely flexible to meet the needs of your application’s design.

Here’s what using template looks like:

$this->template->write('title', 'Introduction to Template');
$this->template->write_view('content', 'blog/posts', $this->blog->get_posts());
$this->template->render();
Look interesting? Head over to the Getting Started section to begin using Template in your next CodeIgniter application.

Template User Guide:

More info:

http://williamsconcepts.com/ci/codeigniter/libraries/template/index.html
http://codeigniter.com/user_guide/libraries/parser.html

Other Template Library for CodeIgniter
http://maestric.com/doc/php/codeigniter_template

How to set InnoDB as a default storage engine for MySQL tables

Leave a comment

I use InnoDB storage engine in my projects because of its support for transactions and referral integrity rules. However, MySQL still creates new tables as MyISAM by default. It was so annoying for me to always define storage engine when creating new tables and double check that I didn’t forget it until I found how I can set InnoDB as default.

The solution is very easy:

  1. Open your MySQL configuration file: my.cnf or my.ini depending on your operation system.
  2. Locate [mysqld] section which usually goes at the top of file.
  3. Add this setting to the section:

    default-storage-engine = InnoDB

  4. Restart MySQL server.
  5. Enjoy your new new tables created as InnoDB w/o any additional worry.

The setting is applied to CREATE TABLE queries as well as tables created with phpMyAdmin, navicat and possibly any other MySQL client.

If you can’t change MySQL configuration file you still can change default storage engine used during a session by setting storage_engine system variable:

SET storage_engine=InnoDB;

More Info

http://www.innodb.com/

http://www.innodb.com/wp/products/innodb/

http://en.wikipedia.org/wiki/InnoDB

http://dev.mysql.com/doc/refman/5.5/en/innodb.html

http://dev.mysql.com/doc/refman/5.5/en/table-locking.html

http://tag1consulting.com/InnoDB_Performance_Tuning

http://www.mysqlperformanceblog.com/2009/01/12/should-you-move-from-myisam-to-innodb/


Web-Based Systems Management Tools

Leave a comment

Webmin

Webmin is a web-based interface for system administration for Unix. Using any modern web browser, you can setup user accounts, Apache, DNS, file sharing and much more. Webmin removes the need to manually edit Unix configuration files like /etc/passwd, and lets you manage a system from the console or remotely. See the standard modules page for a list of all the functions built into Webmin, or check out the screenshots.

check more information here:

http://www.webmin.com/

Virtualmin

Virtualmin is a powerful and flexible web server control panel based on the well-known Open Source web-based systems management GUI, Webmin. Manage your virtual domains, mailboxes, databases, applications, and the entire server, from one comprehensive and friendly interface.

check more information here:

http://www.virtualmin.com/

http://www.ispconfig.org/

http://www.tlbox.com/system_administrators/linux

http://www.google.com/Top/Computers/Software/Operating_Systems/Unix/Administration/Software/

http://www.topology.org/soft/admin.html

Free Hosting Manager

Free Hosting Manager is an open source CPanel/WHM Account Creator designed for free hosting companies. It is coded with PHP and MySQL. Our aim is to make free hosting management as easy, simple and hassle-free as possible.

http://www.fhm-script.com/index.php

web-cp is a full-featured, open source web hosting control panel written in PHP and released under the GPL.

http://www.web-cp.net/

RavenCore

The RavenCore Project is an Open Source hosting control panel aimed at making the most robust, secure, and reliable hosting software. And best of all, it is free!

http://www.ravencore.com/

JavaScript Programming Patterns

Leave a comment

JavaScript Programming Patterns

  1. The Old-School Way
  2. Singleton
  3. Module Pattern
  4. Revealing Module Pattern
  5. Custom Objects
  6. Lazy Function Definition

http://www.klauskomenda.com/code/javascript-programming-patterns/

http://www.webreference.com/programming/javascript/ncz/column5/index.html

Model-View-Controller (MVC) with JavaScript

1 Comment

Model-View-Controller (MVC) with JavaScript

http://www.alexatnet.com/content/model-view-controller-mvc-javascript

AJAX and the Model-View-Controller Design Pattern

http://roborant.info/main.do?entry=1305

JavaScript Programming Techniques

http://www.informit.com/articles/article.aspx?p=27769

http://en.wikipedia.org/wiki/Model–View–Controller

Google Chrome Extensions for web developers

Leave a comment

Web Developer

Adds a toolbar button with various web developer tools.

Measureit!

Draw out a ruler that will help you get the pixel width and height of any elements on a webpage.

Eye Dropper

Eye Dropper and Color Picker extension which allows you to pick color from any webpage or from advanced color picker.

Instant Image Editor

Edit any image or background image instantly.

Picnik

Capture web pages and edit images right in your browser using Picnik.

SpeedTracer

Get insight into the performance of your web applications.

Pendule

Web developer tools for Chrome.

Like more

https://chrome.google.com/extensions/featured/web_dev?hl=en-US

How to install FTP Client (gFTP)

Leave a comment

Prerequisites: add universe and multiverse repositories.

Open a terminal window and type in:
sudo apt-get install gftp
killall gnome-panel

The second command refreshes the GNOME panel.

You can find gFTP then in the Gnome menu under Applications -> Internet.

More information here:

http://www.ubuntux.org/how-to-install-ftp-client-gftp

MySQL Web / Desktop Management Tools

Leave a comment

1.) phpMyAdmin
phpMyAdmin is a free software tool written in PHP intended to handle the administration of MySQL over the World Wide Web. phpMyAdmin supports a wide range of operations with MySQL. The most frequently used operations are supported by the user interface (managing databases, tables, fields, relations, indexes, users, permissions, etc), while you still have the ability to directly execute any SQL statement.
http://www.phpmyadmin.net/home_page/
2.) Adminer
Adminer (formerly phpMinAdmin) is a full-featured MySQL management tool written in PHP. Conversely to phpMyAdmin, it consist of a single file ready to deploy to the target server.
http://www.adminer.org/
3.) MySQL Workbench

MySQL Workbench is a unified visual tool for database architects, developers, and DBAs. MySQL Workbench provides data modeling, SQL development, and comprehensive administration tools for server configuration, user administration, and much more. MySQL Workbench is available on Windows, Linux and Mac OS.

http://www.mysql.com/products/workbench/

4.) HeidiSQL – a free MySQL front-end

http://www.heidisql.com/

HeidiSQL is an easy-to-use interface and a “working-horse” for web-developers using the popular MySQL-Database. It allows you to manage and browse your databases and tables from an intuitive Windows® interface.

5.) Navicat well-designed (GUI), Navicat for MySQL

Navicat for MySQL is a powerful Database administration and development tool for MySQL. It works with any MySQL Database Server from version 3.21 or above, and supports most of the latest MySQL features including Trigger, Stored Procedure, Function, Event, View, and Manage User, etc.

http://www.navicat.com/

6.) EMS SQL Manager for MySQL

EMS SQL Manager for MySQL is a high performance tool for MySQL database administration and development. It works with any MySQL versions from 3.23 to the newest one and supports all of the latest features including MySQL triggers, views, stored procedures and functions, InnoDB foreign keys, Unicode data and so on. SQL Manager for MySQL allows you to create/edit all MySQL database objects, design MySQL databases visually, run SQL scripts, import and export MySQL database data, manage MySQL users and their privileges and has many other useful features for efficient MySQL administration. SQL Manager for MySQL has a state-of-the-art graphical user interface with well-described wizard system, so clear in use that even a newbie will not be confused

http://www.sqlmanager.net/en/products/mysql/manager

7.) SIDU 3.2 DB Web GUI

http://sidu.sourceforge.net/sidu/

8.) SQLyog MySQL GUI

SQLyog MySQL GUI is the most powerful MySQL manager and admin tool, combining the features of MySQL Query Browser, Administrator, phpMyAdmin and other MySQL Front Ends and MySQL GUI tools in a single intuitive interface.

http://www.webyog.com/en/

9.) MySQL-Front

http://www.mysqlfront.de/wp/

http://www.brothersoft.com/mysql-front-80299.html

More information here:

http://en.wikipedia.org/wiki/MySQL

http://en.wikipedia.org/wiki/Comparison_of_database_tools

PHP5 Charting Library Built On Google Chart API

Leave a comment

Lightweight JavaScript framework designed for HTML5

1 Comment

Jo JavaScript Application Framework for HTML5

jo is a lightweight JavaScript framework designed for HTML5 apps.Available as a zip download or with git from GitHub.

jo does

  • Embrace JavaScript’s object model and loosely typed nature
  • Leverage CSS3 to handle as much of the pretty presentation and animation as possible
  • Provide a consistent and modular event model between objects
  • Wrap DOM and device-specific events into a cohesive gesture system
  • Insulate developers from different persistent storage solutions
  • Play nicely with other libraries like PhoneGap

Philosophy

If you want to jam an existing web page into an application framework, jo probably isn’t for you. jo is designed to create applications. While it will play nicely with a mixture of new and old web development techniques, it uses HTML5 as a development stack and does not require direct DOM manipulation.

Readmore here»

http://grrok.com/jo/

25 EXCELLENT PHP TOOLS THAT ENHANCE THE WAY YOU DEVELOP

Leave a comment

PHP has grown to become one of the most wide-spread server-side scripting language that’s used on a daily basis in a variety of ways. For the most part, almost every developer that’s introduced to this programming language uses it and becomes fond of it at some point. With the support of a very large community, this incredibly fast technology is taking over other server-side scripting languages. If you conduct a quick search on the subject you’ll find countless ready-to-use scripts and a fist-full of quality frameworks.

Here you can see we’ve complied 25 Excellent PHP Tools That Will Enhance The Way You Develop in detail. Take a look at a few of these tools, assess which ones address your needs, and take advantage of them. After all, they’re there for us to use.

Read full entry here»

http://www.reencoded.com/2010/02/06/25-excellent-php-tools-that-enhance-the-way-you-develop/

web-based systems management tools

Leave a comment

Virtualmin

Virtualmin is a powerful and flexible web server control panel based on the well-known Open Source web-based systems management GUI, Webmin. Manage your virtual domains, mailboxes, databases, applications, and the entire server, from one comprehensive and friendly interface.

check more information here:

http://www.virtualmin.com/

Webmin

Webmin is a web-based interface for system administration for Unix. Using any modern web browser, you can setup user accounts, Apache, DNS, file sharing and much more. Webmin removes the need to manually edit Unix configuration files like /etc/passwd, and lets you manage a system from the console or remotely. See the standard modules page for a list of all the functions built into Webmin, or check out the screenshots.

check more information here:

http://www.webmin.com/


Web site load testing / web performance

Leave a comment

Howto: Performance Benchmarks a Webserver

here is simple examples for web site load testing

http://www.cyberciti.biz/tips/howto-performance-benchmarks-a-web-server.html

here is about apache bench process.

http://httpd.apache.org/docs/2.0/programs/ab.html

http://en.wikipedia.org/wiki/ApacheBench

Older Entries

Follow

Get every new post delivered to your Inbox.