<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Tiny URLs based on pk</title>
	<link>http://leahculver.com/2008/06/17/tiny-urls-based-on-pk/</link>
	<description>leahculver.com</description>
	<pubDate>Wed, 03 Dec 2008 21:37:03 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.2</generator>
		<item>
		<title>By: Mark Bate</title>
		<link>http://leahculver.com/2008/06/17/tiny-urls-based-on-pk/#comment-1179</link>
		<dc:creator>Mark Bate</dc:creator>
		<pubDate>Thu, 07 Aug 2008 22:35:09 +0000</pubDate>
		<guid>http://leahculver.com/2008/06/17/tiny-urls-based-on-pk/#comment-1179</guid>
		<description>nice idea.
will the permalink be optional or automagical?
It probably won't matter either way, other than a little number crunching on the server.

as far as characters to use.. the tilde is quite nice, it's a funky little character.
I personally think you should try and pick a character that plays with the permalink idea. generally permalinks are something someone thinks is important and should be drawn to attention, kind of like a pinned notice.
Characters that might resemble pushpins could be appropriate? eg. ' or ` (side on push pins?), *, +, @ (front on push pins?)</description>
		<content:encoded><![CDATA[<p>nice idea.<br />
will the permalink be optional or automagical?<br />
It probably won&#8217;t matter either way, other than a little number crunching on the server.</p>
<p>as far as characters to use.. the tilde is quite nice, it&#8217;s a funky little character.<br />
I personally think you should try and pick a character that plays with the permalink idea. generally permalinks are something someone thinks is important and should be drawn to attention, kind of like a pinned notice.<br />
Characters that might resemble pushpins could be appropriate? eg. &#8216; or ` (side on push pins?), *, +, @ (front on push pins?)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charlie La Mothe</title>
		<link>http://leahculver.com/2008/06/17/tiny-urls-based-on-pk/#comment-1175</link>
		<dc:creator>Charlie La Mothe</dc:creator>
		<pubDate>Fri, 01 Aug 2008 03:31:59 +0000</pubDate>
		<guid>http://leahculver.com/2008/06/17/tiny-urls-based-on-pk/#comment-1175</guid>
		<description>http://code.djangoproject.com/changeset/8162#file15</description>
		<content:encoded><![CDATA[<p><a href="http://code.djangoproject.com/changeset/8162#file15" rel="nofollow">http://code.djangoproject.com/changeset/8162#file15</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cesar Noel Quinon</title>
		<link>http://leahculver.com/2008/06/17/tiny-urls-based-on-pk/#comment-1171</link>
		<dc:creator>Cesar Noel Quinon</dc:creator>
		<pubDate>Wed, 23 Jul 2008 02:58:47 +0000</pubDate>
		<guid>http://leahculver.com/2008/06/17/tiny-urls-based-on-pk/#comment-1171</guid>
		<description>I would be nice that pownce would have an tinyurl integrated within the system so that I would shorten the links on the post. Similar to what they did with Twhirl or Twitterfox</description>
		<content:encoded><![CDATA[<p>I would be nice that pownce would have an tinyurl integrated within the system so that I would shorten the links on the post. Similar to what they did with Twhirl or Twitterfox</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark</title>
		<link>http://leahculver.com/2008/06/17/tiny-urls-based-on-pk/#comment-1168</link>
		<dc:creator>Mark</dc:creator>
		<pubDate>Wed, 16 Jul 2008 15:39:06 +0000</pubDate>
		<guid>http://leahculver.com/2008/06/17/tiny-urls-based-on-pk/#comment-1168</guid>
		<description>My template arguments got zapped, but you get the idea.</description>
		<content:encoded><![CDATA[<p>My template arguments got zapped, but you get the idea.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark</title>
		<link>http://leahculver.com/2008/06/17/tiny-urls-based-on-pk/#comment-1167</link>
		<dc:creator>Mark</dc:creator>
		<pubDate>Wed, 16 Jul 2008 15:37:32 +0000</pubDate>
		<guid>http://leahculver.com/2008/06/17/tiny-urls-based-on-pk/#comment-1167</guid>
		<description>Late on the uptake, yes, but I love doing little things like this.  It's faster to push the characters to a list, reverse the list, and join the elements.  About 15% faster.  Also, you realize that this occasionaly (1/56th of the time) sticks a 0 (encoded as '2') on the front?  A do-while loop would be simpler, but Python misses out on that one:

def int_to_anybase(num, alphabet):
    if (num == 0): return alphabet[0]
    arr = []
    while num:
        rem = num % base
        num = num // base
        arr.append(alphabet[num])
    arr.reverse()
    return ''.join(arr)

Here's a do-while in the language of the gods:

std::string int_to_anybase(unsigned num, const std::string &#38;alphabet)
{
    std::ostringstream out;
    std::list list;
    size_t base = alphabet.length();
    do {
        unsigned rem = num % base;
        num /= base;
        list.push_front(alphabet[rem]);
    } while (num);
    std::copy(list.begin(), list.end(), std::ostream_iterator(out));
    return out.str();
}</description>
		<content:encoded><![CDATA[<p>Late on the uptake, yes, but I love doing little things like this.  It&#8217;s faster to push the characters to a list, reverse the list, and join the elements.  About 15% faster.  Also, you realize that this occasionaly (1/56th of the time) sticks a 0 (encoded as &#8216;2&#8242;) on the front?  A do-while loop would be simpler, but Python misses out on that one:</p>
<p>def int_to_anybase(num, alphabet):<br />
    if (num == 0): return alphabet[0]<br />
    arr = []<br />
    while num:<br />
        rem = num % base<br />
        num = num // base<br />
        arr.append(alphabet[num])<br />
    arr.reverse()<br />
    return &#8221;.join(arr)</p>
<p>Here&#8217;s a do-while in the language of the gods:</p>
<p>std::string int_to_anybase(unsigned num, const std::string &amp;alphabet)<br />
{<br />
    std::ostringstream out;<br />
    std::list list;<br />
    size_t base = alphabet.length();<br />
    do {<br />
        unsigned rem = num % base;<br />
        num /= base;<br />
        list.push_front(alphabet[rem]);<br />
    } while (num);<br />
    std::copy(list.begin(), list.end(), std::ostream_iterator(out));<br />
    return out.str();<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Milton</title>
		<link>http://leahculver.com/2008/06/17/tiny-urls-based-on-pk/#comment-1165</link>
		<dc:creator>Chris Milton</dc:creator>
		<pubDate>Mon, 14 Jul 2008 17:34:30 +0000</pubDate>
		<guid>http://leahculver.com/2008/06/17/tiny-urls-based-on-pk/#comment-1165</guid>
		<description>Leah,

Have you considered the caret? "^".
http://en.wikipedia.org/wiki/Caret

Chris</description>
		<content:encoded><![CDATA[<p>Leah,</p>
<p>Have you considered the caret? &#8220;^&#8221;.<br />
<a href="http://en.wikipedia.org/wiki/Caret" rel="nofollow">http://en.wikipedia.org/wiki/Caret</a></p>
<p>Chris</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kevin</title>
		<link>http://leahculver.com/2008/06/17/tiny-urls-based-on-pk/#comment-1163</link>
		<dc:creator>kevin</dc:creator>
		<pubDate>Sun, 13 Jul 2008 22:09:48 +0000</pubDate>
		<guid>http://leahculver.com/2008/06/17/tiny-urls-based-on-pk/#comment-1163</guid>
		<description>http://clickontyler.com/blog/2007/10/foo9-url-shortener/</description>
		<content:encoded><![CDATA[<p><a href="http://clickontyler.com/blog/2007/10/foo9-url-shortener/" rel="nofollow">http://clickontyler.com/blog/2007/10/foo9-url-shortener/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Leah</title>
		<link>http://leahculver.com/2008/06/17/tiny-urls-based-on-pk/#comment-1161</link>
		<dc:creator>Leah</dc:creator>
		<pubDate>Tue, 08 Jul 2008 00:18:50 +0000</pubDate>
		<guid>http://leahculver.com/2008/06/17/tiny-urls-based-on-pk/#comment-1161</guid>
		<description>James - The default view is great for using the ids and it's nice to know it exists. However, I wanted to make the URL suffix shorter than the note id by using more url-safe chars.</description>
		<content:encoded><![CDATA[<p>James - The default view is great for using the ids and it&#8217;s nice to know it exists. However, I wanted to make the URL suffix shorter than the note id by using more url-safe chars.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon</title>
		<link>http://leahculver.com/2008/06/17/tiny-urls-based-on-pk/#comment-1160</link>
		<dc:creator>Jon</dc:creator>
		<pubDate>Mon, 07 Jul 2008 23:58:26 +0000</pubDate>
		<guid>http://leahculver.com/2008/06/17/tiny-urls-based-on-pk/#comment-1160</guid>
		<description>Just wondering...what's the benefit of url-encoding the note ids, when you can just use the note id itself?</description>
		<content:encoded><![CDATA[<p>Just wondering&#8230;what&#8217;s the benefit of url-encoding the note ids, when you can just use the note id itself?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tyler Menezes</title>
		<link>http://leahculver.com/2008/06/17/tiny-urls-based-on-pk/#comment-1159</link>
		<dc:creator>Tyler Menezes</dc:creator>
		<pubDate>Wed, 02 Jul 2008 03:08:17 +0000</pubDate>
		<guid>http://leahculver.com/2008/06/17/tiny-urls-based-on-pk/#comment-1159</guid>
		<description>Why not an exclamation mark? I've always liked them, and the only UNIX related use I can think of is `!!` on the command line, which inserts the last command. Actually, I think that's only Linux, but anyways.

~ would probably be confusing, though.

Make sure, whatever you do, that you send a 301 Moved Permanently header. I mean, I'm sure you know that, but just thought I'd mention it. Really terrible for SEO otherwise.</description>
		<content:encoded><![CDATA[<p>Why not an exclamation mark? I&#8217;ve always liked them, and the only UNIX related use I can think of is `!!` on the command line, which inserts the last command. Actually, I think that&#8217;s only Linux, but anyways.</p>
<p>~ would probably be confusing, though.</p>
<p>Make sure, whatever you do, that you send a 301 Moved Permanently header. I mean, I&#8217;m sure you know that, but just thought I&#8217;d mention it. Really terrible for SEO otherwise.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
