<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>Russell Tyndall's Tech Blog</title><link>http://blogs.acceleration.net/russ/</link><description>The Shizzle Fa Rizzle at &lt;a href="http://www.acceleration.net" &gt;Acceleration.net&lt;/a&gt;</description><managingEditor>Russ</managingEditor><dc:language>en-US</dc:language><generator>.Text Version 0.95.2004.102</generator><item><dc:creator>Russ</dc:creator><title>I suppose I should have mentioned it ...</title><link>http://blogs.acceleration.net/russ/archive/2006/08/15/3005.aspx</link><pubDate>Tue, 15 Aug 2006 09:57:00 GMT</pubDate><guid>http://blogs.acceleration.net/russ/archive/2006/08/15/3005.aspx</guid><description>I have a new blog intended to replace this one.  For whatever reason, I cannot get dotText to export my posts correctly.  I plan on keeping this site up for a while, but all new content is at: &lt;a href="http://russ.unwashedmeme.com/blog"&gt;http://russ.unwashedmeme.com/blog&lt;/a&gt;.&lt;img src ="http://blogs.acceleration.net/russ/aggbug/3005.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml">I have a new blog intended to replace this one.  For whatever reason, I cannot get dotText to export my posts correctly.  I plan on keeping this site up for a while, but all new content is at: <a href="http://russ.unwashedmeme.com/blog">http://russ.unwashedmeme.com/blog</a>.<img src ="http://blogs.acceleration.net/russ/aggbug/3005.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Russ</dc:creator><title>Trac Tab: My First Trac Plugin</title><link>http://blogs.acceleration.net/russ/archive/2006/04/04/2852.aspx</link><pubDate>Tue, 04 Apr 2006 11:27:00 GMT</pubDate><guid>http://blogs.acceleration.net/russ/archive/2006/04/04/2852.aspx</guid><description>I wrote my first trac plugin! You can read a bit about it here:&lt;a href="http://trac-hacks.org/wiki/TracTabPlugin"&gt;Trac Tab&lt;/a&gt;.  It just allows me to easily add new tabs to the mainmenu in trac that point to trac pages with an Iframe inside pointing somewhere else.  We are using it to link to our billing software from inside of trac, so now our trac project for a client, can have our billing software more closely at hand. Yay!&lt;img src ="http://blogs.acceleration.net/russ/aggbug/2852.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml">I wrote my first trac plugin! You can read a bit about it here:<a href="http://trac-hacks.org/wiki/TracTabPlugin">Trac Tab</a>.  It just allows me to easily add new tabs to the mainmenu in trac that point to trac pages with an Iframe inside pointing somewhere else.  We are using it to link to our billing software from inside of trac, so now our trac project for a client, can have our billing software more closely at hand. Yay!<img src ="http://blogs.acceleration.net/russ/aggbug/2852.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Russ</dc:creator><title>LINQ preview and Lisp</title><link>http://blogs.acceleration.net/russ/archive/2006/03/01/2835.aspx</link><pubDate>Wed, 01 Mar 2006 11:26:00 GMT</pubDate><guid>http://blogs.acceleration.net/russ/archive/2006/03/01/2835.aspx</guid><description>I really wanted to be excited about .Net 2.0 and C#'s 3.0 LINQ preview.   However, between .Net1.1 and .Net2 coming out, I started to play with LISP.
&lt;br /&gt;&lt;br /&gt;
First, I was digging through some C# 2.0 the other day (now with Generics and "Anonymous Delegates Outer variable capture" (craptastic, hacked, statically typed closures)),  and while reading a blogpost (that I lost, sorry) the blogger maid the excellent point that in removing static typing from some things (generics) they had to add reams of code.  Something there should smell bad already.  If you find yourself adding reams of code (and more, new syntax) to get away with leaving out half of what the language originally made you specify, maybe the language just shouldn't force you to specify that info.  I dunno maybe I'm crazy and/or stupid and/or a type-ist?(someone who's against typing?).
&lt;br /&gt;&lt;br /&gt;
On to LINQ: When I saw &lt;a href="http://weblog.infoworld.com/udell/2005/09/28.html"&gt;this forthcoming tech, LINQ&lt;/a&gt;, I thought, "Hey relational algebra-ish support inside of the language, nice".  Then I looked at the demo and the only thing I can think of is all of the lisp constructs to do this sort of high end querying.  All of the LISP ways that were built into the language long before its standardization (ANSI standardization: December 8, 1994) a decade ago.  I am fairly sure that Ruby blocks can be put to use to accomplish this same sort of thing.  Also Python list comprehensions.  It really makes me question why people are willing to wait another 2-3 years for LINQ when they are a download away from better, more dynamic frameworks.  Oh... right... its next to impossible to talk to sql server outside of an MS environment (vendor lockin).   And as always learning anything new (that isnt ms )

&lt;div style="white-space:pre;"&gt;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; C# Linq Demo from &lt;a href="http://weblog.infoworld.com/udell/2005/09/28.html"&gt;this .net blog&lt;/a&gt;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
XDocument doc = XDocument.Load("blog.xml");
 
var d  = new Dictionary&lt;string,string&gt;();
d.Add("2005/09","September 2005");
d.Add("2005/08","August 2005");
 
var a = new string[] { "greasemonkey", "ajax" };
 
var query =
  from
    item in doc.Descendants("item"),
    key in d.Keys,
    tag in a
  where item.Element("date").Value.Contains(key) &amp;amp;&amp;amp;
        item.Element("tags").Value.Contains(tag)
  orderby
    (string) item.Element("date") descending
  select new XElement("item",
    new XElement("month",d[key]),
    item.Element("date"),
    item.Element("title"),
    item.Element("tags"));
 
foreach (var result in query)
  Console.WriteLine(result);

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Lisp with Loop which as far as I can tell is about as close as I can get LINQ
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(mapc
 (lambda (elem) (print elem))
 
  (loop for item in doc.Decendants("items")
	for key in d.Keys
	for tag in a
	when (and
	      item
	      (find key (value (item.Element "date")))
	      (find tag (value (item.Element "tags"))))
	collect (make-instance 'XElement
			      :tag-name "month"
			      :children (list (make-instance 'XElement :tag-name "month")
					      (item.Element "date")
					      (item.Element "title")
					      (item.Element "tags")))
	into new-elems
	unless item do (return (sort new-rows #'xml-item-date-&amp;lt; )))  
&lt;/string,string&gt;&lt;/div&gt;&lt;br /&gt;

There might be more that I am missing (for example an XML library (use ClosureXML), and a predicate that will work for the sorting he wants).  About the nicest part of the LINQ stuff seems to be the OrderBy clause (also possibly GroupBy which isnt covered in the demo, but I could see being cool). However, sorting is more or less a done job given an appropriate predicate. Also there might be slightly more involved iterating going on in the query, but nothing that couldnt be handled with a modicum more code, wrapped in a macro to give it that linq-ish look, and packaged up to be useful in a week.&lt;img src ="http://blogs.acceleration.net/russ/aggbug/2835.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml">I really wanted to be excited about .Net 2.0 and C#'s 3.0 LINQ preview.   However, between .Net1.1 and .Net2 coming out, I started to play with LISP.
<br /><br />
First, I was digging through some C# 2.0 the other day (now with Generics and "Anonymous Delegates Outer variable capture" (craptastic, hacked, statically typed closures)),  and while reading a blogpost (that I lost, sorry) the blogger maid the excellent point that in removing static typing from some things (generics) they had to add reams of code.  Something there should smell bad already.  If you find yourself adding reams of code (and more, new syntax) to get away with leaving out half of what the language originally made you specify, maybe the language just shouldn't force you to specify that info.  I dunno maybe I'm crazy and/or stupid and/or a type-ist?(someone who's against typing?).
<br /><br />
On to LINQ: When I saw <a href="http://weblog.infoworld.com/udell/2005/09/28.html">this forthcoming tech, LINQ</a>, I thought, "Hey relational algebra-ish support inside of the language, nice".  Then I looked at the demo and the only thing I can think of is all of the lisp constructs to do this sort of high end querying.  All of the LISP ways that were built into the language long before its standardization (ANSI standardization: December 8, 1994) a decade ago.  I am fairly sure that Ruby blocks can be put to use to accomplish this same sort of thing.  Also Python list comprehensions.  It really makes me question why people are willing to wait another 2-3 years for LINQ when they are a download away from better, more dynamic frameworks.  Oh... right... its next to impossible to talk to sql server outside of an MS environment (vendor lockin).   And as always learning anything new (that isnt ms )

<div style="white-space:pre;">
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; C# Linq Demo from <a href="http://weblog.infoworld.com/udell/2005/09/28.html">this .net blog</a>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
XDocument doc = XDocument.Load("blog.xml");
 
var d  = new Dictionary<string,string>();
d.Add("2005/09","September 2005");
d.Add("2005/08","August 2005");
 
var a = new string[] { "greasemonkey", "ajax" };
 
var query =
  from
    item in doc.Descendants("item"),
    key in d.Keys,
    tag in a
  where item.Element("date").Value.Contains(key) &amp;&amp;
        item.Element("tags").Value.Contains(tag)
  orderby
    (string) item.Element("date") descending
  select new XElement("item",
    new XElement("month",d[key]),
    item.Element("date"),
    item.Element("title"),
    item.Element("tags"));
 
foreach (var result in query)
  Console.WriteLine(result);

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Lisp with Loop which as far as I can tell is about as close as I can get LINQ
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(mapc
 (lambda (elem) (print elem))
 
  (loop for item in doc.Decendants("items")
	for key in d.Keys
	for tag in a
	when (and
	      item
	      (find key (value (item.Element "date")))
	      (find tag (value (item.Element "tags"))))
	collect (make-instance 'XElement
			      :tag-name "month"
			      :children (list (make-instance 'XElement :tag-name "month")
					      (item.Element "date")
					      (item.Element "title")
					      (item.Element "tags")))
	into new-elems
	unless item do (return (sort new-rows #'xml-item-date-&lt; )))  
</string,string></div><br />

There might be more that I am missing (for example an XML library (use ClosureXML), and a predicate that will work for the sorting he wants).  About the nicest part of the LINQ stuff seems to be the OrderBy clause (also possibly GroupBy which isnt covered in the demo, but I could see being cool). However, sorting is more or less a done job given an appropriate predicate. Also there might be slightly more involved iterating going on in the query, but nothing that couldnt be handled with a modicum more code, wrapped in a macro to give it that linq-ish look, and packaged up to be useful in a week.<img src ="http://blogs.acceleration.net/russ/aggbug/2835.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Russ</dc:creator><title>Could not find installable ISAM</title><link>http://blogs.acceleration.net/russ/archive/2006/02/22/2831.aspx</link><pubDate>Wed, 22 Feb 2006 13:02:00 GMT</pubDate><guid>http://blogs.acceleration.net/russ/archive/2006/02/22/2831.aspx</guid><description>So when trying to read from excel files we got this message repeatedly, and could not figure out what the hell it meant.  We tried reinstalling some dlls that were suggested by other blog posts, but nothing would make the excel file open.  Turns out, our connection string was wrong.  &lt;br /&gt;&lt;br /&gt;

This is a basic correct connection string.
"Provider=Microsoft.Jet.OleDb.4.0;data source=[FILE_PATH];Extended Properties=Excel 8.0;"
&lt;br /&gt;&lt;br /&gt;
UPDATE: &lt;a href="http://blogs.wdevs.com/Gaurang/archive/2005/06/15/5112.aspx"&gt;This guy knew the answer if I had read my opened tabs.&lt;/a&gt;&lt;img src ="http://blogs.acceleration.net/russ/aggbug/2831.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml">So when trying to read from excel files we got this message repeatedly, and could not figure out what the hell it meant.  We tried reinstalling some dlls that were suggested by other blog posts, but nothing would make the excel file open.  Turns out, our connection string was wrong.  <br /><br />

This is a basic correct connection string.
"Provider=Microsoft.Jet.OleDb.4.0;data source=[FILE_PATH];Extended Properties=Excel 8.0;"
<br /><br />
UPDATE: <a href="http://blogs.wdevs.com/Gaurang/archive/2005/06/15/5112.aspx">This guy knew the answer if I had read my opened tabs.</a><img src ="http://blogs.acceleration.net/russ/aggbug/2831.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Russ</dc:creator><title>Seriously(elipsis) WTF!?!</title><link>http://blogs.acceleration.net/russ/archive/2005/10/13/2791.aspx</link><pubDate>Thu, 13 Oct 2005 14:14:00 GMT</pubDate><guid>http://blogs.acceleration.net/russ/archive/2005/10/13/2791.aspx</guid><description>What the hell is wrong with these people?&lt;br /&gt;
&lt;a href="http://www.godhatesfags.com"&gt;&lt;img src="http://blogs.acceleration.net//images/blogs_acceleration_net/russ/42/r_WhatTheHell.jpg" /&gt;&lt;/a&gt;&lt;img src ="http://blogs.acceleration.net/russ/aggbug/2791.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml">What the hell is wrong with these people?<br />
<a href="http://www.godhatesfags.com"><img src="http://blogs.acceleration.net//images/blogs_acceleration_net/russ/42/r_WhatTheHell.jpg" /></a><img src ="http://blogs.acceleration.net/russ/aggbug/2791.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Russ</dc:creator><title>IE6 Error downloading PDFs over SSL</title><link>http://blogs.acceleration.net/russ/archive/2005/10/12/2788.aspx</link><pubDate>Wed, 12 Oct 2005 17:03:00 GMT</pubDate><guid>http://blogs.acceleration.net/russ/archive/2005/10/12/2788.aspx</guid><description>&lt;a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;323308"&gt;This MS page descibes the error.&lt;/a&gt; One thing they dont mention is a solution.  They do say that:&lt;br /&gt;&lt;br /&gt;

&lt;b&gt;CAUSE&lt;/b&gt;&lt;br /&gt;
This issue occurs if the server sends a "Cache-control:no-store" header or sends a "Cache-control:no-cache" header.&lt;br /&gt;
&lt;i&gt; What they dont mention is that it isnt only the "Cache-contol" header; the "Pragma:no-cache" header also causes this problem. &lt;/i&gt;

&lt;br /&gt;&lt;br /&gt;

&lt;b&gt;A SOLUTION&lt;/b&gt;&lt;br /&gt;
Remove all of these headers, and make sure that you have the following headers set:&lt;br /&gt;
  Response.AddHeader("Pragma","private");&lt;br /&gt;
  Response.AddHeader("Cache-control","private, must-revalidate");&lt;br /&gt;&lt;img src ="http://blogs.acceleration.net/russ/aggbug/2788.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml"><a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;323308">This MS page descibes the error.</a> One thing they dont mention is a solution.  They do say that:<br /><br />

<b>CAUSE</b><br />
This issue occurs if the server sends a "Cache-control:no-store" header or sends a "Cache-control:no-cache" header.<br />
<i> What they dont mention is that it isnt only the "Cache-contol" header; the "Pragma:no-cache" header also causes this problem. </i>

<br /><br />

<b>A SOLUTION</b><br />
Remove all of these headers, and make sure that you have the following headers set:<br />
  Response.AddHeader("Pragma","private");<br />
  Response.AddHeader("Cache-control","private, must-revalidate");<br /><img src ="http://blogs.acceleration.net/russ/aggbug/2788.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Russ</dc:creator><title>This is so bad</title><link>http://blogs.acceleration.net/russ/archive/2005/09/07/2677.aspx</link><pubDate>Wed, 07 Sep 2005 15:51:00 GMT</pubDate><guid>http://blogs.acceleration.net/russ/archive/2005/09/07/2677.aspx</guid><description>deleted&lt;img src ="http://blogs.acceleration.net/russ/aggbug/2677.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml">deleted<img src ="http://blogs.acceleration.net/russ/aggbug/2677.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Russ</dc:creator><title>New Macro With-Gensym</title><link>http://blogs.acceleration.net/russ/archive/2005/08/19/2037.aspx</link><pubDate>Fri, 19 Aug 2005 22:08:00 GMT</pubDate><guid>http://blogs.acceleration.net/russ/archive/2005/08/19/2037.aspx</guid><description>I have been playing with LISP over the last few days to try and hack together a with-gensym macro that removes the need to put all my symbols as gensyms in a macro.  &lt;a href="http://paste.lisp.org/display/10951"&gt;This is what Nathan and I came up with.&lt;/a&gt; It allows you to use a (with-gensym (a b c d) ...body...) block.  You don't need to unquote the symbols in the body, you can just use the symbols like normal, however in the expansion, there is a let making the symbol gensyms, and all of the symbols are replaced with ,symbol-name.   This way I dont ever have to think about gensym again.&lt;img src ="http://blogs.acceleration.net/russ/aggbug/2037.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml">I have been playing with LISP over the last few days to try and hack together a with-gensym macro that removes the need to put all my symbols as gensyms in a macro.  <a href="http://paste.lisp.org/display/10951">This is what Nathan and I came up with.</a> It allows you to use a (with-gensym (a b c d) ...body...) block.  You don't need to unquote the symbols in the body, you can just use the symbols like normal, however in the expansion, there is a let making the symbol gensyms, and all of the symbols are replaced with ,symbol-name.   This way I dont ever have to think about gensym again.<img src ="http://blogs.acceleration.net/russ/aggbug/2037.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Russ</dc:creator><title>Newest Drink Sensation</title><link>http://blogs.acceleration.net/russ/archive/2005/08/19/2036.aspx</link><pubDate>Fri, 19 Aug 2005 11:46:00 GMT</pubDate><guid>http://blogs.acceleration.net/russ/archive/2005/08/19/2036.aspx</guid><description>The best way to make frozen "girley drinks" : popsicles.  Just blend and add booze.  Genius.&lt;img src ="http://blogs.acceleration.net/russ/aggbug/2036.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml">The best way to make frozen "girley drinks" : popsicles.  Just blend and add booze.  Genius.<img src ="http://blogs.acceleration.net/russ/aggbug/2036.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Russ</dc:creator><title>Playing with Defcached</title><link>http://blogs.acceleration.net/russ/archive/2005/08/14/2023.aspx</link><pubDate>Sun, 14 Aug 2005 14:30:00 GMT</pubDate><guid>http://blogs.acceleration.net/russ/archive/2005/08/14/2023.aspx</guid><description>When I finished &lt;a href="http://blogs.acceleration.net/russ/archive/2005/08/10/2014.aspx"&gt;
playing with defmemoized&lt;/a&gt; a few days ago I realized that I was very close to having a 
general caching scheme.  At that point I decided that when I got a chance I would write a 
new macro based on defmemoized: &lt;a href="http://paste.lisp.org/display/10649#5"&gt;defcached.&lt;/a&gt;  
To make this a caching scheme, I need to have the ability to tell the cache to expire.  To 
accomplish this I added a new vaiable in to the defining environment (timeout) and a new 
function named [symbol]-set-timeout.  The set timeout function tells it how long it should 
cache the results for each set of parameters passed to it.  Its probably about time to break 
out CLOS and learn it since an object is probably better than just inserting more functions 
into the package  name space.&lt;img src ="http://blogs.acceleration.net/russ/aggbug/2023.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml">When I finished <a href="http://blogs.acceleration.net/russ/archive/2005/08/10/2014.aspx">
playing with defmemoized</a> a few days ago I realized that I was very close to having a 
general caching scheme.  At that point I decided that when I got a chance I would write a 
new macro based on defmemoized: <a href="http://paste.lisp.org/display/10649#5">defcached.</a>  
To make this a caching scheme, I need to have the ability to tell the cache to expire.  To 
accomplish this I added a new vaiable in to the defining environment (timeout) and a new 
function named [symbol]-set-timeout.  The set timeout function tells it how long it should 
cache the results for each set of parameters passed to it.  Its probably about time to break 
out CLOS and learn it since an object is probably better than just inserting more functions 
into the package  name space.<img src ="http://blogs.acceleration.net/russ/aggbug/2023.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Russ</dc:creator><title>Playing with defmemoized, redux</title><link>http://blogs.acceleration.net/russ/archive/2005/08/10/2014.aspx</link><pubDate>Wed, 10 Aug 2005 21:23:00 GMT</pubDate><guid>http://blogs.acceleration.net/russ/archive/2005/08/10/2014.aspx</guid><description>&lt;p&gt;
   So a while back &lt;a title="Birdman" href="http://blogs.acceleration.net/birdman/"&gt;Nathan&lt;/a&gt; made a post about &lt;a href="http://blogs.acceleration.net/birdman/archive/2004/12/27/424.aspx"&gt;playing with macros&lt;/a&gt;.  
   Since I have wanted to start playing with lisp for a while and I finally got slime going at home, I thought this would be as good a jumping in point as any. 
&lt;/p&gt;
&lt;p&gt;
   My first endevors where to simply recreate what &lt;a title="Birdman" href="http://blogs.acceleration.net/birdman/"&gt;Nathan&lt;/a&gt; had written with out cheating too much.  I ended up getting it pretty much right, except that I had missed a #' on the memoize call.
   Since this had taken relativly little time, I converted the macro to use gensyms, and tried to think of something else to do.  One of the things that always intrigued me a little was the way 
   that symbols are strings that can be manipulated like most anything else.  Memoizing is a pretty basic caching scheme, but it was missing something: the ability to clear the cache.
&lt;/p&gt;

&lt;p&gt;
   I decided that I would make defmemoize create two functions; one that would call the original function memoized, and one that would clear that functions cache. 
&lt;/p&gt;

   &lt;div class="code"&gt;
      (defmemoized foo (x y z) (sleep x) (+ y z))
      ;;this should put the functions (foo ,) memoized and (foo-clear-cache) into package scope
   &lt;/div&gt;

&lt;p&gt;
   On my &lt;a href="http://paste.lisp.org/display/10649#1"&gt; first attempt&lt;/a&gt;, it became pretty obvious that I didnt have a clue about the timing of this.  
   So I sat down to reconsider what I was doing and realized that, if I was going to declare memoize (the function) in local scope, I needed to move that into the backquoted area.  
   The reason to declare the function in local scope, is that we can pull the cache hashtable out into a slightly larger local scope so that my clear-cache function has access to the same hashtable.
   This lead to &lt;a href="http://paste.lisp.org/display/10649#2"&gt;version 2.&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
   Now that I had everything scoped correctly, I needed to figure out why my symbol munging wasnt working. 
   &lt;a title="Birdman" href="http://blogs.acceleration.net/birdman/"&gt;Nathan&lt;/a&gt; was working with me and he suggested that I use intern instead of make-symbol.  This sort of worked, except that rather than the symbol I wanted, 
   I got the symbol I wanted inside of pipes (ex: foo-clear-cache -&amp;gt; |foo-clear-cache|).  After some mucking about and trying different things, 
   &lt;a title="Birdman" href="http://blogs.acceleration.net/birdman/"&gt;Nathan&lt;/a&gt; noticed that the &lt;a href="http://www.lispworks.com/documentation/HyperSpec/Body/f_intern.htm"&gt;example code&lt;/a&gt; was using capital letters in the keyword arguments.  This combined with playing with the function for a few minutes, revealed to him, that if the string we are trying to symbolize is in all caps when we intern it, it comes without pipes.  Glad LISP is case insensitive, except when it isnt.
&lt;/p&gt;

&lt;p&gt; After, we figured out the symbol munging, the last thing I had to do was figure out which symbols should be #' when passed to funcall and which shouldnt.  While a little arduous do to CL's 2 cell system,   I finally managed to work it out in my &lt;a href="http://paste.lisp.org/display/10649#4"&gt;final version&lt;/a&gt;.  Along the way I came up with a little test script that allowed me to verify that both functions were working.  
&lt;/p&gt;

&lt;p&gt;
   Over all, I am liking LISP a lot, but there is definatly a learning curve.  I am hoping that now that I have gotten my feet wet a bit, I will be able to get into it a little more.  
&lt;/p&gt;&lt;img src ="http://blogs.acceleration.net/russ/aggbug/2014.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml"><p>
   So a while back <a title="Birdman" href="http://blogs.acceleration.net/birdman/">Nathan</a> made a post about <a href="http://blogs.acceleration.net/birdman/archive/2004/12/27/424.aspx">playing with macros</a>.  
   Since I have wanted to start playing with lisp for a while and I finally got slime going at home, I thought this would be as good a jumping in point as any. 
</p>
<p>
   My first endevors where to simply recreate what <a title="Birdman" href="http://blogs.acceleration.net/birdman/">Nathan</a> had written with out cheating too much.  I ended up getting it pretty much right, except that I had missed a #' on the memoize call.
   Since this had taken relativly little time, I converted the macro to use gensyms, and tried to think of something else to do.  One of the things that always intrigued me a little was the way 
   that symbols are strings that can be manipulated like most anything else.  Memoizing is a pretty basic caching scheme, but it was missing something: the ability to clear the cache.
</p>

<p>
   I decided that I would make defmemoize create two functions; one that would call the original function memoized, and one that would clear that functions cache. 
</p>

   <div class="code">
      (defmemoized foo (x y z) (sleep x) (+ y z))
      ;;this should put the functions (foo ,) memoized and (foo-clear-cache) into package scope
   </div>

<p>
   On my <a href="http://paste.lisp.org/display/10649#1"> first attempt</a>, it became pretty obvious that I didnt have a clue about the timing of this.  
   So I sat down to reconsider what I was doing and realized that, if I was going to declare memoize (the function) in local scope, I needed to move that into the backquoted area.  
   The reason to declare the function in local scope, is that we can pull the cache hashtable out into a slightly larger local scope so that my clear-cache function has access to the same hashtable.
   This lead to <a href="http://paste.lisp.org/display/10649#2">version 2.</a>.
</p>
<p>
   Now that I had everything scoped correctly, I needed to figure out why my symbol munging wasnt working. 
   <a title="Birdman" href="http://blogs.acceleration.net/birdman/">Nathan</a> was working with me and he suggested that I use intern instead of make-symbol.  This sort of worked, except that rather than the symbol I wanted, 
   I got the symbol I wanted inside of pipes (ex: foo-clear-cache -&gt; |foo-clear-cache|).  After some mucking about and trying different things, 
   <a title="Birdman" href="http://blogs.acceleration.net/birdman/">Nathan</a> noticed that the <a href="http://www.lispworks.com/documentation/HyperSpec/Body/f_intern.htm">example code</a> was using capital letters in the keyword arguments.  This combined with playing with the function for a few minutes, revealed to him, that if the string we are trying to symbolize is in all caps when we intern it, it comes without pipes.  Glad LISP is case insensitive, except when it isnt.
</p>

<p> After, we figured out the symbol munging, the last thing I had to do was figure out which symbols should be #' when passed to funcall and which shouldnt.  While a little arduous do to CL's 2 cell system,   I finally managed to work it out in my <a href="http://paste.lisp.org/display/10649#4">final version</a>.  Along the way I came up with a little test script that allowed me to verify that both functions were working.  
</p>

<p>
   Over all, I am liking LISP a lot, but there is definatly a learning curve.  I am hoping that now that I have gotten my feet wet a bit, I will be able to get into it a little more.  
</p><img src ="http://blogs.acceleration.net/russ/aggbug/2014.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Russ</dc:creator><title>Javascript Shell Server</title><link>http://blogs.acceleration.net/russ/archive/2005/08/01/1925.aspx</link><pubDate>Mon, 01 Aug 2005 21:26:00 GMT</pubDate><guid>http://blogs.acceleration.net/russ/archive/2005/08/01/1925.aspx</guid><description>So it finally happened...  We have had our own version of the &lt;a href="http://www.squarefree.com/shell/"&gt;javascript shell&lt;/a&gt; brewing over here for quite a while.  Our version has been growing more and more divergent from the &lt;a href="http://ted.mielczarek.org/code/mozilla/extensiondev/"&gt;Extension Developer&lt;/a&gt; version.  &lt;a title="Birdman" href="http://blogs.acceleration.net/birdman/"&gt;Nathan&lt;/a&gt; &lt;a href="http://blogs.acceleration.net/birdman/archive/2005/06/02/1210.aspx"&gt;mentioned that he had incorporated Emacs&lt;/a&gt; into the mix a while back.  Today we I spent a few hours rewriting the autocomplete, so that it is much more readable, and hopefully, much easier to modify in the future.  Our goal being to bring the results back to Emacs, thus giving us intelligent emacs autocomplete for javascript. 
&lt;br /&gt;&lt;br /&gt;

&lt;a href="http://birdman.acceleration.net/JsShellServer/shellserver.xpi"&gt;
This is our shell packaged up as a standalone extension&lt;/a&gt; (that can be run along side of the extension developer if you wish).  The xpi contains &lt;a href="http://birdman.acceleration.net/JsShellServer/js-mode.el"&gt;js-mode.el&lt;/a&gt; (thanks a bunch Helmut Eller) which needs to be installed in emacs.

Check Nathan's &lt;a href="http://blogs.acceleration.net/birdman/archive/2005/06/02/1210.aspx"&gt;post&lt;/a&gt; for more instructions.  &lt;br /&gt;&lt;br /&gt;

Now that we have taken the initiative to separate our version of the shell, I foresee more improvements in the future.  I plan on posting an actual page about the extension and how to get it properly installed in emacs and what not tomorrow.&lt;img src ="http://blogs.acceleration.net/russ/aggbug/1925.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml">So it finally happened...  We have had our own version of the <a href="http://www.squarefree.com/shell/">javascript shell</a> brewing over here for quite a while.  Our version has been growing more and more divergent from the <a href="http://ted.mielczarek.org/code/mozilla/extensiondev/">Extension Developer</a> version.  <a title="Birdman" href="http://blogs.acceleration.net/birdman/">Nathan</a> <a href="http://blogs.acceleration.net/birdman/archive/2005/06/02/1210.aspx">mentioned that he had incorporated Emacs</a> into the mix a while back.  Today we I spent a few hours rewriting the autocomplete, so that it is much more readable, and hopefully, much easier to modify in the future.  Our goal being to bring the results back to Emacs, thus giving us intelligent emacs autocomplete for javascript. 
<br /><br />

<a href="http://birdman.acceleration.net/JsShellServer/shellserver.xpi">
This is our shell packaged up as a standalone extension</a> (that can be run along side of the extension developer if you wish).  The xpi contains <a href="http://birdman.acceleration.net/JsShellServer/js-mode.el">js-mode.el</a> (thanks a bunch Helmut Eller) which needs to be installed in emacs.

Check Nathan's <a href="http://blogs.acceleration.net/birdman/archive/2005/06/02/1210.aspx">post</a> for more instructions.  <br /><br />

Now that we have taken the initiative to separate our version of the shell, I foresee more improvements in the future.  I plan on posting an actual page about the extension and how to get it properly installed in emacs and what not tomorrow.<img src ="http://blogs.acceleration.net/russ/aggbug/1925.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Russ</dc:creator><title>My First GreaseMonkey.</title><link>http://blogs.acceleration.net/russ/archive/2005/07/28/1856.aspx</link><pubDate>Thu, 28 Jul 2005 17:13:00 GMT</pubDate><guid>http://blogs.acceleration.net/russ/archive/2005/07/28/1856.aspx</guid><description>&lt;a href="http://birdman.acceleration.net/russ/tractab.user.js"&gt;My First Greasemonkey Script&lt;/a&gt; allows tabbing and antitabbing in all textareas.
&lt;img src ="http://blogs.acceleration.net/russ/aggbug/1856.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml"><a href="http://birdman.acceleration.net/russ/tractab.user.js">My First Greasemonkey Script</a> allows tabbing and antitabbing in all textareas.
<img src ="http://blogs.acceleration.net/russ/aggbug/1856.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Russ</dc:creator><title>IE bug in dynamically added select options</title><link>http://blogs.acceleration.net/russ/archive/2005/07/27/1849.aspx</link><pubDate>Wed, 27 Jul 2005 17:16:00 GMT</pubDate><guid>http://blogs.acceleration.net/russ/archive/2005/07/27/1849.aspx</guid><description>If you add options to a select dynamically via javascript, IE will not render this correctly until you have opened and closed the select menu a few time.  To get around this you just need to remove the select from the DOM then add it back.  Setting the innerHTML will not help things :(  Unfortunatly, setting the innerHTML causes bugs in both major browsers.&lt;img src ="http://blogs.acceleration.net/russ/aggbug/1849.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml">If you add options to a select dynamically via javascript, IE will not render this correctly until you have opened and closed the select menu a few time.  To get around this you just need to remove the select from the DOM then add it back.  Setting the innerHTML will not help things :(  Unfortunatly, setting the innerHTML causes bugs in both major browsers.<img src ="http://blogs.acceleration.net/russ/aggbug/1849.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Russ</dc:creator><title>Oh Spider Monkey why doest thou keep secrets from me</title><link>http://blogs.acceleration.net/russ/archive/2005/07/21/1834.aspx</link><pubDate>Thu, 21 Jul 2005 17:46:00 GMT</pubDate><guid>http://blogs.acceleration.net/russ/archive/2005/07/21/1834.aspx</guid><description>There are so many hidden things inside of the javascript implementations that it is a constant frustration.  I happen to like javascript an awful lot, but damn this language/environment for being so fickle.
&lt;br /&gt;&lt;br /&gt;
The magic functions/properties I found are listed below.  They solve one of my biggest problems with the javascript getter/setter system that &lt;a title="Birdman" href="http://blogs.acceleration.net/birdman/"&gt;Nathan&lt;/a&gt; &lt;a href="http://blogs.acceleration.net/birdman/archive/2005/04/28/1055.aspx"&gt;wrote about here&lt;/a&gt;, which is that by doing what &lt;a title="Birdman" href="http://blogs.acceleration.net/birdman/"&gt;Nathan&lt;/a&gt; was doing, we couldn't find a way to get a reference to the actual function doing the getting/setting.  I really hate that these are totally hidden.
&lt;br /&gt;&lt;br /&gt;
__proto__ : a reference to the current instances prototype (deprecated in Rhino)&lt;br /&gt;
__defineGetter__('propName', func) :  creates a getter function with the name provided as the first argument&lt;br /&gt;
__defineSetter__('propName', func) :  creates a Setter function with the name provided as the first argument&lt;br /&gt;
__lookupGetter__('propName') :  gets a reference to the getter function of a given property (whose name is passed as an argument)&lt;br /&gt;
__lookupSetter__('propName') :  gets a reference to the setter function of a given property (whose name is passed as an argument)&lt;br /&gt;
&lt;br /&gt;
__parent__ seems to return the scope that something is defined in, but we cant really get this to do anything reliably and its also deprecated.  &lt;a title="Birdman" href="http://blogs.acceleration.net/birdman/"&gt;Nathan&lt;/a&gt; seems to think that this is what a closure uses to keep track of its scope.&lt;img src ="http://blogs.acceleration.net/russ/aggbug/1834.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml">There are so many hidden things inside of the javascript implementations that it is a constant frustration.  I happen to like javascript an awful lot, but damn this language/environment for being so fickle.
<br /><br />
The magic functions/properties I found are listed below.  They solve one of my biggest problems with the javascript getter/setter system that <a title="Birdman" href="http://blogs.acceleration.net/birdman/">Nathan</a> <a href="http://blogs.acceleration.net/birdman/archive/2005/04/28/1055.aspx">wrote about here</a>, which is that by doing what <a title="Birdman" href="http://blogs.acceleration.net/birdman/">Nathan</a> was doing, we couldn't find a way to get a reference to the actual function doing the getting/setting.  I really hate that these are totally hidden.
<br /><br />
__proto__ : a reference to the current instances prototype (deprecated in Rhino)<br />
__defineGetter__('propName', func) :  creates a getter function with the name provided as the first argument<br />
__defineSetter__('propName', func) :  creates a Setter function with the name provided as the first argument<br />
__lookupGetter__('propName') :  gets a reference to the getter function of a given property (whose name is passed as an argument)<br />
__lookupSetter__('propName') :  gets a reference to the setter function of a given property (whose name is passed as an argument)<br />
<br />
__parent__ seems to return the scope that something is defined in, but we cant really get this to do anything reliably and its also deprecated.  <a title="Birdman" href="http://blogs.acceleration.net/birdman/">Nathan</a> seems to think that this is what a closure uses to keep track of its scope.<img src ="http://blogs.acceleration.net/russ/aggbug/1834.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Russ</dc:creator><title>Harry Potter Online</title><link>http://blogs.acceleration.net/russ/archive/2005/07/19/1829.aspx</link><pubDate>Tue, 19 Jul 2005 13:28:00 GMT</pubDate><guid>http://blogs.acceleration.net/russ/archive/2005/07/19/1829.aspx</guid><description>The newsgroups had a digital release of the new Harry Potter audio book up in about 18 hrs.  &lt;br /&gt;
&lt;a href="http://www.boingboing.net/2005/07/19/new_potter_was_onlin.html"&gt;The a digital copy of the print book was apparently up in less 24 hrs&lt;/a&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;I love the internet.&lt;/i&gt;&lt;/b&gt;
&lt;br /&gt;&lt;br /&gt;
The best part (which is noted in the above article), is that the author didnt want to release a digital copy for sale, because it would help pirates.  Good thing that the people who would pay for it, are now left with only the option of a pirated copy.&lt;img src ="http://blogs.acceleration.net/russ/aggbug/1829.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml">The newsgroups had a digital release of the new Harry Potter audio book up in about 18 hrs.  <br />
<a href="http://www.boingboing.net/2005/07/19/new_potter_was_onlin.html">The a digital copy of the print book was apparently up in less 24 hrs</a><br />
<b><i>I love the internet.</i></b>
<br /><br />
The best part (which is noted in the above article), is that the author didnt want to release a digital copy for sale, because it would help pirates.  Good thing that the people who would pay for it, are now left with only the option of a pirated copy.<img src ="http://blogs.acceleration.net/russ/aggbug/1829.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Russ</dc:creator><title>Writing HTML in Javascript</title><link>http://blogs.acceleration.net/russ/archive/2005/07/08/1752.aspx</link><pubDate>Fri, 08 Jul 2005 17:35:00 GMT</pubDate><guid>http://blogs.acceleration.net/russ/archive/2005/07/08/1752.aspx</guid><description>Lately Ive been writing alot of HTML as javascript using a function Ive named createNode in my &lt;a href="http://blogs.acceleration.net/russ/articles/1751.aspx"&gt;Controls Library&lt;/a&gt;
&lt;br /&gt;&lt;br /&gt;
example:
&lt;div style="padding:5px; border:1px solid black;background-color:#EFEFFF;white-space:pre"&gt;// The strings with curly braces are binding points with names matching the columns of my datasource
var cn = Controls.createNode;
var template = cn('tr', {}, 
               cn('td', {'class':"topCell", style:'width:75;'}, 
                  '{StoreNumber}'),
               cn('td', {'class':"topCell", style:'width:100;'}, 
                  '{Name}'),
               cn('td', {'class':"topCell", style:'width:100;' }, 
                  '{Metro}'),
               cn('td', {'class':"topCell", style:'width:250;'}, 
                  "{Address}",
                  cn('br'),
                  "{City}, {State} {Zip}"),
               cn('td', {'class':"topCell", style:'width:150;'}, 
                  cn('textarea', {'class':"displayBox", style:"width:100%;", readonly:"true"},
                     '{PublicPhoneNumbers}')),
               cn('td', {'class':"topCell", style:'width:100;'}, 
                  '{ConnectionType} - {Speed}'),
               cn('td', {'class':"topCell", style:'width:100;'}, 
                  '{UserName}'),
               cn('td', {'class':"topCell", style:'width:150;'}, 
                  '{DateEnteredHistory}'))

&lt;/div&gt;

I was curious how this would square up against redering plain HTML.  I had a feeling that it might be faster since parsing XML is incredibly slow and direct interaction with the DOM is something that JS should theoretically be good at.  In my test I average the rendering time of a 10 column 100 row table over a few page refreshes.  &lt;br /&gt;
The following were the result data:&lt;br /&gt;&lt;br /&gt;
&lt;table border="1" cellpadding="3" cellspacing="0"&gt;
&lt;tr&gt;
   &lt;td align="center"&gt;&lt;a title="Go get Firefox" href="http://www.mozilla.org/products/firefox/" target="_blank"&gt;firefox&lt;/a&gt; - Static&lt;/td&gt;
   &lt;td align="center"&gt;&lt;a title="Go get Firefox" href="http://www.mozilla.org/products/firefox/" target="_blank"&gt;firefox&lt;/a&gt; - JS&lt;/td&gt;
   &lt;td align="center"&gt;IE - static&lt;/td&gt;
   &lt;td align="center"&gt;IE - dynamic&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
   &lt;td align="center"&gt;ave: 54.5ms&lt;/td&gt;
   &lt;td align="center"&gt;ave: 39.125ms&lt;/td&gt;
   &lt;td align="center"&gt;ave: 17.25ms&lt;/td&gt;
   &lt;td align="center"&gt;ave: 52.875ms&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;&lt;br /&gt;

Of note, in this test, is the IE static HTML rendering times, which is much faster than any of the other results.&lt;img src ="http://blogs.acceleration.net/russ/aggbug/1752.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml">Lately Ive been writing alot of HTML as javascript using a function Ive named createNode in my <a href="http://blogs.acceleration.net/russ/articles/1751.aspx">Controls Library</a>
<br /><br />
example:
<div style="padding:5px; border:1px solid black;background-color:#EFEFFF;white-space:pre">// The strings with curly braces are binding points with names matching the columns of my datasource
var cn = Controls.createNode;
var template = cn('tr', {}, 
               cn('td', {'class':"topCell", style:'width:75;'}, 
                  '{StoreNumber}'),
               cn('td', {'class':"topCell", style:'width:100;'}, 
                  '{Name}'),
               cn('td', {'class':"topCell", style:'width:100;' }, 
                  '{Metro}'),
               cn('td', {'class':"topCell", style:'width:250;'}, 
                  "{Address}",
                  cn('br'),
                  "{City}, {State} {Zip}"),
               cn('td', {'class':"topCell", style:'width:150;'}, 
                  cn('textarea', {'class':"displayBox", style:"width:100%;", readonly:"true"},
                     '{PublicPhoneNumbers}')),
               cn('td', {'class':"topCell", style:'width:100;'}, 
                  '{ConnectionType} - {Speed}'),
               cn('td', {'class':"topCell", style:'width:100;'}, 
                  '{UserName}'),
               cn('td', {'class':"topCell", style:'width:150;'}, 
                  '{DateEnteredHistory}'))

</div>

I was curious how this would square up against redering plain HTML.  I had a feeling that it might be faster since parsing XML is incredibly slow and direct interaction with the DOM is something that JS should theoretically be good at.  In my test I average the rendering time of a 10 column 100 row table over a few page refreshes.  <br />
The following were the result data:<br /><br />
<table border="1" cellpadding="3" cellspacing="0">
<tr>
   <td align="center"><a title="Go get Firefox" href="http://www.mozilla.org/products/firefox/" target="_blank">firefox</a> - Static</td>
   <td align="center"><a title="Go get Firefox" href="http://www.mozilla.org/products/firefox/" target="_blank">firefox</a> - JS</td>
   <td align="center">IE - static</td>
   <td align="center">IE - dynamic</td>
</tr>
<tr>
   <td align="center">ave: 54.5ms</td>
   <td align="center">ave: 39.125ms</td>
   <td align="center">ave: 17.25ms</td>
   <td align="center">ave: 52.875ms</td>
</tr>
</table><br />

Of note, in this test, is the IE static HTML rendering times, which is much faster than any of the other results.<img src ="http://blogs.acceleration.net/russ/aggbug/1752.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Russ</dc:creator><title>Object Keyed Hashtable in Javascript</title><link>http://blogs.acceleration.net/russ/archive/2005/07/06/1744.aspx</link><pubDate>Wed, 06 Jul 2005 19:50:00 GMT</pubDate><guid>http://blogs.acceleration.net/russ/archive/2005/07/06/1744.aspx</guid><description>

In the last couple days I have had the need to put keys (that are objects) into a hashtable. Since the default js hashtable only allows string keys (see &lt;a href="http://blogs.acceleration.net/russ/archive/2005/07/05/1736.aspx"&gt;my last post on this topic&lt;/a&gt;), I decided to check the internet.  &lt;a href="http://m.synovic.home.att.net/hashtable/hashtable.html"&gt;Synovic &lt;/a&gt; is most highly rated by google, and pretty much every other refernce to javascript hashtable points to either his implementation or notes that {key:value}  creates an object/array/hashtable in javascript.  Because Synovic's hashtable is just a java like wrapper around the default hashtable, his suffers from the same built in flaw that the normal hashtable suffers.  I seem to be the only one with the need to hash based off objects.  One of the requirements I had was that I didnt want to modify the key (which would greatly simplify the problem).  If I could just add a hashcode to every object passed in as a key this whole problem again becomes trivial.  The only problem is that, since objects == hashtable in javascript, I could be accidently adding things to a collection that I dont want to be modified.  Also it just seems like a horrible practice to have random functions adding properties to your objects.   My solution was basically to create a hash code that I could use to identify objects.  Then, using that hashcode, I look into an internal string-keyed hashtable.  In that value slot,  I store an array of {key: objectKey, value: valPassedIn} objects.  Then it is linear look up to go through the array.  If I can improve the Hashcode function I can improve the overall performance of my Hashtable object, but right now I havn't a clue how to do this.

and now, the moment youve all been waiting for:
&lt;h2&gt;&lt;a href="http://blogs.acceleration.net/russ/articles/1743.aspx"&gt;Hashtable Source&lt;/a&gt;&lt;/h2&gt;&lt;img src ="http://blogs.acceleration.net/russ/aggbug/1744.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml">

In the last couple days I have had the need to put keys (that are objects) into a hashtable. Since the default js hashtable only allows string keys (see <a href="http://blogs.acceleration.net/russ/archive/2005/07/05/1736.aspx">my last post on this topic</a>), I decided to check the internet.  <a href="http://m.synovic.home.att.net/hashtable/hashtable.html">Synovic </a> is most highly rated by google, and pretty much every other refernce to javascript hashtable points to either his implementation or notes that {key:value}  creates an object/array/hashtable in javascript.  Because Synovic's hashtable is just a java like wrapper around the default hashtable, his suffers from the same built in flaw that the normal hashtable suffers.  I seem to be the only one with the need to hash based off objects.  One of the requirements I had was that I didnt want to modify the key (which would greatly simplify the problem).  If I could just add a hashcode to every object passed in as a key this whole problem again becomes trivial.  The only problem is that, since objects == hashtable in javascript, I could be accidently adding things to a collection that I dont want to be modified.  Also it just seems like a horrible practice to have random functions adding properties to your objects.   My solution was basically to create a hash code that I could use to identify objects.  Then, using that hashcode, I look into an internal string-keyed hashtable.  In that value slot,  I store an array of {key: objectKey, value: valPassedIn} objects.  Then it is linear look up to go through the array.  If I can improve the Hashcode function I can improve the overall performance of my Hashtable object, but right now I havn't a clue how to do this.

and now, the moment youve all been waiting for:
<h2><a href="http://blogs.acceleration.net/russ/articles/1743.aspx">Hashtable Source</a></h2><img src ="http://blogs.acceleration.net/russ/aggbug/1744.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Russ</dc:creator><title>Javascript Hashtable</title><link>http://blogs.acceleration.net/russ/archive/2005/07/05/1736.aspx</link><pubDate>Tue, 05 Jul 2005 16:23:00 GMT</pubDate><guid>http://blogs.acceleration.net/russ/archive/2005/07/05/1736.aspx</guid><description>First, I recognize that an Array is an Object is an Hashtable in javascript.  The problem is that only strings can act as a key in an Object.  
Meaning:
&lt;pre&gt;
 var x = new Object()  
 var y = new Object()  
&lt;i&gt;&amp;gt;&amp;gt; [object Object] &lt;/i&gt;
 z = new Object()  
&lt;i&gt;&amp;gt;&amp;gt; [object Object] &lt;/i&gt;
 x[y] = 'test' ;
&lt;i&gt;&amp;gt;&amp;gt; test&lt;/i&gt;
 x[z]  
&lt;i&gt;&amp;gt;&amp;gt; test &lt;/i&gt;
&lt;/pre&gt;

Since alot of the objects in javascript return [Object] as their toString(), this means that I cannot key a hashtable off objects.  I guess I'll get to work writing an actual Hashtable instead of just relying on the built in stuff.  I will post this when I am done.  For now, off to class.
&lt;br /&gt;&lt;br /&gt;
UPDATE: &lt;a href="http://blogs.acceleration.net/russ/archive/2005/07/06/1744.aspx"&gt; The Exciting Conclusion &lt;/a&gt;&lt;img src ="http://blogs.acceleration.net/russ/aggbug/1736.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml">First, I recognize that an Array is an Object is an Hashtable in javascript.  The problem is that only strings can act as a key in an Object.  
Meaning:
<pre>
 var x = new Object()  
 var y = new Object()  
<i>&gt;&gt; [object Object] </i>
 z = new Object()  
<i>&gt;&gt; [object Object] </i>
 x[y] = 'test' ;
<i>&gt;&gt; test</i>
 x[z]  
<i>&gt;&gt; test </i>
</pre>

Since alot of the objects in javascript return [Object] as their toString(), this means that I cannot key a hashtable off objects.  I guess I'll get to work writing an actual Hashtable instead of just relying on the built in stuff.  I will post this when I am done.  For now, off to class.
<br /><br />
UPDATE: <a href="http://blogs.acceleration.net/russ/archive/2005/07/06/1744.aspx"> The Exciting Conclusion </a><img src ="http://blogs.acceleration.net/russ/aggbug/1736.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Russ</dc:creator><title>A Musical Meme</title><link>http://blogs.acceleration.net/russ/archive/2005/06/02/1209.aspx</link><pubDate>Thu, 02 Jun 2005 14:10:00 GMT</pubDate><guid>http://blogs.acceleration.net/russ/archive/2005/06/02/1209.aspx</guid><description>Fine Fine after a 2 weeks procrastination and 2 invites... I give you my almost entirely random answers
&lt;ul&gt;
    &lt;li&gt;Total music: Between 50 and 100 gigs spead all over everywhere (Work/Home/CDs Yet to be ripped. Its really hard to give a better guess since there is a lot of overlap between places)
    &lt;/li&gt;
    &lt;li&gt;Song playing now: &lt;a title="Birdman" href="http://blogs.acceleration.net/birdman/"&gt;Nathan&lt;/a&gt; talking over Carmina Burana's quiet parts.&lt;/li&gt;
    &lt;li&gt;Five Pieces of Music that I listen to a lot or just that I like alot
        &lt;ol&gt;
           &lt;li&gt;The Complete Works of Miles Davis ( This isn't really a single piece of music, but I figure with all of the other "Complete" Miles box sets, it's just a matter of time.  Top place goes between Kinda of Blue and Bitches Brew )&lt;/li&gt;
           &lt;li&gt;And All That Could Have Been - Nine Inch Nails (The song or the Album your choice.)&lt;/li&gt;
           &lt;li&gt;Binaural - Pearl Jam (This is kinda a temporary thing since I like pretty much everything they put out.  This is just what Ive been listening to most, recently&lt;/li&gt;
           &lt;li&gt;Carmina Burana - Carl Orff&lt;/li&gt;
           &lt;li&gt;A few things to hear before we all blow up - Williamson (this is the most peaceful techno I've ever heard)&lt;/li&gt;
       &lt;/ol&gt;
&lt;/li&gt;
&lt;/ul&gt;
A few people that I forward this meme onto:&lt;img src ="http://blogs.acceleration.net/russ/aggbug/1209.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml">Fine Fine after a 2 weeks procrastination and 2 invites... I give you my almost entirely random answers
<ul>
    <li>Total music: Between 50 and 100 gigs spead all over everywhere (Work/Home/CDs Yet to be ripped. Its really hard to give a better guess since there is a lot of overlap between places)
    </li>
    <li>Song playing now: <a title="Birdman" href="http://blogs.acceleration.net/birdman/">Nathan</a> talking over Carmina Burana's quiet parts.</li>
    <li>Five Pieces of Music that I listen to a lot or just that I like alot
        <ol>
           <li>The Complete Works of Miles Davis ( This isn't really a single piece of music, but I figure with all of the other "Complete" Miles box sets, it's just a matter of time.  Top place goes between Kinda of Blue and Bitches Brew )</li>
           <li>And All That Could Have Been - Nine Inch Nails (The song or the Album your choice.)</li>
           <li>Binaural - Pearl Jam (This is kinda a temporary thing since I like pretty much everything they put out.  This is just what Ive been listening to most, recently</li>
           <li>Carmina Burana - Carl Orff</li>
           <li>A few things to hear before we all blow up - Williamson (this is the most peaceful techno I've ever heard)</li>
       </ol>
</li>
</ul>
A few people that I forward this meme onto:<img src ="http://blogs.acceleration.net/russ/aggbug/1209.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Russ</dc:creator><title>Changing the scope of "this" when using eval in javascript</title><link>http://blogs.acceleration.net/russ/archive/2005/05/16/1139.aspx</link><pubDate>Mon, 16 May 2005 17:55:00 GMT</pubDate><guid>http://blogs.acceleration.net/russ/archive/2005/05/16/1139.aspx</guid><description>I want every Item on the page to have an onload that gets called when the window.onload is fired.  What I ended up doing is calling documnet.getElementsByAttribute('onload').  This is a function I wrote, but I will assume everyone can do a simple preorder tree traversal, so I will not go into it here.  After getting a list of nodes with onload (in the correct order I want to execute them, I call the following code on each node:
&lt;div class="code"&gt;function(){
     eval( theStringIWishToEval );
  }.call( objectIWantToBeThis ); // the node
&lt;/div&gt;
This gives the correct scoping to the evaluated code (which is the current node whose "load event" I am reacting to).&lt;img src ="http://blogs.acceleration.net/russ/aggbug/1139.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml">I want every Item on the page to have an onload that gets called when the window.onload is fired.  What I ended up doing is calling documnet.getElementsByAttribute('onload').  This is a function I wrote, but I will assume everyone can do a simple preorder tree traversal, so I will not go into it here.  After getting a list of nodes with onload (in the correct order I want to execute them, I call the following code on each node:
<div class="code">function(){
     eval( theStringIWishToEval );
  }.call( objectIWantToBeThis ); // the node
</div>
This gives the correct scoping to the evaluated code (which is the current node whose "load event" I am reacting to).<img src ="http://blogs.acceleration.net/russ/aggbug/1139.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Russ</dc:creator><title>XUL Repeater</title><link>http://blogs.acceleration.net/russ/archive/2005/05/04/1063.aspx</link><pubDate>Wed, 04 May 2005 16:24:00 GMT</pubDate><guid>http://blogs.acceleration.net/russ/archive/2005/05/04/1063.aspx</guid><description>I had talked about this repeater control a while back but then got distracted onto other things.&lt;br /&gt;
&lt;a href="http://blogs.acceleration.net/russ/articles/1062.aspx"&gt;Go Here to see  the Repeater Source&lt;/a&gt;
&lt;br /&gt;
It probably can easily be ported to work with just javascript and HTML but I havnt had the time or need to do so yet.  Who knows maybe soon.

UPDATE: Fixed Link&lt;img src ="http://blogs.acceleration.net/russ/aggbug/1063.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml">I had talked about this repeater control a while back but then got distracted onto other things.<br />
<a href="http://blogs.acceleration.net/russ/articles/1062.aspx">Go Here to see  the Repeater Source</a>
<br />
It probably can easily be ported to work with just javascript and HTML but I havnt had the time or need to do so yet.  Who knows maybe soon.

UPDATE: Fixed Link<img src ="http://blogs.acceleration.net/russ/aggbug/1063.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Russ</dc:creator><title>Walmart censors parody</title><link>http://blogs.acceleration.net/russ/archive/2005/04/28/1053.aspx</link><pubDate>Thu, 28 Apr 2005 11:27:00 GMT</pubDate><guid>http://blogs.acceleration.net/russ/archive/2005/04/28/1053.aspx</guid><description>&lt;a title="Walmart Foundation" alt="Walmart Foundation" href="http://www.walmart-foundation.org"&gt;This Walmart foundation parody&lt;/a&gt; got censored because of his use of the walmart foundations actual images in his parody creation of their site.  The best thing is that the &lt;a title="Walmart Foundation" alt="Walmart Foundation" href="http://www.walmart-foundation.org"&gt;Walmart foundation parody&lt;/a&gt; is what google will eventually point to as number 1.&lt;img src ="http://blogs.acceleration.net/russ/aggbug/1053.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml"><a title="Walmart Foundation" alt="Walmart Foundation" href="http://www.walmart-foundation.org">This Walmart foundation parody</a> got censored because of his use of the walmart foundations actual images in his parody creation of their site.  The best thing is that the <a title="Walmart Foundation" alt="Walmart Foundation" href="http://www.walmart-foundation.org">Walmart foundation parody</a> is what google will eventually point to as number 1.<img src ="http://blogs.acceleration.net/russ/aggbug/1053.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Russ</dc:creator><title>The XBL Template / Repeater control</title><link>http://blogs.acceleration.net/russ/archive/2005/04/10/819.aspx</link><pubDate>Sun, 10 Apr 2005 17:04:00 GMT</pubDate><guid>http://blogs.acceleration.net/russ/archive/2005/04/10/819.aspx</guid><description>So I finally found a palatable solution to the &lt;a href="http://blogs.acceleration.net/russ/archive/2005/04/06/804.aspx"&gt;Templates Problem&lt;/a&gt; I talked about earlier.  The technique I used was to create a XBL control called 'repeater'.  &lt;a title="Ryan" href="http://blogs.acceleration.net/ryan/"&gt;Ryan&lt;/a&gt; had some issues with the word template as I was using it so we switched over to repeater to be less ambiguous.  The goal of this is not to provide a general control system (which XBL and &lt;a title="xbl alternative" href="http://www.jerf.org/resources/xblinjs/" target="_blank"&gt;XBLinJS&lt;/a&gt; try to do), but only to provide the functionality to easily repeat nodes inside of a valid tag.  The best example I can give for this is for  binding a dropdownlist / select box / menupopup, where I just need to repeat the &amp;lt;menuitem /&amp;gt; over a flat set of data.  
&lt;br /&gt;&lt;br /&gt;
var testTable = [['id', 'name'],&lt;br /&gt;
 [ 1, 'Programmers' ],&lt;br /&gt;
 [ 2, 'WebAdmin' ],&lt;br /&gt;
 [ 3, 'Broadband']];&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hbox&amp;gt;&lt;br /&gt;
  &amp;lt;repeater&amp;gt;&lt;br /&gt;
    &amp;lt;label value="{name}" /&amp;gt;&lt;br /&gt;
  &amp;lt;/repeater&amp;gt;&lt;br /&gt;
&amp;lt;/hbox&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What the 'repeater' control does is remove the repeater node from its parent storing a reference to this 'template' on that control (so we have what was there but none of it is rendered).  Then it loops through the data set adding all of the nodes that were inside of the repeater tags, with their values filled in.  So what gets rendered to the page would be this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hbox&amp;gt;&lt;br /&gt;
    &amp;lt;label value="Programmers" /&amp;gt;&lt;br /&gt;
    &amp;lt;label value="WebAdmin" /&amp;gt;&lt;br /&gt;
    &amp;lt;label value="Broadband" /&amp;gt;&lt;br /&gt;
&amp;lt;/hbox&amp;gt;&lt;br /&gt;
&lt;br /&gt;

The really nice part about this system is that by inserting a repeater node inside of the template, with the outer template filling in the datasource attribute for the inner repeater as it goes, allows you to chain these repeaters to make hierarchical data repeaters.   After I finish polishing everything and test it once more, I am going to port this to use &amp;lt;div repeater="true" &amp;gt; [enter repeated data here]&amp;lt;/div&amp;gt; so that I can achieve the same repeater functionality in standard HTML.   
&lt;br /&gt;&lt;br /&gt;
Overall this has been my best experience with XBL, most notable because it required only one function block and one line of xbl content binding  ( the &amp;lt;children /&amp;gt; node).  It did however force me to copy code in and out of the xbl document to a standard JS doc to get parse errors to show up (Mozilla was just silently failing when their was a parse error in the XBL Javascript). 
&lt;br /&gt;&lt;br /&gt;
&lt;a title="Ryan" href="http://blogs.acceleration.net/ryan/"&gt;Ryan&lt;/a&gt; will probably give us a little preview of his js control scheme based of his interpretations of &lt;a title="xbl alternative" href="http://www.jerf.org/resources/xblinjs/" target="_blank"&gt;XBLinJS&lt;/a&gt;.  What it seems we've got almost worked out is a simple way to repeat nodes and a simple way to create complex, repeatable, XUL/HTML controls.  Most of this work was inspired by excessive frustration (mostly caused by nonexistant error handling) at the way mozilla handles these two things  and by reading &lt;a href="http://www.jerf.org"&gt;Jeremy Bowers&lt;/a&gt; site which convinced us to do what we already wanted to do.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
UPDATE:&lt;br /&gt;
&lt;a href="http://blogs.acceleration.net/russ/articles/1062.aspx"&gt;Go Here to see  the Repeater Source&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://blogs.acceleration.net/russ/articles/1145.aspx"&gt;Usage Example&lt;/a&gt;&lt;img src ="http://blogs.acceleration.net/russ/aggbug/819.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml">So I finally found a palatable solution to the <a href="http://blogs.acceleration.net/russ/archive/2005/04/06/804.aspx">Templates Problem</a> I talked about earlier.  The technique I used was to create a XBL control called 'repeater'.  <a title="Ryan" href="http://blogs.acceleration.net/ryan/">Ryan</a> had some issues with the word template as I was using it so we switched over to repeater to be less ambiguous.  The goal of this is not to provide a general control system (which XBL and <a title="xbl alternative" href="http://www.jerf.org/resources/xblinjs/" target="_blank">XBLinJS</a> try to do), but only to provide the functionality to easily repeat nodes inside of a valid tag.  The best example I can give for this is for  binding a dropdownlist / select box / menupopup, where I just need to repeat the &lt;menuitem /&gt; over a flat set of data.  
<br /><br />
var testTable = [['id', 'name'],<br />
 [ 1, 'Programmers' ],<br />
 [ 2, 'WebAdmin' ],<br />
 [ 3, 'Broadband']];<br />
<br />
&lt;hbox&gt;<br />
  &lt;repeater&gt;<br />
    &lt;label value="{name}" /&gt;<br />
  &lt;/repeater&gt;<br />
&lt;/hbox&gt;<br />
<br />
What the 'repeater' control does is remove the repeater node from its parent storing a reference to this 'template' on that control (so we have what was there but none of it is rendered).  Then it loops through the data set adding all of the nodes that were inside of the repeater tags, with their values filled in.  So what gets rendered to the page would be this:<br />
<br />
&lt;hbox&gt;<br />
    &lt;label value="Programmers" /&gt;<br />
    &lt;label value="WebAdmin" /&gt;<br />
    &lt;label value="Broadband" /&gt;<br />
&lt;/hbox&gt;<br />
<br />

The really nice part about this system is that by inserting a repeater node inside of the template, with the outer template filling in the datasource attribute for the inner repeater as it goes, allows you to chain these repeaters to make hierarchical data repeaters.   After I finish polishing everything and test it once more, I am going to port this to use &lt;div repeater="true" &gt; [enter repeated data here]&lt;/div&gt; so that I can achieve the same repeater functionality in standard HTML.   
<br /><br />
Overall this has been my best experience with XBL, most notable because it required only one function block and one line of xbl content binding  ( the &lt;children /&gt; node).  It did however force me to copy code in and out of the xbl document to a standard JS doc to get parse errors to show up (Mozilla was just silently failing when their was a parse error in the XBL Javascript). 
<br /><br />
<a title="Ryan" href="http://blogs.acceleration.net/ryan/">Ryan</a> will probably give us a little preview of his js control scheme based of his interpretations of <a title="xbl alternative" href="http://www.jerf.org/resources/xblinjs/" target="_blank">XBLinJS</a>.  What it seems we've got almost worked out is a simple way to repeat nodes and a simple way to create complex, repeatable, XUL/HTML controls.  Most of this work was inspired by excessive frustration (mostly caused by nonexistant error handling) at the way mozilla handles these two things  and by reading <a href="http://www.jerf.org">Jeremy Bowers</a> site which convinced us to do what we already wanted to do.<br /><br /><br />
UPDATE:<br />
<a href="http://blogs.acceleration.net/russ/articles/1062.aspx">Go Here to see  the Repeater Source</a><br />
<a href="http://blogs.acceleration.net/russ/articles/1145.aspx">Usage Example</a><img src ="http://blogs.acceleration.net/russ/aggbug/819.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Russ</dc:creator><title>JS Shell Update</title><link>http://blogs.acceleration.net/russ/archive/2005/04/08/812.aspx</link><pubDate>Fri, 08 Apr 2005 14:24:00 GMT</pubDate><guid>http://blogs.acceleration.net/russ/archive/2005/04/08/812.aspx</guid><description>I finally got around to sorting the outputs of both the tab complete and the props function.  That was a long time coming for .sort().
&lt;br /&gt;&lt;br /&gt;
 &lt;a href="http://birdman.acceleration.net/shell/extensiondev.xpi"&gt;The XPI&lt;/a&gt;&lt;img src ="http://blogs.acceleration.net/russ/aggbug/812.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml">I finally got around to sorting the outputs of both the tab complete and the props function.  That was a long time coming for .sort().
<br /><br />
 <a href="http://birdman.acceleration.net/shell/extensiondev.xpi">The XPI</a><img src ="http://blogs.acceleration.net/russ/aggbug/812.aspx" width = "1" height = "1" /></body></item></channel></rss>