Customize your mantis

Here I am not going to talk about how to config the Issue life cycle. There are so many life cycle articles talking about it, and each company all have their standard.

Some article you may interested related mantis debug life cycle

http://www.warelab.org/blog/?p=24

http://www.suitable.com/docs/mantisbt.html

http://www.scribd.com/doc/2088848/Mantis-Administration-Guide

Here I want to talk about how to achieve this, in other words how to configure the display (the strings) in each selection.

Like in article http://www.suitable.com/docs/mantisbt.html, it talked about

Severity

An issue property, answering the question “when the problem occurs, how bad are the effects?” Specified by the reporter that created the issue, but may be changed later. Possible values are:

  • Feature: issue does not describe a problem
  • Typo: text is incorrect
  • Trivial: extremely minor issue
  • Minor: not trivial, but there is a workaround
  • Major: there is no workaround
  • Crash: product crashes
  • Block: prevents operating or testing part of system

[Note that I removed the default Mantis severity “Tweak”, since it seemed too close to “Trivial”. I also renamed “Text” to “Typo”, since the latter seems clearer.]

Reproducibility

An issue property, giving how often the issue has been seen when trying to reproduce it. Specified by the reporter that created the issue, but may be changed later. Possible values are:

  • always
  • sometimes
  • rarely
  • not seen again
  • have not tried
  • N/A

[Note that the default Mantis strings are always, sometimes, random, have not tried, unable to reproduce, N/A. I’ve regularized them so that they all could fit into the same statement about reproducibility.]

How to make it? Although, mantis offer various customized related working flow and role and others in the web view, there are no straight configuration in Mantis web pages to achieve it.

Mantis have default setting of those strings, and default config setting:

config_filter_defaults_inc.php   (contain global strings)

/core/constant_inc.php            (contain constant define)

/lang/*.txt  (for English language is strings_english.txt)

The most beautiful thing is you do not have to modify these default setting, what you have to do is to use custom setting file to overwrite them.

Here is the solution,

Create two files under mantis root folder:

custom_constant_inc.php

custom_strings_inc.php

And in custom_constant_inc.php file write the code below, you do not have to define the constant system already have.

<?php
# severity
define( 'TYPO', 15 );

# reproducibility
define( 'REPRODUCIBILITY_RARLY', 35 );
define( 'REPRODUCIBILITY_NOTSEEN', 40);

In custom_strings_inc.php write those:

<?php
# Note that we don’t have to remove the Updater entry from the
if ( lang_get_current() === 'english') {
$s_severity_enum_string ='10:feature,15:typo,20:trivial,50:minor,60:major,70:crash,80:block';
$s_reproducibility_enum_string = '10:always,30:sometimes,35:rarely,40:not seen again,70:have not tried,100:N/A';}

And in config_inc.php

# Customize severity and default when reporting a new bug
$g_severity_enum_string = '10:feature,15:typo,20:trivial,50:minor,60:major,70:crash,80:block';
$g_default_bug_severity = 10;

# Customize priority and default when reporting a new bug
$g_reproducibility_enum_string = '10:always,30:sometimes,35:rarely,40:not seen again,70:have not tried,100:N/A';
$g_default_bug_reproducibility = 10;

All right, now log in your mantis, have a look at what we got:)

Using Mantis to tracking defects

I am working on a project with remote people. Right now, all our communication is using e-mails including the defects tracking. It is so hard to maintain e-mail, even you can make some label and group for it, it is not enough for a project.

The bug tracking step is very important for the whole quality of software, and QA will rely on it to monitor software developing processing.

“The main benefit of a bug-tracking system is to provide a clear centralized overview of development requests (including both bugs and improvements, the boundary is often fuzzy), and their state. The prioritized list of pending items (often called backlog) provides valuable input when defining the product roadmap, or maybe just “the next release”.” I copy this paragraph from wiki(http://en.wikipedia.org/wiki/Bug_tracking_system)

Also I believe bug-tracking record is a big knowledge resources, we can track what happened before, the avoid or fix what we are facing now.

Considering about the remote people, we have to select a product which can support remote working, so web-based system will be the best fit.

At last, I decide to use Mantis for our tracking system.

To install it is a really happy hour. It is not so hard to install.

I use xampp to solve the  Apache, MySQL, PHP and Mercury Mail issue. You just need to install xampp by double click the installing executable file, it is really enjoyable to have such a type of integrate software. (You can get it from http://www.apachefriends.org/en/xampp.html)

Next, to install mantis in our web server, download it from http://www.mantisbt.org/

unzip to a folder, for my case I unzip in this path: D:\mantis

and set up our Directory in apache, open httpd.conf, add the following content in it

Alias /mantis "D:/mantis/"
<Directory "D:/mantis/">
    Options Indexes
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

So that you can make mantis as your sub address of your site.

Like put localhost/mantis  in your browser address column, it will guide to mantis, be careful that you should modify D:/mantis/ to your path of mantis.

And do not forget set up your MySql root password, you can use this link to do it.

http://localhost/security/xamppsecurity.php

Next, I create a database name mantis for mantis using, and a account with fully privilege named mantis using phpMyAdmin

All right, next we should start to install mantis, if is not so hard, you can follow my step.

1. Unzip mantis download form http://www.mantisbt.org/  to D:/mantis which I have set it before.

2. Put localhost/mantis  in your browser address, so that browser will direct you to the mantis install page

3.install mantis

Type of Database:   MySQL(default)

Hostname (for Database Server):   localhost
Username (for Database),           the account name created before
Password (for Database)         :   the account password created before
Database name (for Database)     the database created before for my case is mantis
Admin Username (to create Database ifrequired),  MySql Admin Username mine is root
Admin Password (to create Database ifrequired):  the password
Print SQL Queries instead of Writing to theDatabase    make sure check it!

Click Install/Upgrade Database

3. All right now

Setting Database Hostname,  Setting Database Type,  Checking PHP support for database type, Setting Database Username, Setting Database Password, Setting Database Name, Setting Admin Username, Setting Admin Password, Attempting to connect to database as admin, Attempting to connect to database as user, Checking Database Server Version,  should be all GOOD in green.

But, there maybe still some BAD in Checking Installation section.

Now, what you have to do is copy all SQL commands from Installing Database Section and remove the warring information in red, and Paste them to SQL tab in mantis database

4. After doing all these, close your browser and re-open it put  http://localhost/mantis/ in address column. You can see the log in page of mantis. That means you have install mantis correctly. You can use default account to log in mantis which is :

Account Name: administrator

Password: root

Well, next what you have to do is to configure mantis.

Extra JpGraph installation:

JpGraph is useful for your summary and report in mantis to install you have to go to

http://jpgraph.net/  to download it.

And unzip it in the root folder under mantis. Add next two lines in config_inc.php of mantis

$g_jpgraph_path= 'jpgraph/src/';
$g_use_jpgraph=ON;

Attention, If you do not like administrator as admin account, Please do not remove the default till you have set up e-mail and create your own admin account. Or you can just change the password of the administrator for future use.

To configure e-mail function of mantis is a really high priority tasks, because without e-mail supporting you can not register user for mantis.

For my case, I use Mercury as my e-mail server. Thanks to http://www.danieltmurphy.com/setting-up-mercury-smtp/ which guide me set up my Mercury

To make it working correctly you have to do the step following:

Setup DNS for your NIC

  • Go to Start->Network Connections
  • Edit the NIC you are using
  • Double Click TCP/IP settings
  • Manually enter in the DNS servers from your ISP

Disable unneeded Protocols

  • Start Mercury from the Control Panel
  • Go to CONFIGURATION->PROTOCOL MODULES
  • Disable everything except the MERCURYC SMTP RELAY CLIENT and MERCURYS SMTP SERVER
  • Restart Mercury

Make Changes to Core Module

  • Go to CONFIGURATION->MERCURY CORE MODULE then the GENERAL tab
  • Check to make sure “localhost” is the value of “internet name for this system”
  • Disable all but “send copies of all errors to postmaster”
  • check tab “Local Domains” make sure Localhost is there
  • Close and save

Edit MercuryS SMTP Server

  • Open CONFIGURATION -> MERCURY S SMTP SERVER
  • Choose general tab and enter name as SMTP
  • Make sure port 25 is listed
  • Add 127.0.0.1 to “IP interface to use”
  • Go to Connection Control and add 127.0.0.1 to the list
  • Un-check “do not permit SMTP relaying to non-local mail”
  • Close and Save

Edit MercuryC SMTP Client

  • Open CONFIGURATION -> MERCURYC SMTP CLIENT
  • Enter in external SMTP client (smtp.google.com for example) on port 465 with SSL encryption using direct connection (or whatever ports are supported)
  • Enter your login name (in most case it should be the full name of e-mail address)and password to that external SMTP server
  • Close and Save

Edit PHP.INI file to include from line

  • Then go edit your PHP.INI file in XAMPP
  • Under [mail function] add the line “sendmail_from = admin@localhost
  • Stop and restart Mercury and Apache

Here is my setting of PHP.ini, I also create php_mail.log under \xampp\apache\logs to log php mail function event.

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = admin@localhost

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
;sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =

; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header = Off

; Log all mail() calls including the full path of the script, line #, to address and headers
mail.log = "C:\xampp\apache\logs\php_mail.log"

For mantis config_inc.php, you can copy my setting, make sure to use PHPMAILER_METHOD_MAIL since if you use my way, since I rely on the main() of PHP

# --- Email Configuration ---
$g_phpMailer_method		= PHPMAILER_METHOD_MAIL; # or PHPMAILER_METHOD_SMTP, PHPMAILER_METHOD_SENDMAIL
$g_smtp_host			= 'localhost';			# used with PHPMAILER_METHOD_SMTP
$g_smtp_username		= '';					# used with PHPMAILER_METHOD_SMTP
$g_smtp_password		= '';					# used with PHPMAILER_METHOD_SMTP
$g_administrator_email  = 'admin@localhost.com';
$g_webmaster_email      = 'admin@localhost.com';
$g_from_name			= 'Mantis Bug Tracker';
$g_from_email           = 'admin@localhost.com';	# the "From: " field in emails
$g_return_path_email    = 'admin@localhost.com';	# the return address for bounced mail
$g_email_receive_own	= OFF;
$g_email_send_using_cronjob = OFF;

Now,reset your apache, mercury, and you should have enabled the E-Mail Function of Mantis. Enjoy it. you can register and e-mail any event from Mantis.

Joomla Plug-in simple Image Gallery compatible issue

Recently, my company need to modify WebSite.

Previously, we used Joomla for our site platform, it is very cool CMS, I loved it. Right now, we bought a cool template which include a plug-in from joomlaworks — simple Image Gallery. It is a free extension for adding image galleries inside Joomla! articles.

But we meet a small defect that the tips display not correctly.

Here you will see what’s wrong with the tips:

You may notice JW_SIG_NAVTIP is a very wired description, what we did just add

{gallery}********{/gallery} in our articles, the image display right, but this tip is not what we expected.

First I went to Joomla administration site, in Extensions/Plugin Manager I find Simple Image Gallery (by JoomlaWorks), but there is no parameter setting for this tips issue.

So I have go into code level.

I go through the PHP code, find here is the reason.

In plugins\content\jw_simpleImageGallery\tmpl\Polaroids\default.php

I found  JW_SIG_NAVTIP words,

rel=”lightbox” title=”<?php echo JText::_(‘JW_SIG_NAVTIP’);?> <b><?php echo $row->title; ?></b><br /><br />” target=”_blank”>

JText::_  it means, it should be a string from language config file.

So what I should do is to check the language file, I am using en-GB language which is default setting in Joomla

In plugins\content\jw_simpleImageGallery_1.5.php,

$languageLoad=JPlugin::loadLanguage(‘plg_content_’.$this->plg_name, JPATH_ADMINISTRATOR);

In plugins\content\jw_simpleImageGallery.php, you can find variable plg_name

var $plg_name = “jw_simpleImageGallery”;

So, the language for simple Image Gallery  should be

en-GB.plg_content_jw_simpleImageGallery.ini under

administrator\language\en-GB folder.

I go to the folder, found the file. Open it I found the string I am looking for

JW_SIG_NAVTIP=”<b>Navigation tip:</b> Hover mouse on top of the right or left side of the image to see the next or previous image respectively.<br /><br />You are browsing images from the article:”CLICK TO ENLARGE=”Click to enlarge”

So if everything is right, it should display the “Navigation tip:*******” things, not JW_SIG_NAVTIP. From this I know the language file is not loaded properly.

I found that this plug-in save all strings in one file either for administration setting or site setting. And I do remember that I have go in the  Extensions/Plugin Manager  to check this the strings display correctly. If you like you can compare it by yourself.

And the JPlugin::loadLanguage API should works fine, because I check other plug in which use it. So I think maybe somehow Joomla can not find the language file.

I checked the API in libraries/joomla/plugin/plugin.php

/**
	 * Loads the plugin language file
	 *
	 * @access	public
	 * @param	string 	$extension 	The extension for which a language file should be loaded
	 * @param	string 	$basePath  	The basepath to use
	 * @return	boolean	True, if the file has successfully loaded.
	 * @since	1.5
	 */
	function loadLanguage($extension = '', $basePath = JPATH_BASE)
	{
		if(empty($extension)) {
			$extension = 'plg_'.$this->_type.'_'.$this->_name;
		}

		$lang =& JFactory::getLanguage();
		return $lang->load( strtolower($extension), $basePath);
	}

Notice that “strtolower” call, and the file under language folder is

en-GB.plg_content_jw_simpleImageGallery.ini which contain two upper characters.

For Operation System, the file name maybe case sensitive maybe not. Like, for windows you can configure this sensitive issue.

(http://technet.microsoft.com/en-us/library/cc725747.aspx)

so I tried to change en-GB.plg_content_jw_simpleImageGallery.ini into

en-GB.plg_content_jw_simpleimagegallery.ini

I do not have the change “GB”, since this language prefix it appended in

JLanguage::load() function (libraries/joomla/language/language.php)

which is called by $lang->load( strtolower($extension), $basePath); code.

So I got the expected view for my site.

But for the display of simple image in Extensions/Plugin Manager is missing.

Since in plugins\content\jw_simpleImageGallery.xml is using upper case file, as you can see below

<language tag=”en-GB”>en-GB.plg_content_jw_simpleImageGallery.ini</language>

So we should modify both of it to lower case, so that everything works fine.

But for me, I decide separate back-end and front-end setting.

So I copy en-GB.plg_content_jw_simpleImageGallery.ini as

en-GB.plg_content_jw_simpleimagegallery.ini to language\en-GB folder, be careful, it the not under administrator folder, it should be the path under your site root folder.

So what I have to modify just one line of code

In plugins\content\jw_simpleImageGallery_1.5.php,

From :

$languageLoad=JPlugin::loadLanguage(‘plg_content_’.$this->plg_name, JPATH_ADMINISTRATOR);

To:

$languageLoad=JPlugin::loadLanguage(‘plg_content_’.$this->plg_name)

To make simple image gallery load from site’s language setting not administrator language setting.

Next, if any one wish to modify the tips content, just modify the string value in language file.

How To Use App Store Promotion Codes on iPhone

Apple created app store promo codes in order to offer a way to distribute application for reviewing purposes. To use promotion codes can somehow allow reviewers to get the app on their iPhone, without having to pay for it.  And unluckily, it can only be use in US area. There are many articles talking about how to redeem the app on iTunes, here we will tell you how to do it on iPhone.

First, open your App store on you iPhone, normally you can find the icon on the first page.

Next, go down to the bottom of App Store you can find the button of Redeem:

Click it, and you will go into redeem view:

In redeem view, input your promotion code in the code text box and click go:

After loading, a window will pop up, select continue to go next steps:

System may ask for your Apple ID password, input your password and click ok:

Then WAIT~~~ be careful it may take minutes to wait, seems nothing happen, but please wait till the system happen to loading:

At last you will reach this step the app your wish to redeem will be downloading:

Django Dairy 2: It works~

The little foolish boy come back to struggle with Django.

Today, I do not have much time to work on it. I have to write a Help file for my application which is a boring issue…… but no one will help me in my company, I have to work on it myself…… using my poor poor English. Fortunately, this time nobody will spend their time on the stupid Help File…… well, in this case, my working on Help File will worth nothing… Anyway… Let’s go back to my little Django Project~~~

Today, I should work on PHP issue.

The installation works fine. But my Apache will not recognize PHP…

Well, first I found while I try to start Apache, there will be some warning like:

Warning: DocumentRoot [/opt/local/apache2/docs/dummy-host.example.com] does not exist
Warning: DocumentRoot [/opt/local/apache2/docs/dummy-host2.example.com] does not exist

I know it is the problem of

httpd-vhosts.conf

I delete the useless virtual hosts in the file, and only left one host for testing. This warning gone.

But I still got 404 error, whatever I tried http://127.0.0.1/index.html or http://127.0.0.1/index in my FireFox…

Not Found

The requested URL /index was not found on this server.

http://kanstech.blogspot.com/2010/12/apache-error-phpmotion-requested-url.html

The site listed above gave me the hint.

When you setup PHPMotion video website you will encounter the following error first,

The requested URL /upload-media was not found on this server.

It happens due to the error in Apache Config. Add the following Directory Element to the config file.

<Directory "/var/www/htdocs/htdocs">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>

If you face the problem like me, I think this time I can say some trick about it

Just go to httpd.conf of your Apache, mine is at /opt/local/apache2/conf/

Type

sudo vi /opt/local/apache2/conf/httpd.conf

in your shell, and search for the Directory you use for web root, see if you give the right permission, for my case, I gave “deny from all” to my root directory, now I changed it to “Allow from all”.

Finally, my index.html in the DoucmentRoot of Apache works fine.

I saw It works~~~, really happy.

Next, what’s going on of my PHP testing file phpinfo.php?

<?phpphpinfo();?>

I found everywhere, at beginning I thought my PHP is not installed correctly.

But it should installed well. Next, I found the point, I use TextWrangler to edit phpinfo.php file at first, but now I try to use vi to open it, I found lots of unexpected characters exists at the top of the file. So I remove it, and phpinfo.php works well.

Here, I tell everybody a trick, I think maybe I am the last one know it, haha~~

Here, if you do not like vi, and you have to use root user permission to open a text file, you can use TextEdit for example:

sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit phpinfo.php

Till now, Apache works, MySql works, PHP works,

So next, I tried to install phpMyAdmin
another problem came out, Chris Gilmer said to modify config.inc.php like this:

<?php
$i = 0;

$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'config';  // Authentication method (config, http or cookie based)?
$cfg['Servers'][$i]['user'] = 'root';         // MySQL User
$cfg['Servers'][$i]['password'] = 'mypassword';  // MySQL Password (only needed with 'config' auth_type)

/* Server parameters */
$cfg['Servers'][$i]['host'] = '127.0.0.1'; // was 'localhost';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['connect_type'] = 'socket'; // was 'tcp';
$cfg['Servers'][$i]['compress'] = false;

/* Select mysqli if your server has it */
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['socket'] = '/tmp/mysql.sock';

$cfg['UploadDir'] = ;
$cfg['SaveDir'] = ;

?>

But it does not work for me, my phpMyAdmin said 2002 error, complaining about the ‘mysql.sock’ issue.

But, I know my MySql works fine the socket is working. So that I use nestat -ln|grep mysql to look for the TCP status.

System told me:

8a5c5f0 stream 0 0 f745b2c 0 0 0 /opt/local/var/run/mysql5/mysqld.sock

I noticed that it is using /opt/local/var/run/mysql5/mysqld.sock

And I also check by

mysqladmin5 -u root -p variables

mysqladmin5 -p version

All of them told me the location of .sock is not $cfg[‘Servers’][$i][‘socket’] = ‘/tmp/mysql.sock’;

So I change it to $cfg[‘Servers’][$i][‘socket’] = ‘/opt/local/var/run/mysql5/mysqld.sock’;

And also used

sudo vi /opt/local/etc/php5/php.ini

to change the mysql.default_socket.

mysql.default_socket = '/opt/local/var/run/mysql5/mysqld.sock'

And still phpMyAdmin is not working correctly.

Finally, I changed config.inc.php to the content followed:

sudo vi /opt/local/www/phpmyadmin/config.inc.php

$i = 0;

/*
* First server
*/
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie'; //Authentication method(config, http or cookie based)?
$cfg['Servers'][$i]['user']='root'; //mysql user
$cfg['Servers'][$i]['password'] = '';
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost'; // was 'localhost'
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['connect_type'] = ''; // was 'tcp'
$cfg['Servers'][$i]['compress'] = false;

/* Select mysqli if your server has it */
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['socket'] = '';

Everything is ok. phpMyAdmin works.

The next step is very easy just follow the article. And my mod_wsgi works well.

After I installed Django, I use django-admin.py startproject mysite

and python manage.py runserver to test django. Yes, it works fine.

Now, what I should do is to hook django with Apache to finish all my environment setup.

But it is still not a easy task for me.

I read various article talking about it

http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango

http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango

http://blog.stannard.net.au/2010/12/11/installing-django-with-apache-and-mod_wsgi-on-ubuntu-10-04/

And all of them can not solve my problem, I always got ImportError: No module named django.core.handlers.wsgi by using

tail /opt/local/apache2/logs/error_log

to check the error log.

Finally, I found a solution. Here I list all my setting for it

/opt/local/apache2/conf/extra/apache_django_wsgi.conf (this file is used for httpd.conf as VirtualHost referenced file)

<VirtualHost *:80>
ServerName simpleknow.djangoserver
DocumentRoot "/Users/zsspkx/workingspace/web/simpleknow"

<Directory "/Users/zsspkx/workingspace/web/simpleknow">
Order deny,allow
Allow from all
</Directory>

Alias /media/ "/Users/zsspkx/workingspace/web/simpleknow/media/"
<Directory "/Users/zsspkx/workingspace/web/simpleknow/media">
Order deny,allow
Allow from all
</Directory>

WSGIScriptAlias / "/Users/zsspkx/workingspace/web/simpleknow/apache/django.wsgi"

<Directory "/Users/zsspkx/workingspace/web/simpleknow/apache">
Order deny,allow
Allow from all
</Directory>

</VirtualHost>

/workingspace/web/simpleknow/apache/django.wsgi (this file is created by me to help apache to load WSGI handler)

import os
import sys
sys.path.append ('/Library/Python/2.6/site-packages/')
path = '/Users/zsspkx/workingspace/web'
if path not in sys.path:
sys.path.append(path)
os.environ['DJANGO_SETTINGS_MODULE'] = 'simpleknow.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

You can see the file above, I add sys.path.append (‘/Library/Python/2.6/site-packages/’) to this file, since for MAC, django is installed under this path.

So now my Django can run on Apache.

However, I still have one problem left, after I modify setting under my site folder

DATABASES = {
'default': {
'ENGINE': 'mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'simpleknow',                      # Or path to database file if using sqlite3.
'USER': 'root',                      # Not used with sqlite3.
'PASSWORD': 'mysql',                  # Not used with sqlite3.
'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
}
}

try to use mysql through Python, My site is wrong. It told me Error loading MySQLdb module: No module named MySQLdb

I download MySQLdb and follow README
$ tar xfz MySQL-python-1.2.1.tar.gz
$ cd MySQL-python-1.2.1
$ # edit site.cfg if necessary
$ python setup.py build
$ sudo python setup.py install # or su first

build will fail. And I check Google, found I should do this way:

http://cd34.com/blog/programming/python/mysql-python-and-snow-leopard/

tar xzf MySQL-python-1.2.3c1.tar.gz
cd MySQL-python-1.2.3c1
ARCHFLAGS=’-arch x86_64′ python setup.py build
ARCHFLAGS=’-arch x86_64′ python setup.py install

The build and install passed, but my problem is not solved, I still face the warning.

Maybe this have to leave tomorrow, since it is very late today.

Django Dairy 1

Here is a new story, I try to use my poor English to record the days struggling with Django and related Web Technology. A big challenge for me~~

Some days before, I meet a programmer in a start-up meet. and heard about Django. A really interesting web framework using python.

At that time, I just wished to create a new site, and I think this is the time to learn new things.

However, the story between me and Django is not so sweat at the beginning. Since I am not a web guy, I do not familiar with Python, MySql also Apache, or anything related with Web……

I am a C programmer, and after that I used C++, C# and so on, but just for embedded system or window application. I only did some Joomla issue or HTML coding before. Now I can say I am facing a totally new world. This is the most exciting news for me!

Before, my trip of Django, I have to set up the environment of it, I have one laptop, one MAC mini, one windows desktop. I am newbie for MAC, and being attracted by it. So now, I turn to MAC world. I decide to set up a MAMP environment on MAC. I heard of that I should stop MAC default web server, and installed a new one, I do not know is it right or not, but I just followed.

My habit, go the Google type in MAMP, and I saw a very fantastic work, MAMP(http://www.mamp.info/en/index.html), and first tried to use it, but I got stuck… while I am trying add

LoadModule wsgi_module modules/mod_wsgi.so

in httpd.conf to load wsgi module for Apache which is recommended by Django.

It is not working. Either my Apache will not work, or my MySql. I can not get through it. So that I drop this way, and decided to installed it separately.

I found a article writing about Django working on MAMP by just put MAMP Django two words in Google searching box.

It is a blog written by Chris Gilmer, it is really helpful. I followed this article to setup everything up.

But it mostly depends on Mac Port, forgive my ignorant, I know nothing about it before. What can I do is just following the words it said.

But, things will not work in this way.

It will really good till I come this step:

To improve security of the mysql server configuration, please run mysql_secure_installation5 script and configure mysql password for root, network access, etc:

$cd /opt/local/bin

$mysql_secure_installation5

System asked me to input password……, I do not remember I have set up any password before, I tried everything I can come through, and system still do not let me go…

Finally I found a way to resetting the root password of MySql at

http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html

I used the Generic Instructions to pass my problem.

At the step of Starting/Stopping Apache and MySQL, I got to know what a fool I am……

first, I followed the way article told me, nothing happened……

After that my teacher Google told me that I should modify the file named ~/.tcshrc not ~/.cshrc so I did it. And it will not work, and bring me more error, at last I got to know, the syntax of alias is not right.

The article write like this

#
# Apache Aliases
#
alias apache2ctl 'sudo /opt/local/apache2/bin/apachectl'

#
# MySQL Aliases
#
#alias mysqlstart 'sudo /opt/local/bin/mysqld_safe5 &'
alias mysqlstart 'sudo /opt/local/share/mysql5/mysql5/mysql/mysql.server start'
alias mysqlstop '/opt/local/bin/mysqladmin5 -u root -p shutdown'

#
# PHP Aliases
#
alias php ”/opt/local/bin/php”

But what works for me is following this format:

#
# Apache Aliases
#
alias apache2ctl="sudo /opt/local/apache2/bin/apachectl"

#
# MySQL Aliases
#
#alias mysqlstart 'sudo /opt/local/bin/mysqld_safe5 &'
alias mysqlstart="sudo /opt/local/share/mysql5/mysql5/mysql/mysql.server start"
alias mysqlstop="/opt/local/bin/mysqladmin5 -u root -p shutdown"

#
# PHP Aliases
#
alias php=”/opt/local/bin/php”

I know I am not familiar with all the things I faced, maybe I made a stupid mistake, but anyway I got this point, And I will continue try it tomorrow.