<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	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/"
	>

<channel>
	<title>Pressing the Red Button &#187; Tech Tips</title>
	<atom:link href="http://www.pressthered.com/category/tech_tips/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pressthered.com</link>
	<description>Adventures in Software Development</description>
	<lastBuildDate>Sun, 08 Jan 2012 21:28:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Importing a List with BulkLoader</title>
		<link>http://www.pressthered.com/importing_a_list_with_bulkloader/</link>
		<comments>http://www.pressthered.com/importing_a_list_with_bulkloader/#comments</comments>
		<pubDate>Sat, 19 Jun 2010 06:16:59 +0000</pubDate>
		<dc:creator>jim.richmond</dc:creator>
				<category><![CDATA[Tech Tips]]></category>
		<category><![CDATA[google app engine]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.pressthered.com/?p=814</guid>
		<description><![CDATA[The latest bulkloader script (api version 1.3.4) does a much better job of exporting data when you auto generate a .yaml file. However it doesn&#8217;t handle the re-import of lists by default (it just treats them as strings). You can add an inline lambda function to the .yaml file to fix this. This handles lists [...]]]></description>
			<content:encoded><![CDATA[<p>The latest bulkloader script (api version 1.3.4) does a much better job of exporting data when you auto generate a .yaml file. However it doesn&#8217;t handle the re-import of lists by default (it just treats them as strings). You can add an inline lambda function to the .yaml file to fix this. This handles lists of strings, but it can probably be modified to handle other types.</p>
<p>- property: mylist<br />
      external_name: mylist<br />
      <strong>import_transform: &#8220;lambda x: len(x) > 0 and eval(x) or &#8221;&#8221;</strong></p>
<p><strong>Why it works:</strong><br />
In your csv, your list should export like so:<br />
&#8220;[u'item1', u'item2', u'item3']&#8220;<br />
Running an eval on this string, converts it to a list. The length check is like if/else statement, if len(x) > 0 convert it else use empty string.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pressthered.com/importing_a_list_with_bulkloader/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to Delete an Index in an AppEngine Datastore</title>
		<link>http://www.pressthered.com/how_to_delete_an_index_in_an_appengine_datastore/</link>
		<comments>http://www.pressthered.com/how_to_delete_an_index_in_an_appengine_datastore/#comments</comments>
		<pubDate>Mon, 19 Apr 2010 03:23:49 +0000</pubDate>
		<dc:creator>jim.richmond</dc:creator>
				<category><![CDATA[Tech Tips]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Google AppEngine]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.pressthered.com/?p=804</guid>
		<description><![CDATA[If using Python, you can delete an index by first removing the entry in your index.yaml file, and then updating your site. Then you must issue this command: appcfg.py vacuum_indexes myapp/ With Django (what I am using), you use this command: manage.py vacuum_indexes What is nice about the process is that, for each index that [...]]]></description>
			<content:encoded><![CDATA[<p>If using Python, you can delete an index by first removing the entry in your index.yaml file, and then updating your site. Then you must issue this command:<br />
<strong>appcfg.py vacuum_indexes myapp/</strong></p>
<p>With Django (what I am using), you use this command:<br />
<strong>manage.py vacuum_indexes</strong></p>
<p>What is nice about the process is that, for each index that has been removed from your index.yaml, it will confirm whether you want to delete it or not. So you get a second chance to make sure you are right. If you delete the wrong index, it&#8217;s going to take some <a href="http://code.google.com/appengine/articles/index_building.html">time for it to rebuild</a>, and portions of your site could be down.</p>
<p><strong>Why do I need this:</strong><br />
I don&#8217;t think you would see a noticeable speed improvement to your data inserts, updates, or deletes by having a few less unused indexes, but it couldn&#8217;t hurt. Also you are limited to 100 indexes (as of April 2010) so this how you free them up.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pressthered.com/how_to_delete_an_index_in_an_appengine_datastore/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google AppEngine: appcfg.py update check failed</title>
		<link>http://www.pressthered.com/google_appengine_appcfgpy_update_check_failed/</link>
		<comments>http://www.pressthered.com/google_appengine_appcfgpy_update_check_failed/#comments</comments>
		<pubDate>Wed, 14 Apr 2010 04:55:18 +0000</pubDate>
		<dc:creator>jim.richmond</dc:creator>
				<category><![CDATA[Tech Tips]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Google AppEngine]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.pressthered.com/?p=800</guid>
		<description><![CDATA[I started getting this error in Windows when running &#8216;manage runserver&#8217; in django on Google AppEngine: appcfg.py update check failed: EOF occurred in violation of protocol This error is related to not having the SSL module for python installed. The easy fix is to install it by running &#8220;easy_install ssl&#8221; from the command prompt. However, [...]]]></description>
			<content:encoded><![CDATA[<p>I started getting this error in Windows when running &#8216;manage runserver&#8217; in django on Google AppEngine:</p>
<p><strong>appcfg.py update check failed: EOF occurred in violation of protocol</strong></p>
<p>This error is related to not having the SSL module for python installed. The easy fix is to install it by running &#8220;easy_install ssl&#8221; from the command prompt. However, using Python 2.5, I received errors and it did not work. </p>
<p>The longer, more involved fix is to compile the SSL module for python. This was a hassle but after about an hour I finally got it working.</p>
<p>Here is the tutorial I used to install the ssl module:<br />
<a href="http://beautifulisbetterthanugly.com/posts/2009/aug/19/compile-ssl-115-python-25-or-lower/">http://beautifulisbetterthanugly.com/posts/2009/aug/19/compile-ssl-115-python-25-or-lower/</a></p>
<p>I also had to follow the troubleshooting section on this link:<br />
<a href="http://wiki.cython.org/InstallingOnWindows">http://wiki.cython.org/InstallingOnWindows</a><br />
because I did not have the python library file (libpython25.a).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pressthered.com/google_appengine_appcfgpy_update_check_failed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Solving &#8220;InvalidSenderError: Unauthorized sender&#8221; in AppEngine</title>
		<link>http://www.pressthered.com/solving_invalidsendererror_unauthorized_sender_in_appengine/</link>
		<comments>http://www.pressthered.com/solving_invalidsendererror_unauthorized_sender_in_appengine/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 06:12:19 +0000</pubDate>
		<dc:creator>jim.richmond</dc:creator>
				<category><![CDATA[Tech Tips]]></category>
		<category><![CDATA[Google AppEngine]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.pressthered.com/?p=794</guid>
		<description><![CDATA[You might get this message in Google AppEngine when sending an email message and specifying a custom from address. To get it to work you must add the address as a developer for your application (or use the email address you signed up with). Steps to Add a Developer Email Address: Log in to your [...]]]></description>
			<content:encoded><![CDATA[<p>You might get this message in Google AppEngine when sending an email message and specifying a custom from address. To get it to work you must add the address as a developer for your application (or use the email address you signed up with). </p>
<p><strong>Steps to Add a Developer Email Address:</strong></p>
<ol>
<li>Log in to your Google App Engine Account.</li>
<li>Under Administration, click Permissions, and add the email address.</li>
<li>Log out, and check for the validation email.</li>
</ol>
<p><strong>More Info:</strong><br />
This is quite a hassle. I understand the reason is to cut back on spam but not only do you have to have a valid email account but you must create a google account for it.<br />
In my case, I just wanted to send notifications out but I don&#8217;t monitor the sender address (but I do include a contact link in the email).<br />
Darn spammers!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pressthered.com/solving_invalidsendererror_unauthorized_sender_in_appengine/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Testing Email Locally with AppEngine Patch on Windows</title>
		<link>http://www.pressthered.com/testing_email_locally_with_appengine_patch_on_windows/</link>
		<comments>http://www.pressthered.com/testing_email_locally_with_appengine_patch_on_windows/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 05:21:52 +0000</pubDate>
		<dc:creator>jim.richmond</dc:creator>
				<category><![CDATA[Tech Tips]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Google AppEngine]]></category>

		<guid isPermaLink="false">http://www.pressthered.com/?p=785</guid>
		<description><![CDATA[If you need to get email working on your windows dev machine for Google AppEngine, here is one method: Download Fake Sendmail for Windows. Unzip the files and copy them into a new folder. Add this new folder to your windows PATH, by right clicking on My Computer -> Properties. Click Advanced Tab -> Environmental [...]]]></description>
			<content:encoded><![CDATA[<p>If you need to get email working on your windows dev machine for Google AppEngine, here is one method:</p>
<ol>
<li>Download <a href="http://glob.com.au/sendmail/">Fake Sendmail for Windows.</a> Unzip the files and copy them into a new folder.</li>
<li>Add this new folder to your windows PATH, by right clicking on My Computer -> Properties. Click Advanced Tab -> Environmental Variables. Edit the PATH variable under System variables. Append your path to the end of the string. Do not replace the existing paths, just add it to the end preceded by a semi colon. Ex: &#8220;;c:\apps\fakesendmail&#8221;</li>
<li>In your fakesendmail folder, you must configure the &#8220;sendmail.ini&#8221; file. You have two choices:
<ul>
<li>Use your own custom smtp server settings (if you have one), by setting &#8220;smtp_server&#8221;, &#8220;auth_username&#8221;, &#8220;auth_password&#8221;, and &#8220;default_domain&#8221;</li>
<li>Use Windows default smtp service by setting &#8220;smtp_server&#8221; to &#8220;C:\Inetpub\mailroot\Pickup&#8221; and &#8220;default_domain&#8221; to &#8220;localhost&#8221;. This second choice will not send your emails but most likely will store your emails in the &#8220;C:\Inetpub\mailroot\Queue&#8221;.</li>
</ul>
</li>
<li>Open a new command console (must reopen the console to pick up the new path variable). Run the appengine patch from your apps root folder with the following argument:<br />
<strong> &#8220;manage runserver &#8211;enable_sendmail&#8221;</strong></li>
</ol>
<p><strong>Some Additional Info:</strong><br />
This will resolve the error message &#8220;SMTP AUTH extension not supported by server&#8221;.</p>
<p>These steps were derived from this <a href="http://groups.google.com/group/app-engine-patch/msg/9cca92df4b993d6c?pli=1">google discussion</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pressthered.com/testing_email_locally_with_appengine_patch_on_windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Removing U3 from USB Drive</title>
		<link>http://www.pressthered.com/removing_u3_from_usb_drive/</link>
		<comments>http://www.pressthered.com/removing_u3_from_usb_drive/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 05:11:19 +0000</pubDate>
		<dc:creator>jim.richmond</dc:creator>
				<category><![CDATA[Tech Tips]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://www.pressthered.com/?p=776</guid>
		<description><![CDATA[Here is how to remove the U3 application from your USB drive and prevent it from starting up every time you plug in your USB stick. For Windows: Download and run this Windows uninstaller from U3. Works in XP, Vista and Windows 7, and others. Macintosh Follow the sandisk instructions ro remove U3. Additional Information [...]]]></description>
			<content:encoded><![CDATA[<p>Here is how to remove the U3 application from your USB drive and prevent it from starting up every time you plug in your USB stick.</p>
<p><strong>For Windows:</strong><br />
<a href="http://u3uninstall.s3.amazonaws.com/U3Uninstall.exe">Download and run this Windows uninstaller from U3.</a><br />
Works in XP, Vista and Windows 7, and others.</p>
<p><strong>Macintosh</strong><br />
<a href="http://communities.sandisk.com/sandisk/board/message?board.id=u3&#038;thread.id=1066">Follow the sandisk instructions ro remove U3.</a></p>
<p><strong>Additional Information</strong><br />
You can always <a href=" http://u3.com/support/default.aspx#CQ3">visit the U3 support site</a> for more info.</p>
<p><strong>Why Remove It?</strong><br />
I find it annoying that it pops up every time you plug it in and you have wait to use your drive (10 seconds on my machine). I&#8217;d keep it if they made it easier to disable that functionality. However I have been using <a href="http://portableapps.com/">PortableApps</a>, an open alternative to U3. The apps that are available for <a href="http://portableapps.com/">PortableApps</a> are not commercial apps but they suit my needs.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pressthered.com/removing_u3_from_usb_drive/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Fixing Desktop.ini popup on Windows Start</title>
		<link>http://www.pressthered.com/fixing_desktopini_popup_on_windows_start/</link>
		<comments>http://www.pressthered.com/fixing_desktopini_popup_on_windows_start/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 06:03:08 +0000</pubDate>
		<dc:creator>jim.richmond</dc:creator>
				<category><![CDATA[Tech Tips]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.pressthered.com/?p=729</guid>
		<description><![CDATA[If you have a file called desktop.ini open in Notepad when Windows starts, here is how to fix it. You just need to delete this file from the Program Menu startup folder. Go to the Notepad window that has the desktop.ini file. In the menu, click File -> Save As. In the &#8220;Save as type&#8221;, [...]]]></description>
			<content:encoded><![CDATA[<p>If you have a file called desktop.ini open in Notepad when Windows starts, here is how to fix it. You just need to delete this file from the Program Menu startup folder.</p>
<ol>
<li> Go to the Notepad window that has the desktop.ini file.</li>
<li> In the menu, click File -> Save As.</li>
<li> In the &#8220;Save as type&#8221;, select &#8220;All Files&#8221;.</li>
<li> You will see the desktop.ini file in the list, right click, and select Delete.</li>
<li> Cancel the Save As, and close the Notepad window.</li>
<li> Now it will not appear anymore when you reboot.</li>
</ol>
<p><strong>How Can This Happen:</strong><br />
Most likely it was some installation process that incorrectly placed the file in the startup folder. In my case it was <a href="http://www.mozy.com">Mozy</a> file. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.pressthered.com/fixing_desktopini_popup_on_windows_start/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UrlEncode in Python</title>
		<link>http://www.pressthered.com/urlencode_in_python/</link>
		<comments>http://www.pressthered.com/urlencode_in_python/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 05:36:55 +0000</pubDate>
		<dc:creator>jim.richmond</dc:creator>
				<category><![CDATA[Tech Tips]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.pressthered.com/?p=719</guid>
		<description><![CDATA[To urlencode a querystring or form data in python you can use the urllib module: use urllib # you have to pass in a dictionary print urllib.urlencode({'id':'100', 'name':'john smith'}) # then you get 'id=100&#038;name=john+smith' Urlencoding Unicode and UTF8 Values #this works fine print urllib.urlencode({name:'José'}) #you have to be careful with unicode strings # this will [...]]]></description>
			<content:encoded><![CDATA[<p><strong>To urlencode a querystring or form data in python you can use the urllib module:</strong></p>
<pre name="code" class="python">
use urllib
# you have to pass in a dictionary
print urllib.urlencode({'id':'100', 'name':'john smith'})

# then you get 'id=100&#038;name=john+smith'
</pre>
<p><strong>Urlencoding Unicode and UTF8 Values</strong></p>
<pre name="code" class="python">
#this works fine
print urllib.urlencode({name:'José'})

#you have to be careful with unicode strings
# this will throw an error:
print urllib.urlencode({name:u'José'})
# UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in
# position 11: ordinal not in range

#since the default ascii conversion can't handle the 'é',
# you have to be explicit in what charset you are using
print urllib.urlencode({'name':u'José'.encode('utf8')})
</pre>
<p><strong>Additional Info:</strong><br />
<a href="http://docs.python.org/library/urllib.html#urllib.urlencode">Python Doc for urllib module</a><br />
<a href="http://www.joelonsoftware.com/articles/Unicode.html">Unicode Primer</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pressthered.com/urlencode_in_python/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using a favicon in Django</title>
		<link>http://www.pressthered.com/using_a_favicon_in_django/</link>
		<comments>http://www.pressthered.com/using_a_favicon_in_django/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 06:23:20 +0000</pubDate>
		<dc:creator>jim.richmond</dc:creator>
				<category><![CDATA[Tech Tips]]></category>
		<category><![CDATA[Django]]></category>

		<guid isPermaLink="false">http://www.pressthered.com/?p=658</guid>
		<description><![CDATA[The default location for a favicon.ico file is the root folder of website. However when using Django with an apache virtualhost, you need to map the location of your favicon. Here are a few ways to get you favicon working: 1) The quick way is to modify the html in your base template to include [...]]]></description>
			<content:encoded><![CDATA[<p>The default location for a favicon.ico file is the root folder of website. However when using Django with an apache virtualhost, you need to map the location of your favicon. </p>
<p>Here are a few ways to get you favicon working:</p>
<p>1) The quick way is to modify the html in your base template to include the shortcut link. This assumes that you have already <a href="http://docs.djangoproject.com/en/dev/howto/deployment/modpython/#id1">mapped a media folder</a> called &#8220;media&#8221;:</p>
<pre name="code" class="html">
&lt;link REL="SHORTCUT ICON" HREF="/media/favicon.ico">
</pre>
<p>2) Probably the more proper way is to modify your httpd.conf file:<br />
<code><br />
&lt;LocationMatch "^/favicon.ico"><br />
        SetHandler default<br />
&lt;/LocationMatch><br />
alias /favicon.ico /directory-to-icon/static/favicon.ico</p>
<p></code></p>
<p><strong>How Can I Make a Favicon</strong><br />
Here is an online tool to quickly <a href="http://tools.dynamicdrive.com/favicon/">create a favicon</a>, by uploading an image.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pressthered.com/using_a_favicon_in_django/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding Dates and Times in Python</title>
		<link>http://www.pressthered.com/adding_dates_and_times_in_python/</link>
		<comments>http://www.pressthered.com/adding_dates_and_times_in_python/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 06:11:03 +0000</pubDate>
		<dc:creator>jim.richmond</dc:creator>
				<category><![CDATA[Tech Tips]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.pressthered.com/?p=645</guid>
		<description><![CDATA[Using the built-in modules datetime and timedelta, you can perform date and time addition/subtraction in python: from datetime import datetime from datetime import timedelta #Add 1 day print datetime.now() + timedelta(days=1) #Subtract 60 seconds print datetime.now() - timedelta(seconds=60) #Add 2 years print datetime.now() + timedelta(days=730) #Other Parameters you can pass in to timedelta: # days, [...]]]></description>
			<content:encoded><![CDATA[<p>Using the built-in modules <strong>datetime</strong> and <strong>timedelta</strong>, you can perform date and time addition/subtraction in <strong>python</strong>:</p>
<pre name="code" class="python">
from datetime import datetime
from datetime import timedelta

#Add 1 day
print datetime.now() + timedelta(days=1)

#Subtract 60 seconds
print datetime.now() - timedelta(seconds=60)

#Add 2 years
print datetime.now() + timedelta(days=730)

#Other Parameters you can pass in to timedelta:
# days, seconds, microseconds,
# milliseconds, minutes, hours, weeks

#Pass multiple parameters (1 day and 5 minutes)
print datetime.now() + timedelta(days=1,minutes=5)
</pre>
<p>Here is a python reference that gives more examples and advanced features:<br />
<a href="http://docs.python.org/library/datetime.html">http://docs.python.org/library/datetime.html</a></p>
<p>If you are coming from a .net or sql environment, here are the above examples in C# and SQL (Microsoft) for comparison:<br />
<strong>C#</strong></p>
<pre name="code" class="c#">
DateTime myTime = new DateTime();

--Add 1 day
myTime.AddDays(1);

--Subtract 60 seconds
myTime.AddSeconds(-60);

--Add 2 years
myTime.AddYears(2);
</pre>
<p><strong>SQL</strong></p>
<pre name="code" class="sql">
--Add 1 day
select DATEADD(day, 1, getdate())

--Subtract 60 seconds
select DATEADD(second, -60, getdate())

--Add 2 years
select DATEADD(Year, 2, getdate())
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.pressthered.com/adding_dates_and_times_in_python/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

