<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-23059582</id><updated>2011-07-07T13:56:36.313-07:00</updated><category term='Python'/><category term='MySQL'/><title type='text'>0 ---&gt; 1</title><subtitle type='html'>Enjoy the beauty of uncertainty!</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://turing4ever.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23059582/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://turing4ever.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Michael Wang</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://4.bp.blogspot.com/_e820zh6ceKI/SiliCrpq_NI/AAAAAAAAAQw/Dpn6HZywego/S220/graffiti_artist.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>5</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-23059582.post-3118316326423230224</id><published>2008-07-31T22:27:00.000-07:00</published><updated>2008-07-31T23:17:34.040-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>Automatically convert data type when using MySQLdb</title><content type='html'>Add following lines:&lt;br /&gt;&lt;br /&gt;from MySQLdb.constants import FIELD_TYPE&lt;br /&gt;&lt;br /&gt;def DateTime2string(object):&lt;br /&gt;    return str(object)&lt;br /&gt;&lt;br /&gt;conv_dict = MySQLdb.converters.conversions&lt;br /&gt;conv_dict[FIELD_TYPE.DATETIME] = DateTime2string&lt;br /&gt;&lt;br /&gt;conn = MySQLdb.connect (host    = 'host',&lt;br /&gt;                  port    = 'port',&lt;br /&gt;                  user    = 'user',&lt;br /&gt;                  passwd  = 'passwd',&lt;br /&gt;                  db      = 'db',&lt;br /&gt;                  conv    = conv_dict&lt;br /&gt;                 )&lt;br /&gt;Then the cursor will automatically convert all fields of DateTime type in resultset into str for you.&lt;br /&gt;This trick was inspired by &lt;a href="http://www.jejik.com/articles/2007/04/automagically_convert_python_objects_to_mysql/"&gt;this post&lt;/a&gt; which unfortunately didn't work for me. &lt;span style="text-decoration: underline;"&gt;&lt;/span&gt;&lt;a href="http://www.jejik.com/articles/2007/04/automagically_convert_python_objects_to_mysql/"&gt;&lt;br /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23059582-3118316326423230224?l=turing4ever.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://turing4ever.blogspot.com/feeds/3118316326423230224/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23059582&amp;postID=3118316326423230224' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23059582/posts/default/3118316326423230224'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23059582/posts/default/3118316326423230224'/><link rel='alternate' type='text/html' href='http://turing4ever.blogspot.com/2008/07/automatically-convert-data-type-when.html' title='Automatically convert data type when using MySQLdb'/><author><name>Michael Wang</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://4.bp.blogspot.com/_e820zh6ceKI/SiliCrpq_NI/AAAAAAAAAQw/Dpn6HZywego/S220/graffiti_artist.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23059582.post-5640676457293509295</id><published>2008-04-19T11:08:00.000-07:00</published><updated>2008-04-21T11:19:33.062-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><title type='text'>spockproxy released!</title><content type='html'>&lt;a href="http://spockproxy.sourceforge.net/"&gt;http://spockproxy.sourceforge.net/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23059582-5640676457293509295?l=turing4ever.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://turing4ever.blogspot.com/feeds/5640676457293509295/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23059582&amp;postID=5640676457293509295' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23059582/posts/default/5640676457293509295'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23059582/posts/default/5640676457293509295'/><link rel='alternate' type='text/html' href='http://turing4ever.blogspot.com/2008/04/spockproxy-released.html' title='spockproxy released!'/><author><name>Michael Wang</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://4.bp.blogspot.com/_e820zh6ceKI/SiliCrpq_NI/AAAAAAAAAQw/Dpn6HZywego/S220/graffiti_artist.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23059582.post-114117197580681516</id><published>2006-02-28T16:12:00.000-08:00</published><updated>2008-04-21T11:17:41.617-07:00</updated><title type='text'>How to modify the configuration of OPENT</title><content type='html'>The philosophy of OPNET configuration is that they keep all the config info organised as a database.So whatever you want to change, go to the "edit"-&gt;"preference", find the corresponding item and modify it.For example,a.the default setting of OPNET is to close on each saving editting. that is rediculous,because I always press "ctrl_S" after I make a modification. So, change it in "Edit"--&gt;"Preference":find item "process_edit_close_on_save" and change it into "false"b.in "Preference""vudoc_prog" setting the path of the Acrobat reader.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23059582-114117197580681516?l=turing4ever.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://turing4ever.blogspot.com/feeds/114117197580681516/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23059582&amp;postID=114117197580681516' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23059582/posts/default/114117197580681516'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23059582/posts/default/114117197580681516'/><link rel='alternate' type='text/html' href='http://turing4ever.blogspot.com/2006/02/how-to-modify-configuration-of-opent.html' title='How to modify the configuration of OPENT'/><author><name>Michael Wang</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://4.bp.blogspot.com/_e820zh6ceKI/SiliCrpq_NI/AAAAAAAAAQw/Dpn6HZywego/S220/graffiti_artist.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23059582.post-114097973486267723</id><published>2006-02-26T10:47:00.000-08:00</published><updated>2006-02-26T10:48:54.866-08:00</updated><title type='text'>sunrise</title><content type='html'>&lt;a href="http://photos1.blogger.com/blogger/3593/1644/640/beijing%20141.jpg"&gt;&lt;img style="CLEAR: all; FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="http://photos1.blogger.com/blogger/3593/1644/320/beijing%20141.jpg" border="0" /&gt;&lt;/a&gt;&amp;nbsp;&lt;a href='http://picasa.google.com/blogger/' target='ext'&gt;&lt;img src='http://photos1.blogger.com/pbp.gif' alt='Posted by Picasa' style='border: 0px none ; padding: 0px; background: transparent none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;' align='middle' border='0' /&gt;&lt;/a&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23059582-114097973486267723?l=turing4ever.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://turing4ever.blogspot.com/feeds/114097973486267723/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23059582&amp;postID=114097973486267723' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23059582/posts/default/114097973486267723'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23059582/posts/default/114097973486267723'/><link rel='alternate' type='text/html' href='http://turing4ever.blogspot.com/2006/02/sunrise.html' title='sunrise'/><author><name>Michael Wang</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://4.bp.blogspot.com/_e820zh6ceKI/SiliCrpq_NI/AAAAAAAAAQw/Dpn6HZywego/S220/graffiti_artist.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23059582.post-114097885365415703</id><published>2006-02-26T10:33:00.000-08:00</published><updated>2006-02-26T10:34:13.670-08:00</updated><title type='text'>Today is the birthday of this blog!</title><content type='html'>:)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/23059582-114097885365415703?l=turing4ever.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://turing4ever.blogspot.com/feeds/114097885365415703/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=23059582&amp;postID=114097885365415703' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23059582/posts/default/114097885365415703'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23059582/posts/default/114097885365415703'/><link rel='alternate' type='text/html' href='http://turing4ever.blogspot.com/2006/02/today-is-birthday-of-this-blog.html' title='Today is the birthday of this blog!'/><author><name>Michael Wang</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://4.bp.blogspot.com/_e820zh6ceKI/SiliCrpq_NI/AAAAAAAAAQw/Dpn6HZywego/S220/graffiti_artist.jpg'/></author><thr:total>0</thr:total></entry></feed>
