<?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>Answer My Searches &#187; Web Services</title>
	<atom:link href="http://www.answermysearches.com/category/web-services/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.answermysearches.com</link>
	<description>Answers to everything I search for, every day</description>
	<lastBuildDate>Wed, 01 Feb 2012 16:27:31 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>XMLRPC Server Slow in Python &#8211; How to Fix</title>
		<link>http://www.answermysearches.com/xmlrpc-server-slow-in-python-how-to-fix/2140/</link>
		<comments>http://www.answermysearches.com/xmlrpc-server-slow-in-python-how-to-fix/2140/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 18:05:26 +0000</pubDate>
		<dc:creator>Greg Pinero (Primary Searcher)</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Web Services]]></category>

		<guid isPermaLink="false">http://www.answermysearches.com/?p=2140</guid>
		<description><![CDATA[Background:
I had set up a Python XML-RPC server on one machine.  When accessing the web services from other machines it would sometimes take up to 20 seconds to get a response.  The strange thing was that this only happened when accessing the web service from some machines but not others.
Problem and Solution:
It turns [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Background:</strong><br />
I had set up a Python XML-RPC server on one machine.  When accessing the web services from other machines it would sometimes take up to 20 seconds to get a response.  The strange thing was that this only happened when accessing the web service from some machines but not others.</p>
<p><strong>Problem and Solution:</strong><br />
It turns out that Python&#8217;s BaseHTTPRequestHandler was trying to log the fully qualified domain name of each request&#8217;s IP address.  Thus when we connected from machines that didn&#8217;t have a fully qualified domain name, it would take a long time to not find the FQDN.  <a href="http://bugs.python.org/issue6085">There is actually a bug for this.</a></p>
<p>Below is a simple fix that solved the problem for me (in Python 2.4).  This would probably work in future versions too.</p>
<p><strong>Assume this is your basic XMLRPC Server set up in Python:</strong></p>
<pre class="Python">
import SimpleXMLRPCServer

class FuncGroup:
    """Just hold the funcs to be used in web service"""
    def hi(self,val):
        return "hi there"

#create server and start it
server_address = ('localhost',8000) # (address, port)
server = SimpleXMLRPCServer.SimpleXMLRPCServer(server_address)
server.register_instance(FuncGroup()) #reg. functions/class instance
server.serve_forever()
</pre>
<p>&#8212;<br />
<strong>Here is the fixed version.  I added in an override for the trouble function:</strong><br />
&#8212;</p>
<pre class="Python">
import SimpleXMLRPCServer

#new code
import BaseHTTPServer
def not_insane_address_string(self):
    host, port = self.client_address[:2]
    return '%s (no getfqdn)' % host #used to call: socket.getfqdn(host)
BaseHTTPServer.BaseHTTPRequestHandler.address_string = \
    not_insane_address_string
#end new code

class FuncGroup:
    """Just hold the funcs to be used in web service"""
    def hi(self,val):
        return "hi there"

#create server and start it
server_address = ('localhost',8000) # (address, port)
server = SimpleXMLRPCServer.SimpleXMLRPCServer(server_address)
server.register_instance(FuncGroup()) #reg. functions/class instance
server.serve_forever()
</pre>
<p>&#8212;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.answermysearches.com/xmlrpc-server-slow-in-python-how-to-fix/2140/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>a MySQL Table of Zip Code Latitude/Longitude Coordinates</title>
		<link>http://www.answermysearches.com/a-mysql-table-of-zip-code-latitudelongitude-coordinates/389/</link>
		<comments>http://www.answermysearches.com/a-mysql-table-of-zip-code-latitudelongitude-coordinates/389/#comments</comments>
		<pubDate>Sat, 01 Nov 2008 23:00:48 +0000</pubDate>
		<dc:creator>Greg Pinero (Primary Searcher)</dc:creator>
				<category><![CDATA[Web Services]]></category>

		<guid isPermaLink="false">http://www.answermysearches.com/a-mysql-table-of-zip-code-latitudelongitude-coordinates/389/</guid>
		<description><![CDATA[I was working on adding location awareness to GigBayes today and ended up making a table of zip codes and their coordinates.  I figured it would be nice to share it with the world:
So here is a pre-made MySQL table containing US zip codes and their latitude and longitude (.zip 820K)
I got the data [...]]]></description>
			<content:encoded><![CDATA[<p>I was working on adding location awareness to <a href="http://www.gigbayes.com">GigBayes</a> today and ended up making a table of zip codes and their coordinates.  I figured it would be nice to share it with the world:</p>
<p><a id="p388" href="http://www.answermysearches.com/wp-content/uploads/2008/11/zip_code.sql.zip">So here is a pre-made MySQL table containing US zip codes and their latitude and longitude (.zip 820K)</a></p>
<p>I got the data from <a href="http://www.populardata.com/downloads.html">here</a>, and then deleted any zip codes which where missing coordinates.</p>
<p>You can also create this MySQL function to use for finding the distance between locations:</p>
<pre>
CREATE FUNCTION `earth_distance_miles`(p1 point, p2 point) RETURNS int(11)
RETURN
((ACOS(SIN(x(p1) * PI() / 180) * SIN(x(p2) * PI() / 180) + COS(x(p1) *
PI() / 180) * COS(x(p2) * PI() / 180) * COS((y(p1) - y(p2)) * PI() /
180)) * 180 / PI()) * 60 * 1.1515)
</pre>
<p>The formula comes from <a href="http://www.zcentric.com/blog/2007/03/calculate_distance_in_mysql_wi.html">here</a>.</p>
<p>You&#8217;d use the function like this:</p>
<pre>
SELECT earth_distance_miles(
(
SELECT location
FROM zip_code
WHERE zip = '06902'
), (
SELECT location
FROM zip_code
WHERE zip = '20905'
)
);
</pre>
<p>Which gives us <strong>227 miles</strong>.  A very reasonable answer.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.answermysearches.com/a-mysql-table-of-zip-code-latitudelongitude-coordinates/389/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python&#8217;s SimpleXMLRPCServer &#8211; How to Serve from a Different Machine</title>
		<link>http://www.answermysearches.com/pythons-simplexmlrpcserver-how-to-serve-from-a-different-machine/304/</link>
		<comments>http://www.answermysearches.com/pythons-simplexmlrpcserver-how-to-serve-from-a-different-machine/304/#comments</comments>
		<pubDate>Fri, 14 Sep 2007 16:46:32 +0000</pubDate>
		<dc:creator>Greg Pinero (Primary Searcher)</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Web Services]]></category>

		<guid isPermaLink="false">http://www.answermysearches.com/pythons-simplexmlrpcserver-how-to-serve-from-a-different-machine/304/</guid>
		<description><![CDATA[It turns out that following the example from Python&#8217;s SimpleXMLRPCServer documentation of serving from localhost only works for well, localhost:

from SimpleXMLRPCServer import SimpleXMLRPCServer
# Create server
server = SimpleXMLRPCServer(("localhost", 8000))
#snip ...(register functions here, see example)
server.register_instance(MyFuncs())
# Run the server's main loop
server.serve_forever()

To make your server available to other computers on your network you should do something like this:

import socket
from [...]]]></description>
			<content:encoded><![CDATA[<p>It turns out that following the <a href="http://docs.python.org/lib/simple-xmlrpc-servers.html">example</a> from Python&#8217;s <a href="http://docs.python.org/lib/module-SimpleXMLRPCServer.html">SimpleXMLRPCServer documentation</a> of serving from localhost only works for well, localhost:</p>
<pre class="Python">
from SimpleXMLRPCServer import SimpleXMLRPCServer
# Create server
server = SimpleXMLRPCServer(("localhost", 8000))
#snip ...(register functions here, see example)
server.register_instance(MyFuncs())
# Run the server's main loop
server.serve_forever()
</pre>
<p>To make your server available to other computers on your network you should do something like this:</p>
<pre class="Python">
import socket
from SimpleXMLRPCServer import SimpleXMLRPCServer
# Create server
server = SimpleXMLRPCServer((socket.gethostbyname(socket.gethostname()), 8000))
#snip ...(register functions here, see example)
server.register_instance(MyFuncs())
server.serve_forever()
</pre>
<p>Open question, will this work for serving to the internet at large, or do I need to do something differently?  I&#8217;m actually not sure why localhost doesn&#8217;t work across the LAN.  Does anyone know?</p>
<p>I found this answer by a <a href="http://www.google.com/codesearch?as_q=SimpleXMLRPCServer%5C%28&#038;btnG=Search+Code&#038;hl=en&#038;as_lang=python&#038;as_license_restrict=i&#038;as_license=&#038;as_package=&#038;as_filename=&#038;as_case=">google code search for SimpleXMLRPCServer</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.answermysearches.com/pythons-simplexmlrpcserver-how-to-serve-from-a-different-machine/304/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Best Javascript IRC Chat Room</title>
		<link>http://www.answermysearches.com/best-javascript-irc-chat-room/225/</link>
		<comments>http://www.answermysearches.com/best-javascript-irc-chat-room/225/#comments</comments>
		<pubDate>Tue, 30 Jan 2007 19:35:46 +0000</pubDate>
		<dc:creator>Greg Pinero (Primary Searcher)</dc:creator>
				<category><![CDATA[Web Services]]></category>

		<guid isPermaLink="false">http://www.answermysearches.com/best-javascript-irc-chat-room/225/</guid>
		<description><![CDATA[Here&#8217;s the biggest one, the folks seem helpful:
Javascript IRC Chat on Freenode

Or you can find a lot more options with this search.
]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s the biggest one, the folks seem helpful:<br />
<a href="irc://irc.freenode.net:6667/javascript">Javascript IRC Chat on Freenode</a></p>
<p><a href="http://searchirc.com/irc-javascript-1"><br />
Or you can find a lot more options with this search.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.answermysearches.com/best-javascript-irc-chat-room/225/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Reader doesn&#8217;t Refresh When You Tell it to</title>
		<link>http://www.answermysearches.com/google-reader-doesnt-refresh-when-you-tell-it-to/221/</link>
		<comments>http://www.answermysearches.com/google-reader-doesnt-refresh-when-you-tell-it-to/221/#comments</comments>
		<pubDate>Sun, 14 Jan 2007 20:21:24 +0000</pubDate>
		<dc:creator>Greg Pinero (Primary Searcher)</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[Web Services]]></category>

		<guid isPermaLink="false">http://www.answermysearches.com/google-reader-doesnt-refresh-when-you-tell-it-to/221/</guid>
		<description><![CDATA[I&#8217;ve been noticing for a while that Google Reader is very delayed in showing me updates to feeds.  I always figured it was my fault somehow, perhaps the specific feeds I was subscribed to?  
But this thread and many others like it has everyone complaining of this problem.  The best I can [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been noticing for a while that <a href="http://www.google.com/reader/">Google Reader</a> is very delayed in showing me updates to feeds.  I always figured it was my fault somehow, perhaps the specific feeds I was subscribed to?  </p>
<p>But this <a href="http://groups-beta.google.com/group/Google-Labs-Reader/browse_thread/thread/39401696082d37f0/6f210c49100bd25c">thread</a> and many others like it has everyone complaining of this problem.  The best I can discern is that Google Readers refreshes feeds only on its own schedule (possibly as little as once every three hours!) and <strong>hitting the refresh button above the feed does nothing</strong>.</p>
<p>It was pointed out that this could be a bandwidth issue as in a lot of webmasters would get unhappy if (millions?) of Google Reader users were always hitting refresh and actually having Google re-access the feed.  But I don&#8217;t want to hear excuses, I want an RSS reader that works!  Timely updates are the killer app of RSS readers, get it fixed!  </p>
<p>Can anyone reccomend a better web based RSS reader?</p>
<p>[tags]Google Reader, RSS, Atom, feeds, RSS reader, web based RSS reader[/tags]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.answermysearches.com/google-reader-doesnt-refresh-when-you-tell-it-to/221/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

