<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-14786774</id><updated>2011-11-27T16:52:48.865-08:00</updated><category term='Humor'/><category term='lisp'/><category term='emacs'/><title type='text'>Code Storm</title><subtitle type='html'>Articles and commentary on various programming topics.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://stormcoders.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://stormcoders.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Mike</name><uri>http://www.blogger.com/profile/00898991996792619958</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>31</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-14786774.post-6434804286942312522</id><published>2008-02-23T11:03:00.000-08:00</published><updated>2008-05-15T11:03:21.654-07:00</updated><title type='text'>Officially pissed at Apple</title><content type='html'>The wireless driver is fucked over in the 10.5.2 update. The airport will drop the connection to the router after a few minutes of heavy use. It sometimes lasts as long as 30 minutes but then it drops the connection. Makes trying to download large files fucking frustrating. They better fix this one fast or Linux is going onto this iMac. Did they test the update at all? You would think this driver would have seen heavy use while testing.&lt;br /&gt;&lt;br /&gt;**UPDATE**&lt;br /&gt;It seems that Apple has corrected this in the last set of updates.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14786774-6434804286942312522?l=stormcoders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stormcoders.blogspot.com/feeds/6434804286942312522/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14786774&amp;postID=6434804286942312522&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/6434804286942312522'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/6434804286942312522'/><link rel='alternate' type='text/html' href='http://stormcoders.blogspot.com/2008/02/officially-pissed-at-apple.html' title='Officially pissed at Apple'/><author><name>Mike</name><uri>http://www.blogger.com/profile/00898991996792619958</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14786774.post-5287930379046083869</id><published>2007-11-21T08:59:00.000-08:00</published><updated>2007-11-28T10:39:59.893-08:00</updated><title type='text'>Restoring Emacs layout</title><content type='html'>&lt;style type="text/css"&gt;&lt;br /&gt;    &lt;!--       body {         color: #87cefa;         background-color: #000000;       }       .comment {         /* font-lock-comment-face */         color: #ff0000;       }       .comment-delimiter {         /* font-lock-comment-delimiter-face */         color: #ff0000;       }       .doc {         /* font-lock-doc-face */         color: #40e0d0;       }       .function-name {         /* font-lock-function-name-face */         color: #ffffff;       }       .keyword {         /* font-lock-keyword-face */         color: #00ff00;       }       .string {         /* font-lock-string-face */         color: #40e0d0;       }        a {         color: inherit;         background-color: inherit;         font: inherit;         text-decoration: inherit;       }       a:hover {         text-decoration: underline;       }     --&gt;&lt;br /&gt;    &lt;/style&gt;&lt;br /&gt;&lt;p&gt;When I work in EMACS I have a specific layout that I use. I have about five frames open each dedicated to some task. One will have three dired windows and an eshell window. Others will have project files open or source files. Restoring this layout is a pain whenever I have to restart emacs. So I decided to automate this layout restoration. I found revive.el that does almost what I wanted so I wrote some code that uses revive to save the state of all the frames that are currently open and then restore that state.&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;emacs-save-layout&lt;/span&gt; ()&lt;span class="comment-delimiter"&gt;;&lt;/span&gt;&lt;span class="comment"&gt;TODO: handle eshell&lt;br /&gt;&lt;/span&gt;  &lt;span class="doc"&gt;"save the frame and window layout to ~/.emacs-layout. Requires revive.el."&lt;/span&gt;&lt;br /&gt;(interactive)&lt;br /&gt;(&lt;span class="keyword"&gt;let&lt;/span&gt; ((out-name (concat *HOME* &lt;span class="string"&gt;"/.emacs-layout"&lt;/span&gt;))&lt;br /&gt;      (frames (frame-list))&lt;br /&gt;      (configs nil)&lt;br /&gt;      (buffs (sorted-buffer-list))&lt;br /&gt;      (filtered-buffs nil)&lt;br /&gt;      (s-buffs nil))&lt;br /&gt;  (&lt;span class="keyword"&gt;dolist&lt;/span&gt; (b buffs)    &lt;br /&gt;      (&lt;span class="keyword"&gt;let&lt;/span&gt; ((file-name (buffer-file-name b)))&lt;br /&gt;        (&lt;span class="keyword"&gt;when&lt;/span&gt; (and file-name&lt;br /&gt;                   (&amp;gt; (length file-name) 0))&lt;br /&gt;          (setq filtered-buffs (cons file-name filtered-buffs)))))&lt;br /&gt;  (&lt;span class="keyword"&gt;when&lt;/span&gt; filtered-buffs (setq filtered-buffs (reverse filtered-buffs)))&lt;br /&gt;  (&lt;span class="keyword"&gt;dolist&lt;/span&gt; (frame frames)&lt;br /&gt;    (select-frame frame)&lt;br /&gt;    (setq configs (cons (current-window-configuration-printable) configs)))&lt;br /&gt;  (setq configs (cons filtered-buffs configs))&lt;br /&gt;  (write-region (&lt;span class="keyword"&gt;with-output-to-string&lt;/span&gt; (prin1 configs)) nil out-name)))&lt;br /&gt;&lt;br /&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;emacs-load-layout&lt;/span&gt; ()&lt;span class="comment-delimiter"&gt;;&lt;/span&gt;&lt;span class="comment"&gt;TODO: handle eshell buffers.&lt;br /&gt;&lt;/span&gt;  &lt;span class="doc"&gt;"Load the layout saved by emacs-save-layout. Requires revive.el."&lt;/span&gt;&lt;br /&gt;(interactive)&lt;br /&gt;(&lt;span class="keyword"&gt;let*&lt;/span&gt; ((in-name (concat *HOME* &lt;span class="string"&gt;"/.emacs-layout"&lt;/span&gt;))&lt;br /&gt;      (config-count 0)&lt;br /&gt;      (frames (frame-list))&lt;br /&gt;      (configs nil)&lt;br /&gt;      (frame-count (length frames))&lt;br /&gt;      (buffs nil))&lt;br /&gt;  (&lt;span class="keyword"&gt;with-temp-buffer&lt;/span&gt;&lt;br /&gt;    (insert-file-contents-literally in-name)&lt;br /&gt;    (setq buffs (read (current-buffer)))&lt;br /&gt;    (setq configs (rest buffs))&lt;br /&gt;    (setq buffs (first buffs)))&lt;br /&gt;  (&lt;span class="keyword"&gt;dolist&lt;/span&gt; (b buffs)&lt;br /&gt;    (find-file-noselect b)&lt;br /&gt;    (message &lt;span class="string"&gt;"Loading buffer %s"&lt;/span&gt; b))&lt;br /&gt;  (setq config-count (length configs))&lt;br /&gt;  (message &lt;span class="string"&gt;"Config count is %s"&lt;/span&gt; config-count)&lt;br /&gt;  (&lt;span class="keyword"&gt;unless&lt;/span&gt; (&amp;gt;= frame-count config-count)&lt;br /&gt;    (&lt;span class="keyword"&gt;dotimes&lt;/span&gt; (i (- config-count frame-count))&lt;br /&gt;      (make-frame))&lt;br /&gt;    (setq frames (frame-list))&lt;br /&gt;    (setq frame-count (length frames))&lt;br /&gt;    (message &lt;span class="string"&gt;"frame-count is %s"&lt;/span&gt; frame-count))&lt;br /&gt;  (&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;it&lt;/span&gt; (lconfigs lframes)&lt;br /&gt;            (&lt;span class="keyword"&gt;when&lt;/span&gt; (and lconfigs lframes)&lt;br /&gt;              (select-frame (first lframes))&lt;br /&gt;              (restore-window-configuration (first lconfigs))&lt;br /&gt;              (it (rest lconfigs) (rest lframes))))&lt;br /&gt;  (it configs frames)))&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14786774-5287930379046083869?l=stormcoders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stormcoders.blogspot.com/feeds/5287930379046083869/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14786774&amp;postID=5287930379046083869&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/5287930379046083869'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/5287930379046083869'/><link rel='alternate' type='text/html' href='http://stormcoders.blogspot.com/2007/11/restoring-emacs-layout.html' title='Restoring Emacs layout'/><author><name>Mike</name><uri>http://www.blogger.com/profile/00898991996792619958</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14786774.post-6748949372292423061</id><published>2007-10-15T15:18:00.000-07:00</published><updated>2007-10-15T15:19:33.141-07:00</updated><title type='text'>The Authoritarians</title><content type='html'>&lt;a href="http://home.cc.umanitoba.ca/%7Ealtemey/"&gt;The Authoritarians&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Normally I don't enjoy political discussions or make politically oriented posts but I think, with the upcoming elections and the current climate in the United States, that more people should know about this book and an associated article. This work on authoritarianism has been done over a period of fourty years, in a manner that is very readable, and is well worth the time to read. An associated article is &lt;a href="http://www.boston.com/news/globe/editorial_opinion/oped/articles/2006/07/14/triumph_of_the_authoritarians/"&gt;here.&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14786774-6748949372292423061?l=stormcoders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://home.cc.umanitoba.ca/~altemey/' title='The Authoritarians'/><link rel='replies' type='application/atom+xml' href='http://stormcoders.blogspot.com/feeds/6748949372292423061/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14786774&amp;postID=6748949372292423061&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/6748949372292423061'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/6748949372292423061'/><link rel='alternate' type='text/html' href='http://stormcoders.blogspot.com/2007/10/authoritarians.html' title='The Authoritarians'/><author><name>Mike</name><uri>http://www.blogger.com/profile/00898991996792619958</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14786774.post-7096757752679808783</id><published>2007-10-11T13:22:00.000-07:00</published><updated>2007-10-11T13:22:46.502-07:00</updated><title type='text'>David Rupp's Blog: The Last Language War / Language Trolling Post You'll Ever Need To Read (Hopefully)</title><content type='html'>&lt;a href="http://davidrupp.blogspot.com/2007/10/last-language-war-language-trolling.html"&gt;David Rupp's Blog: The Last Language War / Language Trolling Post You'll Ever Need To Read (Hopefully)&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Seriously funny post. Most excellent.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14786774-7096757752679808783?l=stormcoders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://davidrupp.blogspot.com/2007/10/last-language-war-language-trolling.html' title='David Rupp&apos;s Blog: The Last Language War / Language Trolling Post You&apos;ll Ever Need To Read (Hopefully)'/><link rel='replies' type='application/atom+xml' href='http://stormcoders.blogspot.com/feeds/7096757752679808783/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14786774&amp;postID=7096757752679808783&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/7096757752679808783'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/7096757752679808783'/><link rel='alternate' type='text/html' href='http://stormcoders.blogspot.com/2007/10/david-rupps-blog-last-language-war.html' title='David Rupp&apos;s Blog: The Last Language War / Language Trolling Post You&apos;ll Ever Need To Read (Hopefully)'/><author><name>Mike</name><uri>http://www.blogger.com/profile/00898991996792619958</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14786774.post-5614292198314814098</id><published>2007-09-17T15:14:00.000-07:00</published><updated>2007-09-17T15:29:39.632-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='lisp'/><category scheme='http://www.blogger.com/atom/ns#' term='emacs'/><title type='text'>elisp functions for emacs</title><content type='html'>A set of functions that I use in my emacs configuration and to automate tasks. Some functions have been acquired and some I have written myself.&lt;br /&gt;   &lt;pre&gt;&lt;br /&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;lispdoc&lt;/span&gt; ()&lt;br /&gt; &lt;span class="doc"&gt;"searches lispdoc.com for SYMBOL, which is by default the symbol&lt;br /&gt;currently under the curser"&lt;/span&gt;&lt;br /&gt; (interactive)&lt;br /&gt; (&lt;span class="keyword"&gt;let*&lt;/span&gt; ((word-at-point (word-at-point))&lt;br /&gt;        (symbol-at-point (symbol-at-point))&lt;br /&gt;        (default (symbol-name symbol-at-point))&lt;br /&gt;        (inp (read-from-minibuffer&lt;br /&gt;              (&lt;span class="keyword"&gt;if&lt;/span&gt; (or word-at-point symbol-at-point)&lt;br /&gt;                  (concat &lt;span class="string"&gt;"Symbol (default "&lt;/span&gt; default &lt;span class="string"&gt;"): "&lt;/span&gt;)&lt;br /&gt;                &lt;span class="string"&gt;"Symbol (no default): "&lt;/span&gt;))))&lt;br /&gt;   (&lt;span class="keyword"&gt;if&lt;/span&gt; (and (string= inp &lt;span class="string"&gt;""&lt;/span&gt;) (not word-at-point) (not&lt;br /&gt;                                                  symbol-at-point))&lt;br /&gt;       (message &lt;span class="string"&gt;"you didn't enter a symbol!"&lt;/span&gt;)&lt;br /&gt;     (&lt;span class="keyword"&gt;let&lt;/span&gt; ((search-type (read-from-minibuffer&lt;br /&gt;                           &lt;span class="string"&gt;"full-text (f) or basic (b) search (default b)? "&lt;/span&gt;)))&lt;br /&gt;         (browse-url (concat &lt;span class="string"&gt;"http://lispdoc.com?q="&lt;/span&gt;&lt;br /&gt;                             (&lt;span class="keyword"&gt;if&lt;/span&gt; (string= inp &lt;span class="string"&gt;""&lt;/span&gt;)&lt;br /&gt;                                 default&lt;br /&gt;                               inp)&lt;br /&gt;                             &lt;span class="string"&gt;"&amp;amp;search="&lt;/span&gt;&lt;br /&gt;                             (&lt;span class="keyword"&gt;if&lt;/span&gt; (string-equal search-type &lt;span class="string"&gt;"f"&lt;/span&gt;)&lt;br /&gt;                                 &lt;span class="string"&gt;"full+text+search"&lt;/span&gt;&lt;br /&gt;                               &lt;span class="string"&gt;"basic+search"&lt;/span&gt;)))))))&lt;br /&gt;&lt;br /&gt;&lt;span class="comment-delimiter"&gt;;;;&lt;/span&gt;&lt;span class="comment"&gt;======================================================================&lt;br /&gt;&lt;/span&gt;&lt;span class="comment-delimiter"&gt;;;; &lt;/span&gt;&lt;span class="comment"&gt;scratch buffer function to immediately go to the scratch buffer&lt;br /&gt;&lt;/span&gt;&lt;span class="comment-delimiter"&gt;;;; &lt;/span&gt;&lt;span class="comment"&gt;from anywhere else&lt;br /&gt;&lt;/span&gt;&lt;span class="comment-delimiter"&gt;;;;&lt;/span&gt;&lt;span class="comment"&gt;======================================================================&lt;br /&gt;&lt;/span&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;scratch&lt;/span&gt; ()&lt;br /&gt; (interactive)&lt;br /&gt; (switch-to-buffer &lt;span class="string"&gt;"*scratch*"&lt;/span&gt;)&lt;br /&gt; (lisp-interaction-mode)&lt;br /&gt; (&lt;span class="keyword"&gt;if&lt;/span&gt; current-prefix-arg&lt;br /&gt;     (delete-region (point-min) (point-max))&lt;br /&gt;   (goto-char (point-max))))&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="comment-delimiter"&gt;;;;&lt;/span&gt;&lt;span class="comment"&gt;======================================================================&lt;br /&gt;&lt;/span&gt;&lt;span class="comment-delimiter"&gt;;;; &lt;/span&gt;&lt;span class="comment"&gt;From: lawrence mitchell &amp;lt;wence-at-gmx.li&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="comment-delimiter"&gt;;;; &lt;/span&gt;&lt;span class="comment"&gt;Find the function under the point in the elisp manual&lt;br /&gt;&lt;/span&gt;&lt;span class="comment-delimiter"&gt;;;;&lt;/span&gt;&lt;span class="comment"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="comment-delimiter"&gt;;;; &lt;/span&gt;&lt;span class="comment"&gt;C-h TAB runs the command info-lookup-symbol&lt;br /&gt;&lt;/span&gt;&lt;span class="comment-delimiter"&gt;;;;    &lt;/span&gt;&lt;span class="comment"&gt;which is an interactive autoloaded Lisp function in `&lt;/span&gt;&lt;span class="comment"&gt;&lt;span class="constant"&gt;info-look&lt;/span&gt;&lt;/span&gt;&lt;span class="comment"&gt;'.&lt;br /&gt;&lt;/span&gt;&lt;span class="comment-delimiter"&gt;;;; &lt;/span&gt;&lt;span class="comment"&gt;[Arg list not available until function definition is loaded.]&lt;br /&gt;&lt;/span&gt;&lt;span class="comment-delimiter"&gt;;;;&lt;/span&gt;&lt;span class="comment"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="comment-delimiter"&gt;;;; &lt;/span&gt;&lt;span class="comment"&gt;Display the definition of SYMBOL, as found in the relevant manual.&lt;br /&gt;&lt;/span&gt;&lt;span class="comment-delimiter"&gt;;;; &lt;/span&gt;&lt;span class="comment"&gt;When this command is called interactively, it reads SYMBOL from the minibuffer.&lt;br /&gt;&lt;/span&gt;&lt;span class="comment-delimiter"&gt;;;; &lt;/span&gt;&lt;span class="comment"&gt;In the minibuffer, use M-n to yank the default argument value&lt;br /&gt;&lt;/span&gt;&lt;span class="comment-delimiter"&gt;;;; &lt;/span&gt;&lt;span class="comment"&gt;into the minibuffer so you can edit it.&lt;br /&gt;&lt;/span&gt;&lt;span class="comment-delimiter"&gt;;;; &lt;/span&gt;&lt;span class="comment"&gt;The default symbol is the one found at point.&lt;br /&gt;&lt;/span&gt;&lt;span class="comment-delimiter"&gt;;;;&lt;/span&gt;&lt;span class="comment"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="comment-delimiter"&gt;;;; &lt;/span&gt;&lt;span class="comment"&gt;With prefix arg a query for the symbol help mode is offered.&lt;br /&gt;&lt;/span&gt;&lt;span class="comment-delimiter"&gt;;;;&lt;/span&gt;&lt;span class="comment"&gt;======================================================================&lt;br /&gt;&lt;/span&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;find-function-in-elisp-manual&lt;/span&gt; (function)&lt;br /&gt; (interactive&lt;br /&gt;  (&lt;span class="keyword"&gt;let&lt;/span&gt; ((fn (function-called-at-point))&lt;br /&gt;    (enable-recursive-minibuffers t)&lt;br /&gt;    val)&lt;br /&gt;    (setq val&lt;br /&gt;      (completing-read&lt;br /&gt;       (&lt;span class="keyword"&gt;if&lt;/span&gt; fn&lt;br /&gt;       (format &lt;span class="string"&gt;"Find function (default %s): "&lt;/span&gt; fn)&lt;br /&gt;         &lt;span class="string"&gt;"Find function: "&lt;/span&gt;)&lt;br /&gt;       obarray 'fboundp t nil nil (symbol-name fn)))&lt;br /&gt;    (list (&lt;span class="keyword"&gt;if&lt;/span&gt; (equal val &lt;span class="string"&gt;""&lt;/span&gt;)&lt;br /&gt;          fn&lt;br /&gt;        val))))&lt;br /&gt; (Info-goto-node &lt;span class="string"&gt;"(elisp)Index"&lt;/span&gt;)&lt;br /&gt; (&lt;span class="keyword"&gt;condition-case&lt;/span&gt; err&lt;br /&gt;     (&lt;span class="keyword"&gt;progn&lt;/span&gt;&lt;br /&gt;   (search-forward (concat &lt;span class="string"&gt;"* "&lt;/span&gt;function&lt;span class="string"&gt;":"&lt;/span&gt;))&lt;br /&gt;   (Info-follow-nearest-node))&lt;br /&gt;   (&lt;span class="warning"&gt;error&lt;/span&gt; (message &lt;span class="string"&gt;"`&lt;/span&gt;&lt;span class="string"&gt;&lt;span class="constant"&gt;%s&lt;/span&gt;&lt;/span&gt;&lt;span class="string"&gt;' not found"&lt;/span&gt; function))))&lt;br /&gt;&lt;br /&gt;&lt;span class="comment-delimiter"&gt;;;;&lt;/span&gt;&lt;span class="comment"&gt;======================================================================&lt;br /&gt;&lt;/span&gt;&lt;span class="comment-delimiter"&gt;;;; &lt;/span&gt;&lt;span class="comment"&gt;Functions to insert the date, the time, and the date and time at&lt;br /&gt;&lt;/span&gt;&lt;span class="comment-delimiter"&gt;;;; &lt;/span&gt;&lt;span class="comment"&gt;point.  Useful for keeping records and automatically creating&lt;br /&gt;&lt;/span&gt;&lt;span class="comment-delimiter"&gt;;;; &lt;/span&gt;&lt;span class="comment"&gt;program headers&lt;br /&gt;&lt;/span&gt;&lt;span class="comment-delimiter"&gt;;;;&lt;/span&gt;&lt;span class="comment"&gt;======================================================================&lt;br /&gt;&lt;/span&gt;(&lt;span class="keyword"&gt;defvar&lt;/span&gt; &lt;span class="variable-name"&gt;insert-time-format&lt;/span&gt; &lt;span class="string"&gt;"%H:%M"&lt;/span&gt;&lt;br /&gt; &lt;span class="doc"&gt;"*Format for \\[&lt;/span&gt;&lt;span class="doc"&gt;&lt;span class="constant"&gt;insert-time&lt;/span&gt;&lt;/span&gt;&lt;span class="doc"&gt;] (c-h f 'format-time-string' for info on how to format)."&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;(&lt;span class="keyword"&gt;defvar&lt;/span&gt; &lt;span class="variable-name"&gt;insert-date-format&lt;/span&gt; &lt;span class="string"&gt;"%d %b %Y"&lt;/span&gt;&lt;br /&gt; &lt;span class="doc"&gt;"*Format for \\[&lt;/span&gt;&lt;span class="doc"&gt;&lt;span class="constant"&gt;insert-date&lt;/span&gt;&lt;/span&gt;&lt;span class="doc"&gt;] (c-h f 'format-time-string' for info on how to format)."&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;insert-time&lt;/span&gt; ()&lt;br /&gt; &lt;span class="doc"&gt;"Insert the current time according to the variable \"insert-time-format\"."&lt;/span&gt;&lt;br /&gt; (interactive &lt;span class="string"&gt;"*"&lt;/span&gt;)&lt;br /&gt; (insert (concat (format-time-string insert-time-format (current-time)) &lt;span class="string"&gt;" "&lt;/span&gt;)))&lt;br /&gt;&lt;br /&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;insert-date&lt;/span&gt; ()&lt;br /&gt; &lt;span class="doc"&gt;"Insert the current date according to the variable \"insert-date-format\"."&lt;/span&gt;&lt;br /&gt; (interactive &lt;span class="string"&gt;"*"&lt;/span&gt;)&lt;br /&gt; (insert (concat (format-time-string insert-date-format (current-time))&lt;span class="string"&gt;" "&lt;/span&gt;)))&lt;br /&gt;&lt;br /&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;insert-date-time&lt;/span&gt; ()&lt;br /&gt; &lt;span class="doc"&gt;"Insert the current date according to the variable \"insert-date-format\", then a space, then the current time according to the variable \"insert-time-format\"."&lt;/span&gt;&lt;br /&gt; (interactive &lt;span class="string"&gt;"*"&lt;/span&gt;)&lt;br /&gt; (&lt;span class="keyword"&gt;progn&lt;/span&gt;&lt;br /&gt;   (insert-date)&lt;br /&gt;   (insert &lt;span class="string"&gt;" "&lt;/span&gt;)&lt;br /&gt;   (insert-time)))&lt;br /&gt;&lt;br /&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;insert-current-file-name&lt;/span&gt; ()&lt;br /&gt; (interactive)&lt;br /&gt; (insert (file-name-nondirectory (buffer-file-name (current-buffer)) &lt;span class="string"&gt;"\/"&lt;/span&gt;)))&lt;br /&gt;&lt;br /&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;insert-current-path&lt;/span&gt; ()&lt;br /&gt; (interactive)&lt;br /&gt; (insert (buffer-file-name (current-buffer))))&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="comment-delimiter"&gt;;;;&lt;/span&gt;&lt;span class="comment"&gt;======================================================================&lt;br /&gt;&lt;/span&gt;&lt;span class="comment-delimiter"&gt;;;; &lt;/span&gt;&lt;span class="comment"&gt;this function prints an ascii table in a new buffer 4 columns&lt;br /&gt;&lt;/span&gt;&lt;span class="comment-delimiter"&gt;;;;&lt;/span&gt;&lt;span class="comment"&gt;======================================================================&lt;br /&gt;&lt;/span&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;ascii-table&lt;/span&gt; (&lt;span class="type"&gt;&amp;amp;optional&lt;/span&gt; extended)&lt;br /&gt; &lt;span class="doc"&gt;"Print the ascii table (up to char 127). Given an optional argument, print up to char 255."&lt;/span&gt;&lt;br /&gt; (interactive &lt;span class="string"&gt;"P"&lt;/span&gt;)&lt;br /&gt; (&lt;span class="keyword"&gt;defvar&lt;/span&gt; &lt;span class="variable-name"&gt;col&lt;/span&gt;)&lt;br /&gt; (&lt;span class="keyword"&gt;defvar&lt;/span&gt; &lt;span class="variable-name"&gt;limit&lt;/span&gt;)&lt;br /&gt; (setq limit 255)&lt;br /&gt; (&lt;span class="keyword"&gt;if&lt;/span&gt; (null extended)&lt;br /&gt;     (setq limit 127))&lt;br /&gt; (setq col (/ (+ 1 limit) 4))&lt;br /&gt; (switch-to-buffer &lt;span class="string"&gt;"*ASCII*"&lt;/span&gt;)&lt;br /&gt; (erase-buffer)&lt;br /&gt; (insert (format &lt;span class="string"&gt;"ASCII characters up to %d. (00 is NULL character)\n\n"&lt;/span&gt; limit))&lt;br /&gt; (insert &lt;span class="string"&gt;" DEC OCT HEX CHAR\t\t DEC OCT HEX CHAR\t\t DEC OCT HEX CHAR\t\t DEC OCT HEX CHAR\n"&lt;/span&gt;)&lt;br /&gt; (insert &lt;span class="string"&gt;" ----------------\t\t ----------------\t\t ----------------\t\t ----------------\n"&lt;/span&gt;)&lt;br /&gt; (&lt;span class="keyword"&gt;let&lt;/span&gt; ((i 0) (right 0) (tab-width 4))&lt;br /&gt;   (&lt;span class="keyword"&gt;while&lt;/span&gt; (&amp;lt; i col)&lt;br /&gt;     (setq col2 (+ i col))&lt;br /&gt;     (setq col3 (+ i (* col 2)))&lt;br /&gt;     (setq col4 (+ i (* col 3)))&lt;br /&gt;     &lt;span class="comment-delimiter"&gt;; &lt;/span&gt;&lt;span class="comment"&gt;special condition to insert a &amp;lt;TAB&amp;gt; instead of an actual tab&lt;br /&gt;&lt;/span&gt;      (&lt;span class="keyword"&gt;cond&lt;/span&gt;&lt;br /&gt;      ((= i 9)&lt;br /&gt;       (insert (format &lt;span class="string"&gt;"%4d%4o%4x  &amp;lt;TAB&amp;gt;\t\t%4d%4o%4x%4c\t\t%4d%4o%4x%4c\t\t%4d%4o%4x%4c\n"&lt;/span&gt;&lt;br /&gt;               i i i  col2 col2 col2 col2 col3 col3 col3 col3 col4 col4 col4 col4)))&lt;br /&gt;       &lt;span class="comment-delimiter"&gt;; &lt;/span&gt;&lt;span class="comment"&gt;special conditon to insert a &amp;lt;LF&amp;gt; instead of an actual line feed&lt;br /&gt;&lt;/span&gt;       ((= i 10)&lt;br /&gt;       (insert (format &lt;span class="string"&gt;"%4d%4o%4x  &amp;lt;LF&amp;gt;\t\t%4d%4o%4x%4c\t\t%4d%4o%4x%4c\t\t%4d%4o%4x%4c\n"&lt;/span&gt;&lt;br /&gt;               i i i  col2 col2 col2 col2 col3 col3 col3 col3 col4 col4 col4 col4)))&lt;br /&gt;      (t&lt;br /&gt;       &lt;span class="comment-delimiter"&gt;; &lt;/span&gt;&lt;span class="comment"&gt;insert the actual character&lt;br /&gt;&lt;/span&gt;        (insert (format &lt;span class="string"&gt;"%4d%4o%4x%4c&amp;gt;\t\t%4d%4o%4x%4c\t\t%4d%4o%4x%4c\t\t%4d%4o%4x%4c\n"&lt;/span&gt;&lt;br /&gt;               i i i i col2 col2 col2 col2 col3 col3 col3 col3 col4 col4 col4 col4))))&lt;br /&gt;     (setq i (+ i 1))))&lt;br /&gt; (beginning-of-buffer)&lt;br /&gt; (local-set-key &lt;span class="string"&gt;"q"&lt;/span&gt; (quote bury-buffer)))&lt;br /&gt;&lt;br /&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;explorer&lt;/span&gt; ()&lt;br /&gt; &lt;span class="doc"&gt;"Launch the windows explorer in the current directory"&lt;/span&gt;&lt;br /&gt; (interactive)&lt;br /&gt; (w32-shell-execute&lt;br /&gt;  &lt;span class="string"&gt;"open"&lt;/span&gt;&lt;br /&gt;  &lt;span class="string"&gt;"explorer"&lt;/span&gt;&lt;br /&gt;  (concat &lt;span class="string"&gt;"/e, "&lt;/span&gt; (convert-standard-filename default-directory))))&lt;br /&gt;&lt;br /&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;cmd&lt;/span&gt; ()&lt;br /&gt; &lt;span class="doc"&gt;"Launch the NT Command console"&lt;/span&gt;&lt;br /&gt; (interactive)&lt;br /&gt;   (w32-shell-execute&lt;br /&gt;    &lt;span class="string"&gt;"open"&lt;/span&gt;&lt;br /&gt;    &lt;span class="string"&gt;"cmd"&lt;/span&gt;))&lt;br /&gt;&lt;br /&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;tomcat&lt;/span&gt; ()&lt;br /&gt; &lt;span class="doc"&gt;"launch tomcat in debug mode."&lt;/span&gt;&lt;br /&gt; (interactive)&lt;br /&gt; (&lt;span class="keyword"&gt;let*&lt;/span&gt; ((cwd (getenv &lt;span class="string"&gt;"CATALINA_HOME"&lt;/span&gt;))&lt;br /&gt;       (tcat (concat  cwd &lt;span class="string"&gt;"/bin/startdbg.bat"&lt;/span&gt;)))&lt;br /&gt;   (find-file tcat)&lt;br /&gt;   (w32-shell-execute&lt;br /&gt;    &lt;span class="string"&gt;"open"&lt;/span&gt;&lt;br /&gt;    tcat)&lt;br /&gt;   (kill-buffer (get-file-buffer tcat))))&lt;br /&gt;&lt;br /&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;dbg-tomcat&lt;/span&gt; ()&lt;br /&gt; &lt;span class="doc"&gt;"launch a debug console for tomcat."&lt;/span&gt;&lt;br /&gt; (interactive)&lt;br /&gt; (&lt;span class="keyword"&gt;let&lt;/span&gt; ((dbg (concat (getenv &lt;span class="string"&gt;"JAVA_HOME"&lt;/span&gt;) &lt;span class="string"&gt;"/bin/jdb.exe"&lt;/span&gt;)))&lt;br /&gt;   (w32-shell-execute&lt;br /&gt;    nil&lt;br /&gt;    dbg&lt;br /&gt;    &lt;span class="string"&gt;"-attach jdbconn"&lt;/span&gt;)))&lt;br /&gt;&lt;br /&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;run-cmd&lt;/span&gt; (cmd)&lt;br /&gt; (interactive &lt;span class="string"&gt;"sCommand: "&lt;/span&gt;)&lt;br /&gt; (start-process cmd &lt;span class="string"&gt;"*scratch*"&lt;/span&gt; &lt;span class="string"&gt;"cmd"&lt;/span&gt; (concat &lt;span class="string"&gt;"/c "&lt;/span&gt; cmd))&lt;br /&gt; (switch-to-buffer &lt;span class="string"&gt;"*scratch*"&lt;/span&gt;))&lt;br /&gt;&lt;br /&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;replace-all&lt;/span&gt; (string to-string)&lt;br /&gt; (interactive (&lt;span class="keyword"&gt;progn&lt;/span&gt; (setq string (read-from-minibuffer &lt;span class="string"&gt;"Replace string: "&lt;/span&gt;))&lt;br /&gt;                     (setq to-string (read-from-minibuffer&lt;br /&gt;                                      (format &lt;span class="string"&gt;"Replace %s with: "&lt;/span&gt; string)))&lt;br /&gt;                     (list string to-string)))&lt;br /&gt; &lt;span class="string"&gt;"Replaces string with to-string in all buffers"&lt;/span&gt;&lt;br /&gt; (&lt;span class="keyword"&gt;let&lt;/span&gt; ((buffs (buffer-list))&lt;br /&gt;       (current-buffer (current-buffer)))&lt;br /&gt;   (&lt;span class="keyword"&gt;while&lt;/span&gt; (car buffs)&lt;br /&gt;     (switch-to-buffer (buffer-name (car buffs)))&lt;br /&gt;     (&lt;span class="keyword"&gt;let&lt;/span&gt; ((pos (point)))&lt;br /&gt;       (goto-char 0) &lt;br /&gt;       (query-replace string to-string)&lt;br /&gt;       (goto-char pos))&lt;br /&gt;     (setq buffs (cdr buffs)))&lt;br /&gt;   (switch-to-buffer current-buffer)))&lt;br /&gt;&lt;br /&gt;&lt;span class="comment-delimiter"&gt;;;&lt;/span&gt;&lt;span class="comment"&gt;overlay bookmarks&lt;br /&gt;&lt;/span&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;filter&lt;/span&gt; (fn lst)&lt;br /&gt; (&lt;span class="keyword"&gt;let&lt;/span&gt; ((acc nil))&lt;br /&gt;   (&lt;span class="keyword"&gt;dolist&lt;/span&gt; (x lst)&lt;br /&gt;     (&lt;span class="keyword"&gt;let&lt;/span&gt; ((val (funcall fn x)))&lt;br /&gt;       (&lt;span class="keyword"&gt;if&lt;/span&gt; val (push val acc))))&lt;br /&gt;   (nreverse acc)))&lt;br /&gt;&lt;br /&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;setOverlayBookmark&lt;/span&gt; ()&lt;br /&gt; (interactive)&lt;br /&gt; (&lt;span class="keyword"&gt;let*&lt;/span&gt;&lt;br /&gt;     ((pnt (line-beginning-position))&lt;br /&gt;      (ovrly (make-overlay pnt (line-end-position))))&lt;br /&gt;   (overlay-put ovrly 'face 'highlight)&lt;br /&gt;   (overlay-put ovrly 'pointHistory t)&lt;br /&gt;   ovrly))&lt;br /&gt;&lt;br /&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;overlayBookmarkFilterFunc&lt;/span&gt; (ovrly) (and (overlay-get ovrly 'pointHistory) ovrly))&lt;br /&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;overlayBookmarkFilterStartsFunc&lt;/span&gt; (ovrly) (and (overlay-get ovrly 'pointHistory) (overlay-start ovrly)))&lt;br /&gt;&lt;br /&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;nextOverlayBookmark&lt;/span&gt; ()&lt;br /&gt; (interactive)&lt;br /&gt; (&lt;span class="keyword"&gt;let*&lt;/span&gt;((pnt (line-end-position))&lt;br /&gt;      (ovrly_starts (or (filter 'overlayBookmarkFilterStartsFunc (overlays-in pnt (point-max)))&lt;br /&gt;                  (filter 'overlayBookmarkFilterStartsFunc (overlays-in (point-min) pnt)))))&lt;br /&gt;   (&lt;span class="keyword"&gt;if&lt;/span&gt; ovrly_starts&lt;br /&gt;       (goto-char (reduce (&lt;span class="keyword"&gt;lambda&lt;/span&gt; (a b) (&lt;span class="keyword"&gt;if&lt;/span&gt; (&amp;lt; a b) a b)) ovrly_starts))&lt;br /&gt;     (message &lt;span class="string"&gt;"no items in history"&lt;/span&gt;))))&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;clearOverlayBookmarks&lt;/span&gt; ()&lt;br /&gt; (interactive)&lt;br /&gt; (&lt;span class="keyword"&gt;let&lt;/span&gt;&lt;br /&gt;     ((ovrlys (filter 'overlayBookmarkFilterFunc (overlays-in (point-min) (point-max)))))&lt;br /&gt;   (mapcar 'delete-overlay ovrlys)&lt;br /&gt;   (message &lt;span class="string"&gt;"cleared point history"&lt;/span&gt;)))&lt;br /&gt;&lt;br /&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;toggleOverlayBookmark&lt;/span&gt; ()&lt;br /&gt; (interactive)&lt;br /&gt; (&lt;span class="keyword"&gt;let&lt;/span&gt;&lt;br /&gt;     ((ovrlys (filter 'overlayBookmarkFilterFunc (overlays-in (line-beginning-position) (line-end-position)))))&lt;br /&gt;   (&lt;span class="keyword"&gt;if&lt;/span&gt; ovrlys&lt;br /&gt;       (mapcar 'delete-overlay ovrlys)&lt;br /&gt;     (setOverlayBookmark))))&lt;br /&gt;&lt;br /&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;overlayBookmarkRefresh&lt;/span&gt; ()&lt;br /&gt; &lt;span class="doc"&gt;"stretches the overlays from the beginning to end of a line"&lt;/span&gt;&lt;br /&gt; (interactive)&lt;br /&gt; (&lt;span class="keyword"&gt;let&lt;/span&gt;&lt;br /&gt;     ((ovrlys (filter 'overlayBookmarkFilterFunc (overlays-in (point-min) (point-max))))&lt;br /&gt;      (lf (&lt;span class="keyword"&gt;lambda&lt;/span&gt; (tmp) (&lt;span class="keyword"&gt;save-excursion&lt;/span&gt;&lt;br /&gt;                                (goto-char (overlay-start tmp))&lt;br /&gt;                                (move-overlay tmp (overlay-start tmp) (line-end-position))))))&lt;br /&gt;   (&lt;span class="keyword"&gt;if&lt;/span&gt; ovrlys&lt;br /&gt;       (mapcar lf ovrlys)&lt;br /&gt;     (setPointHistory))))&lt;br /&gt;&lt;br /&gt;&lt;span class="comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="comment"&gt;eshell/bmk - version 0.1.2&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;pcomplete/eshell-mode/bmk&lt;/span&gt; ()&lt;br /&gt; &lt;span class="doc"&gt;"Completion for `&lt;/span&gt;&lt;span class="doc"&gt;&lt;span class="constant"&gt;bmk&lt;/span&gt;&lt;/span&gt;&lt;span class="doc"&gt;'"&lt;/span&gt;&lt;br /&gt; (pcomplete-here (bookmark-all-names)))&lt;br /&gt;&lt;br /&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;eshell/bmk&lt;/span&gt; (&lt;span class="type"&gt;&amp;amp;rest&lt;/span&gt; args)&lt;br /&gt; &lt;span class="doc"&gt;"Integration between EShell and bookmarks. For usage, execute without arguments."&lt;/span&gt;&lt;br /&gt; (setq args (eshell-flatten-list args))&lt;br /&gt; (&lt;span class="keyword"&gt;let&lt;/span&gt; ((bookmark (car args))&lt;br /&gt;       filename name)&lt;br /&gt;   (&lt;span class="keyword"&gt;cond&lt;/span&gt;&lt;br /&gt;    ((eq nil args)&lt;br /&gt;     (format &lt;span class="string"&gt;"Usage: bmk BOOKMARK to change directory pointed to by BOOKMARK&lt;br /&gt;   or bmk . BOOKMARK to bookmark current directory in BOOKMARK.&lt;br /&gt;Completion is available."&lt;/span&gt;))&lt;br /&gt;    ((string= &lt;span class="string"&gt;"."&lt;/span&gt; bookmark)&lt;br /&gt;     &lt;span class="comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="comment"&gt;Store current path in EShell as a bookmark&lt;br /&gt;&lt;/span&gt;      (&lt;span class="keyword"&gt;if&lt;/span&gt; (setq name (car (cdr args)))&lt;br /&gt;         (&lt;span class="keyword"&gt;progn&lt;/span&gt;&lt;br /&gt;           (bookmark-set name)&lt;br /&gt;           (bookmark-set-filename name (eshell/pwd))&lt;br /&gt;           (format &lt;span class="string"&gt;"Saved current directory in bookmark %s"&lt;/span&gt; name))&lt;br /&gt;       (&lt;span class="warning"&gt;error&lt;/span&gt; &lt;span class="string"&gt;"You must enter a bookmark name"&lt;/span&gt;)))&lt;br /&gt;    (t&lt;br /&gt;     &lt;span class="comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="comment"&gt;Assume the user wants to go to the path pointed out by a bookmark.&lt;br /&gt;&lt;/span&gt;      (&lt;span class="keyword"&gt;if&lt;/span&gt; (setq filename (cdr (car (bookmark-get-bookmark-record bookmark))))&lt;br /&gt;         (&lt;span class="keyword"&gt;if&lt;/span&gt; (file-directory-p filename)&lt;br /&gt;             (eshell/cd filename)&lt;br /&gt;            &lt;span class="comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="comment"&gt;TODO: Handle this better and offer to go to directory&lt;br /&gt;&lt;/span&gt;            &lt;span class="comment-delimiter"&gt;;; &lt;/span&gt;&lt;span class="comment"&gt;where the file is located.&lt;br /&gt;&lt;/span&gt;            (&lt;span class="warning"&gt;error&lt;/span&gt; &lt;span class="string"&gt;"Bookmark %s points to %s which is not a directory"&lt;/span&gt;&lt;br /&gt;                  bookmark filename)))))))&lt;br /&gt;&lt;br /&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;eshell/start&lt;/span&gt; (FILE)&lt;br /&gt; &lt;span class="doc"&gt;"Invoke (w32-shell-execute \"Open\" FILE) and substitute slashes for backslashes"&lt;/span&gt;&lt;br /&gt; (w32-shell-execute &lt;span class="string"&gt;"Open"&lt;/span&gt; (substitute ?\\ ?/ (expand-file-name FILE))))&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;setenv-from-list&lt;/span&gt; (env strlst)&lt;br /&gt; &lt;span class="doc"&gt;"Set an environment variable using the contents of a list."&lt;/span&gt;&lt;br /&gt; (setenv env (join &lt;span class="string"&gt;"; "&lt;/span&gt; strlst)))&lt;br /&gt;&lt;br /&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;join-strings&lt;/span&gt; (sep &lt;span class="type"&gt;&amp;amp;rest&lt;/span&gt; strngs)&lt;br /&gt; &lt;span class="doc"&gt;"join a bunch of strings with sep concatinated after each string."&lt;/span&gt;&lt;br /&gt; (&lt;span class="keyword"&gt;let&lt;/span&gt; ((rslt &lt;span class="string"&gt;""&lt;/span&gt;))&lt;br /&gt;   (&lt;span class="keyword"&gt;dolist&lt;/span&gt; (str strngs)&lt;br /&gt;     (setq rslt (concat rslt str sep)))&lt;br /&gt;   rslt))&lt;br /&gt;&lt;br /&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;join&lt;/span&gt; (sep strlst)&lt;br /&gt; &lt;span class="doc"&gt;"join a list of strings with sep between each."&lt;/span&gt;&lt;br /&gt; (&lt;span class="keyword"&gt;let&lt;/span&gt; ((rslt &lt;span class="string"&gt;""&lt;/span&gt;))&lt;br /&gt;   (&lt;span class="keyword"&gt;dolist&lt;/span&gt; (str strlst)&lt;br /&gt;     (setq rslt (concat rslt str sep)))&lt;br /&gt;   rslt))&lt;br /&gt;&lt;br /&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;join-ba&lt;/span&gt; (before after strlst)&lt;br /&gt; &lt;span class="doc"&gt;"join a list of strings with before and after pre/post pended to each string."&lt;/span&gt;&lt;br /&gt; (&lt;span class="keyword"&gt;let&lt;/span&gt; ((rslt &lt;span class="string"&gt;""&lt;/span&gt;))&lt;br /&gt;   (&lt;span class="keyword"&gt;dolist&lt;/span&gt; (str strlst)&lt;br /&gt;     (setq rslt (concat rslt (format &lt;span class="string"&gt;"%s%s%s"&lt;/span&gt; before str after))))&lt;br /&gt;   rslt))&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="comment-delimiter"&gt;;;&lt;/span&gt;&lt;span class="comment"&gt;setup load paths&lt;br /&gt;&lt;/span&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;setup-load-paths&lt;/span&gt; (edir subdirlst)&lt;br /&gt; &lt;span class="doc"&gt;"Setup load paths. edir is the elisp directory path and subdirlst is a list of subdirectories."&lt;/span&gt; &lt;br /&gt; (mapcar (&lt;span class="keyword"&gt;lambda&lt;/span&gt; (subdir) (add-to-list 'load-path (concat edir subdir)))&lt;br /&gt;         subdirlst)&lt;br /&gt; (add-to-list 'load-path edir))&lt;br /&gt;&lt;br /&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;copy-to-scratch&lt;/span&gt; ()&lt;br /&gt; &lt;span class="doc"&gt;"copies selected text to the scratch buffer."&lt;/span&gt;&lt;br /&gt; (interactive)&lt;br /&gt; (&lt;span class="keyword"&gt;let&lt;/span&gt; ((txt (buffer-substring (region-beginning) (region-end))))&lt;br /&gt;   (&lt;span class="keyword"&gt;save-current-buffer&lt;/span&gt;&lt;br /&gt;     (set-buffer &lt;span class="string"&gt;"*scratch*"&lt;/span&gt;)&lt;br /&gt;     (insert txt &lt;span class="string"&gt;"\n"&lt;/span&gt;))))&lt;br /&gt;&lt;br /&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;search-all-buffers&lt;/span&gt; (srch-str &lt;span class="type"&gt;&amp;amp;optional&lt;/span&gt; match-buffers)&lt;br /&gt; &lt;span class="doc"&gt;"Search across all open buffers."&lt;/span&gt;&lt;br /&gt; (interactive &lt;span class="string"&gt;"sSearch String: \nsMatch Buffers: "&lt;/span&gt;)&lt;br /&gt; (&lt;span class="keyword"&gt;let&lt;/span&gt; (buffer-re)&lt;br /&gt;   (&lt;span class="keyword"&gt;if&lt;/span&gt; (stringp match-buffers)&lt;br /&gt;       (setq buffer-re match-buffers)&lt;br /&gt;     (setq buffer-re &lt;span class="string"&gt;"."&lt;/span&gt;))&lt;br /&gt;   (multi-occur-in-matching-buffers buffer-re srch-str t)))&lt;br /&gt;&lt;br /&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;todo&lt;/span&gt; ()&lt;br /&gt; &lt;span class="doc"&gt;"Find all todo items in all buffers."&lt;/span&gt;&lt;br /&gt; (interactive)&lt;br /&gt; (multi-occur-in-matching-buffers &lt;span class="string"&gt;"."&lt;/span&gt; &lt;span class="string"&gt;"TODO: "&lt;/span&gt; t))&lt;br /&gt;&lt;br /&gt;(&lt;span class="keyword"&gt;defun&lt;/span&gt; &lt;span class="function-name"&gt;multi-find-file&lt;/span&gt; (root-dir name-regx)&lt;br /&gt; &lt;span class="doc"&gt;"Find multiple files starting in root-dir and descending directories."&lt;/span&gt;&lt;br /&gt; (interactive &lt;span class="string"&gt;"sDirectory to search from: \nsMatch files Regx: "&lt;/span&gt;)&lt;br /&gt; &lt;span class="comment-delimiter"&gt;;&lt;/span&gt;&lt;span class="comment"&gt;(message (concat "root-dir: " root-dir))&lt;br /&gt;&lt;/span&gt;  &lt;span class="comment-delimiter"&gt;;&lt;/span&gt;&lt;span class="comment"&gt;(message (concat "name-regx: " name-regx))&lt;br /&gt;&lt;/span&gt;  (&lt;span class="keyword"&gt;if&lt;/span&gt; (and (and (stringp root-dir) (&amp;gt; (length root-dir) 0))&lt;br /&gt;              (and (stringp name-regx) (&amp;gt; (length name-regx) 0)))&lt;br /&gt;   (&lt;span class="keyword"&gt;let&lt;/span&gt; ((files-to-open nil)&lt;br /&gt;         (subdirs nil)&lt;br /&gt;         (names-list nil))&lt;br /&gt;     (setq names-list (directory-files root-dir t))&lt;br /&gt;     (&lt;span class="keyword"&gt;unless&lt;/span&gt; names-list (message &lt;span class="string"&gt;"names-list is nil."&lt;/span&gt;))&lt;br /&gt;     (&lt;span class="keyword"&gt;dolist&lt;/span&gt; (name names-list)&lt;br /&gt;       &lt;span class="comment-delimiter"&gt;;&lt;/span&gt;&lt;span class="comment"&gt;(message (concat "file name: " name))&lt;br /&gt;&lt;/span&gt;        (&lt;span class="keyword"&gt;cond&lt;/span&gt;&lt;br /&gt;        ((file-directory-p name)  (&lt;span class="keyword"&gt;unless&lt;/span&gt; (string-match &lt;span class="string"&gt;"[.]+$"&lt;/span&gt; name) (setq subdirs (cons name subdirs))))&lt;br /&gt;        ((string-match name-regx (file-name-nondirectory name)) (setq files-to-open (cons name files-to-open)))&lt;br /&gt;        ))&lt;br /&gt;     (&lt;span class="keyword"&gt;dolist&lt;/span&gt; (item files-to-open)&lt;br /&gt;       &lt;span class="comment-delimiter"&gt;;&lt;/span&gt;&lt;span class="comment"&gt;(message (concat "opening file " item))&lt;br /&gt;&lt;/span&gt;        (find-file-other-window item))&lt;br /&gt;     (setq file-to-open nil)&lt;br /&gt;     (setq names-list nil)&lt;br /&gt;     (&lt;span class="keyword"&gt;dolist&lt;/span&gt; (item subdirs)&lt;br /&gt;       &lt;span class="comment-delimiter"&gt;;&lt;/span&gt;&lt;span class="comment"&gt;(message "dropping into subdirectory.")&lt;br /&gt;&lt;/span&gt;        (multi-find-file item name-regx)))&lt;br /&gt;   (message &lt;span class="string"&gt;"Need values for root-dir and name-regx."&lt;/span&gt;)))&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14786774-5614292198314814098?l=stormcoders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stormcoders.blogspot.com/feeds/5614292198314814098/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14786774&amp;postID=5614292198314814098&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/5614292198314814098'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/5614292198314814098'/><link rel='alternate' type='text/html' href='http://stormcoders.blogspot.com/2007/09/elisp-functions-for-emacs.html' title='elisp functions for emacs'/><author><name>Mike</name><uri>http://www.blogger.com/profile/00898991996792619958</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14786774.post-2063155125077139143</id><published>2007-05-08T15:10:00.000-07:00</published><updated>2007-07-24T14:18:13.404-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Humor'/><title type='text'>Fat Dutch Guy</title><content type='html'>&lt;object width="425" height="350"&gt;&lt;param name="movie" value="http://www.youtube.com/v/cPirDlJ1HO8"&gt;&lt;/param&gt;&lt;param name="wmode" value="transparent"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/cPirDlJ1HO8" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14786774-2063155125077139143?l=stormcoders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stormcoders.blogspot.com/feeds/2063155125077139143/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14786774&amp;postID=2063155125077139143&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/2063155125077139143'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/2063155125077139143'/><link rel='alternate' type='text/html' href='http://stormcoders.blogspot.com/2007/05/fat-dutch-guy.html' title='Fat Dutch Guy'/><author><name>Mike</name><uri>http://www.blogger.com/profile/00898991996792619958</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14786774.post-6974389013768789052</id><published>2007-05-01T14:34:00.000-07:00</published><updated>2007-05-01T14:35:35.277-07:00</updated><title type='text'>Lets see how long this lasts</title><content type='html'>&lt;code&gt;The HD-DVD key. Fighting censorship.&lt;br /&gt;&lt;br /&gt;09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14786774-6974389013768789052?l=stormcoders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://rudd-o.com/archives/2007/04/30/spread-this-number/' title='Lets see how long this lasts'/><link rel='replies' type='application/atom+xml' href='http://stormcoders.blogspot.com/feeds/6974389013768789052/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14786774&amp;postID=6974389013768789052&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/6974389013768789052'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/6974389013768789052'/><link rel='alternate' type='text/html' href='http://stormcoders.blogspot.com/2007/05/lets-see-how-long-this-lasts.html' title='Lets see how long this lasts'/><author><name>Mike</name><uri>http://www.blogger.com/profile/00898991996792619958</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14786774.post-116889983189670002</id><published>2007-01-15T14:22:00.000-08:00</published><updated>2007-01-15T14:23:51.960-08:00</updated><title type='text'>Real life project management using Scrum</title><content type='html'>&lt;table xmlns="http://purl.org/atom/ns#" border="0" cellpadding="0" cellspacing="0"&gt;&lt;tr&gt;&lt;td colspan="2"&gt;&lt;embed flashvars="" id="VideoPlayback" src="http://video.google.com/googleplayer.swf?docId=-2461467790752644622&amp;amp;hl=en" style="width:400px; height:326px;" type="application/x-shockwave-flash"&gt; &lt;/embed&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr/&gt;&lt;tr&gt;&lt;td&gt;Dody Gunawinata, founder of Silverkey Technologies, explaining real life project management using Scrum.&lt;br /&gt;                &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14786774-116889983189670002?l=stormcoders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stormcoders.blogspot.com/feeds/116889983189670002/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14786774&amp;postID=116889983189670002&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/116889983189670002'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/116889983189670002'/><link rel='alternate' type='text/html' href='http://stormcoders.blogspot.com/2007/01/real-life-project-management-using.html' title='Real life project management using Scrum'/><author><name>Mike</name><uri>http://www.blogger.com/profile/00898991996792619958</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14786774.post-116889436701752196</id><published>2007-01-15T12:51:00.000-08:00</published><updated>2007-01-15T12:52:47.026-08:00</updated><title type='text'>Scrum Tuning: Lessons learned from Scrum implementation at Google</title><content type='html'>&lt;table xmlns="http://purl.org/atom/ns#" border="0" cellpadding="0" cellspacing="0"&gt;&lt;tr&gt;&lt;td colspan="2"&gt;&lt;embed flashvars="" id="VideoPlayback" src="http://video.google.com/googleplayer.swf?docId=8795214308797356840&amp;amp;hl=en" style="width:400px; height:326px;" type="application/x-shockwave-flash"&gt; &lt;/embed&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr/&gt;&lt;tr&gt;&lt;td&gt;Google Tech Talks&lt;br /&gt;December 7, 2006&lt;br /&gt;&lt;br /&gt;ABSTRACT&lt;br /&gt;&lt;br /&gt;Adwords introduced a Scrum implementation at Google in small steps with remarkable success. As presented at the Agile 2006 conference this exemplifies a great way to start up Scrum teams. The inventor and Co-Creator of Scrum will use this approach in building the Google Scrum implementation to describe some of the subtle aspects of Scrum along with suggested next steps that can help in distributing and scaling Scrum in a "Googly way".&lt;br /&gt;                &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14786774-116889436701752196?l=stormcoders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stormcoders.blogspot.com/feeds/116889436701752196/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14786774&amp;postID=116889436701752196&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/116889436701752196'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/116889436701752196'/><link rel='alternate' type='text/html' href='http://stormcoders.blogspot.com/2007/01/scrum-tuning-lessons-learned-from.html' title='Scrum Tuning: Lessons learned from Scrum implementation at Google'/><author><name>Mike</name><uri>http://www.blogger.com/profile/00898991996792619958</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14786774.post-116889404029540574</id><published>2007-01-15T12:46:00.000-08:00</published><updated>2007-01-15T12:47:20.336-08:00</updated><title type='text'>Scrum et al.</title><content type='html'>&lt;table xmlns="http://purl.org/atom/ns#" border="0" cellpadding="0" cellspacing="0"&gt;&lt;tr&gt;&lt;td colspan="2"&gt;&lt;embed flashvars="" id="VideoPlayback" src="http://video.google.com/googleplayer.swf?docId=-7230144396191025011&amp;amp;hl=en" style="width:400px; height:326px;" type="application/x-shockwave-flash"&gt; &lt;/embed&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr/&gt;&lt;tr&gt;&lt;td&gt;Google Tech Talks&lt;br /&gt;September 5, 2006&lt;br /&gt;&lt;br /&gt;Ken Schwaber co-developed the Agile process, Scrum. He is a founder of the Agile Alliance and Scrum Alliance, and signatory to the Agile Manifesto. Ken has been a software developer for over thirty years. He is an active advocate and evangelist for Agile processes.&lt;br /&gt;&lt;br /&gt;ABSTRACT&lt;br /&gt;Scrum is an amazingly simple process that causes many, many changes when it is implemented. This seminar presents the basic framework of Scrum and some of the implementation issues associated with it.&lt;br /&gt;                &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14786774-116889404029540574?l=stormcoders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stormcoders.blogspot.com/feeds/116889404029540574/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14786774&amp;postID=116889404029540574&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/116889404029540574'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/116889404029540574'/><link rel='alternate' type='text/html' href='http://stormcoders.blogspot.com/2007/01/scrum-et-al.html' title='Scrum et al.'/><author><name>Mike</name><uri>http://www.blogger.com/profile/00898991996792619958</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14786774.post-114537359189044022</id><published>2006-04-18T08:01:00.000-07:00</published><updated>2006-04-18T08:19:51.913-07:00</updated><title type='text'>Getting Started with Common Lisp, part 2</title><content type='html'>The first thing that you need to do when getting started with Common Lisp is to choose a Lisp implementation. Lisp has a standard, similar to C++. Choosing a Lisp implementation is similar to choosing a C++ compiler. Like C++ compilers, conformance to the standard varies. For this post I will only discuss Free CL implementations but there are a number of commercial CL implementations. If your lucky enough to be using Linux for development, there are quite a few Free CL implementations. You have the choice of CMUCL, SBCL, CLISP, GCL, and ECL. There are probably more but those are the ones I know of. I chose SBCL because of its speed and because ASDF comes pre-installed. (ASDF is a library management system similar to CPAN.)  SBCL can produce standalone executables. If you're stuck running Windows for some reason then your choices are somewhat more limited. There is CLISP, GCL and ECL. Under windows I chose CLISP because of it's standards conformance and because there are a lot of libraries that are known to work with it. It is also very cross platform. It will pretty much run under whatever OS you want. There are also a number of interop libraries for it so you can make use of windows specific features easily. CLISP uses a VM and byte code system, similar to Java, so it is not as fast as some of the other LISPs but it is  faster than Java.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14786774-114537359189044022?l=stormcoders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stormcoders.blogspot.com/feeds/114537359189044022/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14786774&amp;postID=114537359189044022&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/114537359189044022'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/114537359189044022'/><link rel='alternate' type='text/html' href='http://stormcoders.blogspot.com/2006/04/getting-started-with-common-lisp-part_18.html' title='Getting Started with Common Lisp, part 2'/><author><name>Mike</name><uri>http://www.blogger.com/profile/00898991996792619958</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14786774.post-114438222632970773</id><published>2006-04-06T20:35:00.000-07:00</published><updated>2006-04-06T20:57:06.346-07:00</updated><title type='text'>Getting Started with Common Lisp, part 1</title><content type='html'>I've spent the last couple of months learning Lisp. I would say the hardest part about the process has been figuring out how to get a proper development process setup and learning how to install libraries.&lt;br /&gt;    Lisp is a significantly different environment than any of the other languages I have learned. It's not the syntax that is the real issue. Once you get used to prefix notation and how the libraries work, you really start to appreciate the language. If you get emacs setup correctly then Lisp syntax is actually easier than the more common languages. The bug hurdle in my adjustment to Lisp was getting used to working with the repl, learning about application images, learning how to work with SLIME and learning the primary library and application management system, which is called ASDF. Once you learn how to install ASDF, getting and installing libraries becomes simple, somewhat like CPAN or Python's easyInstall. The next few posts will be about how I overcame each of these hurdles and learning to appreciate Lisp and the Lisp way.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14786774-114438222632970773?l=stormcoders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stormcoders.blogspot.com/feeds/114438222632970773/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14786774&amp;postID=114438222632970773&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/114438222632970773'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/114438222632970773'/><link rel='alternate' type='text/html' href='http://stormcoders.blogspot.com/2006/04/getting-started-with-common-lisp-part.html' title='Getting Started with Common Lisp, part 1'/><author><name>Mike</name><uri>http://www.blogger.com/profile/00898991996792619958</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14786774.post-114186155292116089</id><published>2006-03-08T15:42:00.000-08:00</published><updated>2006-03-08T15:45:52.936-08:00</updated><title type='text'>Lisp in Python</title><content type='html'>I was browsing through some Lisp sites and came across this cool &lt;a href="http://ibiblio.org/obp/py4fun/lisp/lisp.html"&gt;article&lt;/a&gt;. Describes and implements a Lisp interpreter in Python. There are some other cool articles on this &lt;a href="http://www.ibiblio.org/obp/py4fun/"&gt;site&lt;/a&gt; as well.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14786774-114186155292116089?l=stormcoders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://ibiblio.org/obp/py4fun/lisp/lisp.html' title='Lisp in Python'/><link rel='replies' type='application/atom+xml' href='http://stormcoders.blogspot.com/feeds/114186155292116089/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14786774&amp;postID=114186155292116089&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/114186155292116089'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/114186155292116089'/><link rel='alternate' type='text/html' href='http://stormcoders.blogspot.com/2006/03/lisp-in-python.html' title='Lisp in Python'/><author><name>Mike</name><uri>http://www.blogger.com/profile/00898991996792619958</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14786774.post-113985725835672207</id><published>2006-02-13T10:54:00.001-08:00</published><updated>2006-02-13T11:06:33.780-08:00</updated><title type='text'>A nice series of introductory Python articles</title><content type='html'>This series (&lt;a href="http://www.linuxjournal.com/article/8729"&gt;Part1&lt;/a&gt;, &lt;a href="http://www.linuxjournal.com/article/8794"&gt;Part2&lt;/a&gt;, &lt;a href="http://www.linuxjournal.com/article/8858"&gt;Part3&lt;/a&gt;, &lt;a href="http://www.linuxjournal.com/article/8859"&gt;Part4 &lt;/a&gt; ) articles looks like a nice intro to Python.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14786774-113985725835672207?l=stormcoders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stormcoders.blogspot.com/feeds/113985725835672207/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14786774&amp;postID=113985725835672207&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/113985725835672207'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/113985725835672207'/><link rel='alternate' type='text/html' href='http://stormcoders.blogspot.com/2006/02/nice-series-of-introductor_113985725835672207.html' title='A nice series of introductory Python articles'/><author><name>Mike</name><uri>http://www.blogger.com/profile/00898991996792619958</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14786774.post-113796976761408843</id><published>2006-01-22T14:42:00.000-08:00</published><updated>2006-01-22T14:42:47.663-08:00</updated><title type='text'>Mastering Ajax, Part 2: Make asynchronous requests with JavaScript and Ajax</title><content type='html'>&lt;div xmlns="http://purl.org/atom/ns#"&gt;      Part 2 goes into more depth on using XMLHttpRequest. It details some basic uses like error handling and call backs. Nice article.      &lt;p&gt;        Read more at        &lt;a href="http://www-128.ibm.com/developerworks/web/library/wa-ajaxintro2/?ca=dgr-lnxw07AJAX-Request"&gt;www-128.ibm.com/develop...&lt;/a&gt;      &lt;/p&gt;    &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14786774-113796976761408843?l=stormcoders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stormcoders.blogspot.com/feeds/113796976761408843/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14786774&amp;postID=113796976761408843&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/113796976761408843'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/113796976761408843'/><link rel='alternate' type='text/html' href='http://stormcoders.blogspot.com/2006/01/mastering-ajax-part-2-make.html' title='Mastering Ajax, Part 2: Make asynchronous requests with JavaScript and Ajax'/><author><name>Mike</name><uri>http://www.blogger.com/profile/00898991996792619958</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14786774.post-113796776229546120</id><published>2006-01-22T14:09:00.000-08:00</published><updated>2006-01-22T14:09:22.340-08:00</updated><title type='text'>Mastering Ajax, Part 1: Introduction to Ajax</title><content type='html'>&lt;div xmlns="http://purl.org/atom/ns#"&gt;      &lt;p&gt;Yet another excellent Developer Works article. A nice intro to Ajax. Covers the basics of using the XMLHttpRequest object, including cross browser issues.&lt;/p&gt;      &lt;p&gt;        Read more at        &lt;a href="http://www-128.ibm.com/developerworks/java/library/wa-ajaxintro1.html"&gt;www-128.ibm.com/develop...&lt;/a&gt;      &lt;/p&gt;    &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14786774-113796776229546120?l=stormcoders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stormcoders.blogspot.com/feeds/113796776229546120/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14786774&amp;postID=113796776229546120&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/113796776229546120'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/113796776229546120'/><link rel='alternate' type='text/html' href='http://stormcoders.blogspot.com/2006/01/mastering-ajax-part-1-introduction-to.html' title='Mastering Ajax, Part 1: Introduction to Ajax'/><author><name>Mike</name><uri>http://www.blogger.com/profile/00898991996792619958</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14786774.post-113701657850600446</id><published>2006-01-11T13:54:00.000-08:00</published><updated>2006-01-11T13:56:18.526-08:00</updated><title type='text'>Another nice Python Tutorial</title><content type='html'>Nice tutorial. The color scheme is not so hot though.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14786774-113701657850600446?l=stormcoders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://hetland.org/python/instant-python.php' title='Another nice Python Tutorial'/><link rel='replies' type='application/atom+xml' href='http://stormcoders.blogspot.com/feeds/113701657850600446/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14786774&amp;postID=113701657850600446&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/113701657850600446'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/113701657850600446'/><link rel='alternate' type='text/html' href='http://stormcoders.blogspot.com/2006/01/another-nice-python-tutorial.html' title='Another nice Python Tutorial'/><author><name>Mike</name><uri>http://www.blogger.com/profile/00898991996792619958</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14786774.post-113691061286698132</id><published>2006-01-10T08:23:00.000-08:00</published><updated>2006-01-10T08:30:12.886-08:00</updated><title type='text'>Discover Python</title><content type='html'>There is a nice set of introductory Python articles over on Developer works.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14786774-113691061286698132?l=stormcoders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://www-128.ibm.com/developerworks/views/opensource/libraryview.jsp?search_by=Discover+Python' title='Discover Python'/><link rel='replies' type='application/atom+xml' href='http://stormcoders.blogspot.com/feeds/113691061286698132/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14786774&amp;postID=113691061286698132&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/113691061286698132'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/113691061286698132'/><link rel='alternate' type='text/html' href='http://stormcoders.blogspot.com/2006/01/discover-python.html' title='Discover Python'/><author><name>Mike</name><uri>http://www.blogger.com/profile/00898991996792619958</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14786774.post-113159696888985234</id><published>2005-11-09T20:08:00.000-08:00</published><updated>2005-11-09T20:29:28.933-08:00</updated><title type='text'>Planner Mode for EMACS</title><content type='html'>I came across Planner mode a couple of weeks ago. It has been working very well for me. It integrates with a variety of other EMACS applications. It is also able to keep track of time spent on a given task, which is handy for a number of uses.&lt;br /&gt;    In the past I have used a variety of contact management/calendaring software including Outlook and Evolution but they are big and bulky and get in the way. They are also overly complicated and it is hard to associate notes with a given piece of information.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14786774-113159696888985234?l=stormcoders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://www.emacswiki.org/cgi-bin/wiki/PlannerMode' title='Planner Mode for EMACS'/><link rel='replies' type='application/atom+xml' href='http://stormcoders.blogspot.com/feeds/113159696888985234/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14786774&amp;postID=113159696888985234&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/113159696888985234'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/113159696888985234'/><link rel='alternate' type='text/html' href='http://stormcoders.blogspot.com/2005/11/planner-mode-for-emacs.html' title='Planner Mode for EMACS'/><author><name>Mike</name><uri>http://www.blogger.com/profile/00898991996792619958</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14786774.post-112736230918114890</id><published>2005-09-21T21:09:00.000-07:00</published><updated>2005-09-21T21:11:49.186-07:00</updated><title type='text'>Useful web site</title><content type='html'>This site has a lot of interesting articles on a number of different languages.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14786774-112736230918114890?l=stormcoders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://www.norvig.com/' title='Useful web site'/><link rel='replies' type='application/atom+xml' href='http://stormcoders.blogspot.com/feeds/112736230918114890/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14786774&amp;postID=112736230918114890&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/112736230918114890'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/112736230918114890'/><link rel='alternate' type='text/html' href='http://stormcoders.blogspot.com/2005/09/useful-web-site.html' title='Useful web site'/><author><name>Mike</name><uri>http://www.blogger.com/profile/00898991996792619958</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14786774.post-112440681959872283</id><published>2005-08-18T16:08:00.000-07:00</published><updated>2005-08-18T16:13:39.603-07:00</updated><title type='text'>Very Interesting Lisp Primer</title><content type='html'>It gives a very nice history and current state of Common Lisp as well as pointers to a lot of additional material. &lt;a href="http://p-cos.net/lisp/guide.html"&gt;Pascal Costanza's Highly Opinionated Guide to Lisp&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14786774-112440681959872283?l=stormcoders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://p-cos.net/lisp/guide.html' title='Very Interesting Lisp Primer'/><link rel='replies' type='application/atom+xml' href='http://stormcoders.blogspot.com/feeds/112440681959872283/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14786774&amp;postID=112440681959872283&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/112440681959872283'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/112440681959872283'/><link rel='alternate' type='text/html' href='http://stormcoders.blogspot.com/2005/08/very-interesting-lisp-primer.html' title='Very Interesting Lisp Primer'/><author><name>Mike</name><uri>http://www.blogger.com/profile/00898991996792619958</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14786774.post-112270064454773796</id><published>2005-08-08T22:12:00.000-07:00</published><updated>2005-08-08T18:58:46.586-07:00</updated><title type='text'>Find 'hidden' resources in extension DLL's</title><content type='html'>&lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;While creating your new, nifty grid control for your MFC extension DLL, you put your resources into your MFC extension control. Then when you compile and run your test application, or worse, your production application, it can’t find the controls resources. A worse problem is that it silently uses the wrong resources.&lt;/span&gt;&lt;/span&gt; &lt;p style="margin-top: 0.08in; margin-bottom: 0in; line-height: 0.21in; widows: 2; orphans: 2; color: rgb(0, 0, 0); font-weight: bold;" lang="en-US"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:100%;"&gt;Identifying the problem&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-right: 0.75in; text-indent: 0.13in; margin-bottom: 0in; line-height: 0.17in;"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;The problem is that MFC&lt;span style="font-size:78%;"&gt;&lt;span style="font-family:Times New Roman,serif;"&gt;&lt;!-- MFC stands for Microsoft Foundation classes which is the most commonly used class library I can think of. A class library is a bunch of pre-made programming code that you can use in your applications. --&gt;&lt;/span&gt;&lt;/span&gt; assumes that all of the applications' resources reside in the main executable. There are two ways to solve this problem. The first method is to let MFC hunt for the correct resource using AfxFindResourceHandle. The second method revolves around treating the extension DLL like a separate resource DLL.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-right: 0.75in; text-indent: 0.13in; margin-bottom: 0in; line-height: 0.17in;"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;However, there are significant disadvantages to both methods. The main disadvantage with the first method, which uses AfxFindResourceHandle, is that there can’t be any duplicate resource IDs in any of your applications DLL’s. Also, this method is slower.Both occur because AfxFindResourceHandle searches the entire link chain in the application and returns the first module with a matching resource.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-right: 0.75in; text-indent: 0.13in; margin-bottom: 0in; line-height: 0.17in;"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;The primary disadvantage with the second method is that you have to explicitly get a handle to the target module; and since loading each kind of resource uses different functions, you end up with code that is almost identical for each kind of resource. &lt;/span&gt;&lt;/span&gt; &lt;/p&gt;  &lt;p style="margin-top: 0.08in; margin-bottom: 0in; line-height: 0.21in; widows: 2; orphans: 2; color: rgb(0, 0, 0); font-weight: bold;" lang="en-US"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:100%;"&gt;Ask MFC politely for the resource&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-right: 0.75in; text-indent: 0.13in; margin-bottom: 0in; line-height: 0.17in;"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;To have MFC do all the heavy lifting, call AfxFindResourceHandle, like this:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-right: -1in; margin-bottom: 0in; widows: 2; orphans: 2;" lang="en-US"&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-size:85%;"&gt;HINSTANCE hInst;&lt;br /&gt;HANDLE hIcon;&lt;br /&gt;hInst = AfxFindResourceHandle(MAKEINTRESOURCE(IDI_YOURICONHERE),       &lt;br /&gt;                            RT_GROUP_ICON);&lt;br /&gt;hIcon = FindResource(hInst, MAKEINTRESOURCE(IDI_YOURICONHERE),&lt;br /&gt;                   RT_GROUP_ICON);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-right: 0.75in; text-indent: 0.13in; margin-bottom: 0in; line-height: 0.17in;"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;This will work fine--until someone adds an icon with a duplicate ID to the code base. There is one advantage to this method of loading a resource: You don’t have to know which module the resource resides in.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-top: 0.08in; margin-bottom: 0in; line-height: 0.21in; widows: 2; orphans: 2;" lang="en-US"&gt; &lt;span style="color: rgb(255, 0, 255);"&gt;&lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: rgb(0, 0, 0); font-weight: bold;"&gt;When something can go wrong, it will.&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-family:Times New Roman,serif;"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;!-- This is paraphrased from Murphy’s Laws everybody must know them so I am attaching a copy. --&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-right: 0.75in; text-indent: 0.13in; margin-bottom: 0in; line-height: 0.17in;"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Being a firm believer in Murphy’s Law; I like to be as explicit as possible. So I prefer the second method of loading resources in my extension DLL’s. Although it requires a little more investment upfront, it pays off when your code goes into maintenance mode. Basically, for each kind of resource you use in your extension DLL, you’ll write a function like this:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-right: -1in; margin-bottom: 0in; widows: 2; orphans: 2;" lang="en-US"&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-size:85%;"&gt;CString LoadResString(UINT ResID, CString strModuleName)&lt;br /&gt;{&lt;br /&gt;  TCHAR szBuffer[256];&lt;br /&gt;  //The module handle can be obtained in a variety of ways the&lt;br /&gt;  //following is the most&lt;br /&gt; //straight forward    &lt;br /&gt;  HMODULE mod = ::GetModuleHandle(strModuleName);&lt;br /&gt;  ASSERT(mod);&lt;br /&gt;  if (!mod){&lt;br /&gt;      AfxMessageBox(_T("GetModuleHandle failed in LoadResString."));&lt;br /&gt;                    RaiseException(1814, 0, 0, NULL);&lt;br /&gt;  }&lt;br /&gt;  //This is where the resource actually gets loaded and will be&lt;br /&gt;  //different in each function&lt;br /&gt;  int count = LoadString(mod, ResID, szBuffer, 255);&lt;br /&gt;  ASSERT(count);&lt;br /&gt;  if (!count){&lt;br /&gt;      AfxMessageBox(_T("LoadString failed in LoadResString."));&lt;br /&gt;      RaiseException(1814, 0, 0, NULL);&lt;br /&gt;  }&lt;br /&gt;  CString rslt(szBuffer);&lt;br /&gt;  return rslt;&lt;br /&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-bottom: 0in; font-family: times new roman;"&gt; MFC extension DLL’s are a nice feature but because of all the legacy code that Microsoft has to support we are stuck with some “interesting” features like this problem with MFC not looking in the extension DLL for resources first. It’s an easy problem to overcome but it can give you a headache the first time you encounter it. It doesn’t help that you have to know what the problem is before you can find the answer in the documentation. &lt;/p&gt;  &lt;p style="margin-right: 0.75in; text-indent: 0.13in; margin-bottom: 0in; line-height: 0.17in;"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;Note:&lt;/b&gt; Technically, there is a third method for specifying which module to load resources from. I chose not to examine it in this article because it's an even less explicit than the AfxFindResourceHandle method.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14786774-112270064454773796?l=stormcoders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stormcoders.blogspot.com/feeds/112270064454773796/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14786774&amp;postID=112270064454773796&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/112270064454773796'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/112270064454773796'/><link rel='alternate' type='text/html' href='http://stormcoders.blogspot.com/2005/08/find-hidden-resources-in-extension.html' title='Find &apos;hidden&apos; resources in extension DLL&apos;s'/><author><name>Mike</name><uri>http://www.blogger.com/profile/00898991996792619958</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14786774.post-112328091147283904</id><published>2005-08-05T15:21:00.000-07:00</published><updated>2005-08-05T15:28:31.476-07:00</updated><title type='text'>Marking an ActiveX object safe for scripting</title><content type='html'>I recently ran a cross a problem where I had to create a COM component for use in Internet Exploder. In order to mark component safe for scripting you need to add the following to your Python class.&lt;br /&gt;&lt;br /&gt;_reg_catids_ = ["{7DD95801-9882-11CF-9FA9-00AA006C42C4}"]&lt;br /&gt;&lt;br /&gt;Now the class won't cause Internet Exporer to prompt for permission to load the component. I wonder why there is such a spyware problem? :0&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14786774-112328091147283904?l=stormcoders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stormcoders.blogspot.com/feeds/112328091147283904/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14786774&amp;postID=112328091147283904&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/112328091147283904'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/112328091147283904'/><link rel='alternate' type='text/html' href='http://stormcoders.blogspot.com/2005/08/marking-activex-object-safe-for.html' title='Marking an ActiveX object safe for scripting'/><author><name>Mike</name><uri>http://www.blogger.com/profile/00898991996792619958</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14786774.post-112270093514004020</id><published>2005-08-04T22:18:00.000-07:00</published><updated>2005-08-04T22:27:20.393-07:00</updated><title type='text'>Event logging the .NET way</title><content type='html'>&lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Those of you who have used the event logging API are in for a pleasant surprise. In the past, event logging required (comparatively) arduous coding. After creating an executable with specially formatted resources to be used as a message source, you had to register the message source. Then you finally got to write to the event log.&lt;/span&gt;&lt;/span&gt; &lt;p style="margin-right: 0.75in; text-indent: 0.13in; margin-bottom: 0in; line-height: 0.17in;"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;The System.Diagnostics name space contains (among other things) the event logging API. The two classes we'll focus on for reading and writing to the event log in .NET are the EventLog and the EventLogEntry classes.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-top: 0.08in; margin-bottom: 0in; line-height: 0.21in; widows: 2; orphans: 2; font-weight: bold; color: rgb(0, 0, 0);" lang="en-US"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:100%;"&gt;Write to the event log&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-right: 0.75in; text-indent: 0.13in; margin-bottom: 0in; line-height: 0.17in;"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Writing to the event log in .NET follows the same basic procedure as using the Win32 API. First, open the event log.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-right: -1in; margin-bottom: 0in; widows: 2; orphans: 2;" lang="en-US"&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-size:85%;"&gt;//The period means this machine&lt;br /&gt;EventLog log = new EventLog(“Application”, “.”, “MySource”);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-right: 0.75in; text-indent: 0.13in; margin-bottom: 0in; line-height: 0.17in;"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Then write the event:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-right: -1in; margin-bottom: 0in; widows: 2; orphans: 2;" lang="en-US"&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-size:85%;"&gt;log.WriteEntry(“Test message”, EventLogEntryType.Information);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-top: 0.08in; margin-bottom: 0in; line-height: 0.21in; widows: 2; orphans: 2; color: rgb(0, 0, 0); font-weight: bold;" lang="en-US"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:100%;"&gt;Read from the event log&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-right: 0.75in; text-indent: 0.13in; margin-bottom: 0in; line-height: 0.17in;"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Reading the event log the Win32 way requires you to open the log with the OpenEventLog function and retrieve a handle to the Event Log. Then you have to retrieve the EVENTLOGRECORD structure with the ReadEventLog function.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-right: 0.75in; text-indent: 0.13in; margin-bottom: 0in; line-height: 0.17in;"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;The EVENTLOGRECORD structure has both static and dynamic fields. In order to access the dynamic fields of the structure such as the message and the source, you have to treat the structure like a byte array. To make things inconsistent, you access the static fields with the dot operator like normal. Although it’s not difficult, it can be error-prone, and if you miscount bytes, you'll get access violations or bad data.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-right: 0.75in; text-indent: 0.13in; margin-bottom: 0in; line-height: 0.17in;"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Reading the event log the .NET way is much improved. Instead of dealing with an EVENTLOGRECORD structure, you get to deal with a much safer and easier EventLogEntry class. When you create an EventLog instance pointing at a specific log, the Entries property (which is an instance of the EventLogEntryCollection class) automatically fills with EventLogEntries. You can use the following code to access the Entries collection:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-right: -1in; margin-bottom: 0in; widows: 2; orphans: 2;" lang="en-US"&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-size:85%;"&gt;foreach EventLogEntry entry in eventLog.Entries{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Console.WriteLine(entry.Source);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Console.WriteLine(entry.Message);&lt;br /&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-top: 0.08in; margin-bottom: 0in; line-height: 0.21in; widows: 2; orphans: 2; color: rgb(0, 0, 0); font-weight: bold;" lang="en-US"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:100%;"&gt;Create a custom event log&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-right: 0.75in; text-indent: 0.13in; margin-bottom: 0in; line-height: 0.17in;"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;You can also create a custom event log by calling the static method CreateEventSource of the EventLog class. For example:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-right: -1in; margin-bottom: 0in; widows: 2; orphans: 2;" lang="en-US"&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-size:85%;"&gt;//Check to make sure that the source that will &lt;br/&gt;//be associated with the new log doesn’t exist. &lt;br/&gt;//SourceExists is also a static method&lt;br /&gt;if (!EventLog.SourceExists(“MySource”){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//If MyNewLog does not exist it will be created.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;EventLog.CreateEventSource(“MySource”, “MyNewLog”);&lt;br /&gt;  }&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-right: 0.75in; text-indent: 0.13in; margin-bottom: 0in; line-height: 0.17in;"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;As the above code indicates, you can check to see if a source is registered. If the source name already exists, you could overwrite someone else’s source, creating havoc.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-right: 0.75in; text-indent: 0.13in; margin-bottom: 0in; line-height: 0.17in;"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Compare the previous code to what you would have to do to create a custom event log with the Win32 API:&lt;span style="font-size:78%;"&gt;&lt;span style="font-family:Times New Roman,serif;"&gt; &lt;!-- This is a comparison of what you would have to do if you were using the Win32 API instead of .NET --&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;ol&gt; &lt;li&gt;&lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Helvetica,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Create  a message file.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Helvetica,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Compile it using the message compiler.(Be sure to include the created resource into the resources of the message synch DLL or Executable.)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Helvetica,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Register  the message synch (which is about 100 lines of code) in the event  system by creating the requisite registry entries.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Helvetica,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Take  a look at the keys under  HKLM\System\CurrentControlSet\Services\EventLog in the registry.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Helvetica,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Open  and retrieve a handle to an event log.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Helvetica,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Now  you can write the custom event log.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/li&gt; &lt;/ol&gt;  &lt;p style="margin-top: 0.08in; margin-bottom: 0in; line-height: 0.21in; widows: 2; orphans: 2; color: rgb(0, 0, 0); font-weight: bold;" lang="en-US"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:100%;"&gt;Conclusion&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-right: 0.75in; text-indent: 0.13in; margin-bottom: 0in; line-height: 0.17in;"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;As you can see, event logging the .NET way is quite easy. The only drawback is that your application has to be running on a version of Windows based on Windows NT. But since Windows XP is the new consumer OS, this issue will soon be moot.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14786774-112270093514004020?l=stormcoders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stormcoders.blogspot.com/feeds/112270093514004020/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14786774&amp;postID=112270093514004020&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/112270093514004020'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/112270093514004020'/><link rel='alternate' type='text/html' href='http://stormcoders.blogspot.com/2005/08/event-logging-net-way.html' title='Event logging the .NET way'/><author><name>Mike</name><uri>http://www.blogger.com/profile/00898991996792619958</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14786774.post-112269964561078335</id><published>2005-08-01T21:57:00.000-07:00</published><updated>2006-08-22T23:16:19.323-07:00</updated><title type='text'>MASTER THE MYSTERIOUS EVENTLOGRECORD</title><content type='html'>&lt;p&gt;When dealing with the Windows event log, a developer usually only wants to write events to the log. The Event Viewer, on the other hand, is good at displaying event log messages and lets you view, sort, or filter these messages from a local or remote machine. However, sometimes it's necessary to read events from the log. For instance, if you're dealing with end users and you want the users to be able to click on an icon and have all relevant event log entries sent to you via e-mail.&lt;/p&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;OVERVIEW&lt;/span&gt;&lt;br /&gt;&lt;p&gt;If you look at the documentation for the event-logging API, it appears that reading entries from the log is as simple as this.&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;       DWORD nBytesRead, nBytesMin;&lt;br /&gt;       EVENTLOGRECORD record;&lt;br /&gt;       HANDLE hEntry = OpenEventLog( NULL, "Application");&lt;br /&gt;  &lt;br /&gt;       While(ReadEventLog(hEvent, EVENTLOG_SEQUENTIAL_READ |&lt;br /&gt;                          EVENTLOG_FORWARDS_READ,&lt;br /&gt;                          0, &amp;record, sizeof(EVENTLOGRECORD),&lt;br /&gt;                          &amp;amp;nBytesRead, &amp;nBytesMin)){&lt;br /&gt;              //Do something with record&lt;br /&gt;       }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;READING AN EVENT&lt;/span&gt;&lt;br /&gt;&lt;p&gt;There are a number of problems with the preceding code, which stem from the fact that EVENTLOGRECORD is a dynamic structure. If you look at the documentation for EVENTLOGRECORD, you'll see the following:&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;typedef struct _EVENTLOGRECORD {&lt;br /&gt;DWORD  Length;&lt;br /&gt;DWORD  Reserved;&lt;br /&gt;DWORD  RecordNumber;&lt;br /&gt;DWORD  TimeGenerated;&lt;br /&gt;DWORD  TimeWritten;&lt;br /&gt;DWORD  EventID;&lt;br /&gt;WORD   EventType;&lt;br /&gt;WORD   NumStrings;&lt;br /&gt;WORD   EventCategory;&lt;br /&gt;WORD   ReservedFlags;&lt;br /&gt;DWORD  ClosingRecordNumber;&lt;br /&gt;DWORD  StringOffset;&lt;br /&gt;DWORD  UserSidLength;&lt;br /&gt;DWORD  UserSidOffset;&lt;br /&gt;DWORD  DataLength;&lt;br /&gt;DWORD  DataOffset;&lt;br /&gt;//&lt;br /&gt;// Then follow:&lt;br /&gt;//&lt;br /&gt;// TCHAR SourceName[]&lt;br /&gt;// TCHAR Computername[]&lt;br /&gt;// SID   UserSid&lt;br /&gt;// TCHAR Strings[]&lt;br /&gt;// BYTE  Data[]&lt;br /&gt;// CHAR  Pad[]&lt;br /&gt;// DWORD Length;&lt;br /&gt;//&lt;br /&gt;} EVENTLOGRECORD, *PEVENTLOGRECORD;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;All of the fields in comments are just examples. Yet if you try to do something like this:&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;     _tcslen(record.SourceName);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;you'll get a compile error. All of the fields after DataOffset are one big buffer, and you have to treat it as such to work with it. For instance, to get the length of the SourceName field, you must do the following.&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;        //precord is declared as a pointer to a byte buffer.&lt;br /&gt;        DWORD length = _tcslen((TCHAR*)precord + 56);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;The magic number 56 happens to be the total number of bytes preceding the SourceName field. So if you want to get the value of the ComputerName field, you use the following code:&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;        DWORD offset = 56 + _tcslen((TCHAR*)precord + 56) + 1;&lt;br /&gt;        //The +1 is for the NULL byte&lt;br /&gt;        DWORD length = _tcslen((TCHAR*)precord + offset)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;The other major problem is that there isn't a way to tell how big the EVENTLOGRECORD is ahead of time without attempting to read it. This means you have to call ReadEventLog log twice: the first time with parameters that you know will fail and the second time with the correct parameters. If you look at the last parameter, nBytesMin, this variable will contain the number of bytes necessary to read the requested number of records. If you didn't catch that, you can read multiple records with each call to ReadEventLog. Here's some code that works:&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;  DWORD nBytesRead = 0;&lt;br /&gt;  DWORD nBytesMin = 0;&lt;br /&gt;  DWORD nBytesToRead = 0;&lt;br /&gt;  BYTE *precord = NULL;&lt;br /&gt;  BYTE fake[1];&lt;br /&gt;&lt;br /&gt;  HANDLE hEntry = OpenEventLog( NULL, "Application");&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  //This one fails but gives us the event record size&lt;br /&gt;  ReadEventLog(hEvent, EVENTLOG_SEQUENTIAL_READ |&lt;br /&gt;               EVENTLOG_FORWARDS_READ,&lt;br /&gt;               0, fake, 1,&amp;nBytesRead, &amp;amp;nBytesMin);&lt;br /&gt;&lt;br /&gt;  nBytesToRead = nBytesMin;&lt;br /&gt;  precord = new BYTE[nBytesToRead];&lt;br /&gt;  ReadEventLog(hEvent, EVENTLOG_SEQUENTIAL_READ |&lt;br /&gt;               EVENTLOG_FORWARDS_READ, 0,&lt;br /&gt;               precord, nBytesToRead, &amp;nBytesRead,&lt;br /&gt;               &amp;amp;nBytesMin);//read one record&lt;br /&gt;&lt;br /&gt;Now we extract some fields.&lt;br /&gt;&lt;br /&gt;   CString SourceName(precord + 56);&lt;br /&gt;   CString ComputerName(precord + 56 + SourceName.GetLength() + 1);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;SUMMARY&lt;/span&gt;&lt;br /&gt;&lt;p&gt;Even though the event log API isn't the most difficult to master, it isn't well documented or obvious. Yet once you master the EVENTLOGRECORD structure, it's smooth sailing.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14786774-112269964561078335?l=stormcoders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stormcoders.blogspot.com/feeds/112269964561078335/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14786774&amp;postID=112269964561078335&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/112269964561078335'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/112269964561078335'/><link rel='alternate' type='text/html' href='http://stormcoders.blogspot.com/2005/08/master-mysterious-eventlogrecord.html' title='MASTER THE MYSTERIOUS EVENTLOGRECORD'/><author><name>Mike</name><uri>http://www.blogger.com/profile/00898991996792619958</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14786774.post-112269828599515603</id><published>2005-07-29T21:29:00.000-07:00</published><updated>2005-07-29T21:51:03.686-07:00</updated><title type='text'>Hide data in thestream</title><content type='html'>&lt;span style="color: rgb(0, 0, 0);font-family:Arial,sans-serif;" &gt;&lt;span style="font-size:85%;"&gt;Streams are a facility built into NTFS that attaches metadata to files; this facility is similar to the extended attributes in an OS/2 file system. Unfortunately, using the term streams could be confusing because it's so overloaded (especially when it comes to files).&lt;/span&gt;&lt;/span&gt; &lt;p style="margin-top: 0.08in; margin-bottom: 0in; line-height: 0.21in; widows: 2; orphans: 2; color: rgb(0, 0, 0); font-weight: bold;" lang="en-US"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:100%;"&gt;A new definition for streams&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-right: 0.75in; text-indent: 0.13in; margin-bottom: 0in; line-height: 0.17in; color: rgb(0, 0, 0);"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;A file on an NTFS volume is composed of a primary stream and zero or more secondary streams . The primary stream is the data that you normally access, while the secondary stream(s) reside in parallel with the primary stream. Unlike the primary stream (which is unnamed), a secondary stream has a unique name. The secondary stream can hold any amount of any kind of data. However, streams are only available on the NTFS file system. So if a file with secondary streams is moved to another file system, you'll lose the secondary streams.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-top: 0.08in; margin-bottom: 0in; line-height: 0.21in; widows: 2; orphans: 2; color: rgb(0, 0, 0); font-weight: bold;" lang="en-US"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:100%;"&gt;Secondary streams are invisible&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="background: rgb(255, 255, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 0.75in; text-indent: 0.13in; margin-bottom: 0in; line-height: 0.17in; color: rgb(0, 0, 0);"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Secondary streams are invisible to both the Windows &lt;span style="background: rgb(255, 255, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"&gt;Explorer&lt;/span&gt; &lt;span style="font-size:78%;"&gt;&lt;span style="font-family:Times New Roman,serif;"&gt;&lt;!-- Windows Explorer is the name of the Windows file manager. --&gt;&lt;/span&gt;&lt;/span&gt;and the console. In fact, the Explorer and the console will (incorrectly) report that the space is free. Streams are only partially implemented in Windows even though it’s been around since Windows NT 3.1. In order for the explorer to be stream aware, you need to install an Explorer add-on.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-top: 0.08in; margin-bottom: 0in; line-height: 0.21in; widows: 2; orphans: 2; color: rgb(0, 0, 0); font-weight: bold;" lang="en-US"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:100%;"&gt;Accessing secondary streams&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-right: 0.75in; text-indent: 0.13in; margin-bottom: 0in; line-height: 0.17in; color: rgb(0, 0, 0);"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;You can access secondary streams with the standard CreateFile, ReadFile, and WriteFile Win32 API&lt;span style="font-size:78%;"&gt;&lt;span style="font-family:Times New Roman,serif;"&gt;&lt;!-- API is a TLA (three letter acronym) which stands for Application programming interface. Programmers use these API’s to communicate with the operating system. --&gt;&lt;/span&gt;&lt;/span&gt;’s or another API such as MFC’s CFile or executable that uses these functions for low-level file access. To access a secondary stream, append a colon followed by the name of the secondary stream to the file name. Stream names are &lt;span style="background: rgb(255, 255, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"&gt;case insensitive&lt;/span&gt; &lt;span style="font-size:78%;"&gt;&lt;span style="font-family:Times New Roman,serif;"&gt;&lt;!-- Some things are case sensitive like the C++ programming language and some things are case insensitive like the Windows file system. When you specify a file name in windows it doesn’t matter whate case you use. --&gt;&lt;/span&gt;&lt;/span&gt;just like file names.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-right: 0.75in; text-indent: 0.13in; margin-bottom: 0in; line-height: 0.17in; color: rgb(0, 0, 0);"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Here's the command’s you use when writing to the stream using the console:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-right: -1in; margin-bottom: 0in; widows: 2; orphans: 2; color: rgb(0, 0, 0);" lang="en-US"&gt; &lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-size:85%;"&gt;echo foo &gt; bar.txt:title&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-right: 0.75in; text-indent: 0.13in; margin-bottom: 0in; line-height: 0.17in; color: rgb(0, 0, 0);"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;(Note about the above code: You can’t read the stream back from the console with the Type command.)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-right: 0.75in; text-indent: 0.13in; margin-bottom: 0in; line-height: 0.17in; color: rgb(0, 0, 0);"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Here's the code you use when writing to the secondary stream, title, in C:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-right: -1in; margin-bottom: 0in; widows: 2; orphans: 2; color: rgb(0, 0, 0);" lang="en-US"&gt; &lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-size:85%;"&gt;DWORD BytesWritten = 0;&lt;br /&gt;const DWORD BufferLength = 3;&lt;br /&gt;HANDLE hFile = CreateFile(“bar.txt:title”, GENERIC_WRITE,&lt;br /&gt;                        0, NULL, OPEN_ALWAYS, 0, 0);&lt;span style="font-size:78%;"&gt;&lt;span style="font-family:Times New Roman,serif;"&gt;&lt;!-- Indentation and formatting style are very important to programmers. Programmers stick to a style of code formatting religiously --&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;WriteFile(hFile, “foo”, BufferLength, &amp;BytesWritten, NULL);&lt;br /&gt;CloseHandle(hFile);&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-right: 0.75in; text-indent: 0.13in; margin-bottom: 0in; line-height: 0.17in; color: rgb(0, 0, 0);"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Here's the code you use when writing to the secondary stream in Python:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-right: -1in; margin-bottom: 0in; widows: 2; orphans: 2; color: rgb(0, 0, 0);" lang="en-US"&gt; &lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-size:85%;"&gt;File = PrivoxyWindowOpen(“bar.txt:title”, “w”);&lt;br /&gt;File.write(“foo”);&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-right: 0.75in; text-indent: 0.13in; margin-bottom: 0in; line-height: 0.17in; color: rgb(0, 0, 0);"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Below are some examples on reading the bar.txt:title stream. Specifically, here's code for reading the stream in C:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-right: -1in; margin-bottom: 0in; widows: 2; orphans: 2; color: rgb(0, 0, 0);" lang="en-US"&gt; &lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-size:85%;"&gt;HANDLE hFile = CreateFile(“bar.txt:title”, GENERIC_READ, 0, NULL,&lt;br /&gt;OPEN_EXISTING, 0,0);&lt;br /&gt;const DWORD BufferSize = 25;&lt;br /&gt;DWORD BytesRead = 0;&lt;br /&gt;BYTE buffer[BufferSize];&lt;br /&gt;ReadFile(hFile, buffer, BufferSize, &amp;BytesRead, NULL);&lt;br /&gt;       CloseHandle(hFile);&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-right: 0.75in; text-indent: 0.13in; margin-bottom: 0in; line-height: 0.17in; color: rgb(0, 0, 0);"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Here's the code you use when reading the stream in Python:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-right: -1in; margin-bottom: 0in; widows: 2; orphans: 2; color: rgb(0, 0, 0);" lang="en-US"&gt; &lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-size:85%;"&gt;file = PrivoxyWindowOpen(“bar.txt:title”, “r”)&lt;br /&gt;print file.read()&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-top: 0.08in; margin-bottom: 0in; line-height: 0.21in; widows: 2; orphans: 2; color: rgb(0, 0, 0); font-weight: bold;" lang="en-US"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:100%;"&gt;The potential for misuse&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-right: 0.75in; text-indent: 0.13in; margin-bottom: 0in; line-height: 0.17in; color: rgb(0, 0, 0);"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;If you start writing large amounts of data to secondary streams, you're going to create problems for users of the software. Even though they’ll run out of disk space, their systems will continue to report that there is free space. When you use streams in moderation, they can be invaluable tools for keeping key configuration data out of sight from the user.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-right: 0.75in; text-indent: 0.13in; margin-bottom: 0in; line-height: 0.17in; color: rgb(0, 0, 0);"&gt; &lt;span style="font-family:Arial,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;But people can misuse streams. For instance, there is a potential for malicious use in worms and viruses. I don't know of any virus scanners that check secondary streams for malicious code. Like I said previously, secondary streams can store any type of data--that includes executable code. Hopefully the anti-virus companies catch this problem before hackers start using streams in their malicious code.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14786774-112269828599515603?l=stormcoders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stormcoders.blogspot.com/feeds/112269828599515603/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14786774&amp;postID=112269828599515603&amp;isPopup=true' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/112269828599515603'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/112269828599515603'/><link rel='alternate' type='text/html' href='http://stormcoders.blogspot.com/2005/07/hide-data-in-thestream.html' title='Hide data in thestream'/><author><name>Mike</name><uri>http://www.blogger.com/profile/00898991996792619958</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14786774.post-112269661990089833</id><published>2005-07-29T21:05:00.000-07:00</published><updated>2005-07-29T21:11:33.736-07:00</updated><title type='text'>Update your application with BITS</title><content type='html'>&lt;p style="margin-bottom: 0in;"&gt; BITS is a new service shipped with Windows XP and later. It allows large files to be uploaded or downloaded in the background. BITS will then notify you when the transfer is complete. &lt;/p&gt;  &lt;h2 class="western"&gt;What’s it good for?&lt;/h2&gt;  &lt;p style="margin-bottom: 0in;"&gt; Windows XP’s version of Windows update makes heavy use of BITS to download updates in the background while the user is doing other things or while the system is unattended. I would say that following Microsoft’s lead in this is the way to go. You can easily use it to automatically download updates for your apps. &lt;/p&gt;  &lt;p style="margin-bottom: 0in;"&gt; In the past developers have written their own update code or just depended on the user to check the applications web site. Using BITS to update your application gives the user more control and is also more convenient. It also reassures the more paranoid user, like myself, who get nervous when they notice the application they are using keeps going out to the Internet for no apparent reason.&lt;/p&gt;  &lt;h2 class="western"&gt;Making use of BITS.&lt;/h2&gt;  &lt;p style="margin-bottom: 0in;"&gt; The first step in using BITS is to register a job for the queue.&lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;//make sure to include &lt;span style="font-size:85%;"&gt;&lt;span style="font-family:Courier New,monospace;"&gt;Bits.h&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-size:85%;"&gt;//error checking has been left out&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-size:85%;"&gt;HRESULT hr = 0;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-size:85%;"&gt;IBackgroundCopyManager* TransManager = NULL;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-size:85%;"&gt;IBackgroundCopyJob *pCopyJob = NULL;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-size:85%;"&gt;GUID ID;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-size:85%;"&gt;//Your threading model here&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-size:85%;"&gt;hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:Courier New,monospace;"&gt;//Set the impersonation level to RPC_C_IMP_LEVEL_IMPERSONATE&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-size:85%;"&gt;hr = CoInitializeSecurity(NULL, -1, NULL, NULL,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-bottom: 0in;"&gt;                            &lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-size:85%;"&gt;RPC_C_AUTHN_LEVEL_CONNECT,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-bottom: 0in;"&gt;                            &lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-size:85%;"&gt;RPC_C_IMP_LEVEL_IMPERSONATE,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-bottom: 0in;"&gt;                            &lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-size:85%;"&gt;NULL, EOAC_NONE, 0);&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-size:85%;"&gt;//Create an IBackgroundCopyManager instance.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:Courier New,monospace;"&gt;hr = CoCreateInstance&lt;span style="color: rgb(0, 0, 0);"&gt;(__uuidof&lt;/span&gt;(BackgroundCopyManager), NULL,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-bottom: 0in;"&gt;                      &lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-size:85%;"&gt;CLSCTX_LOCAL_SERVER,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-bottom: 0in;"&gt;                      &lt;span style="font-size:85%;"&gt;&lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;__uuidof&lt;/span&gt;(IBackgroundCopyManager),&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-bottom: 0in;"&gt;                      &lt;span style="font-size:85%;"&gt;&lt;span style="font-family:Courier New,monospace;"&gt;(&lt;span style="color: rgb(0, 0, 0);"&gt;void&lt;/span&gt;**) &amp;TransManager);&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-size:85%;"&gt;hr = TransManager-&gt;CreateJob(L”DemoJob”,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-bottom: 0in;"&gt;                             &lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-size:85%;"&gt;BG_JOB_TYPE_DOWNLOAD, &lt;/span&gt;&lt;/span&gt; &lt;/p&gt;  &lt;p style="margin-bottom: 0in;"&gt;                             &lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-size:85%;"&gt;&amp;ID, &amp;amp;amp;pCopyJob);&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-size:85%;"&gt;//Add files to the job&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-bottom: 0in;"&gt;&lt;span style="font-family:Courier New,monospace;"&gt;&lt;span style="font-size:85%;"&gt;hr = pCopyJob-&gt;AddFile(L"http://MyServer/Path/MyFile.Ext", L"c:\\Path\\MyFile.Ext");&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p style="margin-bottom: 0in;"&gt;One limitation with BITS that I think is pretty severe is that the content on the server cannot be dynamic. So for instance you can’t specify a URL like this, &lt;span style="color: rgb(0, 0, 255);"&gt;&lt;u&gt;&lt;a href="http://www.myserver.com/Update.asp?CurrentVersion=1.0"&gt;http://www.myserver.com/Update.asp?CurrentVersion=1.0&lt;/a&gt;&lt;/u&gt;&lt;/span&gt; and have the server give you the right version or have the server notify you that you’re up to date. One simple solution to this is to have your installer setup the new job and delete the old job. So whenever an update is installed the installer removes the old job and creates a new job pointing at the future file name. &lt;/p&gt;  &lt;h2 class="western"&gt;Checking the status of a job.&lt;/h2&gt;  &lt;p style="margin-bottom: 0in;"&gt; There are a number of ways to check the status of a job. You could poll for the jobs status and perform some action based on the status of the job or you can register to receive a notification of when the job has succeeded or failed. You can actually go one step further and register a program to be executed when the job succeeds.&lt;/p&gt;  &lt;p style="margin-bottom: 0in;"&gt; The last option probably makes the most sense for updating an application. In our example application we have the installer registering a job with BITS and also registers a program with a command line argument consisting of the job ID, to be run when the job succeeds. When our transfer job succeeds our little program runs and retrieves the job information, including the path of the installer and the program runs the installer. Walla, our application is updated. &lt;/p&gt; &lt;p style="margin-bottom: 0in;"&gt;//Continuing from previous code.&lt;/p&gt;  &lt;p style="margin-bottom: 0in;"&gt;WCHAR wJobID[48];&lt;/p&gt;  &lt;p style="margin-bottom: 0in;"&gt;WCHAR wParameters[257];&lt;/p&gt;  &lt;p style="margin-bottom: 0in;"&gt;IBackgroundCopyJob2* pCopyJob2 = NULL;&lt;/p&gt;  &lt;p style="margin-bottom: 0in;"&gt;WCHAR *wProgram = L”C:\program files\MyApp\UpdateUtil.exe”;&lt;/p&gt;  &lt;p style="margin-bottom: 0in;"&gt;StringFromGUID2(ID, wJobID, 48);&lt;/p&gt;   &lt;p style="margin-bottom: 0in;"&gt;wsprintf(wParameters, L"%s %s", wProgram, wJobID);&lt;/p&gt;   &lt;p style="margin-bottom: 0in;"&gt;pCopyJob-&gt;QueryInterface(__uuidof(IBackgroundCopyJob2), (void**)&amp;pCopyJob2);&lt;/p&gt;   &lt;p style="margin-bottom: 0in;"&gt;hr = pCopyJob2-&gt;SetNotifyCmdLine(pProgram, wParameters);&lt;/p&gt;   &lt;p style="margin-bottom: 0in;"&gt;//remember to release you COM objects&lt;/p&gt;  &lt;p style="margin-bottom: 0in;"&gt;pCopyJob2-&gt;Release();&lt;/p&gt;  &lt;p style="margin-bottom: 0in;"&gt;pCopyJob-&gt;Release();&lt;/p&gt;  &lt;p style="margin-bottom: 0in;"&gt;TransManager-&gt;Release();&lt;/p&gt;  &lt;h2 class="western"&gt;Wrap up.&lt;/h2&gt;  &lt;p style="margin-bottom: 0in;"&gt; One of the first useful axioms I learned when I got into this industry was, “never code what you can steal”. This isn’t exactly stealing but it’s in the same vein. The less code you write, the less code you have to test, and the less code you have to maintain. &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14786774-112269661990089833?l=stormcoders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stormcoders.blogspot.com/feeds/112269661990089833/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14786774&amp;postID=112269661990089833&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/112269661990089833'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/112269661990089833'/><link rel='alternate' type='text/html' href='http://stormcoders.blogspot.com/2005/07/update-your-application-with-bits.html' title='Update your application with BITS'/><author><name>Mike</name><uri>http://www.blogger.com/profile/00898991996792619958</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14786774.post-112252250883920817</id><published>2005-07-27T20:35:00.000-07:00</published><updated>2006-06-08T00:56:00.106-07:00</updated><title type='text'>Taking Advantage of COM with Python</title><content type='html'>&lt;p style="margin-bottom: 0in;" align="left"&gt;Microsoft's Common Object Model (COM) implements a cross-language object model.COM is the basis for most of Microsoft's recent technologies, such as WMI and Microsoft Office. COM allows you to write code in one language, like C++, and use it in another, such as Python or VB. Python is capable of both using COM objects and creating COM objects. It's been around, in one form or another, for a number of years. &lt;/p&gt;    &lt;p style="margin-bottom: 0in;" align="left"&gt;Python has excellent support for COM. In fact, Python's support for COM is so good that COM can be used as a legitimate way to extend Python. If you need to write a Python extension that will be running exclusively on Windows, strongly consider using COM. COM objects can be reused, providing flexibility and reusability, as well. &lt;/p&gt;    &lt;p style="margin-bottom: 0in;" align="left"&gt;To use COM in Python, you must install the Python Win32 extensions, which can be downloaded from &lt;a href="http://sourceforge.net/projects/pywin32/"&gt;http://sourceforge.net/projects/pywin32/&lt;/a&gt;. The pywin32 package&lt;a href="https://sourceforge.net/projects/pywin32/"&gt; &lt;/a&gt;comes in a nice installer package, so compiling isn't necessary.&lt;/p&gt;    &lt;h3 class="western"&gt;Using a COM component&lt;/h3&gt;  &lt;p&gt;The steps for using a COM object is the same for all languages that support COM. First you must instantiate the object. The instantiation can be directly incorporated in the language like Jscript's ActiveXObject function or it can be supported via a library, like Pythons Dispatch function. The only difference between the two approaches is that with library based support you have to import the library code first. Once the object is instantiated, you can use the properties, fields and methods just like they were part of normal Python objects.&lt;/p&gt;  &lt;p&gt;To start, run the makepy utility on the component that you intend to use. This isn't a mandatory step, but it has some nice advantages. Specifically, named constants defined in the typelib will be available to you when you import the constants class, and if you're using the PyWin IDE, you'll get intellisense for the properties and methods of the component. &lt;/p&gt;  &lt;p&gt;The easiest way to run makepy is through the PyWin IDE. Launch PyWin, and under the tools menu, choose makepy. This opens a simple little dialog that contains a list of all the registed COM components on the system.&lt;/p&gt;  &lt;p&gt;You can use a COM component without running the makepy utility, but you'll then have to use numeric values in place of the named constants that you normally use for parameters and such. &lt;/p&gt;  &lt;p&gt;Using a COM component in Python is nearly as simple as using the component in VB.First you need to import the COM support module:&lt;/p&gt;    &lt;p style="font-weight: bold;" class="code-western"&gt;import win32com.client as w32c&lt;/p&gt;    &lt;p&gt;If you ran the makepy utility on the component, then the constants class has all of the named constants defined in the typelib:&lt;/p&gt;    &lt;p style="font-weight: bold;" class="code-western"&gt;from win32com.client import constants&lt;/p&gt;    &lt;p&gt;Once the module is imported, you can instantiate the COM component simply:&lt;/p&gt;    &lt;p style="font-weight: bold;" class="code-western"&gt;Obj = w32c.Dispatch(r"Object.name")&lt;/p&gt;&lt;p&gt;To instantiate a COM component, you need to know the class name of the component. You can find it in the documentation for the component or by looking in the registry for the object, if you know the GUID. However, If you run the makepy utility on the component then both the name of the component and its GUID will be listed in the generated python file. &lt;/p&gt;  &lt;p&gt;Once you've instantiated a component, you have access to all the properties and methods of that component. For example the following code calls the load and transform methods of the MSXML control:&lt;/p&gt;    &lt;p style="font-weight: bold;" class="code-western"&gt;xmldoc = w32c.Dispatch(r"Msxml2.DOMDocument")&lt;/p&gt;  &lt;p style="font-weight: bold;" class="code-western"&gt;rval = xmldoc.load(xml)&lt;/p&gt;  &lt;p style="font-weight: bold;" class="code-western"&gt;xmldoc.transformNode(xsldoc)&lt;/p&gt;    &lt;p&gt;The file transform.py that accompanies this article shows a complete example that demonstrates how to use the MSXML COM component. To use that example, you need to have the MSXML components installed. (MSXML is installed along with Internet Explorer, so it is usually present on most systems.)&lt;/p&gt;  &lt;p&gt;Using COM, you can drive other applications such as Microsoft Office. For instance, Python can be combined with MS Word to create document management systems. Python COM integration is extremely powerful in this regard. On most Windows systems there are numerous COM objects installed. You can browse through them using the makepy utility. Anything that shows up in the makepy utility can be used in Python. &lt;/p&gt;  &lt;h3 class="western"&gt;  &lt;/h3&gt;  &lt;h3 class="western"&gt;Creating a COM component&lt;/h3&gt;  &lt;p style="margin-bottom: 0in;"&gt;Let's look now at what may be the coolest part of Python's COM integration.  &lt;/p&gt;    &lt;p style="margin-bottom: 0in;"&gt;Python comes with a large library of modules that do not have equivalents in other languages. By using Python to create COM objects, it is easy to expose some of these modules to other languages.&lt;/p&gt;    &lt;p style="margin-bottom: 0in;"&gt;Creating COM objects in other languages, such as C++, requires a lot of code and knowledge. It also requires that you be familiar with IDL, which is a seperate language. So, to create a COM object in C++, you actually must know two languages. &lt;/p&gt;    &lt;p style="margin-bottom: 0in;"&gt;Contrast that to creating a COM object in Python.&lt;/p&gt;    &lt;p style="font-weight: bold;" class="code-western"&gt;class MD5Obj:&lt;/p&gt;  &lt;p style="font-weight: bold;" class="code-western"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;_public_methods_ = ["Update", "Hash", "Hex"]&lt;/p&gt;  &lt;p style="font-weight: bold;" class="code-western"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;_reg_progid_ = "Python.MD5"&lt;/p&gt;  &lt;p style="font-weight: bold;" class="code-western"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;_reg_clsid_ = "{895E2BD0-0DA7-11D9-9669-0800200C9A66}"&lt;/p&gt;  &lt;p style="font-weight: bold;" class="code-western"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;MD5 = None&lt;/p&gt;  &lt;p style="font-weight: bold;" class="code-western"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;def __init__ (self):&lt;/p&gt;  &lt;p style="font-weight: bold;" class="code-western"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;self.MD5 = md5.new()&lt;/p&gt;  &lt;p style="font-weight: bold;" class="code-western"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&lt;/p&gt;  &lt;p style="font-weight: bold;" class="code-western"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;def Update (self, val):&lt;/p&gt;  &lt;p style="font-weight: bold;" class="code-western"&gt;        &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;self.MD5.update(val)&lt;/p&gt;  &lt;p style="font-weight: bold;" class="code-western"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&lt;/p&gt;  &lt;p style="font-weight: bold;" class="code-western"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;def Hash (self):&lt;/p&gt;  &lt;p style="font-weight: bold;" class="code-western"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return self.MD5.digest()&lt;/p&gt;  &lt;p style="font-weight: bold;" class="code-western"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;def Hex (self):&lt;/p&gt;  &lt;p style="font-weight: bold;" class="code-western"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return self.MD5.hexdigest()&lt;/p&gt;    &lt;p&gt;Notice, that there are no non-Python constructs, no IDL, and no funny preprocessor macros —just plain old Python. The code wraps the MD5 module and exposes the methods that it needs. Something else to notice is that this class does not inherit from another class some magical COM class. What makes this a COM class is the three fields, &lt;span style="font-style: italic;"&gt;_public_methods_&lt;/span&gt;, &lt;span style="font-style: italic;"&gt;_reg_progid_&lt;/span&gt;, and &lt;span style="font-style: italic;"&gt;_&lt;/span&gt;&lt;span style="text-decoration: none;"&gt;&lt;span style="font-style: italic;"&gt;reg_clsid_&lt;/span&gt;. &lt;span style="font-style: italic;"&gt;_public_methods_&lt;/span&gt; informs informs pyWin which methods you want publicly exposed. Usually you want only the methods that are part of you public interface listed in this field. &lt;span style="font-style: italic;"&gt;_reg_progid_&lt;/span&gt; is just a string that gives the object a semi-unique name, that can be used to instantiate the object. The &lt;span style="font-style: italic;"&gt;_reg_clsid_&lt;/span&gt; field is a GUID (Globally Unique ID) that is the actual unique name of the object. This is also called the class ID. The class ID can be used to instantiate an object but there are various reasons not to do this. It's better to use the program ID for this. There are a number of utilities to create GUID's available on the Internet as well as part of various development environments.&lt;/span&gt;  &lt;/p&gt;   &lt;p&gt;To have the COM object work in a development environment, you have to register it. The easiest way to do this is just create a little code that register's the object when the script file is run:&lt;/p&gt;   &lt;p style="font-weight: bold;" class="code-western"&gt;if __name__=='__main__':&lt;/p&gt;  &lt;p style="font-weight: bold;" class="code-western"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;import win32com.server.register&lt;/p&gt;  &lt;p style="font-weight: bold;" class="code-western"&gt;   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;win32com.server.register.UseCommandLine(MD5Obj)&lt;/p&gt;   &lt;p&gt;That's it. Just run the script and the object is registered. No seperate utility, like regsrv32, to worry about. You can't get much simpler than that. &lt;/p&gt;   &lt;p&gt;To use the object from another language, like JScript, is just like using any other COM object.&lt;/p&gt;   &lt;p style="font-weight: bold;" class="code-western"&gt;var md5 = new ActiveXObject("Python.md5");&lt;/p&gt;  &lt;p style="font-weight: bold;" class="code-western"&gt;md5.Update("Th\is is a test");&lt;/p&gt;  &lt;p style="font-weight: bold;" class="code-western"&gt;WScript.Echo(md5.Hash());&lt;/p&gt;  &lt;p style="font-weight: bold;" class="code-western"&gt;Wscript.Echo(md5.Hex());&lt;/p&gt;   &lt;p&gt;The full example is available in the MD5Obj.py script.&lt;/p&gt;   &lt;h3 class="western"&gt;Wrapping Up&lt;/h3&gt;  &lt;p&gt;Even though this was a simple example, everything shown here holds true for complex object hiarchies. You have full access to COM's facilities. You can use attributes, read only attributes, methods, and so on. You've got access to it all as well as the full power of Python. It's all easy as (wait for it...) pie. &lt;/p&gt;  &lt;p&gt;Consider using Python to prototype your objects before jumping into C++. This gives you the chance to evaluate your object interfaces without having to go through the build and register step each time you change something. &lt;/p&gt;  &lt;p&gt;Who knows, you may find that there is no reason to implement the objects in C++ after all.&lt;/p&gt;  &lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;  &lt;p&gt;SIDEBAR:  &lt;/p&gt;  &lt;h3 class="western"&gt;Using Pyscript&lt;/h3&gt;  &lt;p&gt;Windows Common Object Model (COM) isn't the only way to integrate Python with Windows. You can also use PyScript.  &lt;/p&gt;  &lt;p&gt;PyScript integrates Python with the Windows Scripting Host (WSH), Windows' official scripting engine. WSH is interesting because it's scripting language-agnostic, and because it provides an API for adding new scripting languages to the system. &lt;/p&gt;  &lt;p&gt;Using WSH, Python has full access many of the core Windows features, such as such as mapping drives, controlling network printers, and remote scripting. WSH also allows Python to be used in login scripts. And since WSH has poor support for creating graphical user interfaces (GUIs), Python is a nice complement. By using pyscript you get everything that the WSH provides as well as all the capabilities and just plain fun that Python provides. &lt;/p&gt;  &lt;p&gt;Python's Win32 library has WSH integration, but it's not enabled by default. To enable pyscript you need to run the pyscript.py file. It's default location is C:\Python23\Lib\site-packages\win32comext\axscript\client\pyscript.py. Running this script simply registers Python with WSH. To create a pyscript file, use the pys extension intead of the py or pyw extensions.&lt;/p&gt;  &lt;p&gt;(Because of the many exploits involving vbscript and WSH, the pyscript.py registration script does not enable explorer associations. Considering that many network admins are actively disabling explorer associations with .vbs and .js files, this is a smart default. If you would like to have explorer integration, I have included a reg file that will add the explorer integration for you. If you have an odd setup or use an older version of Python you will need to edit the reg file.)&lt;/p&gt;  &lt;p&gt;The  example script, example.pys, first creates an MD5  object  using Python's MD5 module.&lt;/p&gt;   &lt;p style="font-weight: bold;" class="code-western"&gt;import md5&lt;/p&gt;  &lt;p style="font-weight: bold;" class="code-western"&gt;m = md5.new()&lt;/p&gt;  &lt;p style="font-weight: bold;" class="code-western"&gt;m.update("%systemroot%\\system32\\wscript.exe")&lt;/p&gt;   &lt;p&gt;Next, it creates a link, on the desktop to the wscript.exe application. The MD5 hash is appended to the end of the link description.&lt;/p&gt;   &lt;p style="font-weight: bold;" class="code-western"&gt;WshShell = WScript.CreateObject("WScript.Shell")&lt;/p&gt;  &lt;p style="font-weight: bold;" class="code-western"&gt;Desktop = WshShell.SpecialFolders("Desktop")&lt;/p&gt;  &lt;p style="font-weight: bold;" class="code-western"&gt;link = WshShell.CreateShortcut(Desktop + "\\Wscript.lnk")&lt;/p&gt;  &lt;p style="font-weight: bold;" class="code-western"&gt;link.Description = "Link to the Windows Scripting Host" + " " + m.hexdigest()&lt;/p&gt;  &lt;p style="font-weight: bold;" class="code-western"&gt;link.IconLocation = "wscript.exe,1"&lt;/p&gt;  &lt;p style="font-weight: bold;" class="code-western"&gt;link.TargetPath = "%systemroot%\\system32\\wscript.exe"&lt;/p&gt;  &lt;p style="font-weight: bold;" class="code-western"&gt;link.Save()&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14786774-112252250883920817?l=stormcoders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stormcoders.blogspot.com/feeds/112252250883920817/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14786774&amp;postID=112252250883920817&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/112252250883920817'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/112252250883920817'/><link rel='alternate' type='text/html' href='http://stormcoders.blogspot.com/2005/07/taking-advantage-of-com-with-python.html' title='Taking Advantage of COM with Python'/><author><name>Mike</name><uri>http://www.blogger.com/profile/00898991996792619958</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14786774.post-112226559549983845</id><published>2005-07-24T21:23:00.000-07:00</published><updated>2005-07-24T21:26:35.500-07:00</updated><title type='text'></title><content type='html'>&lt;p&gt;Here are two great books on Common lisp.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="http://www.gigamonkeys.com/book/"&gt;Practical Common Lisp&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="http://www.paulgraham.com/onlisp.html"&gt;On Lisp&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;They're both available for download.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14786774-112226559549983845?l=stormcoders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stormcoders.blogspot.com/feeds/112226559549983845/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14786774&amp;postID=112226559549983845&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/112226559549983845'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/112226559549983845'/><link rel='alternate' type='text/html' href='http://stormcoders.blogspot.com/2005/07/here-are-two-great-books-on-common.html' title=''/><author><name>Mike</name><uri>http://www.blogger.com/profile/00898991996792619958</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14786774.post-112226480119700034</id><published>2005-07-24T21:09:00.000-07:00</published><updated>2005-07-24T21:14:54.176-07:00</updated><title type='text'>An interesting Python function for working with Subversion</title><content type='html'>This is a function I wrote for working with SVN repositories. It works like os.walk.&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt; &lt;pre&gt;import pysvn&lt;br /&gt;&lt;br /&gt;"""&lt;br /&gt;Utilities for working with Subversion repositories&lt;br /&gt;&lt;br /&gt;"""&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;def walk (targeturl):&lt;br /&gt;  """&lt;br /&gt;  Walk through an subversion repository.&lt;br /&gt;&lt;br /&gt;  """&lt;br /&gt;  dirStack = []&lt;br /&gt;  theEnd = 0&lt;br /&gt;  client = pysvn.Client()&lt;br /&gt;  client.callback_get_login = prompt&lt;br /&gt;  client.callback_notify = notify&lt;br /&gt;  client.callback_get_log_message = logmessage&lt;br /&gt;&lt;br /&gt;  ls = client.ls(targeturl, recurse = False)&lt;br /&gt;  files = []&lt;br /&gt;  dirs = []&lt;br /&gt;  for item in ls:&lt;br /&gt;      if item["kind"] == pysvn.node_kind.dir:&lt;br /&gt;          dirStack.append(item)&lt;br /&gt;          dirs.append(endOfPath(item["name"]))&lt;br /&gt;      if item["kind"] == pysvn.node_kind.file:&lt;br /&gt;          files.append(item["name"])&lt;br /&gt;  yield (targeturl, dirs, files)&lt;br /&gt;&lt;br /&gt;  while len(dirStack):&lt;br /&gt;      files = []&lt;br /&gt;      dirs = []&lt;br /&gt;      base = dirStack[theEnd]&lt;br /&gt;      del dirStack[theEnd]&lt;br /&gt;    &lt;br /&gt;      currentDir = base["name"]&lt;br /&gt;      ls = client.ls(currentDir, recurse = False)&lt;br /&gt;      for item in ls:&lt;br /&gt;          if item["kind"] == pysvn.node_kind.dir:&lt;br /&gt;              name = endOfPath(item["name"])&lt;br /&gt;              dirs.append(name)&lt;br /&gt;              dirStack.append(item)&lt;br /&gt;          if item["kind"] == pysvn.node_kind.file:&lt;br /&gt;              name = endOfPath(item["name"])&lt;br /&gt;              files.append(name)&lt;br /&gt;&lt;br /&gt;      yield (currentDir, dirs, files)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;  return &lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14786774-112226480119700034?l=stormcoders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stormcoders.blogspot.com/feeds/112226480119700034/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14786774&amp;postID=112226480119700034&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/112226480119700034'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/112226480119700034'/><link rel='alternate' type='text/html' href='http://stormcoders.blogspot.com/2005/07/interesting-python-function-for.html' title='An interesting Python function for working with Subversion'/><author><name>Mike</name><uri>http://www.blogger.com/profile/00898991996792619958</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-14786774.post-112226325618997406</id><published>2005-07-24T20:47:00.000-07:00</published><updated>2005-07-24T20:47:36.193-07:00</updated><title type='text'>Obligatory first post</title><content type='html'>&lt;p class="mobile-post"&gt;I am a software engineer located in western Washington. I tend to use a lot of different programming languages in my development projects. Since I enjoy learning new languages, this works out well. I also enjoy experimenting with new gadgets. For instance this post is being written from an Ogo, which is a little email and IM only device.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/14786774-112226325618997406?l=stormcoders.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stormcoders.blogspot.com/feeds/112226325618997406/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=14786774&amp;postID=112226325618997406&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/112226325618997406'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/14786774/posts/default/112226325618997406'/><link rel='alternate' type='text/html' href='http://stormcoders.blogspot.com/2005/07/obligatory-first-post.html' title='Obligatory first post'/><author><name>Mike</name><uri>http://www.blogger.com/profile/00898991996792619958</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
