<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
        <?xml-stylesheet type="text/css" href="http://a1k0n.net/blah/styles/feed.css"?>
<title type="html">a1k0n</title>
<link rel="alternate" type="text/html" href="http://a1k0n.net/blah"/>
<link rel="self" type="application/atom+xml" href="http://a1k0n.net/blah/atom.xml"/>
<updated>2007-10-12T17:30:16-05:00</updated>
<author>
<name>a1k0n</name>
<uri>http://a1k0n.net/blah</uri>
</author>
<id>http://a1k0n.net/blah/</id>
<generator uri="http://nanoblogger.sourceforge.net" version="3.3">
NanoBlogger
</generator>

<entry>
<title type="html">Vendetta Online source code</title>
<author>
<name>a1k0n</name>
</author>
<link rel="alternate" type="text/html" href="http://a1k0n.net/blah/archives/2007/10/12/index.html#e2007-10-12T14_39_12.txt"/>
<id>http://a1k0n.net/blah/archives/2007/10/12/index.html#e2007-10-12T14_39_12.txt</id>
<published>2007-10-12T14:39:12-05:00</published>
<updated>2007-10-12T14:39:12-05:00</updated>
<category term="Vendetta" />
<category term="Obfuscated C" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<![CDATA[By request: <a href="http://a1k0n.net/code/vosource.c.txt">Vendetta
Online's source code</a>.  It runs ok in cygwin but if it's too fast
then stick a <tt>usleep(20000);</tt> right before the last }}.
<br /><br />
(From <a
href="http://www.vendetta-online.com/x/msgboard/2/14902?page=2">this
thread</a>, referencing an inside joke from a <a
href="http://www.vendetta-online.com/x/msgboard/1/2807#38314">much
earlier thread</a>, but the message ordering got all mixed up at some
point when I had to reindex the message IDs in the database (sigh)).]]>
</div>
</content>

</entry>
<entry>
<title type="html">Updates!</title>
<author>
<name>a1k0n</name>
</author>
<link rel="alternate" type="text/html" href="http://a1k0n.net/blah/archives/2007/10/09/index.html#e2007-10-09T23_03_25.txt"/>
<id>http://a1k0n.net/blah/archives/2007/10/09/index.html#e2007-10-09T23_03_25.txt</id>
<published>2007-10-09T23:03:25-05:00</published>
<updated>2007-10-09T23:03:25-05:00</updated>
<category term="Personal" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<![CDATA[I sure don't update this blog very often.  So, let's see...
<br /><br />
Since I've posted last:
<br /><br />
John has replaced fear.incarnate.net, our long-standing webserver,
with a new box.  This one has 750gig mirrored disks, whereas the old
one was constantly running out of space.  Of course, since they're
John's disks, one of them died already.  (Vendetta's DB server's hot
spare disk was DOA, and fear's two mirrored disks have died at the
same time in the past, and then there was the Micropolis disk
debacle.. in short, John has the worst luck with hard disks)
Apparently the warranty on them is good until 2012, so that's good.
<br /><br />
Nanoblogger has been upgraded, and as a result my site got a little
facelift.  Woo.  It's.. uglier, I think.
<br /><br />
I found out that my wife's coworker Jen's husband <a
href="http://www.damonpayne.com/">Damon</a> works at CarSpot.com,
where <a href="http://superpants.com">Nick Purvis</a> worked until
recently.  I think Nick was a cofounder.  Jen and Damon live right
down the street from us; the first time I met them was at their
wedding.  Small world, I guess.
<br /><br />
I also want to point out, belatedly, that I made it to 26th on the <a
href="http://www.icfpcontest.org/submits/scoreboard">ICFP 2007
contest</a>, and with Ray's help our combined Guild Software effort
made it to 22nd.  I didn't get to spend much time at all on this
contest as I was busy that weekend, but I'm pleased with how well we
did given the effort.  (A sort of post-mortem is <a
href="http://programming.reddit.com/info/28xdp/comments/c28zc7">here</a>).
<br /><br />
Speaking of programming contests, Damon's site reminded me of <a
href="http://projecteuler.net">Project Euler</a>.  It's pretty fun,
highly recommended.  (see <a
href="http://projecteuler.net/index.php?section=profile&profile=3464">my
profile</a> - but you must be logged in for that).  
<br /><br />
I was also in the ~200s ranking (nothing to write home about) on the
<a href="http://netflixprize.com">Netflix Prize</a> back in March but
I've fallen even lower (607 as of this writing - now that's
embarassing) since then.  I used a maximum-likelihood singular value
decomposition approach except with a conjugate gradient optimizer
(L-BFGS, to be specific, a quasi-Newton method), which is a hell of a
lot more efficient than any gradient descent method with learning
rates that a lot of other people are using.  But I didn't devote all
that much CPU time to it, and I need to do a fair amount of
preprocessing of the data to be more competitive.  Seems a lot of
people are getting a handle on this very interesting problem.  
<br /><br />
The Netflix challenge been very educational for me as I've been able
to put a lot of stuff I learned from <a
href="http://www.inference.phy.cam.ac.uk/mackay/itila/book.html">David
MacKay's excellent book</a> into context.  If I come back to the
problem I'll probably try Hamiltonian Monte Carlo or Gibbs sampling in
order to get more than one sample to marginalize over.
<br /><br />
Also, watch for the IOCCC 2006 results announcement in November...
<br /><br />
If one of the two people who actually read this blog would like
elaboration on any topic I would be happy to oblige.]]>
</div>
</content>

</entry>
<entry>
<title type="html">Another short C program.</title>
<author>
<name>a1k0n</name>
</author>
<link rel="alternate" type="text/html" href="http://a1k0n.net/blah/archives/2007/08/24/index.html#e2007-08-24T15_40_49.txt"/>
<id>http://a1k0n.net/blah/archives/2007/08/24/index.html#e2007-08-24T15_40_49.txt</id>
<published>2007-08-24T15:40:49-05:00</published>
<updated>2007-08-24T15:40:49-05:00</updated>
<category term="Obfuscated C" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<![CDATA[<pre>
b[2080];main(j){for(;;){printf("\x1b[H");for(j=1;j&lt;2080;j++)b[j]=j&lt;
2000?(b[j+79]+b[j+80]+b[j]+b[j-1]+b[j+81])/5:rand()%4?0:512,j&lt;1840?
putchar((j%80)==79?'\n':" .:*#$H@"[b[j]&gt;&gt;5]):0;usleep(20000);}}
</pre>
<br /><br />
update: fixed a crashing bug.  It has other issues with uninitialized
data, though.]]>
</div>
</content>

</entry>
<entry>
<title type="html">the end.</title>
<author>
<name>a1k0n</name>
</author>
<link rel="alternate" type="text/html" href="http://a1k0n.net/blah/archives/2007/07/12/index.html#e2007-07-12T17_26_38.txt"/>
<id>http://a1k0n.net/blah/archives/2007/07/12/index.html#e2007-07-12T17_26_38.txt</id>
<published>2007-07-12T17:26:38-05:00</published>
<updated>2007-07-12T17:26:38-05:00</updated>

<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<![CDATA[Lingering narrative concepts and furtive simplistic montage are the
harbingers of the new semiotics!
<br /><br />
But language as a patriarchal construct of insipid teledildonics
obscures the struggle for representational power and ideology!
<br /><br />
No.  (No no no no no no no no)  Noooo!  We project prefrontally the
supersocietal oppression of convergent transaction with art.
<br /><br />
Speak to me now, bad kangaroo<br>
Speak to me now, bad kangaroo<br>
Speak to me now!
<br /><br />
<object width="425" height="350"> <param name="movie"
value="http://www.youtube.com/v/oY-TRd9VujA"> </param> <embed
src="http://www.youtube.com/v/oY-TRd9VujA"
type="application/x-shockwave-flash" width="425" height="350">
</embed> </object>]]>
</div>
</content>

</entry>
<entry>
<title type="html">Building on the donut: here's an old-school CG cliche</title>
<author>
<name>a1k0n</name>
</author>
<link rel="alternate" type="text/html" href="http://a1k0n.net/blah/archives/2006/09/20/index.html#e2006-09-20T19_10_14.txt"/>
<id>http://a1k0n.net/blah/archives/2006/09/20/index.html#e2006-09-20T19_10_14.txt</id>
<published>2006-09-20T19:10:14-05:00</published>
<updated>2006-09-20T19:10:14-05:00</updated>
<category term="Obfuscated C" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<![CDATA[<pre>
_,x,y,o       ,N;char       b[1840]       ;p(n,c)
{for(;n       --;x++)       c==10?y       +=80,x=
o-1:x&gt;=       0?80&gt;x?       c!='~'?       b[y+x]=
c:0:0:0       ;}c(q,l       ,r,o,v)       char*l,
       *r;{for       (;q&gt;=0;       )q=("A"       "YLrZ^"
       "w^?EX"           "novne"     "bYV"       "dO}LE"
       "{yWlw"      "Jl_Ja|[ur]zovpu"   ""       "i]e|y"
       "ao_Be"   "osmIg}r]]r]m|wkZU}{O}"         "xys]]\
x|ya|y"        "sm||{uel}|r{yIcsm||ya[{uE"  "{qY\
w|gGor"      "VrVWioriI}Qac{{BIY[sXjjsVW]aM"  "T\
tXjjss"     "sV_OUkRUlSiorVXp_qOM&gt;E{BadB"[_/6  ]-
62&gt;&gt;_++    %6&amp;1?r[q]:l[q])-o;return q;}E(a){for (
       o= x=a,y=0,_=0;1095&gt;_;)a= " &lt;.,`'/)(\n-"  "\\_~"[
       c  (12,"!%*/')#3"  ""     "+-6,8","\"(.$" "01245"
       " &amp;79",46)+14],  p(""       "#$%&amp;'()0:439 "[ c(10
       , "&amp;(*#,./1345" ,"')"       "+%-$02\"! ", 44)+12]
-34,a);  }main(k){float     A=0,B= 0,i,j,z[1840];
puts(""  "\x1b[2J");;;      for(;; ){float e=sin
(A), n=  sin(B),g=cos(      A),m=  cos(B);for(k=
0;1840&gt;   k;k++)y=-10-k/    80   ,o=41+(k%80-40
       )* 1.3/y+n,N=A-100.0/y,b[k]=".#"[o+N&amp;1],  z[k]=0;
       E(  80-(int)(9*B)%250);for(j=0;6.28&gt;j;j   +=0.07)
       for  (i=0;6.28&gt;i;i+=0.02){float c=sin(    i),  d=
       cos(  j),f=sin(j),h=d+2,D=15/(c*h*e+f     *g+5),l
=cos(i)        ,t=c*h*g-f*e;x=40+2*D*(l*h*  m-t*n
),y=12+       D  *(l*h*n+t*m),o=x+80*y,N  =8*((f*
e-c*d*g       )*m   -c*d*e-f*g-l*d*n)     ;if(D&gt;z
[o])z[o       ]=D,b[     o]=" ."          ".,,-+"
       "+=#$@"       [N&gt;0?N:       0];;;;}       printf(
       "%c[H",       27);for       (k=1;18       *100+41
       &gt;k;k++)       putchar       (k%80?b       [k]:10)
       ;;;;A+=       0.053;;       B+=0.03       ;;;;;}}
</pre>
(again, compile it with -lm, and it needs ANSI-ish terminal emulation)]]>
</div>
</content>

</entry>
<entry>
<title type="html">Have a donut.</title>
<author>
<name>a1k0n</name>
</author>
<link rel="alternate" type="text/html" href="http://a1k0n.net/blah/archives/2006/09/15/index.html#e2006-09-15T14_02_08.txt"/>
<id>http://a1k0n.net/blah/archives/2006/09/15/index.html#e2006-09-15T14_02_08.txt</id>
<published>2006-09-15T14:02:08-05:00</published>
<updated>2006-09-15T14:02:08-05:00</updated>
<category term="Obfuscated C" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<![CDATA[(needs -lm to compile, and ANSI- or VT100-like emulation)
<pre>
             k;double sin()
         ,cos();main(){float A=
       0,B=0,i,j,z[1760];char b[
     1760];printf("\x1b[2J");for(;;
  ){memset(b,32,1760);memset(z,0,7040)
  ;for(j=0;6.28&gt;j;j+=0.07)for(i=0;6.28
 &gt;i;i+=0.02){float c=sin(i),d=cos(j),e=
 sin(A),f=sin(j),g=cos(A),h=d+2,D=1/(c*
 h*e+f*g+5),l=cos      (i),m=cos(B),n=s\
in(B),t=c*h*g-f*        e;int x=40+30*D*
(l*h*m-t*n),y=            12+15*D*(l*h*n
+t*m),o=x+80*y,          N=8*((f*e-c*d*g
 )*m-c*d*e-f*g-l        *d*n);if(22&gt;y&amp;&amp;
 y&gt;0&amp;&amp;x&gt;0&amp;&amp;80&gt;x&amp;&amp;D&gt;z[o]){z[o]=D;;;b[o]=
 ".,-~:;=!*#$@"[N&gt;0?N:0];}}/*#****!!-*/
  printf("\x1b[H");for(k=0;1761&gt;k;k++)
   putchar(k%80?b[k]:10);A+=0.04;B+=
     0.02;}}/*****####*******!!=;:~
       ~::==!!!**********!!!==::-
         .,~~;;;========;;;:~-.
             ..,--------,*/
</pre>]]>
</div>
</content>

</entry>
<entry>
<title type="html">Auto-generating ASDF defsystems given a bunch of .lisp files</title>
<author>
<name>a1k0n</name>
</author>
<link rel="alternate" type="text/html" href="http://a1k0n.net/blah/archives/2005/11/16/index.html#e2005-11-16T15_28_05.txt"/>
<id>http://a1k0n.net/blah/archives/2005/11/16/index.html#e2005-11-16T15_28_05.txt</id>
<published>2005-11-16T15:28:05-05:00</published>
<updated>2005-11-16T15:28:05-05:00</updated>
<category term="Lisp" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<![CDATA[I hacked together a really simple ASDF defsystem generator.  What it
does is scan through a set of source files for any DEF* form, assuming
that when it sees <tt>(defblargh foo)</tt> it's defining a "blargh"
named foo, and anytime it subsequently sees "foo" it knows which .lisp
file "foo" was defined in, and thus adds it as a :depends-on clause to
the .lisp file which used "foo".
<br /><br />
It has a lot of shortcomings.  Firstly, it simply uses the Lisp
reader, which tries to intern symbols it sees - but into which
package?  If it sees, for instance, <tt>clsql:connect</tt>, then it
will bork unless CLSQL has been loaded first.  Which is why the first
thing <tt>make-asdf</tt> does is load all the systems your new system
depends on, which should really be ASDF's job.  By the same token, if
your system uses multiple packages then it won't work at all because
the defpackage forms will never be evaluated before they're needed.
<br /><br />
Anyway, <a href="/lisp/asdfgen.lisp.html">here is the first rudimentary
version of the code</a>.]]>
</div>
</content>

</entry>
<entry>
<title type="html">Using SLIME over an SSH tunnel</title>
<author>
<name>a1k0n</name>
</author>
<link rel="alternate" type="text/html" href="http://a1k0n.net/blah/archives/2005/11/04/index.html#e2005-11-04T18_00_44.txt"/>
<id>http://a1k0n.net/blah/archives/2005/11/04/index.html#e2005-11-04T18_00_44.txt</id>
<published>2005-11-04T18:00:44-05:00</published>
<updated>2005-11-04T18:00:44-05:00</updated>
<category term="Lisp" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<![CDATA[If you'd like to use emacs on one computer (i.e. your windows box at
home) and use <a
href="http://common-lisp.net/project/slime/">SLIME</a> to connect to a
Lisp process on a remote computer (i.e. your server at work), here's
how I do it.
<br /><br />
First, create a startup file for your favorite Lisp implementation.
<br /><br />
<h2>lisp startup file</h2>
<pre>
(require 'asdf)
(asdf:oos 'asdf:load-op 'swank)
 
; start swank
(setf swank:*use-dedicated-output-stream* nil)
(setf swank:*communication-style* :fd-handler)
(swank:create-server :dont-close t)
</pre>
 
Now edit your ~/.emacs so that you've got something like the following in it:
 
<h2>.emacs</h2>
<pre>
(require 'slime)
(require 'tramp)
 
(add-hook 'lisp-mode-hook (lambda () (slime-mode t)))
(add-hook 'inferior-lisp-mode-hook (lambda () (inferior-slime-mode t)))
 
(setq lisp-indent-function 'common-lisp-indent-function
      slime-complete-symbol-function 'slime-fuzzy-complete-symbol)
 
(slime-setup)
 
;;; If you want to tunnel through an intermediate host, such as your
;;; work firewall, use the following couple lines.  If you're using a
;;; Windows emacs, use 'plink' as below, otherwise substitute 'ssh'.
(add-to-list
 'tramp-default-proxies-alist
 '("\\.work-domain\\.com" nil "/plink:fwuserid@firewall.work-domain.com:/"))
(add-to-list
 'tramp-default-proxies-alist
 '("firewall\\.work-domain\\.com" nil nil))
 
(defvar *my-box-tramp-path*
  "/ssh:me@my-box.work-domain.com:")
 
(defvar *current-tramp-path* nil)
(defun connect-to-host (path)
  (setq *current-tramp-path* path)
  (setq slime-translate-from-lisp-filename-function
    (lambda (f)
      (concat *current-tramp-path* f)))
  (setq slime-translate-to-lisp-filename-function
    (lambda (f)
      (substring f (length *current-tramp-path*))))
  (slime-connect "localhost" 4005))
 
(defun my-box-slime ()
  (interactive)
  (connect-to-host *my-box-tramp-path*))
 
(defun my-box-homedir ()
  (interactive)
  (find-file (concat *zarniwoop-tramp-path* "/home/me/")))
</pre>
<br /><br />
Now, load up the startup file you created on your host Lisp to start
the swank server.  Then, create an ssh tunnel, i.e. <tt>ssh -L
4005:localhost:4005 me@my-work.com</tt>.
<br /><br />
Now you can <tt>M-x my-box-slime</tt> to connect through your SSH
tunnel to your work box; SLIME's <tt>M-</tt>. command will also
correctly open up the file containing the defun of whatever's under
your cursor, and <tt>C-c C-k</tt> works correctly, etc.  If you want
to open up some lisp file, <tt>M-x my-box-homedir</tt> is a convenient
shortcut.
<br /><br />
<h2>For Windows users</h2>
If you're using Windows and want to also use a multi-hop tramp method
(i.e. ssh into your work firewall, and then ssh from there to your
server at work), be aware that tramp 2.1.4 and prior has a bug; it's
fixed in CVS and probably 2.1.5, which is not out yet.  Information
and a patch is available <a
href="http://lists.gnu.org/archive/html/tramp-devel/2005-10/msg00060.html">here</a>.
<br /><br />
You'll also want to use plink from the <a
href="http://www.chiark.greenend.org.uk/~sgtatham/putty/">PuTTY</a>
distribution in lieu of ssh.  If you're doing multi-hop tramp, though,
you need to use plink for the first hop (Windows box -> "firewall"
box) and ssh thereafter ("firewall" -> "server").]]>
</div>
</content>

</entry>
<entry>
<title type="html">Lisp REPL in Vendetta Online</title>
<author>
<name>a1k0n</name>
</author>
<link rel="alternate" type="text/html" href="http://a1k0n.net/blah/archives/2005/11/04/index.html#e2005-11-04T17_36_48.txt"/>
<id>http://a1k0n.net/blah/archives/2005/11/04/index.html#e2005-11-04T17_36_48.txt</id>
<published>2005-11-04T17:36:48-05:00</published>
<updated>2005-11-04T17:36:48-05:00</updated>
<category term="Vendetta" />
<category term="Lisp" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<![CDATA[<a href="http://www.vendetta-online.com">Vendetta Online</a> has a
Lisp environment (using SBCL) which controls much of its NPC behavior
and will soon be in charge of generating player and NPC missions.
Partly in order to get around some thread-safety issues, and partly
for convenience we built an REPL into a secret chat channel.  (it only
responds to developer accounts)
<br /><br />
<a href="/lisp/vo-lisp-repl1.png"><img src="/lisp/vo-lisp-repl1_small.png"></a>
<br /><br />
<a href="/lisp/vo-lisp-repl2.png"><img src="/lisp/vo-lisp-repl2_small.png"></a>
<br /><br />
It also handles errors by printing a quick and dirty stack trace:
<br /><br />
<a href="/lisp/vo-lisp-repl3.png"><img src="/lisp/vo-lisp-repl3_small.png"></a>
<br /><br />
Here's the code for the stack dump handler, for interested readers:
<br /><br />
<pre>
(defun trap-and-log-error-handler (condition)
  (format t "Error signalled: ~A~%" condition)
  ;; this (write-string (with-output-to-string (s) ...) thing is odd,
  ;; but seemingly necessary because print-frame-call seems
  ;; uncooperative when using t for a stream argument.
  (write-string (with-output-to-string (s)
		  (do ((frame (sb-di:top-frame) (sb-di:frame-down frame))
		       (i 0 (1+ i)))
		      ((null frame))
		    (format s "~a: " i)
		    (sb-debug::print-frame-call frame s)
		    (format s "~%")))))
<br /><br />
(defmacro trap-and-log-errors (&amp;body body)
  `(ignore-errors
     (handler-bind ((error #'trap-and-log-error-handler))
       ,@body)))
<br /><br />
</pre>
<br /><br />
and here's the REPL code (trap-and-log-errors is somewhere upstream
from where this is called)
<br /><br />
<pre>
;;; this is what interprets "eval" requests from developers; we have a
;;; simple color code tag involving the non-printable character 
;;; (code-char 127), so return values show up in red (like in SLIME)
<br /><br />
(define-server-function eval (&amp;rest cmd)
  (flet ((format-return-value (return-val)
	   (with-output-to-string (os)
	     (with-input-from-string (s (format nil "~s~&amp;" return-val))
	       (loop for line = (read-line s nil)
		     while line do
		     (format os "~aff0000~a~%" (code-char 127) line))))))
    (let ((return-val (multiple-value-list (eval `(progn
						   (in-package :com.guildsoftware.deliverator)
						   ,@cmd)))))
      (format t "~&amp;")
      (dolist (val return-val)
	(write-string (format-return-value val))))))
<br /><br />
<br /><br />
</pre>
<br /><br />
Why didn't I just use <tt>sb-debug:backtrace</tt>?  I didn't know
about it.  I just looked at how SLIME did it.]]>
</div>
</content>

</entry>
<entry>
<title type="html">An introductory note.</title>
<author>
<name>a1k0n</name>
</author>
<link rel="alternate" type="text/html" href="http://a1k0n.net/blah/archives/2005/11/04/index.html#e2005-11-04T15_46_27.txt"/>
<id>http://a1k0n.net/blah/archives/2005/11/04/index.html#e2005-11-04T15_46_27.txt</id>
<published>2005-11-04T15:46:27-05:00</published>
<updated>2005-11-04T15:46:27-05:00</updated>
<category term="Personal" />
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
<![CDATA[My uncle <a href="http://www.sloaneassociates.com/">Ron</a> asked me,
"Do you know what a blog is?  I have a blog, and I don't even know
what the hell it is."
<br /><br />
I feigned ignorance.
<br /><br />
But at last, I broke down and made one of my own.  Will it have any
purpose?  Who knows!  I think it might help me flesh out new ideas if
I actually decide to write them down.  It might also take lots of time
away from me, as I write about pointless tangents when I'm supposed to
be working.
<br /><br />
Alas, this, my first entry, shall contain no new ideas.  But what I
will do is convert some of the old stuff on my site into retroactive
entries, which is sort of cheating but whatever.  
<br /><br />
So anything below this post was written prior to this post, but
reformatted for the blog afterwards.]]>
</div>
</content>

</entry>

</feed>
