<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Dot Mac</title>
	
	<link>http://dotmac.rationalmind.net</link>
	<description>Adventures with OS X and DotNet</description>
	<lastBuildDate>Wed, 07 Jul 2010 12:42:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/dotmacblog" /><feedburner:info uri="dotmacblog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Getting an OpenSocial user’s GPS coordinates with YQL</title>
		<link>http://feedproxy.google.com/~r/dotmacblog/~3/EsL3f1v_rXw/</link>
		<comments>http://dotmac.rationalmind.net/2010/06/getting-an-opensocial-users-gps-coordinates-with-yql/#comments</comments>
		<pubDate>Tue, 08 Jun 2010 16:34:30 +0000</pubDate>
		<dc:creator>David Veksler</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[OpenSocial]]></category>
		<category><![CDATA[OpenSocial Javascript]]></category>
		<category><![CDATA[YAP]]></category>
		<category><![CDATA[YQL]]></category>

		<guid isPermaLink="false">http://dotmac.rationalmind.net/?p=191</guid>
		<description>This code is designed to run inside a Yahoo Open App, but it can be adapted for any OpenSocial widget written with the JavaScript API. It uses OpenSocial to get the users unstructured location and YQL to convert it into GPS coordinates. &amp;#60;script type=&amp;#34;text/javascript&amp;#34;&amp;#62; &amp;#160; function getProfile&amp;#40;&amp;#41; &amp;#123; var req = opensocial.newDataRequest&amp;#40;&amp;#41;; var opt_params = [...]</description>
			<content:encoded><![CDATA[<p>This code is designed to run inside a <a href="http://developer.yahoo.com/yap/">Yahoo Open App</a>, but it can be adapted for any OpenSocial widget written with the <a href="http://wiki.opensocial.org/index.php?title=JavaScript_API_Overview_%28v0.8%29">JavaScript API</a>.  It uses OpenSocial to get the users unstructured location and <a href="http://developer.yahoo.com/yql/">YQL</a> to convert it into GPS coordinates.</p>
<p><span id="more-191"></span></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
    <span style="color: #003366; font-weight: bold;">function</span> getProfile<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003366; font-weight: bold;">var</span> req <span style="color: #339933;">=</span> opensocial.<span style="color: #660066;">newDataRequest</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> opt_params <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> req <span style="color: #339933;">=</span> opensocial.<span style="color: #660066;">newDataRequest</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        opt_params<span style="color: #009900;">&#91;</span>opensocial.<span style="color: #660066;">DataRequest</span>.<span style="color: #660066;">PeopleRequestFields</span>.<span style="color: #660066;">PROFILE_DETAILS</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>opensocial.<span style="color: #660066;">Person</span>.<span style="color: #660066;">Field</span>.<span style="color: #660066;">CURRENT_LOCATION</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        req.<span style="color: #660066;">add</span><span style="color: #009900;">&#40;</span>req.<span style="color: #660066;">newFetchPersonRequest</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'VIEWER'</span><span style="color: #339933;">,</span> opt_params<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'myOwner'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        req.<span style="color: #660066;">send</span><span style="color: #009900;">&#40;</span>onLoadProfile<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #003366; font-weight: bold;">function</span> onLoadProfile<span style="color: #009900;">&#40;</span>response<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003366; font-weight: bold;">var</span> html <span style="color: #339933;">=</span> processProfile<span style="color: #009900;">&#40;</span>response<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'divProfile'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> html<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #003366; font-weight: bold;">function</span> processProfile<span style="color: #009900;">&#40;</span>response<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #003366; font-weight: bold;">var</span> html <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Array<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
&nbsp;
            <span style="color: #003366; font-weight: bold;">var</span> person <span style="color: #339933;">=</span> response.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'myOwner'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">getData</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #003366; font-weight: bold;">var</span> sId <span style="color: #339933;">=</span> person.<span style="color: #660066;">getId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #003366; font-weight: bold;">var</span> sGivenName <span style="color: #339933;">=</span> person.<span style="color: #660066;">getField</span><span style="color: #009900;">&#40;</span>opensocial.<span style="color: #660066;">Person</span>.<span style="color: #660066;">Field</span>.<span style="color: #000066;">NAME</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">getField</span><span style="color: #009900;">&#40;</span>opensocial.<span style="color: #000066;">Name</span>.<span style="color: #660066;">Field</span>.<span style="color: #660066;">GIVEN_NAME</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #003366; font-weight: bold;">var</span> sFamilyName <span style="color: #339933;">=</span> person.<span style="color: #660066;">getField</span><span style="color: #009900;">&#40;</span>opensocial.<span style="color: #660066;">Person</span>.<span style="color: #660066;">Field</span>.<span style="color: #000066;">NAME</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">getField</span><span style="color: #009900;">&#40;</span>opensocial.<span style="color: #000066;">Name</span>.<span style="color: #660066;">Field</span>.<span style="color: #660066;">FAMILY_NAME</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #003366; font-weight: bold;">var</span> sUnstructuredName <span style="color: #339933;">=</span> person.<span style="color: #660066;">getField</span><span style="color: #009900;">&#40;</span>opensocial.<span style="color: #660066;">Person</span>.<span style="color: #660066;">Field</span>.<span style="color: #000066;">NAME</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">getField</span><span style="color: #009900;">&#40;</span>opensocial.<span style="color: #000066;">Name</span>.<span style="color: #660066;">Field</span>.<span style="color: #660066;">UNSTRUCTURED</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #003366; font-weight: bold;">var</span> gender <span style="color: #339933;">=</span> person.<span style="color: #660066;">getField</span><span style="color: #009900;">&#40;</span>opensocial.<span style="color: #660066;">Person</span>.<span style="color: #660066;">Field</span>.<span style="color: #660066;">GENDER</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #003366; font-weight: bold;">var</span> sGender <span style="color: #339933;">=</span> gender <span style="color: #339933;">?</span> gender.<span style="color: #660066;">getDisplayValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">'unknown'</span><span style="color: #339933;">;</span>
            <span style="color: #003366; font-weight: bold;">var</span> sAddressUnstructured <span style="color: #339933;">=</span> person.<span style="color: #660066;">getField</span><span style="color: #009900;">&#40;</span>opensocial.<span style="color: #660066;">Person</span>.<span style="color: #660066;">Field</span>.<span style="color: #660066;">CURRENT_LOCATION</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">getField</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'formatted'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #006600; font-style: italic;">// Get GPS coordinates:</span>
            <span style="color: #003366; font-weight: bold;">var</span> sLocation <span style="color: #339933;">=</span> getLocationFromAddress<span style="color: #009900;">&#40;</span>sAddressUnstructured<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            html.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'givenName: '</span> <span style="color: #339933;">+</span> sGivenName<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            html.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;br&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            html.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'familyName: '</span> <span style="color: #339933;">+</span> sFamilyName<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            html.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;br&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            html.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'gender:'</span> <span style="color: #339933;">+</span> sGender<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            html.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;br&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            html.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'unstructured address: '</span> <span style="color: #339933;">+</span> sAddressUnstructured<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            html.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;br&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000066; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>err<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
            html.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;div class=&quot;yap-error&quot;&gt;error! '</span> <span style="color: #339933;">+</span> err <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;/div&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000066; font-weight: bold;">return</span> html.<span style="color: #660066;">join</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #003366; font-weight: bold;">function</span> getLocationFromAddress<span style="color: #009900;">&#40;</span>location<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #003366; font-weight: bold;">var</span> BASE_URI <span style="color: #339933;">=</span> <span style="color: #3366CC;">'http://query.yahooapis.com/v1/public/yql?format=json&amp;q='</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #003366; font-weight: bold;">function</span> handler<span style="color: #009900;">&#40;</span>rsp<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #003366; font-weight: bold;">var</span> latitude <span style="color: #339933;">=</span> rsp.<span style="color: #660066;">data</span>.<span style="color: #660066;">query</span>.<span style="color: #660066;">results</span>.<span style="color: #660066;">place</span>.<span style="color: #660066;">centroid</span>.<span style="color: #660066;">latitude</span><span style="color: #339933;">;</span>
            <span style="color: #003366; font-weight: bold;">var</span> longitude <span style="color: #339933;">=</span> rsp.<span style="color: #660066;">data</span>.<span style="color: #660066;">query</span>.<span style="color: #660066;">results</span>.<span style="color: #660066;">place</span>.<span style="color: #660066;">centroid</span>.<span style="color: #660066;">longitude</span><span style="color: #339933;">;</span>
&nbsp;
            document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'divProfile'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'divProfile'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;&lt;br/&gt; latitude: &quot;</span> <span style="color: #339933;">+</span> latitude <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;&lt;br/&gt; longitude&quot;</span> <span style="color: #339933;">+</span> longitude<span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #003366; font-weight: bold;">var</span> params <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
        params<span style="color: #009900;">&#91;</span>gadgets.<span style="color: #660066;">io</span>.<span style="color: #660066;">RequestParameters</span>.<span style="color: #660066;">CONTENT_TYPE</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> gadgets.<span style="color: #660066;">io</span>.<span style="color: #660066;">ContentType</span>.<span style="color: #660066;">JSON</span><span style="color: #339933;">;</span>
        params<span style="color: #009900;">&#91;</span>gadgets.<span style="color: #660066;">io</span>.<span style="color: #660066;">RequestParameters</span>.<span style="color: #660066;">METHOD</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> gadgets.<span style="color: #660066;">io</span>.<span style="color: #660066;">MethodType</span>.<span style="color: #660066;">GET</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #003366; font-weight: bold;">var</span> yqlQuery <span style="color: #339933;">=</span> BASE_URI <span style="color: #339933;">+</span> escape<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;select centroid from geo.places where text='&quot;</span> <span style="color: #339933;">+</span> location <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;'&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        gadgets.<span style="color: #660066;">io</span>.<span style="color: #660066;">makeRequest</span><span style="color: #009900;">&#40;</span>yqlQuery<span style="color: #339933;">,</span> handler<span style="color: #339933;">,</span> params<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span>
&nbsp;
    gadgets.<span style="color: #660066;">util</span>.<span style="color: #660066;">registerOnLoadHandler</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        getProfile<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>         
&nbsp;
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span>
&lt;div id=&quot;yap-app&quot;&gt;
    &lt;h1&gt;
        YAP OpenSocial/YQL/Geo Demo&lt;/h1&gt;
    &lt;h3&gt;
        Your Profile&lt;/h3&gt;
    &lt;div id=&quot;divProfile&quot;&gt;
        &lt;div&gt;
            Loading Profile...&lt;/div&gt;
    &lt;/div&gt;    
&lt;/div&gt;</pre></div></div>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dotmacblog?a=EsL3f1v_rXw:XvorwW1j5kI:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dotmacblog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dotmacblog?a=EsL3f1v_rXw:XvorwW1j5kI:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/dotmacblog?i=EsL3f1v_rXw:XvorwW1j5kI:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dotmacblog?a=EsL3f1v_rXw:XvorwW1j5kI:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/dotmacblog?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dotmacblog?a=EsL3f1v_rXw:XvorwW1j5kI:cGdyc7Q-1BI"><img src="http://feeds.feedburner.com/~ff/dotmacblog?d=cGdyc7Q-1BI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/dotmacblog/~4/EsL3f1v_rXw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://dotmac.rationalmind.net/2010/06/getting-an-opensocial-users-gps-coordinates-with-yql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://dotmac.rationalmind.net/2010/06/getting-an-opensocial-users-gps-coordinates-with-yql/</feedburner:origLink></item>
		<item>
		<title>Rotating content with JQuery, JTemplates &amp; AJAX</title>
		<link>http://feedproxy.google.com/~r/dotmacblog/~3/QZbquOC02ZE/</link>
		<comments>http://dotmac.rationalmind.net/2010/05/rotating-content-with-jquery-jtemplates-ajax/#comments</comments>
		<pubDate>Sun, 30 May 2010 20:53:17 +0000</pubDate>
		<dc:creator>David Veksler</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[jtemplates]]></category>
		<category><![CDATA[REST]]></category>

		<guid isPermaLink="false">http://dotmac.rationalmind.net/?p=186</guid>
		<description>The following JavaScript is used here to rotate the featured product every 30 seconds. I will leave the implementation of the JSON-emitting REST api for another post. &amp;#60;script type='text/javascript' src=&amp;#34;/Javascript/jquery-latest.min.js&amp;#34;&amp;#62;&amp;#60;/script&amp;#62; &amp;#60;script type='text/javascript' src=&amp;#34;/Javascript/jquery-jtemplates.js&amp;#34;&amp;#62;&amp;#60;/script&amp;#62; &amp;#160; &amp;#60;script type=&amp;#34;text/javascript&amp;#34;&amp;#62; &amp;#160; $(document).ready(function () { GetRandomProduct(); setInterval(GetRandomProduct, 30000); &amp;#160; }); &amp;#160; function GetRandomProduct(day) { var service_URL = BASE_URL + 'books'; [...]</description>
			<content:encoded><![CDATA[<p>The following JavaScript is used <a href="http://mises.org/">here</a> to rotate the featured product every 30 seconds.  I will leave the implementation of the JSON-emitting <a href="http://mises.org/rest/books">REST api</a> for another post.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;script type='text/javascript' src=&quot;/Javascript/jquery-latest.min.js&quot;&gt;&lt;/script&gt;
&lt;script type='text/javascript' src=&quot;/Javascript/jquery-jtemplates.js&quot;&gt;&lt;/script&gt;    
&nbsp;
&lt;script type=&quot;text/javascript&quot;&gt;
&nbsp;
    $(document).ready(function () {
        GetRandomProduct();
        setInterval(GetRandomProduct, 30000);
&nbsp;
    });
&nbsp;
    function GetRandomProduct(day) {
        var service_URL = BASE_URL + 'books';
        $.ajax({
            url: service_URL,
            dataType: 'json',
            success: function (data) {
                // alert(&quot;response:&quot; + data);
&nbsp;
                if (data == null) {
                    // alert(&quot;No response recieved!&quot;)
                    return;
                }
                else if (data.Payload.length == 0) {
                    return;
                }
                $(&quot;#FeaturedProduct&quot;).setTemplateElement(&quot;productTemplate&quot;);
                $(&quot;#FeaturedProduct&quot;).processTemplate(data.Payload);
&nbsp;
            },
            error: function (error, type, exception) {
                //alert(error); alert(type); alert(exception); 
            }
        });
    }
&lt;/script&gt;
&lt;div class=&quot;outerbox&quot; id=&quot;FeaturedProduct&quot;&gt;
&lt;/div&gt;
&lt;textarea id=&quot;productTemplate&quot; style=&quot;display: none&quot;&gt; 
 &lt;div class=&quot;outerbox&quot;&gt; 
	&lt;div class=&quot;box featured&quot;&gt; 
		&lt;h2 &gt; 
			Featured&lt;/h2&gt; 
		&lt;div class=&quot;item&quot;&gt; 
			&lt;div class=&quot;bord-se&quot;&gt; 
				&lt;div class=&quot;bord-ne&quot;&gt; 
					&lt;div class=&quot;bord-s&quot;&gt; 
						&lt;a href=&quot;/store/Product.aspx?ProductId={$T.ProductId}&amp;utm_source=Homepage&amp;utm_medium=FeaturedProd&amp;utm_term=Widget&amp;utm_campaign=Featured_Widget&quot; id=&quot;A1&quot;&gt; 
							&lt;img class=&quot;FeaturedProduct&quot; src=&quot;{$T.ThumbnailUrl}&quot; alt=&quot;featured&quot; style=&quot;border-width:0px;&quot; /&gt; 
						&lt;/a&gt; 
					&lt;/div&gt; 
				&lt;/div&gt; 
			&lt;/div&gt; 
		&lt;/div&gt; 
		&lt;h4&gt; 
			&lt;a href=&quot;/store/Product.aspx?ProductId={$T.ProductId}&amp;amp;utm_source=Homepage&amp;amp;utm_medium=FeaturedProd&amp;amp;utm_term=Widget&amp;amp;utm_campaign=Featured_Widget&quot;&gt;{$T.Name}&lt;/a&gt;&lt;/h4&gt; 
		&lt;p&gt; 
			&lt;span&gt;Author: &lt;/span&gt; 
			&lt;a href=&quot;/store/search.aspx?m={$T.AuthorId}&quot;&gt;{$T.Author}&lt;/a&gt;&lt;br /&gt; 
			&lt;span class=&quot;Price&quot;&gt; 
				${$T.Price}&lt;/span&gt;&lt;br /&gt; 
&nbsp;
            {$T.Summary}				
&nbsp;
			&lt;a class=&quot;more&quot; href=&quot;/store/New-Products-C52.aspx&quot;&gt;view all&amp;hellip;&lt;/a&gt; 
		&lt;/p&gt; 		
	&lt;/div&gt;
&lt;/div&gt;  
&nbsp;
&lt;/textarea&gt;</pre></div></div>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dotmacblog?a=QZbquOC02ZE:110MJ7YWtg0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dotmacblog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dotmacblog?a=QZbquOC02ZE:110MJ7YWtg0:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/dotmacblog?i=QZbquOC02ZE:110MJ7YWtg0:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dotmacblog?a=QZbquOC02ZE:110MJ7YWtg0:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/dotmacblog?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dotmacblog?a=QZbquOC02ZE:110MJ7YWtg0:cGdyc7Q-1BI"><img src="http://feeds.feedburner.com/~ff/dotmacblog?d=cGdyc7Q-1BI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/dotmacblog/~4/QZbquOC02ZE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://dotmac.rationalmind.net/2010/05/rotating-content-with-jquery-jtemplates-ajax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://dotmac.rationalmind.net/2010/05/rotating-content-with-jquery-jtemplates-ajax/</feedburner:origLink></item>
		<item>
		<title>AES encryption strategies with .Net</title>
		<link>http://feedproxy.google.com/~r/dotmacblog/~3/0YOKYdZdxd8/</link>
		<comments>http://dotmac.rationalmind.net/2010/04/aes-encryption-strategies-with-net/#comments</comments>
		<pubDate>Sun, 11 Apr 2010 21:31:32 +0000</pubDate>
		<dc:creator>David Veksler</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[AES]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[ecnryption]]></category>

		<guid isPermaLink="false">http://dotmac.rationalmind.net/?p=179</guid>
		<description>I did a presentation last week on AES encryption techniques in .Net. I&amp;#8217;ll post some details here later, but for now, I&amp;#8217;ve uploaded a zip file with the project code. Here&amp;#8217;s the key bit: &amp;#160; string key = &amp;#34;1234567891123456&amp;#34;; string secret = @&amp;#34;Sometimes I sing Shania Twain's &amp;#34;&amp;#34;I Feel Like A Woman!&amp;#34;&amp;#34; in the shower.&amp;#34;; [...]</description>
			<content:encoded><![CDATA[<p>I did a presentation last week on <a href="http://en.wikipedia.org/wiki/Advanced_Encryption_Standard">AES</a> encryption techniques in .Net.</p>
<p>I&#8217;ll post some details here later, but for now, I&#8217;ve <a href="http://dotmac.rationalmind.net/wp-content/uploads/2010/04/AESCryptoDotNet.zip">uploaded a zip file with the project code</a>.</p>
<p>Here&#8217;s the key bit:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">&nbsp;
            <span style="color: #FF0000;">string</span> key <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;1234567891123456&quot;</span><span style="color: #008000;">;</span>
            <span style="color: #FF0000;">string</span> secret <span style="color: #008000;">=</span> <span style="color: #666666;">@&quot;Sometimes I sing Shania Twain's &quot;</span><span style="color: #666666;">&quot;I Feel Like A Woman!&quot;</span><span style="color: #666666;">&quot; in the shower.&quot;</span><span style="color: #008000;">;</span>
&nbsp;
            Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;basic:&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            EncryptString<span style="color: #000000;">&#40;</span>key, secret<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            Console.<span style="color: #0000FF;">ReadKey</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;salt the secret:&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #008080; font-style: italic;">// good when there are multiple machines but a dynamic global shared secret (for example, Profile Create Date or User ID)</span>
            <span style="color: #FF0000;">string</span> secret2 <span style="color: #008000;">=</span> secret <span style="color: #008000;">+</span> <span style="color: #666666;">&quot; ###&quot;</span> <span style="color: #008000;">+</span> DateTime.<span style="color: #0000FF;">Now</span>.<span style="color: #0000FF;">Millisecond</span><span style="color: #008000;">;</span>
            EncryptString<span style="color: #000000;">&#40;</span>key, secret2<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            secret2 <span style="color: #008000;">=</span> secret <span style="color: #008000;">+</span> <span style="color: #666666;">&quot; ###&quot;</span> <span style="color: #008000;">+</span> DateTime.<span style="color: #0000FF;">Now</span>.<span style="color: #0000FF;">Millisecond</span><span style="color: #008000;">;</span>
            EncryptString<span style="color: #000000;">&#40;</span>key, secret2<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            Console.<span style="color: #0000FF;">ReadKey</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;salt the key:&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span> 
            <span style="color: #008080; font-style: italic;">// good when the same machine encrypts/decrepts</span>
            <span style="color: #FF0000;">string</span> uniqueMachineIdentifier <span style="color: #008000;">=</span> MachineId.<span style="color: #0000FF;">GetProcessorID</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;MachineId: &quot;</span> <span style="color: #008000;">+</span> uniqueMachineIdentifier<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            EncryptString<span style="color: #000000;">&#40;</span>key <span style="color: #008000;">+</span> uniqueMachineIdentifier, secret<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            Console.<span style="color: #0000FF;">ReadKey</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;SHA1 hash the passphrase with a salt:&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span> 
            <span style="color: #008080; font-style: italic;">// note: talk about why hashing is good</span>
            SHA1 sha <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> SHA1CryptoServiceProvider<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #008080; font-style: italic;">// This is one implementation of the abstract class SHA1.</span>
            <span style="color: #FF0000;">string</span> password <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;this is my user password and/or userid&quot;</span><span style="color: #008000;">;</span>
            <span style="color: #FF0000;">byte</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> saltedKey <span style="color: #008000;">=</span> Encoding.<span style="color: #0600FF;">Default</span>.<span style="color: #0000FF;">GetBytes</span><span style="color: #000000;">&#40;</span>key <span style="color: #008000;">+</span> password<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #FF0000;">byte</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> result <span style="color: #008000;">=</span> sha.<span style="color: #0000FF;">ComputeHash</span><span style="color: #000000;">&#40;</span>saltedKey<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            EncryptString<span style="color: #000000;">&#40;</span>Convert.<span style="color: #0000FF;">ToBase64String</span><span style="color: #000000;">&#40;</span>result<span style="color: #000000;">&#41;</span>, secret<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            Console.<span style="color: #0000FF;">ReadKey</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dotmacblog?a=0YOKYdZdxd8:lFO_0M1sIXU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dotmacblog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dotmacblog?a=0YOKYdZdxd8:lFO_0M1sIXU:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/dotmacblog?i=0YOKYdZdxd8:lFO_0M1sIXU:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dotmacblog?a=0YOKYdZdxd8:lFO_0M1sIXU:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/dotmacblog?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dotmacblog?a=0YOKYdZdxd8:lFO_0M1sIXU:cGdyc7Q-1BI"><img src="http://feeds.feedburner.com/~ff/dotmacblog?d=cGdyc7Q-1BI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/dotmacblog/~4/0YOKYdZdxd8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://dotmac.rationalmind.net/2010/04/aes-encryption-strategies-with-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://dotmac.rationalmind.net/2010/04/aes-encryption-strategies-with-net/</feedburner:origLink></item>
		<item>
		<title>Using the MySql ADO.Net adapter</title>
		<link>http://feedproxy.google.com/~r/dotmacblog/~3/tiVH8WpeA1I/</link>
		<comments>http://dotmac.rationalmind.net/2010/04/using-the-mysql-ado-net-adapter/#comments</comments>
		<pubDate>Sun, 11 Apr 2010 21:18:13 +0000</pubDate>
		<dc:creator>David Veksler</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[csharp]]></category>

		<guid isPermaLink="false">http://dotmac.rationalmind.net/?p=177</guid>
		<description>public DataSet ExecuteQuery&amp;#40;string commandText&amp;#41; &amp;#123; DataSet ds = new DataSet&amp;#40;&amp;#41;; using &amp;#40;var connection = new MySqlConnection&amp;#40;connString&amp;#41;&amp;#41; &amp;#123; connection.Open&amp;#40;&amp;#41;; var command = connection.CreateCommand&amp;#40;&amp;#41;; command.CommandText = commandText; using &amp;#40;var data = new MySqlDataAdapter &amp;#123; SelectCommand = command &amp;#125;&amp;#41; &amp;#123; data.Fill&amp;#40;ds&amp;#41;; connection.Close&amp;#40;&amp;#41;; &amp;#125; &amp;#125; return ds; &amp;#125;</description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> DataSet ExecuteQuery<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span> commandText<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            DataSet ds <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> DataSet<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF;">using</span> <span style="color: #000000;">&#40;</span>var connection <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> MySqlConnection<span style="color: #000000;">&#40;</span>connString<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
                connection.<span style="color: #0000FF;">Open</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                var command <span style="color: #008000;">=</span> connection.<span style="color: #0000FF;">CreateCommand</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                command.<span style="color: #0000FF;">CommandText</span> <span style="color: #008000;">=</span> commandText<span style="color: #008000;">;</span>
                <span style="color: #0600FF;">using</span> <span style="color: #000000;">&#40;</span>var data <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> MySqlDataAdapter <span style="color: #000000;">&#123;</span> SelectCommand <span style="color: #008000;">=</span> command <span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span>
                <span style="color: #000000;">&#123;</span>
                    data.<span style="color: #0000FF;">Fill</span><span style="color: #000000;">&#40;</span>ds<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                    connection.<span style="color: #0000FF;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #000000;">&#125;</span>
            <span style="color: #000000;">&#125;</span>
            <span style="color: #0600FF;">return</span> ds<span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span></pre></div></div>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dotmacblog?a=tiVH8WpeA1I:3xlruGL8F1w:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dotmacblog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dotmacblog?a=tiVH8WpeA1I:3xlruGL8F1w:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/dotmacblog?i=tiVH8WpeA1I:3xlruGL8F1w:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dotmacblog?a=tiVH8WpeA1I:3xlruGL8F1w:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/dotmacblog?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dotmacblog?a=tiVH8WpeA1I:3xlruGL8F1w:cGdyc7Q-1BI"><img src="http://feeds.feedburner.com/~ff/dotmacblog?d=cGdyc7Q-1BI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/dotmacblog/~4/tiVH8WpeA1I" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://dotmac.rationalmind.net/2010/04/using-the-mysql-ado-net-adapter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://dotmac.rationalmind.net/2010/04/using-the-mysql-ado-net-adapter/</feedburner:origLink></item>
		<item>
		<title>.Net Graphics: drawing text on a bitmap</title>
		<link>http://feedproxy.google.com/~r/dotmacblog/~3/xM4RDhVoPkE/</link>
		<comments>http://dotmac.rationalmind.net/2010/04/net-graphics-drawing-text-on-a-bitmap/#comments</comments>
		<pubDate>Thu, 01 Apr 2010 06:50:58 +0000</pubDate>
		<dc:creator>David Veksler</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dotmac.rationalmind.net/?p=174</guid>
		<description>I use this code here. Graphics backgroundGraphics; backgroundImage = &amp;#40;Bitmap&amp;#41;Image.FromFile&amp;#40;AppDomain.CurrentDomain.BaseDirectory + &amp;#34;\\images\\Header.jpg&amp;#34;&amp;#41;; backgroundGraphics = Graphics.FromImage&amp;#40;backgroundImage&amp;#41;; var font = new Font&amp;#40;&amp;#34;Perpetua Titling MT&amp;#34;, 24F, FontStyle.Regular&amp;#41;; backgroundGraphics.DrawString&amp;#40;authorname.ToUpper&amp;#40;&amp;#41;, font, new SolidBrush&amp;#40;Color.FromArgb&amp;#40;100, 0, 0, 0&amp;#41;&amp;#41;, 10, 5&amp;#41;; Now save &amp;#8211; or output to the browser: backgroundImage.Save&amp;#40;context.Response.OutputStream, ImageFormat.Jpeg&amp;#41;;</description>
			<content:encoded><![CDATA[<p>I use this code <a href="http://mises.org/media.aspx?action=author&amp;ID=443">here</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">Graphics backgroundGraphics<span style="color: #008000;">;</span>
backgroundImage <span style="color: #008000;">=</span> <span style="color: #000000;">&#40;</span>Bitmap<span style="color: #000000;">&#41;</span>Image.<span style="color: #0000FF;">FromFile</span><span style="color: #000000;">&#40;</span>AppDomain.<span style="color: #0000FF;">CurrentDomain</span>.<span style="color: #0000FF;">BaseDirectory</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;<span style="color: #008080; font-weight: bold;">\\</span>images<span style="color: #008080; font-weight: bold;">\\</span>Header.jpg&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
backgroundGraphics <span style="color: #008000;">=</span> Graphics.<span style="color: #0000FF;">FromImage</span><span style="color: #000000;">&#40;</span>backgroundImage<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
var font <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Font<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Perpetua Titling MT&quot;</span>, 24F, FontStyle.<span style="color: #0000FF;">Regular</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
backgroundGraphics.<span style="color: #0000FF;">DrawString</span><span style="color: #000000;">&#40;</span>authorname.<span style="color: #0000FF;">ToUpper</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, font, <span style="color: #008000;">new</span> SolidBrush<span style="color: #000000;">&#40;</span>Color.<span style="color: #0000FF;">FromArgb</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">100</span>, <span style="color: #FF0000;">0</span>, <span style="color: #FF0000;">0</span>, <span style="color: #FF0000;">0</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>, <span style="color: #FF0000;">10</span>, <span style="color: #FF0000;">5</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>Now save &#8211; or output to the browser:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">backgroundImage.<span style="color: #0000FF;">Save</span><span style="color: #000000;">&#40;</span>context.<span style="color: #0000FF;">Response</span>.<span style="color: #0000FF;">OutputStream</span>, ImageFormat.<span style="color: #0000FF;">Jpeg</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dotmacblog?a=xM4RDhVoPkE:FKMkAXdeSoI:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dotmacblog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dotmacblog?a=xM4RDhVoPkE:FKMkAXdeSoI:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/dotmacblog?i=xM4RDhVoPkE:FKMkAXdeSoI:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dotmacblog?a=xM4RDhVoPkE:FKMkAXdeSoI:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/dotmacblog?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dotmacblog?a=xM4RDhVoPkE:FKMkAXdeSoI:cGdyc7Q-1BI"><img src="http://feeds.feedburner.com/~ff/dotmacblog?d=cGdyc7Q-1BI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/dotmacblog/~4/xM4RDhVoPkE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://dotmac.rationalmind.net/2010/04/net-graphics-drawing-text-on-a-bitmap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://dotmac.rationalmind.net/2010/04/net-graphics-drawing-text-on-a-bitmap/</feedburner:origLink></item>
		<item>
		<title>Response.Redirect and 302 and 301 status codes</title>
		<link>http://feedproxy.google.com/~r/dotmacblog/~3/zjmIEwF-4hc/</link>
		<comments>http://dotmac.rationalmind.net/2010/03/response-redirect-and-302-and-301-status-codes/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 00:32:13 +0000</pubDate>
		<dc:creator>David Veksler</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://dotmac.rationalmind.net/?p=170</guid>
		<description>If you use Response.Redirect to direct users to a new location, you should be aware that it issues a status code of 302, which means that &amp;#8220;the resource resides temporarily under a different URI.&amp;#8221; If you intend to communicate that the resource has permanently changed locations, you should not use Response.Redirect. This is important for [...]</description>
			<content:encoded><![CDATA[<p>If you use Response.Redirect to direct users to a new location, you should be aware that it issues a status code of 302, <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html">which mean</a>s that &#8220;the resource resides temporarily under a different URI.&#8221;  If you intend to communicate that the resource has <em>permanently</em> changed locations, you should <em>not</em> use Response.Redirect.  This is important for search engines and other crawlers that might need to know the definitive url.</p>
<p>To send a 301 redirect:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">Response.<span style="color: #0000FF;">Status</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;301 Moved Permanently&quot;</span><span style="color: #008000;">;</span>
Response.<span style="color: #0000FF;">StatusCode</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">301</span><span style="color: #008000;">;</span>
Response.<span style="color: #0000FF;">AddHeader</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Location&quot;</span>, url<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
Response.<span style="color: #0000FF;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>Update: <a href="http://weblogs.asp.net/scottgu/archive/2010/01/05/asp-net-4-seo-improvements-vs-2010-and-net-4-0-series.aspx">ASP.Net 4.0 ads a Response.RedirectPermanent() method.</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dotmacblog?a=zjmIEwF-4hc:9oGkhzcwndw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dotmacblog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dotmacblog?a=zjmIEwF-4hc:9oGkhzcwndw:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/dotmacblog?i=zjmIEwF-4hc:9oGkhzcwndw:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dotmacblog?a=zjmIEwF-4hc:9oGkhzcwndw:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/dotmacblog?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dotmacblog?a=zjmIEwF-4hc:9oGkhzcwndw:cGdyc7Q-1BI"><img src="http://feeds.feedburner.com/~ff/dotmacblog?d=cGdyc7Q-1BI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/dotmacblog/~4/zjmIEwF-4hc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://dotmac.rationalmind.net/2010/03/response-redirect-and-302-and-301-status-codes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://dotmac.rationalmind.net/2010/03/response-redirect-and-302-and-301-status-codes/</feedburner:origLink></item>
		<item>
		<title>Set the admin color scheme for all WordPress users</title>
		<link>http://feedproxy.google.com/~r/dotmacblog/~3/gFTyRPkTqh8/</link>
		<comments>http://dotmac.rationalmind.net/2010/03/set-the-admin-color-scheme-for-all-wordpress-users/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 08:32:38 +0000</pubDate>
		<dc:creator>David Veksler</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dotmac.rationalmind.net/?p=167</guid>
		<description>INSERT INTO wp_usermeta &amp;#40; user_id, meta_key, meta_value &amp;#41; &amp;#40; SELECT id, 'admin_color', 'classic' FROM wp_users WHERE id NOT IN &amp;#40;SELECT user_Id FROM wp_usermeta WHERE meta_key = 'admin_color'&amp;#41; &amp;#41; &amp;#160; UPDATE wp_usermeta SET meta_value = 'classic' WHERE meta_key = 'admin_color'</description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> wp_usermeta
<span style="color: #66cc66;">&#40;</span>
user_id<span style="color: #66cc66;">,</span>
meta_key<span style="color: #66cc66;">,</span>
meta_value
<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>
<span style="color: #993333; font-weight: bold;">SELECT</span> 
id<span style="color: #66cc66;">,</span>
<span style="color: #ff0000;">'admin_color'</span><span style="color: #66cc66;">,</span>
<span style="color: #ff0000;">'classic'</span>
<span style="color: #993333; font-weight: bold;">FROM</span> wp_users
<span style="color: #993333; font-weight: bold;">WHERE</span> id  <span style="color: #993333; font-weight: bold;">NOT</span>  <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> user_Id <span style="color: #993333; font-weight: bold;">FROM</span> wp_usermeta <span style="color: #993333; font-weight: bold;">WHERE</span> meta_key <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'admin_color'</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #993333; font-weight: bold;">UPDATE</span> wp_usermeta <span style="color: #993333; font-weight: bold;">SET</span> meta_value <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'classic'</span> <span style="color: #993333; font-weight: bold;">WHERE</span> meta_key <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'admin_color'</span></pre></div></div>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dotmacblog?a=gFTyRPkTqh8:VP5sEk7XiTs:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dotmacblog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dotmacblog?a=gFTyRPkTqh8:VP5sEk7XiTs:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/dotmacblog?i=gFTyRPkTqh8:VP5sEk7XiTs:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dotmacblog?a=gFTyRPkTqh8:VP5sEk7XiTs:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/dotmacblog?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dotmacblog?a=gFTyRPkTqh8:VP5sEk7XiTs:cGdyc7Q-1BI"><img src="http://feeds.feedburner.com/~ff/dotmacblog?d=cGdyc7Q-1BI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/dotmacblog/~4/gFTyRPkTqh8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://dotmac.rationalmind.net/2010/03/set-the-admin-color-scheme-for-all-wordpress-users/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://dotmac.rationalmind.net/2010/03/set-the-admin-color-scheme-for-all-wordpress-users/</feedburner:origLink></item>
		<item>
		<title>Bulk update post slugs in a WordPress blog</title>
		<link>http://feedproxy.google.com/~r/dotmacblog/~3/p_XcY14RVic/</link>
		<comments>http://dotmac.rationalmind.net/2010/03/bulk-update-post-slugs-in-a-wordpress-blog/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 07:25:07 +0000</pubDate>
		<dc:creator>David Veksler</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dotmac.rationalmind.net/?p=165</guid>
		<description>The following script updates missing post slugs (permalinks) in a WordPress blogs, or reformats them according to your needs: &amp;#34;; &amp;#60; ?php // change this this to strip old slugs if needed: //update wp_posts set post_name = '' where guid like '%.asp' set_time_limit(20000); &amp;#160; /** Loads the WordPress Environment and Template, allowing wp functions like [...]</description>
			<content:encoded><![CDATA[<p>The following script updates missing post slugs (permalinks) in a WordPress blogs, or reformats them according to your needs:</p>
<p><span id="more-165"></span></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #0000ff;">&quot;;
&lt; ?php
// change this this to strip old slugs if needed:
//update wp_posts set post_name = '' where guid like '%.asp'
set_time_limit(20000);
&nbsp;
/** Loads the WordPress Environment and Template, allowing wp functions like the_title() */
define('WP_USE_THEMES', false);
require('./wp-blog-header.php');
&nbsp;
function bleach(<span style="color: #006699; font-weight: bold;">$which</span>)
{
    <span style="color: #006699; font-weight: bold;">$result</span> = sanitize_title(get_the_title(<span style="color: #006699; font-weight: bold;">$which</span>));
    return <span style="color: #006699; font-weight: bold;">$result</span>;
}
&nbsp;
<span style="color: #006699; font-weight: bold;">$dbhost</span> = 'data.mises.org';
<span style="color: #006699; font-weight: bold;">$dbuser</span> = 'mises_blog';
<span style="color: #006699; font-weight: bold;">$dbpass</span> = '5u7$^kjW8V';
<span style="color: #006699; font-weight: bold;">$dbname</span> = 'WordPress';
&nbsp;
<span style="color: #006699; font-weight: bold;">$sql</span> = 'SELECT ID, post_title' . ' FROM `wp_posts`' . ' WHERE post_status = &quot;</span>publish<span style="color: #0000ff;">&quot;' . &quot;</span> and post_name <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span> <span style="color: #0000ff;">&quot; . ' order by ID asc';
&nbsp;
<span style="color: #006699; font-weight: bold;">$db</span> = mysql_connect(<span style="color: #006699; font-weight: bold;">$dbhost</span>, <span style="color: #006699; font-weight: bold;">$dbuser</span>, <span style="color: #006699; font-weight: bold;">$dbpass</span>) or die('Could not connect: ' . mysql_error());
mysql_select_db(<span style="color: #006699; font-weight: bold;">$dbname</span>);
&nbsp;
<span style="color: #006699; font-weight: bold;">$result</span> = mysql_query(<span style="color: #006699; font-weight: bold;">$sql</span>) or die('&lt;b&gt;Query failed: ' . mysql_error());
while (<span style="color: #006699; font-weight: bold;">$row</span> = mysql_fetch_array(<span style="color: #006699; font-weight: bold;">$result</span>, MYSQL_ASSOC)) {
    <span style="color: #006699; font-weight: bold;">$id</span>         = <span style="color: #006699; font-weight: bold;">$row</span>['ID'];
    <span style="color: #006699; font-weight: bold;">$title</span>      = <span style="color: #006699; font-weight: bold;">$row</span>['post_title'];
    <span style="color: #006699; font-weight: bold;">$clean_slug</span> = bleach(<span style="color: #006699; font-weight: bold;">$id</span>);
&nbsp;
    echo &quot;</span>ID<span style="color: #339933;">&lt;</span>i<span style="color: #339933;">&gt;:</span><span style="color: #009900;">&#123;</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ID'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#125;</span> <span style="color: #0000ff;">&quot; . &quot;</span>post_title <span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span><span style="color: #000088;">$title</span><span style="color: #009900;">&#125;</span> <span style="color: #0000ff;">&quot; . &quot;</span>sanitized <span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span><span style="color: #000088;">$clean_slug</span><span style="color: #009900;">&#125;</span> <span style="color: #0000ff;">&quot;;
    <span style="color: #006699; font-weight: bold;">$sql_u</span> = &quot;</span>UPDATE `wp_posts` SET post_name <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&quot; . $clean_slug . &quot;'</span> <span style="color: #0000ff;">&quot; . 'WHERE ID = ' . <span style="color: #006699; font-weight: bold;">$id</span>;
    echo '&lt;b&gt;QUERY:&lt;/b&gt;' . <span style="color: #006699; font-weight: bold;">$sql_u</span> . '';
    mysql_query(<span style="color: #006699; font-weight: bold;">$sql_u</span>) or die('ERROR: ' . mysql_error());
    flush();
}
&nbsp;
mysql_close(<span style="color: #006699; font-weight: bold;">$db</span>);
?&gt;
&lt;/i&gt;&lt;/b&gt;</span></pre></div></div>

<p><b><br />
</b></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dotmacblog?a=p_XcY14RVic:End-qT1w14E:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dotmacblog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dotmacblog?a=p_XcY14RVic:End-qT1w14E:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/dotmacblog?i=p_XcY14RVic:End-qT1w14E:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dotmacblog?a=p_XcY14RVic:End-qT1w14E:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/dotmacblog?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dotmacblog?a=p_XcY14RVic:End-qT1w14E:cGdyc7Q-1BI"><img src="http://feeds.feedburner.com/~ff/dotmacblog?d=cGdyc7Q-1BI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/dotmacblog/~4/p_XcY14RVic" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://dotmac.rationalmind.net/2010/03/bulk-update-post-slugs-in-a-wordpress-blog/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://dotmac.rationalmind.net/2010/03/bulk-update-post-slugs-in-a-wordpress-blog/</feedburner:origLink></item>
		<item>
		<title>Delete smart quotes and fix latin1&gt;utf8 encoding issues in WordPress</title>
		<link>http://feedproxy.google.com/~r/dotmacblog/~3/ECbuQkZLgyI/</link>
		<comments>http://dotmac.rationalmind.net/2010/03/delete-smart-quotes-in-wordpress/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 07:36:17 +0000</pubDate>
		<dc:creator>David Veksler</dc:creator>
				<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://dotmac.rationalmind.net/?p=158</guid>
		<description>If you use wptexturize, smart quotes will just mess you up. UPDATE wordpress.wp_posts SET post_content = REPLACE&amp;#40;post_content,&amp;#34;&amp;#34;&amp;#34;,&amp;#34;'&amp;#34;); UPDATE wordpress.wp_posts SET post_content = REPLACE(post_content,&amp;#34;&amp;#38;ldquo;&amp;#34;,'&amp;#34;'); UPDATE wordpress.wp_posts SET post_content = REPLACE(post_content,&amp;#34;”&amp;#34;,'&amp;#34;'); UPDATE wordpress.wp_posts SET post_content = REPLACE(post_content,&amp;#34;‘&amp;#34;,&amp;#34;'&amp;#34;); UPDATE wordpress.wp_posts SET post_content = REPLACE(post_content,&amp;#34;’&amp;#34;,&amp;#34;'&amp;#34;); UPDATE wordpress.wp_posts SET post_content = REPLACE(post_content,&amp;#34;Ã¶&amp;#34;,&amp;#34;ö&amp;#34;); UPDATE wordpress.wp_posts SET post_content = REPLACE(post_content,&amp;#34;Ã¼&amp;#34;,&amp;#34;ü&amp;#34;); UPDATE wordpress.wp_posts [...]</description>
			<content:encoded><![CDATA[<p>If you use <a href="http://codex.wordpress.org/Function_Reference/wptexturize">wptexturize</a>, smart quotes will just mess you up.<br />
<span id="more-158"></span></p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">UPDATE</span> wordpress<span style="color: #66cc66;">.</span>wp_posts <span style="color: #993333; font-weight: bold;">SET</span> post_content <span style="color: #66cc66;">=</span> <span style="color: #993333; font-weight: bold;">REPLACE</span><span style="color: #66cc66;">&#40;</span>post_content<span style="color: #66cc66;">,</span><span style="color: #ff0000;">&quot;&quot;</span><span style="color: #ff0000;">&quot;,&quot;</span><span style="color: #ff0000;">'&quot;);
UPDATE wordpress.wp_posts SET post_content = REPLACE(post_content,&quot;&amp;ldquo;&quot;,'</span><span style="color: #ff0000;">&quot;');
UPDATE wordpress.wp_posts SET post_content = REPLACE(post_content,&quot;</span>”<span style="color: #ff0000;">&quot;,'&quot;</span><span style="color: #ff0000;">');
UPDATE wordpress.wp_posts SET post_content = REPLACE(post_content,&quot;‘&quot;,&quot;'</span><span style="color: #ff0000;">&quot;);
UPDATE wordpress.wp_posts SET post_content = REPLACE(post_content,&quot;</span>’<span style="color: #ff0000;">&quot;,&quot;</span><span style="color: #ff0000;">'&quot;);
UPDATE wordpress.wp_posts SET post_content = REPLACE(post_content,&quot;Ã¶&quot;,&quot;ö&quot;);
UPDATE wordpress.wp_posts SET post_content = REPLACE(post_content,&quot;Ã¼&quot;,&quot;ü&quot;);
UPDATE wordpress.wp_posts SET post_content = REPLACE(post_content,&quot;Ã©&quot;,&quot;é&quot;);
UPDATE wordpress.wp_posts SET post_content = REPLACE(post_content,&quot;Ã‰&quot;,&quot;É&quot;);
&nbsp;
UPDATE wordpress.wp_users SET display_name = REPLACE(display_name,&quot;Ã©&quot;,&quot;é&quot;);
UPDATE wordpress.wp_users SET display_name = REPLACE(display_name,&quot;&quot;&quot;,&quot;'</span><span style="color: #ff0000;">&quot;);
UPDATE wordpress.wp_users SET display_name = REPLACE(display_name,&quot;</span>“<span style="color: #ff0000;">&quot;,'&quot;</span><span style="color: #ff0000;">');
UPDATE wordpress.wp_users SET display_name = REPLACE(display_name,&quot;”&quot;,'</span><span style="color: #ff0000;">&quot;');
UPDATE wordpress.wp_users SET display_name = REPLACE(display_name,&quot;</span>‘<span style="color: #ff0000;">&quot;,&quot;</span><span style="color: #ff0000;">'&quot;);
UPDATE wordpress.wp_users SET display_name = REPLACE(display_name,&quot;’&quot;,&quot;'</span><span style="color: #ff0000;">&quot;);
UPDATE wordpress.wp_users SET display_name = REPLACE(display_name,&quot;</span>Ã¶<span style="color: #ff0000;">&quot;,&quot;</span>ö<span style="color: #ff0000;">&quot;);
UPDATE wordpress.wp_users SET display_name = REPLACE(display_name,&quot;</span>Ã¼<span style="color: #ff0000;">&quot;,&quot;</span>ü<span style="color: #ff0000;">&quot;);
UPDATE wordpress.wp_users SET display_name = REPLACE(display_name,&quot;</span>Ã©<span style="color: #ff0000;">&quot;,&quot;</span>é<span style="color: #ff0000;">&quot;);
&nbsp;
&nbsp;
UPDATE wordpress.wp_posts SET post_title = REPLACE(post_title,&quot;</span><span style="color: #ff0000;">&quot;&quot;</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">&quot;'&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #993333; font-weight: bold;">UPDATE</span> wordpress<span style="color: #66cc66;">.</span>wp_posts <span style="color: #993333; font-weight: bold;">SET</span> post_title <span style="color: #66cc66;">=</span> <span style="color: #993333; font-weight: bold;">REPLACE</span><span style="color: #66cc66;">&#40;</span>post_title<span style="color: #66cc66;">,</span><span style="color: #ff0000;">&quot;“&quot;</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'&quot;'</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #993333; font-weight: bold;">UPDATE</span> wordpress<span style="color: #66cc66;">.</span>wp_posts <span style="color: #993333; font-weight: bold;">SET</span> post_title <span style="color: #66cc66;">=</span> <span style="color: #993333; font-weight: bold;">REPLACE</span><span style="color: #66cc66;">&#40;</span>post_title<span style="color: #66cc66;">,</span><span style="color: #ff0000;">&quot;”&quot;</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'&quot;'</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #993333; font-weight: bold;">UPDATE</span> wordpress<span style="color: #66cc66;">.</span>wp_posts <span style="color: #993333; font-weight: bold;">SET</span> post_title <span style="color: #66cc66;">=</span> <span style="color: #993333; font-weight: bold;">REPLACE</span><span style="color: #66cc66;">&#40;</span>post_title<span style="color: #66cc66;">,</span><span style="color: #ff0000;">&quot;‘&quot;</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">&quot;'&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #993333; font-weight: bold;">UPDATE</span> wordpress<span style="color: #66cc66;">.</span>wp_posts <span style="color: #993333; font-weight: bold;">SET</span> post_title <span style="color: #66cc66;">=</span> <span style="color: #993333; font-weight: bold;">REPLACE</span><span style="color: #66cc66;">&#40;</span>post_title<span style="color: #66cc66;">,</span><span style="color: #ff0000;">&quot;’&quot;</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">&quot;'&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #993333; font-weight: bold;">UPDATE</span> wordpress<span style="color: #66cc66;">.</span>wp_posts <span style="color: #993333; font-weight: bold;">SET</span> post_title <span style="color: #66cc66;">=</span> <span style="color: #993333; font-weight: bold;">REPLACE</span><span style="color: #66cc66;">&#40;</span>post_title<span style="color: #66cc66;">,</span><span style="color: #ff0000;">&quot;Ã¶&quot;</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">&quot;ö&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #993333; font-weight: bold;">UPDATE</span> wordpress<span style="color: #66cc66;">.</span>wp_posts <span style="color: #993333; font-weight: bold;">SET</span> post_title <span style="color: #66cc66;">=</span> <span style="color: #993333; font-weight: bold;">REPLACE</span><span style="color: #66cc66;">&#40;</span>post_title<span style="color: #66cc66;">,</span><span style="color: #ff0000;">&quot;Ã¼&quot;</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">&quot;ü&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #993333; font-weight: bold;">UPDATE</span> wordpress<span style="color: #66cc66;">.</span>wp_posts <span style="color: #993333; font-weight: bold;">SET</span> post_title <span style="color: #66cc66;">=</span> <span style="color: #993333; font-weight: bold;">REPLACE</span><span style="color: #66cc66;">&#40;</span>post_title<span style="color: #66cc66;">,</span><span style="color: #ff0000;">&quot;Ã©&quot;</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">&quot;é&quot;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dotmacblog?a=ECbuQkZLgyI:EuYGQvnWQQY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dotmacblog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dotmacblog?a=ECbuQkZLgyI:EuYGQvnWQQY:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/dotmacblog?i=ECbuQkZLgyI:EuYGQvnWQQY:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dotmacblog?a=ECbuQkZLgyI:EuYGQvnWQQY:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/dotmacblog?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dotmacblog?a=ECbuQkZLgyI:EuYGQvnWQQY:cGdyc7Q-1BI"><img src="http://feeds.feedburner.com/~ff/dotmacblog?d=cGdyc7Q-1BI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/dotmacblog/~4/ECbuQkZLgyI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://dotmac.rationalmind.net/2010/03/delete-smart-quotes-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://dotmac.rationalmind.net/2010/03/delete-smart-quotes-in-wordpress/</feedburner:origLink></item>
		<item>
		<title>SQL script to migrate from Movable Type to WordPress</title>
		<link>http://feedproxy.google.com/~r/dotmacblog/~3/VrYu6hHjbQQ/</link>
		<comments>http://dotmac.rationalmind.net/2010/03/sql-script-to-migrate-from-movable-type-to-wordpress/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 06:05:02 +0000</pubDate>
		<dc:creator>David Veksler</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[Movable Type]]></category>
		<category><![CDATA[MySql]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://dotmac.rationalmind.net/?p=145</guid>
		<description>While trying to migrate a large blog from Movable Type to WordPress, I found the built-in export and import functionality unable to handle volume of content on the blog or to properly preserve the primary keys needed for permalinks. With assistance from Alvaro on the MisesDev list, we came up with the following MySql SQL [...]</description>
			<content:encoded><![CDATA[<p>While trying to migrate a large blog from <a class="zem_slink" href="http://www.movabletype.com/" title="Movable Type" rel="homepage">Movable Type</a> to <a class="zem_slink" href="http://wordpress.org" title="WordPress" rel="homepage">WordPress</a>, I found the built-in export and import functionality unable to handle volume of content on the blog or to properly preserve the primary keys needed for permalinks.  </p>
<p>With assistance from <a href="http://groups.google.com/group/misesdev/browse_thread/thread/4dc7502b8d363a4e">Alvaro on the MisesDev</a> list, we came up with the following MySql SQL script to import the entries directly from the Movable Type (5.01) database to WordPress (2.9.2).  What would take many hours otherwise can be done in a minute or two.  This is especially important if you don&#8217;t want to lose data during the time it takes to migrate the blog, as the script can be run immediately before the switch.  This script also includes additional stuff like IP addresses and url-friendly names.<br />
<span id="more-145"></span><br />
Change the MT database name in the script below:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;">&nbsp;
<span style="color: #993333; font-weight: bold;">USE</span> <span style="color: #ff0000;">`WordPress`</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">/*  !!! Truncate tables to prevent primary key conflicts !!! */</span>
<span style="color: #993333; font-weight: bold;">TRUNCATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> wp_posts;
<span style="color: #993333; font-weight: bold;">TRUNCATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> wp_comments;
<span style="color: #993333; font-weight: bold;">TRUNCATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> wp_users;
&nbsp;
<span style="color: #808080; font-style: italic;">/* users from author */</span>
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> wp_users <span style="color: #66cc66;">&#40;</span>
ID<span style="color: #66cc66;">,</span>
user_login<span style="color: #66cc66;">,</span>
user_pass<span style="color: #66cc66;">,</span>
user_nicename<span style="color: #66cc66;">,</span>
user_email<span style="color: #66cc66;">,</span>
user_url<span style="color: #66cc66;">,</span>
user_registered<span style="color: #66cc66;">,</span>
<span style="color: #808080; font-style: italic;">/* user_activation_key, */</span>
user_status<span style="color: #66cc66;">,</span>
display_name
&nbsp;
<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span>
author_id<span style="color: #66cc66;">,</span>
author_name<span style="color: #66cc66;">,</span>
author_password<span style="color: #66cc66;">,</span> <span style="color: #808080; font-style: italic;">/* fingers crossed */</span>
<span style="color: #993333; font-weight: bold;">IF</span> <span style="color: #66cc66;">&#40;</span>author_basename <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>author_basename<span style="color: #66cc66;">,</span>author_name<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">,</span>
author_email<span style="color: #66cc66;">,</span>
<span style="color: #993333; font-weight: bold;">IF</span> <span style="color: #66cc66;">&#40;</span>author_url <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>author_url<span style="color: #66cc66;">,</span><span style="color: #ff0000;">' '</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
author_created_on<span style="color: #66cc66;">,</span>
<span style="color: #808080; font-style: italic;">/* user_activation_key, */</span>
author_status<span style="color: #66cc66;">,</span> 
<span style="color: #993333; font-weight: bold;">IF</span> <span style="color: #66cc66;">&#40;</span>author_nickname <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>author_nickname<span style="color: #66cc66;">,</span>author_name<span style="color: #66cc66;">&#41;</span> 
 <span style="color: #993333; font-weight: bold;">FROM</span> mtutf<span style="color: #66cc66;">.</span>mt_author<span style="color: #66cc66;">&#41;</span>; 
&nbsp;
<span style="color: #808080; font-style: italic;">/*  post from entry */</span>
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> wp_posts <span style="color: #66cc66;">&#40;</span>
ID<span style="color: #66cc66;">,</span>
post_author<span style="color: #66cc66;">,</span>
post_date<span style="color: #66cc66;">,</span>
post_date_gmt<span style="color: #66cc66;">,</span>
post_content<span style="color: #66cc66;">,</span>
post_title<span style="color: #66cc66;">,</span>
post_excerpt<span style="color: #66cc66;">,</span>
post_status<span style="color: #66cc66;">,</span>
comment_status<span style="color: #66cc66;">,</span>
ping_status<span style="color: #66cc66;">,</span>
<span style="color: #808080; font-style: italic;">/* post_password  */</span>
post_name<span style="color: #66cc66;">,</span>
post_modified<span style="color: #66cc66;">,</span>
post_modified_gmt<span style="color: #66cc66;">,</span> <span style="color: #808080; font-style: italic;">/* --post_modified_gmt,  */</span>
<span style="color: #808080; font-style: italic;">/* --post_content_filter,  */</span>
<span style="color: #808080; font-style: italic;">/* --post_parent,  */</span>
<span style="color: #808080; font-style: italic;">/* --guid,  */</span>
<span style="color: #808080; font-style: italic;">/* --menu_order,  */</span>
<span style="color: #808080; font-style: italic;">/* --post_type,  */</span>
<span style="color: #808080; font-style: italic;">/* --post_mime_type,  */</span>
comment_count<span style="color: #66cc66;">,</span>
to_ping<span style="color: #66cc66;">,</span>
pinged  
<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span>
<span style="color: #993333; font-weight: bold;">SELECT</span>
entry_id<span style="color: #66cc66;">,</span>
entry_author_id<span style="color: #66cc66;">,</span>
entry_created_on<span style="color: #66cc66;">,</span>
CONVERT_TZ<span style="color: #66cc66;">&#40;</span>entry_created_on<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'+00:00'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'-06:00'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #808080; font-style: italic;">/* GMT */</span>
CONCAT<span style="color: #66cc66;">&#40;</span>entry_text<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'&lt;!--more--&gt;'</span><span style="color: #66cc66;">,</span>entry_text_more<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">,</span>
entry_title<span style="color: #66cc66;">,</span>
entry_excerpt<span style="color: #66cc66;">,</span>
TRIM<span style="color: #66cc66;">&#40;</span>CAST<span style="color: #66cc66;">&#40;</span>entry_status <span style="color: #993333; font-weight: bold;">AS</span> CHAR<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
TRIM<span style="color: #66cc66;">&#40;</span>CAST<span style="color: #66cc66;">&#40;</span>entry_allow_comments <span style="color: #993333; font-weight: bold;">AS</span> CHAR<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
TRIM<span style="color: #66cc66;">&#40;</span>CAST<span style="color: #66cc66;">&#40;</span>entry_allow_pings <span style="color: #993333; font-weight: bold;">AS</span> CHAR<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
<span style="color: #808080; font-style: italic;">/* --post_password  */</span>
entry_basename<span style="color: #66cc66;">,</span>
<span style="color: #808080; font-style: italic;">/* --to_ping  */</span>
<span style="color: #808080; font-style: italic;">/* --pinged  */</span>
entry_modified_on<span style="color: #66cc66;">,</span>
CONVERT_TZ<span style="color: #66cc66;">&#40;</span>entry_modified_on<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'+00:00'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'-06:00'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #808080; font-style: italic;">/* -- post_modified_gmt,  */</span>
<span style="color: #808080; font-style: italic;">/* --post_content_filter,  */</span>
<span style="color: #808080; font-style: italic;">/* --post_parent,  */</span>
<span style="color: #808080; font-style: italic;">/* --guid,  */</span>
<span style="color: #808080; font-style: italic;">/* --menu_order,  */</span>
<span style="color: #808080; font-style: italic;">/* --post_type,  */</span>
<span style="color: #808080; font-style: italic;">/* --post_mime_type,  */</span>
entry_comment_count<span style="color: #66cc66;">,</span>
<span style="color: #ff0000;">''</span><span style="color: #66cc66;">,</span>
<span style="color: #ff0000;">''</span>
 <span style="color: #993333; font-weight: bold;">FROM</span> mtutf<span style="color: #66cc66;">.</span>mt_entry<span style="color: #66cc66;">&#41;</span>;
&nbsp;
&nbsp;
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> wp_comments <span style="color: #66cc66;">&#40;</span>
comment_ID<span style="color: #66cc66;">,</span>
comment_post_ID<span style="color: #66cc66;">,</span>
comment_author<span style="color: #66cc66;">,</span>
comment_author_email<span style="color: #66cc66;">,</span>
comment_author_url<span style="color: #66cc66;">,</span>
comment_author_IP<span style="color: #66cc66;">,</span>
comment_date<span style="color: #66cc66;">,</span>
comment_date_gmt<span style="color: #66cc66;">,</span>
comment_content<span style="color: #66cc66;">,</span>
<span style="color: #808080; font-style: italic;">/* comment_karma, junk_score? */</span>
<span style="color: #808080; font-style: italic;">/* comment_approved, comment_junk_status?? */</span>
<span style="color: #808080; font-style: italic;">/* comment_agent, */</span>
<span style="color: #808080; font-style: italic;">/* comment_type, */</span>
comment_parent<span style="color: #66cc66;">,</span>
user_id
 <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #993333; font-weight: bold;">SELECT</span>
comment_id<span style="color: #66cc66;">,</span>
comment_entry_id<span style="color: #66cc66;">,</span>
comment_author<span style="color: #66cc66;">,</span>
comment_email<span style="color: #66cc66;">,</span>
comment_url<span style="color: #66cc66;">,</span>
comment_ip<span style="color: #66cc66;">,</span>
comment_created_on<span style="color: #66cc66;">,</span>
CONVERT_TZ<span style="color: #66cc66;">&#40;</span>comment_created_on<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'+00:00'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'-06:00'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #808080; font-style: italic;">/* comment_date_gmt, */</span>
comment_text<span style="color: #66cc66;">,</span>
<span style="color: #808080; font-style: italic;">/* comment_karma, */</span>
<span style="color: #808080; font-style: italic;">/* comment_approved, */</span>
<span style="color: #808080; font-style: italic;">/* comment_agent, */</span>
<span style="color: #808080; font-style: italic;">/* comment_type, */</span>
comment_parent_id<span style="color: #66cc66;">,</span>
comment_created_by
 <span style="color: #993333; font-weight: bold;">FROM</span> mtutf<span style="color: #66cc66;">.</span>mt_comment <span style="color: #993333; font-weight: bold;">WHERE</span> comment_junk_status <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
&nbsp;
<span style="color: #993333; font-weight: bold;">UPDATE</span> wp_posts <span style="color: #993333; font-weight: bold;">SET</span> post_status <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'publish'</span><span style="color: #66cc66;">,</span> comment_status<span style="color: #66cc66;">=</span><span style="color: #ff0000;">'open'</span><span style="color: #66cc66;">,</span> ping_status<span style="color: #66cc66;">=</span><span style="color: #ff0000;">'open'</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">/*  More... */</span>
&nbsp;
<span style="color: #993333; font-weight: bold;">UPDATE</span> 
wordpress<span style="color: #66cc66;">.</span>wp_posts<span style="color: #66cc66;">,</span> mises_blog<span style="color: #66cc66;">.</span>mt_entry
&nbsp;
<span style="color: #993333; font-weight: bold;">SET</span> post_content <span style="color: #66cc66;">=</span> CONCAT<span style="color: #66cc66;">&#40;</span>CONCAT<span style="color: #66cc66;">&#40;</span>entry_text<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'&lt;!--more--&gt;'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> entry_text_more<span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #993333; font-weight: bold;">WHERE</span> LENGTH<span style="color: #66cc66;">&#40;</span>entry_text_more<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&gt;</span> <span style="color: #cc66cc;">0</span> 
<span style="color: #993333; font-weight: bold;">AND</span> 
mises_blog<span style="color: #66cc66;">.</span>mt_entry<span style="color: #66cc66;">.</span>entry_id <span style="color: #66cc66;">=</span> wp_posts<span style="color: #66cc66;">.</span>id
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">/* Specific to our DB: */</span>
&nbsp;
<span style="color: #993333; font-weight: bold;">UPDATE</span> wordpress<span style="color: #66cc66;">.</span>wp_posts <span style="color: #993333; font-weight: bold;">SET</span> guid <span style="color: #66cc66;">=</span> CONCAT<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'http://blog.mises.org/archives/'</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">RIGHT</span><span style="color: #66cc66;">&#40;</span>CONCAT<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'000000'</span><span style="color: #66cc66;">,</span> ID<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">6</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">&quot;.asp&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">/* Set User Contributor Levels */</span>
&nbsp;
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> wp_usermeta
<span style="color: #66cc66;">&#40;</span>
user_id<span style="color: #66cc66;">,</span>
meta_key<span style="color: #66cc66;">,</span>
meta_value
<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>
<span style="color: #993333; font-weight: bold;">SELECT</span> 
id<span style="color: #66cc66;">,</span>
<span style="color: #ff0000;">'wp_user_level'</span><span style="color: #66cc66;">,</span>
<span style="color: #cc66cc;">1</span>
<span style="color: #993333; font-weight: bold;">FROM</span> wp_users
<span style="color: #993333; font-weight: bold;">WHERE</span> id  <span style="color: #993333; font-weight: bold;">NOT</span>  <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">295</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> wp_usermeta
<span style="color: #66cc66;">&#40;</span>
user_id<span style="color: #66cc66;">,</span>
meta_key<span style="color: #66cc66;">,</span>
meta_value
<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>
<span style="color: #993333; font-weight: bold;">SELECT</span> 
id<span style="color: #66cc66;">,</span>
<span style="color: #ff0000;">'nickname'</span><span style="color: #66cc66;">,</span>
display_name
<span style="color: #993333; font-weight: bold;">FROM</span> wp_users
<span style="color: #993333; font-weight: bold;">WHERE</span> id  <span style="color: #993333; font-weight: bold;">NOT</span>  <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">295</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> wp_usermeta
<span style="color: #66cc66;">&#40;</span>
user_id<span style="color: #66cc66;">,</span>
meta_key<span style="color: #66cc66;">,</span>
meta_value
<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>
<span style="color: #993333; font-weight: bold;">SELECT</span> 
id<span style="color: #66cc66;">,</span>
<span style="color: #ff0000;">'wp_capabilities'</span><span style="color: #66cc66;">,</span>
meta_value <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'a:1:{s:6:&quot;author&quot;;b:1;}'</span> 
<span style="color: #993333; font-weight: bold;">FROM</span> wp_users
<span style="color: #993333; font-weight: bold;">WHERE</span> id  <span style="color: #993333; font-weight: bold;">NOT</span>  <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">295</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span></pre></div></div>

<div class="zemanta-pixie"><a class="zemanta-pixie-a" href="http://reblog.zemanta.com/zemified/394ce66e-aa4c-41a7-938f-79c4cef70b8f/" title="Reblog this post [with Zemanta]"><img class="zemanta-pixie-img" src="http://img.zemanta.com/reblog_e.png?x-id=394ce66e-aa4c-41a7-938f-79c4cef70b8f" alt="Reblog this post [with Zemanta]" /></a><span class="zem-script more-related pretty-attribution"><script type="text/javascript" src="http://static.zemanta.com/readside/loader.js" defer="defer"></script></span></div>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/dotmacblog?a=VrYu6hHjbQQ:08ryh4_83C0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/dotmacblog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dotmacblog?a=VrYu6hHjbQQ:08ryh4_83C0:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/dotmacblog?i=VrYu6hHjbQQ:08ryh4_83C0:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dotmacblog?a=VrYu6hHjbQQ:08ryh4_83C0:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/dotmacblog?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/dotmacblog?a=VrYu6hHjbQQ:08ryh4_83C0:cGdyc7Q-1BI"><img src="http://feeds.feedburner.com/~ff/dotmacblog?d=cGdyc7Q-1BI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/dotmacblog/~4/VrYu6hHjbQQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://dotmac.rationalmind.net/2010/03/sql-script-to-migrate-from-movable-type-to-wordpress/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://dotmac.rationalmind.net/2010/03/sql-script-to-migrate-from-movable-type-to-wordpress/</feedburner:origLink></item>
	</channel>
</rss>
