<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Lex Mλchina</title>
	<atom:link href="http://lexmachina.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://lexmachina.wordpress.com</link>
	<description>General geekery about teaching computers how to think</description>
	<lastBuildDate>Thu, 24 Jun 2010 00:53:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='lexmachina.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Lex Mλchina</title>
		<link>http://lexmachina.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://lexmachina.wordpress.com/osd.xml" title="Lex Mλchina" />
	<atom:link rel='hub' href='http://lexmachina.wordpress.com/?pushpress=hub'/>
		<item>
		<title></title>
		<link>http://lexmachina.wordpress.com/2010/01/05/97/</link>
		<comments>http://lexmachina.wordpress.com/2010/01/05/97/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 22:06:13 +0000</pubDate>
		<dc:creator>lexmachina</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://lexmachina.wordpress.com/?p=97</guid>
		<description><![CDATA[Modified Ajantis Shadow Beacon, uses Skull/X/Square marks instead of the defaults. -- master frame local sb = CreateFrame(&#34;Frame&#34;) local markClearFrame = CreateFrame(&#34;Frame&#34;) -- constants local SPELLS = { [64465] = true, } local NAMES = { [&#34;Marked Immortal Guardian&#34;] = true, } -- variables local lastIconIndex = 9 -- mobs tracking local guids = { [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lexmachina.wordpress.com&amp;blog=4648550&amp;post=97&amp;subd=lexmachina&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Modified Ajantis Shadow Beacon, uses Skull/X/Square marks instead of the defaults.</p>
<pre>
-- master frame
local sb = CreateFrame(&quot;Frame&quot;)
local markClearFrame = CreateFrame(&quot;Frame&quot;)

-- constants
local SPELLS = { [64465] = true, }
local NAMES = { [&quot;Marked Immortal Guardian&quot;] = true, }

-- variables
local lastIconIndex = 9

-- mobs tracking
local guids = { }
local ignoreGuids = { }

-- loop and timer control
local nextCheckTime = nil
local lastBeaconBatchTime = nil


-- mark clearing control
local markToClear = 8
local nextMarkCheckTime = nil


-- Main mark clearing loop.
local function ClearAllMarksLoop()
    if nextMarkCheckTime ~= nil then
        local curTime = GetTime()
        local abort = nil


        if curTime &gt;= nextMarkCheckTime then
            if markToClear == 6 then
                markToClear = 0
                abort = true
            end

            SetRaidTarget(&quot;player&quot;, markToClear)

            if abort then
                nextMarkCheckTime = nil
                markToClear = 8
                markClearFrame:SetScript(&quot;OnUpdate&quot;, nil)
            else
                markToClear = markToClear + 1

                if markToClear == 6 then
                    nextMarkCheckTime = curTime + 0.5
                else
                    nextMarkCheckTime = curTime + 0.2
                end
            end
        end
    end
end


-- Starts the mark clearing loop.
function ClearAllMarks()
    markToClear = 8
    nextMarkCheckTime = GetTime()
    markClearFrame:SetScript(&quot;OnUpdate&quot;, ClearAllMarksLoop)
end


-- Gets the next icon index to mark a mob with.
local function GetNextAvailableIcon()
    if lastIconIndex == 6 then
        lastIconIndex = 9
    end

    lastIconIndex = lastIconIndex - 1

    return lastIconIndex
end


-- Marks the supplied unit.
local function MarkUnit(unit)
    if UnitExists(unit) then
        local guid = UnitGUID(unit)


        SetRaidTarget(unit, GetNextAvailableIcon())
        ignoreGuids[guid] = true
    end
end

-- Checks to see if we want to mark this unitId, by
-- checking to see if it's a known GUID from the
-- combat log, if it's name matches something in our
-- list of markable mobs, or if it has the Shadow
-- Beacon buff.  Returns true if we are interested
-- in the mob, nil otherwise.
local function IsMobOfInterest(unitId)
    local rc


    if UnitExists(unitId) then
        local name = UnitName(unitId)
        local guid = UnitGUID(unitId)


        if not ignoreGuids[guid] then
            if guids[guid] then
                rc = true

            elseif NAMES[name] then
                rc = true

            else
                for spellId, _ in pairs(SPELLS) do
                    local spellName = GetSpellInfo(spellId)


                    if spellName then
                        if UnitBuff(unitId, spellName) then
                            rc = true
                            break
                        end
                    end
                end
            end
        end
    end

    return rc
end


-- Checks the supplied unitId to see if it matches the
-- supplied GUID.  If it does, this function ensures
-- that mob has one of the acceptable Shadow Beacon
-- marks.  If the mob doesn't yet have an allowed
-- mark, it marks it up with the next usable mark.
-- Returns true if the mob matched the GUID and has
-- a mark, nil otherwise.
local function MarkMobByUnitIfGUID(unitId, guid)
    local rc


    if UnitExists(unitId) then
        if UnitGUID(unitId) == guid then
            local curIcon = GetRaidTargetIndex(unitId) or 0


            -- only mark up if it doesn't already
            -- have one of the five marks we use
            if curIcon &lt; 6 or curIcon &gt; 8 then
                MarkUnit(unitId)
            end

            rc = true
        end
    end

    return rc
end


-- Scans all available targets to see if any of them match
-- the supplied GUID.  If that mob is found, this function
-- ensures it is marked with one of the acceptable Shadow
-- Beacon marks.  Returns true if the mob was found and
-- is (or was caused to be) marked, nil otherwise.
local function MarkMobByGUIDFromRaidTargets(guid)
    local rc


    for i = 1, 40 do
        local unitId = &quot;raid&quot;..i..&quot;target&quot;

        if MarkMobByUnitIfGUID(unitId, guid) then
            rc = true
            break
        end
    end

    return rc
end


-- Attempts to mark up the mob with the supplied GUID, and
-- if it can't be found, the GUID is put in a list to be
-- scanned on a 100ms timer so it will be marked ASAP.
local function RecordMobByGUID(guid)
    if not MarkMobByGUIDFromRaidTargets(guid) then  
        guids[guid] = true
    end
end


-- Detect Yogg-Saron casting Shadow Beacon and find out which mob he cast it on.
local function HandleCombatLog(timeStamp, event, sourceGuid, sourceName, sourceFlags, destGuid, destName, destFlags, spellId)
    if event == &quot;SPELL_AURA_APPLIED&quot; or event == &quot;SPELL_AURA_REFRESH&quot; then
        if SPELLS[spellId] then
            -- Activate the mouseover timer.
            nextCheckTime = GetTime()

            -- If this is a new round of Beacons, tell the player
            -- to start going nuts with the mouseovers.
            if lastBeaconBatchTime == nil then
                lastBeaconBatchTime = GetTime()
                UIErrorsFrame:AddMessage(&quot;Shadow Beacon cast - start mousing over the elephants!&quot;)
                PlaySoundFile((&quot;Interface\\AddOns\\AjantisShadowBeacon\\aoogah.ogg&quot;))
            end

            -- Record this mob as one of interest.
            RecordMobByGUID(destGuid)
        end
    end
end


-- Forgets we ever did anything.
local function Reset(removeIgnored)
    guids = { }
    nextCheckTime = nil
    lastIconIndex = 9
    lastBeaconBatchTime = nil
    ClearAllMarks()

    ignoreGuids = { }
end


-- The timer loop for marking mobs that weren't being
-- targeted by someone at the time the Beacon was cast.
-- It tracks mouseovers until all mobs that are known
-- to be of interest are marked up.
sb:SetScript(&quot;OnUpdate&quot;, function(f, event, ...)
    local curTime = GetTime()


    -- Reset everything if the last 'batch' of Shadow Beacons sent out was long enough ago.
    if lastBeaconBatchTime ~= nil and curTime - lastBeaconBatchTime &gt;= 31 then
        Reset()
    else
        -- Main mouseover loop to check the current mouseover unit
        -- to see if it's in need of a mark.
        if nextCheckTime ~= nil and curTime &gt;= nextCheckTime then
            if IsMobOfInterest(&quot;mouseover&quot;) then
                local curGuid = UnitGUID(&quot;mouseover&quot;)
                local curIcon = GetRaidTargetIndex(&quot;mouseover&quot;) or 0


                -- Only mark up if it doesn't already
                -- have one of the five marks we use.
                if curIcon &lt; 6 or curIcon &gt; 8 then
                    MarkUnit(&quot;mouseover&quot;)
                end

                -- Done marking this mob, forget about it now.
                guids[curGuid] = nil
            end

            nextCheckTime = curTime + 0.15
        end
    end
end)


-- Hook into and handle the various events.
sb:SetScript(&quot;OnEvent&quot;, function(f, event, ...)
    if event == &quot;COMBAT_LOG_EVENT_UNFILTERED&quot; then
        HandleCombatLog(...)

    elseif event == &quot;PLAYER_REGEN_DISABLED&quot; then
        Reset(true)

    elseif event == &quot;ZONE_CHANGED_NEW_AREA&quot; then
        Reset(true)

    elseif event == &quot;ZONE_CHANGED&quot; then
        Reset(true)

    end
end)

sb:RegisterEvent(&quot;COMBAT_LOG_EVENT_UNFILTERED&quot;)
sb:RegisterEvent(&quot;PLAYER_REGEN_DISABLED&quot;)
sb:RegisterEvent(&quot;ZONE_CHANGED_NEW_AREA&quot;)
sb:RegisterEvent(&quot;ZONE_CHANGED&quot;)
</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lexmachina.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lexmachina.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lexmachina.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lexmachina.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lexmachina.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lexmachina.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lexmachina.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lexmachina.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lexmachina.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lexmachina.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lexmachina.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lexmachina.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lexmachina.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lexmachina.wordpress.com/97/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lexmachina.wordpress.com&amp;blog=4648550&amp;post=97&amp;subd=lexmachina&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lexmachina.wordpress.com/2010/01/05/97/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/aca17ffad5faa4b9f2ea9090b56a1c59?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Lex</media:title>
		</media:content>
	</item>
		<item>
		<title>US Phone Number Regular Expression</title>
		<link>http://lexmachina.wordpress.com/2008/10/30/us-phone-number-regular-expression/</link>
		<comments>http://lexmachina.wordpress.com/2008/10/30/us-phone-number-regular-expression/#comments</comments>
		<pubDate>Thu, 30 Oct 2008 21:51:46 +0000</pubDate>
		<dc:creator>lexmachina</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[phone]]></category>
		<category><![CDATA[phone number]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[regexen]]></category>
		<category><![CDATA[regular expression]]></category>
		<category><![CDATA[validation]]></category>

		<guid isPermaLink="false">http://lexmachina.wordpress.com/?p=62</guid>
		<description><![CDATA[Here&#8217;s a regex for validating/parsing USA-format phone numbers. /^(?:(\d)[ \-\.]?)?(?:\(?(\d{3})\)?[ \-\.])?(\d{3})[ \-\.](\d{4})(?: ?x?(\d+))?$/ Try copy and pasting it in Rubular. Capture Groups: 0: &#8220;1&#8243; prefix, if included 1: Area code, if included 2: Prefix 3: Line Number 4: Extension, if included It allows for a handful of formats as well. You may use dashes, dots, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lexmachina.wordpress.com&amp;blog=4648550&amp;post=62&amp;subd=lexmachina&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a regex for validating/parsing USA-format phone numbers.</p>
<p>/^(?:(\d)[ \-\.]?)?(?:\(?(\d{3})\)?[ \-\.])?(\d{3})[ \-\.](\d{4})(?: ?x?(\d+))?$/</p>
<p>Try copy and pasting it in <a href="http://www.rubular.com">Rubular</a>.</p>
<p>Capture Groups:<br />
0: &#8220;1&#8243; prefix, if included<br />
1: Area code, if included<br />
2: Prefix<br />
3: Line Number<br />
4: Extension, if included</p>
<p>It allows for a handful of formats as well. You may use dashes, dots, spaces or even nothing as separators, parentheses around area code are optional. Extension may be defined as simply another segment, or prefixed with &#8220;x&#8221;.</p>
<p>Examples that all work<br />
155555555555555<br />
1.555.555.5555 5555<br />
(555) 555-5555 x5555<br />
555-5555</p>
<p>Simple validation can be performed just by checking if it matches, more robust validation can be performed by validating each capture group.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lexmachina.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lexmachina.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lexmachina.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lexmachina.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lexmachina.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lexmachina.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lexmachina.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lexmachina.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lexmachina.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lexmachina.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lexmachina.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lexmachina.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lexmachina.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lexmachina.wordpress.com/62/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lexmachina.wordpress.com&amp;blog=4648550&amp;post=62&amp;subd=lexmachina&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lexmachina.wordpress.com/2008/10/30/us-phone-number-regular-expression/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/aca17ffad5faa4b9f2ea9090b56a1c59?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Lex</media:title>
		</media:content>
	</item>
		<item>
		<title>Stack Overflow</title>
		<link>http://lexmachina.wordpress.com/2008/10/17/stack-overflow/</link>
		<comments>http://lexmachina.wordpress.com/2008/10/17/stack-overflow/#comments</comments>
		<pubDate>Fri, 17 Oct 2008 16:39:06 +0000</pubDate>
		<dc:creator>lexmachina</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[community]]></category>
		<category><![CDATA[stack overflow]]></category>

		<guid isPermaLink="false">http://lexmachina.wordpress.com/?p=60</guid>
		<description><![CDATA[I just signed up on Stack Overflow, a programming QA site with a strong basis on community. It&#8217;s the most addicting website I&#8217;ve used since Facebook. Users ask questions and they appear on the main page in a feed showing the question and how many votes the question has in a fashion similar to digg.com. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lexmachina.wordpress.com&amp;blog=4648550&amp;post=60&amp;subd=lexmachina&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I just signed up on <a title="Stack Overflow" href="http://stackoverflow.com" target="_blank">Stack Overflow</a>, a programming QA site with a strong basis on community. It&#8217;s the most addicting website I&#8217;ve used since <a title="Facebook" href="http://www.facebook.com" target="_blank">Facebook</a>. Users ask questions and they appear on the main page in a feed showing the question and how many votes the question has in a fashion similar to <a title="Digg" href="http://digg.com" target="_blank">digg.com</a>. People then have the opportunity to respond, and each response may be voted on as helpful or not.</p>
<p>Users earn reputation points by asking questions, providing answers, and receiving votes. Users may also earn &#8220;Badges&#8221; by doing other tasks like filling out their profile, or providing a very good answer to a long-outdated question.</p>
<p>If you&#8217;re a developer, you owe it to yourself to check out <a title="Stack Overflow" href="http://stackoverflow.com" target="_blank">Stack Overflow</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lexmachina.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lexmachina.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lexmachina.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lexmachina.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lexmachina.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lexmachina.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lexmachina.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lexmachina.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lexmachina.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lexmachina.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lexmachina.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lexmachina.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lexmachina.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lexmachina.wordpress.com/60/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lexmachina.wordpress.com&amp;blog=4648550&amp;post=60&amp;subd=lexmachina&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lexmachina.wordpress.com/2008/10/17/stack-overflow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/aca17ffad5faa4b9f2ea9090b56a1c59?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Lex</media:title>
		</media:content>
	</item>
		<item>
		<title>Intel&#8217;s Tiny Forbidden City</title>
		<link>http://lexmachina.wordpress.com/2008/10/14/intels-tiny-forbidden-city/</link>
		<comments>http://lexmachina.wordpress.com/2008/10/14/intels-tiny-forbidden-city/#comments</comments>
		<pubDate>Tue, 14 Oct 2008 21:08:08 +0000</pubDate>
		<dc:creator>lexmachina</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[china]]></category>
		<category><![CDATA[core]]></category>
		<category><![CDATA[cpu]]></category>
		<category><![CDATA[forbidden city]]></category>
		<category><![CDATA[intel]]></category>
		<category><![CDATA[penryn]]></category>
		<category><![CDATA[wolfdale]]></category>

		<guid isPermaLink="false">http://lexmachina.wordpress.com/?p=56</guid>
		<description><![CDATA[Coincidence?<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lexmachina.wordpress.com&amp;blog=4648550&amp;post=56&amp;subd=lexmachina&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Coincidence?</p>

<a href='http://lexmachina.wordpress.com/2008/10/14/intels-tiny-forbidden-city/wolfdale-die/' title='wolfdale-die'><img data-attachment-id='58' data-orig-size='250,357' data-liked='0'width="105" height="150" src="http://lexmachina.files.wordpress.com/2008/10/wolfdale-die.jpg?w=105&#038;h=150" class="attachment-thumbnail" alt="wolfdale-die" title="wolfdale-die" /></a>
<a href='http://lexmachina.wordpress.com/2008/10/14/intels-tiny-forbidden-city/forbidden_city/' title='forbidden_city'><img data-attachment-id='57' data-orig-size='994,798' data-liked='0'width="150" height="120" src="http://lexmachina.files.wordpress.com/2008/10/forbidden_city.jpg?w=150&#038;h=120" class="attachment-thumbnail" alt="forbidden_city" title="forbidden_city" /></a>

<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lexmachina.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lexmachina.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lexmachina.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lexmachina.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lexmachina.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lexmachina.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lexmachina.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lexmachina.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lexmachina.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lexmachina.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lexmachina.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lexmachina.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lexmachina.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lexmachina.wordpress.com/56/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lexmachina.wordpress.com&amp;blog=4648550&amp;post=56&amp;subd=lexmachina&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lexmachina.wordpress.com/2008/10/14/intels-tiny-forbidden-city/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/aca17ffad5faa4b9f2ea9090b56a1c59?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Lex</media:title>
		</media:content>

		<media:content url="http://lexmachina.files.wordpress.com/2008/10/wolfdale-die.jpg?w=105" medium="image">
			<media:title type="html">wolfdale-die</media:title>
		</media:content>

		<media:content url="http://lexmachina.files.wordpress.com/2008/10/forbidden_city.jpg?w=150" medium="image">
			<media:title type="html">forbidden_city</media:title>
		</media:content>
	</item>
		<item>
		<title>Closure vs. First-Class Function</title>
		<link>http://lexmachina.wordpress.com/2008/10/08/closure-vs-first-class-function/</link>
		<comments>http://lexmachina.wordpress.com/2008/10/08/closure-vs-first-class-function/#comments</comments>
		<pubDate>Wed, 08 Oct 2008 16:20:14 +0000</pubDate>
		<dc:creator>lexmachina</dc:creator>
				<category><![CDATA[Dynamic Languages]]></category>
		<category><![CDATA[Groovy]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[closure]]></category>
		<category><![CDATA[lambda]]></category>

		<guid isPermaLink="false">http://lexmachina.wordpress.com/?p=52</guid>
		<description><![CDATA[I said I wasn&#8217;t going to post anymore on this page, but this has been bugging me. Since this latest dynamic-language trend has been going on, people have been throwing around the word &#8216;closure&#8217; like a Swedish meatball in a food fight. A first-class function is a function that acts as an object or variable. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lexmachina.wordpress.com&amp;blog=4648550&amp;post=52&amp;subd=lexmachina&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I said I wasn&#8217;t going to post anymore on this page, but this has been bugging me. Since this latest dynamic-language trend has been going on, people have been throwing around the word &#8216;closure&#8217; like a Swedish meatball in a food fight. </p>
<p>A first-class function is a function that acts as an object or variable. They are sometimes called lambdas, anonymous functions, or procs. A closure is a special type of anonymous function that has access to external variables not passed in as arguments. In most cases with the popular dynamic languages (Javascript, Ruby, Groovy, etc&#8230;) first-class functions are indeed closures, but I believe that it is less important that they are closures as they are first-class functions.</p>
<p>To help clarify, in Javascript:<br />
<code>
<pre>
var lambda = function(x) { &nbsp;return x + 2; };
</pre>
<p></code><br />
This is an example of a first-class function. Technically it is also a closure, but the fact that it is is unimportant because it doesn&#8217;t reference and variable outside its scope.</p>
<p><code>
<pre>
var y = 35;
var closure = function(x) { return x+y; };
</pre>
<p></code><br />
This time it IS important to call this function a closure (though it is also an anonymous function, lambda, etc&#8230;) because it references variable &#8216;y&#8217; which is defined outside the scope of the function.</p>
<p>In Ruby a &#8216;block&#8217; is a special type of anonymous function that is passed to another function as an argument. Because they have access to their parent scope&#8217;s variables, they are closures, but they are more importantly blocks. So call them that. Using &#8216;closure&#8217; all the time just adds confusion as to what a closure really is.</p>
<p>Ruby block example:<br />
<code>
<pre>
['one', 'two', 'three'].each {|it| puts it }
</pre>
<p></code></p>
<p>The &#8220;{|it| puts it}&#8221; part is the block. It is not important that it is a closure, again, because it doesn&#8217;t reference external variables.</p>
<p>This is really a bunch of hot air, but I believe that it&#8217;s very important, especially when dealing with very technical subjects, to use the most appropriate nomenclature. Unless you&#8217;re referencing the fact that a lambda (etc..) is referencing external variables, don&#8217;t call it a closure.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lexmachina.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lexmachina.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lexmachina.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lexmachina.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lexmachina.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lexmachina.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lexmachina.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lexmachina.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lexmachina.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lexmachina.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lexmachina.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lexmachina.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lexmachina.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lexmachina.wordpress.com/52/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lexmachina.wordpress.com&amp;blog=4648550&amp;post=52&amp;subd=lexmachina&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lexmachina.wordpress.com/2008/10/08/closure-vs-first-class-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/aca17ffad5faa4b9f2ea9090b56a1c59?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Lex</media:title>
		</media:content>
	</item>
		<item>
		<title>You are now being redirected&#8230;</title>
		<link>http://lexmachina.wordpress.com/2008/10/07/you-are-now-being-redirected/</link>
		<comments>http://lexmachina.wordpress.com/2008/10/07/you-are-now-being-redirected/#comments</comments>
		<pubDate>Tue, 07 Oct 2008 17:03:28 +0000</pubDate>
		<dc:creator>lexmachina</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Groovy]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://lexmachina.wordpress.com/?p=48</guid>
		<description><![CDATA[I&#8217;m abandoning this blog. Yep, I just started it, but I can&#8217;t be happy unless I&#8217;m hosting things myself. So I&#8217;m preparing to launch http://www.alexeibroner.com/ and http://www.lex-machina.com/ to host my new blogs. I&#8217;ll be in the woodshed making things work for a couple more weeks and then I&#8217;ll be back up at the new addresses. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lexmachina.wordpress.com&amp;blog=4648550&amp;post=48&amp;subd=lexmachina&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m abandoning this blog. Yep, I just started it, but I can&#8217;t be happy unless I&#8217;m hosting things myself. So I&#8217;m preparing to launch <a href="http://www.alexeibroner.com/">http://www.alexeibroner.com/</a> and <a href="http://www.lex-machina.com/">http://www.lex-machina.com/</a> to host my new blogs. I&#8217;ll be in the woodshed making things work for a couple more weeks and then I&#8217;ll be back up at the new addresses.</p>
<p>What&#8217;s to come? An article on RESTful architecture for PHP and a preview of my REST server framework (oh god, that&#8217;s terrible news&#8230; not another web framework!). The good news? It&#8217;s easier to use than Rails (really!), and will be available for PHP with ports to Ruby and  Java/Groovy in the works (and possibly Python as well).</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lexmachina.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lexmachina.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lexmachina.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lexmachina.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lexmachina.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lexmachina.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lexmachina.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lexmachina.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lexmachina.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lexmachina.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lexmachina.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lexmachina.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lexmachina.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lexmachina.wordpress.com/48/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lexmachina.wordpress.com&amp;blog=4648550&amp;post=48&amp;subd=lexmachina&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lexmachina.wordpress.com/2008/10/07/you-are-now-being-redirected/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/aca17ffad5faa4b9f2ea9090b56a1c59?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Lex</media:title>
		</media:content>
	</item>
		<item>
		<title>33 year old high school cheerleader</title>
		<link>http://lexmachina.wordpress.com/2008/09/15/33-year-old-high-school-cheerleader/</link>
		<comments>http://lexmachina.wordpress.com/2008/09/15/33-year-old-high-school-cheerleader/#comments</comments>
		<pubDate>Mon, 15 Sep 2008 13:50:43 +0000</pubDate>
		<dc:creator>lexmachina</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[cheerleader]]></category>
		<category><![CDATA[identity theft]]></category>
		<category><![CDATA[mom]]></category>

		<guid isPermaLink="false">http://lexmachina.wordpress.com/?p=46</guid>
		<description><![CDATA[Only in Wisconsin: via Yahoo. Isn&#8217;t that cute? She just wanted to be a cheerleader. While public humiliation is one thing, I think pressing charges is a bit extreme. I mean; Who doesn&#8217;t want to be a high school cheerleader? Thanks for the link Charles.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lexmachina.wordpress.com&amp;blog=4648550&amp;post=46&amp;subd=lexmachina&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Only in Wisconsin:<br />
<a href="http://news.yahoo.com/s/ap/20080913/ap_on_fe_st/odd_cheerleading_mom">via Yahoo.</a></p>
<p>Isn&#8217;t that cute? She just wanted to be a cheerleader. While public humiliation is one thing, I think pressing charges is a bit extreme. I mean; Who doesn&#8217;t want to be a high school cheerleader?</p>
<p>Thanks for the link Charles.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/lexmachina.wordpress.com/46/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/lexmachina.wordpress.com/46/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lexmachina.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lexmachina.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lexmachina.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lexmachina.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lexmachina.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lexmachina.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lexmachina.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lexmachina.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lexmachina.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lexmachina.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lexmachina.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lexmachina.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lexmachina.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lexmachina.wordpress.com/46/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lexmachina.wordpress.com&amp;blog=4648550&amp;post=46&amp;subd=lexmachina&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lexmachina.wordpress.com/2008/09/15/33-year-old-high-school-cheerleader/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/aca17ffad5faa4b9f2ea9090b56a1c59?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Lex</media:title>
		</media:content>
	</item>
		<item>
		<title>Computing a hexidecimal hash for a string in Java</title>
		<link>http://lexmachina.wordpress.com/2008/09/12/computing-a-hexidecimal-hash-for-a-string-in-java/</link>
		<comments>http://lexmachina.wordpress.com/2008/09/12/computing-a-hexidecimal-hash-for-a-string-in-java/#comments</comments>
		<pubDate>Fri, 12 Sep 2008 20:30:23 +0000</pubDate>
		<dc:creator>lexmachina</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[checksum]]></category>
		<category><![CDATA[digest]]></category>
		<category><![CDATA[hash]]></category>
		<category><![CDATA[hex]]></category>
		<category><![CDATA[hexadecimal]]></category>
		<category><![CDATA[md2]]></category>
		<category><![CDATA[md5]]></category>
		<category><![CDATA[sha-1]]></category>
		<category><![CDATA[sha-2]]></category>
		<category><![CDATA[sha-256]]></category>
		<category><![CDATA[sha-384]]></category>
		<category><![CDATA[sha-512]]></category>

		<guid isPermaLink="false">http://lexmachina.wordpress.com/?p=43</guid>
		<description><![CDATA[Computing a hexidecimal hash for a string is a very common function used in web development. It&#8217;s so common that most scripting languages provide a MD5 function that does just that. e.g. MD5(&#8220;Your favorite string goes here&#8221;); Well I&#8217;ve found myself needing to generate hashes in Java apps a couple of times, and have found [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lexmachina.wordpress.com&amp;blog=4648550&amp;post=43&amp;subd=lexmachina&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Computing a hexidecimal hash for a string is a very common function used in web development. It&#8217;s so common that most scripting languages provide a MD5 function that does just that. e.g. MD5(&#8220;Your favorite string goes here&#8221;);</p>
<p>Well I&#8217;ve found myself needing to generate hashes in Java apps a couple of times, and have found myself very disappointed in the amount of code required to perform what seems to me like a very mundane task. Simply put, it&#8217;s a pain in the butt.</p>
<p>So, I wrote a simple Java class with a single static method to do just that. To use it just type:</p>
<p><code><br />
String myHash = DigestUtil.computeHexDigest(DigestUtil.ALGORITHM_MD5, "your favorite string goes here");<br />
</code></p>
<p>And that&#8217;s that. Well, it&#8217;ll never be as simple as  but this beats the pants off doing it manually.</p>
<p>So, without further adieu, here&#8217;s the code ripe for copying-and-pasting into your app. Sorry for the formatting, WordPress is giving me trouble.</p>
<p>&#8211;BEGIN CODE SNIPPET&#8211;</p>
<p>import java.math.BigInteger;<br />
import java.security.MessageDigest;<br />
import java.security.NoSuchAlgorithmException;</p>
<p>public class DigestUtil<br />
{<br />
    /**<br />
     * Constant representing the MD2 hash algorithm<br />
     */<br />
    public static String ALGORITHM_MD2    = &#8220;MD2&#8243;;</p>
<p>    /**<br />
     * Constant representing the MD5 hash algorithm<br />
     */<br />
    public static String ALGORITHM_MD5    = &#8220;MD5&#8243;;</p>
<p>    /**<br />
     * Constant representing the SHA-1 hash algorithm<br />
     */<br />
    public static String ALGORITHM_SHA1   = &#8220;SHA-1&#8243;;</p>
<p>    /**<br />
     * Constant representing the SHA-256 hash algorithm<br />
     */<br />
    public static String ALGORITHM_SHA256 = &#8220;SHA-256&#8243;;</p>
<p>    /**<br />
     * Constant representing the SHA-384 hash algorithm<br />
     */<br />
    public static String ALGORITHM_SHA384 = &#8220;SHA-384&#8243;;</p>
<p>    /**<br />
     * Constant representing the SHA-512 hash algorithm<br />
     */<br />
    public static String ALGORITHM_SHA512 = &#8220;SHA-512&#8243;;</p>
<p>    /**<br />
     *<br />
     * Computes the hexadecimal hash key for &lt;em&gt;input&lt;/em&gt; using given &lt;em&gt;algorithm&lt;/em&gt;<br />
     *<br />
     * @param algorithm<br />
     * @param input<br />
     * @return<br />
     * @throws NoSuchAlgorithmException<br />
     *<br />
     */<br />
    public static String computeHexDigest(String algorithm, String input)<br />
        throws NoSuchAlgorithmException<br />
    {<br />
        byte []       inputBytes = input.getBytes();<br />
        MessageDigest md         = MessageDigest.getInstance(algorithm);<br />
        byte []       digest     = md.digest(inputBytes);<br />
        BigInteger    bigNumber  = new BigInteger(1, digest);<br />
        String        hash       = bigNumber.toString(16);</p>
<p>        if ( hash.length() &lt; 64 )<br />
        {<br />
            StringBuffer buf = new StringBuffer();</p>
<p>            for ( int i = 1; i &lt; 64 &#8211; hash.length(); i++ )<br />
            {<br />
                buf.append(&#8220;0&#8243;);<br />
            }</p>
<p>            hash = buf.toString() + hash;<br />
        }</p>
<p>        return hash;<br />
    }</p>
<p>}</p>
<p>&#8211;END CODE SNIPPET&#8211;</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/lexmachina.wordpress.com/43/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/lexmachina.wordpress.com/43/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lexmachina.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lexmachina.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lexmachina.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lexmachina.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lexmachina.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lexmachina.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lexmachina.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lexmachina.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lexmachina.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lexmachina.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lexmachina.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lexmachina.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lexmachina.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lexmachina.wordpress.com/43/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lexmachina.wordpress.com&amp;blog=4648550&amp;post=43&amp;subd=lexmachina&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lexmachina.wordpress.com/2008/09/12/computing-a-hexidecimal-hash-for-a-string-in-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/aca17ffad5faa4b9f2ea9090b56a1c59?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Lex</media:title>
		</media:content>
	</item>
		<item>
		<title>How to read this specification</title>
		<link>http://lexmachina.wordpress.com/2008/09/05/how-to-read-this-specification/</link>
		<comments>http://lexmachina.wordpress.com/2008/09/05/how-to-read-this-specification/#comments</comments>
		<pubDate>Fri, 05 Sep 2008 21:36:55 +0000</pubDate>
		<dc:creator>lexmachina</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[humor]]></category>
		<category><![CDATA[w3c]]></category>

		<guid isPermaLink="false">http://lexmachina.wordpress.com/?p=36</guid>
		<description><![CDATA[From section 1.6.1 of the W3C Editor&#8217;s Draft of the HTML5 specification: This specification should be read like all other specifications. First, it should be read cover-to-cover, multiple times. Then, it should be read backwards at least once. Then it should be read by picking random sections from the contents list and following all the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lexmachina.wordpress.com&amp;blog=4648550&amp;post=36&amp;subd=lexmachina&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>From section 1.6.1 of the <a href="http://www.w3.org/html/wg/html5/" target="_blank">W3C Editor&#8217;s Draft of the HTML5 specification</a>:</p>
<blockquote><p>This specification should be read like all other specifications. First, it should be read cover-to-cover, multiple times. Then, it should be read backwards at least once. Then it should be read by picking random sections from the contents list and following all the cross-references.</p></blockquote>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/lexmachina.wordpress.com/36/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/lexmachina.wordpress.com/36/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lexmachina.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lexmachina.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lexmachina.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lexmachina.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lexmachina.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lexmachina.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lexmachina.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lexmachina.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lexmachina.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lexmachina.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lexmachina.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lexmachina.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lexmachina.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lexmachina.wordpress.com/36/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lexmachina.wordpress.com&amp;blog=4648550&amp;post=36&amp;subd=lexmachina&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lexmachina.wordpress.com/2008/09/05/how-to-read-this-specification/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/aca17ffad5faa4b9f2ea9090b56a1c59?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Lex</media:title>
		</media:content>
	</item>
		<item>
		<title>Rubular: web-based Ruby regular expression editor</title>
		<link>http://lexmachina.wordpress.com/2008/09/04/rubular-web-based-ruby-regular-expression-editor/</link>
		<comments>http://lexmachina.wordpress.com/2008/09/04/rubular-web-based-ruby-regular-expression-editor/#comments</comments>
		<pubDate>Thu, 04 Sep 2008 21:28:59 +0000</pubDate>
		<dc:creator>lexmachina</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[gobbledygook]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[regular expression]]></category>
		<category><![CDATA[rubular]]></category>
		<category><![CDATA[utility]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://lexmachina.wordpress.com/?p=15</guid>
		<description><![CDATA[I just stumbled upon Rubular a regex editor for Ruby. I&#8217;ve already used it once for work and I&#8217;m quite sure I&#8217;ll be returning regularly (pun intended). Note: Ruby 1.8 uses a PCRE engine, so this is useful to users of regexen in other languages as well, including PHP, Java, and JavaScript. Most other languages [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lexmachina.wordpress.com&amp;blog=4648550&amp;post=15&amp;subd=lexmachina&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I just stumbled upon <a href="http://rubular.com">Rubular</a> a regex editor for Ruby. I&#8217;ve already used it once for work and I&#8217;m quite sure I&#8217;ll be returning regularly (pun intended). Note: Ruby 1.8 uses a <span title="Perl Compatible Regular Expression">PCRE</span> engine, so this is useful to users of regexen in other languages as well, including PHP, Java, and JavaScript. Most other languages have PCRE libraries available.</p>
<p>Just as an exercise I wrote a regex for parsing a url. I&#8217;m sure it can be improved on (for example, it won&#8217;t deal with an &#8220;@&#8221; symbol) but for regular web addresses it will be quite useful. Copy and paste into Rubular for a demo.</p>
<p>Regex:<br />
<code>^(\w+):(?:\/\/)?([\w.]+)(\/(?:\w*/)*)(\w+)(\.\w+)?(?:\?([\w=&amp;]*))?$</code></p>
<p>Test string:<br />
<code>https://www.example.com/parent/child/resource.xml?query=something&amp;sort=asc</code></p>
<p>I&#8217;m looking forward to when Ruby changes its regex engine to Onigurama, then I can do this:</p>
<p><code><br />
^(?&lt;protocol&gt;\w+):(?:\/\/)?(?&lt;domain&gt;[\w.]+)(?&lt;path&gt;\/(?:\w*/)*)(?&lt;resource&gt;\w+)(?&lt;format&gt;\.\w+)?(?:\?(?:&lt;query_string&gt;[\w=&amp;]*))?$<br />
</code></p>
<p>This way I can refer to each capture by name. Onigurama is currently supported by the <a href="http://macromates.com">TextMate</a> text editor.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/lexmachina.wordpress.com/15/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/lexmachina.wordpress.com/15/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lexmachina.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lexmachina.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lexmachina.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lexmachina.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lexmachina.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lexmachina.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lexmachina.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lexmachina.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lexmachina.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lexmachina.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lexmachina.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lexmachina.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lexmachina.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lexmachina.wordpress.com/15/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lexmachina.wordpress.com&amp;blog=4648550&amp;post=15&amp;subd=lexmachina&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lexmachina.wordpress.com/2008/09/04/rubular-web-based-ruby-regular-expression-editor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/aca17ffad5faa4b9f2ea9090b56a1c59?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Lex</media:title>
		</media:content>
	</item>
	</channel>
</rss>
