<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom">
 
 <title>Brendan Johan Lee's blog</title>
 
 <link href="http://blog.vanntett.net/" />
 <updated>2011-11-08T08:17:36+00:00</updated>
 <id>http://blog.vanntett.net/</id>
 <author>
   <name>Brendan Johan Lee</name>
 </author>

 
 <feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/bjlb" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bjlb" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry>
   <title>This blog is now discontinued</title>
   <link href="http://blog.vanntett.net/2011/11/08/this-blog-is-now-discontinued.html" />
   <updated>2011-11-08T00:00:00+00:00</updated>
   <id>http://blog.vanntett.net/2011/11/08/this-blog-is-now-discontinued</id>
   <content type="html">&lt;div id="outline-container-1" class="outline-3"&gt;

&lt;div class="outline-text-3" id="text-1"&gt;

&lt;p&gt;When I discovered that I could &lt;a href="http://gsmblog.net/blogs/posting-drupal-sites-emacs"&gt;post directly to my drupal sites from emacs&lt;/a&gt; this blog became redundant. It is therefore abandoned and all future blog posts will be at &lt;a href="http://gsmblog.net"&gt;http://gsmblog.net&lt;/a&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>Single most important Android application</title>
   <link href="http://blog.vanntett.net/2010/09/22/single-most-important-android-application.html" />
   <updated>2010-09-22T00:00:00+00:00</updated>
   <id>http://blog.vanntett.net/2010/09/22/single-most-important-android-application</id>
   <content type="html">&lt;div id="outline-container-1" class="outline-3"&gt;

&lt;div class="outline-text-3" id="text-1"&gt;

&lt;p&gt;If you purchase a single Android application let it be &lt;a href="http://wiki.vanntett.net/cellphones:android:tasker"&gt;Tasker for Android&lt;/a&gt;. This is the single most important Android application of all times.
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>Automating Emacs</title>
   <link href="http://blog.vanntett.net/2010/09/22/automating-emacs.html" />
   <updated>2010-09-22T00:00:00+00:00</updated>
   <id>http://blog.vanntett.net/2010/09/22/automating-emacs</id>
   <content type="html">&lt;div id="outline-container-1" class="outline-3"&gt;

&lt;div class="outline-text-3" id="text-1"&gt;


&lt;p&gt;
I've spent a lot of time doing repetitive tasks in Emacs lately, which prompted med to make the following function. This function asks for a name and a keyboard binding, saves the latest defined macro in my .emacs (my .emacs is located in .emacs.d since I have .emacs.d in a git repository), adds a keybinding to it, saves my .emacs file, reloads it so the keybinding will work immediately and updates the git repository that my .emacs file resides in. 
&lt;/p&gt;



&lt;pre class="src src-lisp"&gt;(&lt;span style="color: #f0dfaf; font-weight: bold;"&gt;defun&lt;/span&gt; &lt;span style="color: #f0dfaf;"&gt;save-macro&lt;/span&gt; (name keybinding)                  
    &lt;span style="color: #8fb28f;"&gt;"save latest macro defined macro and a keybinding to it to .emacs"&lt;/span&gt;
     (interactive &lt;span style="color: #cc9393;"&gt;"SName of the macro: \nSKey binding for macro %s: "&lt;/span&gt;)
     (kmacro-name-last-macro name)
     (find-file &lt;span style="color: #cc9393;"&gt;"~/.emacs.d/.emacs"&lt;/span&gt;)
     (goto-char (point-max))
     (newline)              
     (insert-kbd-macro name)
     (newline)
     (insert (format &lt;span style="color: #cc9393;"&gt;"(global-set-key (kbd \"%s\") '%s)"&lt;/span&gt; keybinding name))
     (newline)
     (save-buffer)
     (switch-to-buffer nil)
     (load-file &lt;span style="color: #cc9393;"&gt;"~/.emacs.d/.emacs"&lt;/span&gt;)
     (shell-command &lt;span style="color: #cc9393;"&gt;"cd ~/.emacs.d;git pull origin master;git commit -am 'added macro to .emacs';git push;"&lt;/span&gt;)
     (kill-buffer &lt;span style="color: #cc9393;"&gt;"*Shell Command Output*"&lt;/span&gt;))
&lt;/pre&gt;



&lt;/div&gt;
&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>Domain fetish</title>
   <link href="http://blog.vanntett.net/2010/09/16/domain-fetish.html" />
   <updated>2010-09-16T00:00:00+00:00</updated>
   <id>http://blog.vanntett.net/2010/09/16/domain-fetish</id>
   <content type="html">&lt;div id="outline-container-1" class="outline-3"&gt;

&lt;div class="outline-text-3" id="text-1"&gt;


&lt;p&gt;
My domain fetish overwhelmed me last night, and i purchased and created the domain hacks &lt;a href="http://underdo.gs/"&gt;http://underdo.gs/&lt;/a&gt; and &lt;a href="http://hedgeho.gs/"&gt;http://hedgeho.gs/&lt;/a&gt;
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>Migrating SMS from Nokia 8GB to HTC Desire</title>
   <link href="http://blog.vanntett.net/2010/08/21/migrating-sms-from-nokia-8gb-to-htc-desire.html" />
   <updated>2010-08-21T00:00:00+00:00</updated>
   <id>http://blog.vanntett.net/2010/08/21/migrating-sms-from-nokia-8gb-to-htc-desire</id>
   <content type="html">&lt;div id="outline-container-1" class="outline-3"&gt;

&lt;div class="outline-text-3" id="text-1"&gt;


&lt;p&gt;
I finally received my new HTC Desire that I ordered sometime in June a couple of days ago. One of the first things I decided to do was import SMS from my old Nokia 8GB. No need to sync contacts since I decided to do that manually and get rid of a lot of old crap at the same time. Since the Desire syncs to my Google apps account contacts this is an easy task.
&lt;/p&gt;
&lt;p&gt;
However, migrating the SMS was not. I spend ages trying all sorts of different solutions. None of them worked, until I came across the Nokia2Android application. Oh, and by the way. I did this in Windows. There are GNU/Linux solutions out there (using gammu or gnokii) but they aren't very trustworthy (timestamp problems etc).
&lt;/p&gt;
&lt;p&gt;
So here is how to do it:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Download and install &lt;a href="http://www.comms.ovi.com/m/p/ovi/suite/index_en_uk.html"&gt;Nokia OVI suite&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
Synchronize your messages after connecting your phone
&lt;/li&gt;
&lt;li&gt;
Disconnect your phone and close OVI suite (make sure it's closed, not minimized to system tray)
&lt;/li&gt;
&lt;li&gt;
Download &lt;a href="http://www.simail.si/download/Nokia2AndroidSMS.7z"&gt;Nokia2Android&lt;/a&gt; and unzip it (use winzip or similar)
&lt;/li&gt;
&lt;li&gt;
Run the application
&lt;/li&gt;
&lt;li&gt;
Press the convert button. An XML-file should now be stored wherever you placed the Nokia2Android executable
&lt;/li&gt;
&lt;li&gt;
On your Android-phone install &lt;a href="http://android.riteshsahu.com/apps/sms-backup-restore/"&gt;SMS Backup &amp;amp; Restore&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
Connect your Android-phone to the computer (as storage device)
&lt;/li&gt;
&lt;li&gt;
Copy the XML-file into the directory SMSBackupRestore on the root of your phones memory card (if the directory doesn't exist, create it)
&lt;/li&gt;
&lt;li&gt;
Disconnect your phone
&lt;/li&gt;
&lt;li&gt;
Run the SMS Backup &amp;amp; Restore application on your phone and import the messages

&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And there you have. Simple as could be, compared to so many of the other non-functional solutions to be found when googling.
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>More .emacs-fu</title>
   <link href="http://blog.vanntett.net/2010/06/15/more-.emacs-fu.html" />
   <updated>2010-06-15T00:00:00+00:00</updated>
   <id>http://blog.vanntett.net/2010/06/15/more-.emacs-fu</id>
   <content type="html">&lt;div id="outline-container-1" class="outline-3"&gt;

&lt;div class="outline-text-3" id="text-1"&gt;


&lt;p&gt;
I promised somebody I know to start posting more .emacs-fu on in my blog. So here goes. First out is a function to duplicate whatever the line under the cursor is. If you are a programmer this is something that you probably do a lot. However C-a C-k C-y C-y or C-a M-spc C-e M-w gets old very fast. Instead, put the following function in your .emacs:
&lt;/p&gt;



&lt;pre class="src src-lisp"&gt;(&lt;span style="color: #f0dfaf; font-weight: bold;"&gt;defun&lt;/span&gt; &lt;span style="color: #f0dfaf;"&gt;duplicate&lt;/span&gt;()
 &lt;span style="color: #8fb28f;"&gt;"Duplicate it the line we are on"&lt;/span&gt;
 (interactive)
 (&lt;span style="color: #f0dfaf; font-weight: bold;"&gt;let&lt;/span&gt; (
       (beg (line-beginning-position))
       (end (line-end-position)))
   (copy-region-as-kill beg end)
   (beginning-of-line)
   (forward-line 1)
   (yank)
   (newline)
   (forward-line -1)))
&lt;/pre&gt;



&lt;p&gt;
and bind it to any key-kombo you like (I used C-c C-j), and duplicating lines is suddenly just a key press away.
&lt;/p&gt;
&lt;p&gt;
And while we are in the spirit. Another thing I often want to do is copy the whole line under the cursor so that I can paste it somewhere else in my document. Similarly add the following function to your .emacs:
&lt;/p&gt;



&lt;pre class="src src-lisp"&gt;(&lt;span style="color: #f0dfaf; font-weight: bold;"&gt;defun&lt;/span&gt; &lt;span style="color: #f0dfaf;"&gt;copy-line&lt;/span&gt; ()
  &lt;span style="color: #8fb28f;"&gt;"Copy current line in the kill ring"&lt;/span&gt;
  (interactive)
  (kill-ring-save (line-beginning-position)
                  (line-beginning-position 2))
  (message &lt;span style="color: #cc9393;"&gt;"Line copied"&lt;/span&gt;))
&lt;/pre&gt;



&lt;p&gt;
and bind it to any key-kombo you like (I used C-c C-y), and copying a line is suddenly just a key press away.
&lt;/p&gt;
&lt;p&gt;
Enjoy!
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>Update on the fu</title>
   <link href="http://blog.vanntett.net/2010/06/11/update-on-the-fu.html" />
   <updated>2010-06-11T00:00:00+00:00</updated>
   <id>http://blog.vanntett.net/2010/06/11/update-on-the-fu</id>
   <content type="html">&lt;div id="outline-container-1" class="outline-3"&gt;

&lt;div class="outline-text-3" id="text-1"&gt;


&lt;p&gt;
Just a quick update on the fu from yesterday. First of all I'm working on converting back to xterm again since I've had so much trouble with urxvt. This should probably make some of the stuff done in the fu not needed. I still haven't found a way to get screen to inform about it's presence over ssh yet (even though I've been told it should be possible).
The stuff needed for getting 256 colors in screen is different for xterm, but I will not post anything about that since there are lots of good resources to be found on the net already.
&lt;/p&gt;
&lt;p&gt;
Next a tip. If you don't want your bashrc to be generating new hostspecificscreenrcs all the time, you can instead create several different hostspecificscreenrcs and name them .&amp;lt;username&amp;gt;&amp;lt;host&amp;gt;screenrc and put the following into your .screenrc:
&lt;/p&gt;



&lt;pre class="src src-bash"&gt;source $HOME/configfiles/.$HOSTNAME
&lt;/pre&gt;



&lt;p&gt;
The reason I haven't done this is I want to be able to roll out my system on new hosts by simply adding a couple of lines to .bashrc and then cloning my configuration git repository on the new host. Thus I don't want to be bothered about making new .screenrc-files when adding a new host.
&lt;/p&gt;
&lt;p&gt;
Finally. The code I posted yesterday for GNU Emacs was flawed. I was so eager to post it on my blog that I didn't discover I wasn't quite finished writing the code. The correct code should be:
&lt;/p&gt;



&lt;pre class="src src-bash"&gt;(defun set-screen-title ()
  (send-string-to-terminal (concat &lt;span style="color: #cc9393;"&gt;"\ek"&lt;/span&gt;
        &lt;span style="color: #cc9393;"&gt;"emacs "&lt;/span&gt; (buffer-name) &lt;span style="color: #cc9393;"&gt;"\e\\"&lt;/span&gt;)))

(when (and (not window-system) (string= &lt;span style="color: #cc9393;"&gt;"1"&lt;/span&gt; (getenv &lt;span style="color: #cc9393;"&gt;"LC_SCREEN_RUNNING"&lt;/span&gt;)))
  (add-hook 'window-configuration-change-hook 'set-screen-title)
  (add-hook 'emacs-startup-hook 'set-screen-title))
&lt;/pre&gt;



&lt;/div&gt;
&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>emacs-screen-bash-fu</title>
   <link href="http://blog.vanntett.net/2010/06/09/emacs-screen-bash-fu.html" />
   <updated>2010-06-09T00:00:00+00:00</updated>
   <id>http://blog.vanntett.net/2010/06/09/emacs-screen-bash-fu</id>
   <content type="html">&lt;div id="outline-container-1" class="outline-3"&gt;

&lt;div class="outline-text-3" id="text-1"&gt;


&lt;p&gt;
Today I "wasted" lots of time on a great deal of emacs-screen-bash-fu. It mainly took a lot of time since a lot of the things I did people don't seem to be doing, or if they are they aren't posting it on the net.  Thus I'll post the more interesting parts here.
&lt;/p&gt;
&lt;p&gt;
Trying to organize this in a smart way I'll do things file by file. However I will not include the whole files, only the bits and parts containing my new fu.
&lt;/p&gt;
&lt;p&gt;
First lets have a look at .screenrc:
&lt;/p&gt;


&lt;pre class="src src-bash"&gt;terminfo rxvt-unicode 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
source $HOME/configfiles/.hostspecificscreenrc
setenv LC_SCREEN_RUNNING 1
shelltitle '] |bash'
&lt;/pre&gt;



&lt;ol&gt;
&lt;li&gt;
The first sentence enables 256-color support (since I'm using urxvt). However, this must be combined with the alias mentioned in .bashrc below.

&lt;/li&gt;
&lt;li&gt;
The second sentence includes a separate screen resource file. I've done this because I have my configuration shared between all of my machines using git, but I want a hardstatus string on each host.

&lt;/li&gt;
&lt;li&gt;
The third sentence allows me to detect that screen is running when ssh-ing into a different host from screen. By default (at least on Debian) any environment variables starting with &lt;i&gt;LC_&lt;/i&gt; will be forwarded to the remote host when using SSH.

&lt;/li&gt;
&lt;li&gt;
Last, but not least, the final sentence enables the shell to be able to set the title of the screen-window it is running in. More about that later.

&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now we will take a look at .bashrc:
&lt;/p&gt;


&lt;pre class="src src-bash"&gt;alias screen='/usr/bin/screen -T rxvt-unicode'
alias python='echo -ne &lt;span style="color: #cc9393;"&gt;"\ekpython\e\\"&lt;/span&gt;;/usr/bin/python'
alias top='echo -ne &lt;span style="color: #cc9393;"&gt;"\ektop\e\\"&lt;/span&gt;;/usr/bin/top'

HNAME=${HOSTNAME}

if [ &lt;span style="color: #cc9393;"&gt;"whisky"&lt;/span&gt; == &lt;span style="color: #cc9393;"&gt;"$HOSTNAME"&lt;/span&gt; ]; then
    echo 'hardstatus string &lt;span style="color: #cc9393;"&gt;"%{.Yk} %-w%{.KY} %n %t %{-}%+w %=%{.Yk} %H  %m/%d %C%a \
    "&lt;/span&gt;' &amp;gt; $HOME/configfiles/.hostspecificscreenrc
    PROMPT_COLOR=&lt;span style="color: #cc9393;"&gt;"\[\e[33;1m\]"&lt;/span&gt;
elif [ &lt;span style="color: #cc9393;"&gt;"fatboy"&lt;/span&gt; == &lt;span style="color: #cc9393;"&gt;"$HOSTNAME"&lt;/span&gt; ]; then
    echo 'hardstatus string &lt;span style="color: #cc9393;"&gt;"%{.gk} %-w%{.Kg} %n %t %{-}%+w %=%{.gk} %H  %m/%d %C%a \
    "&lt;/span&gt;' &amp;gt; $HOME/configfiles/.hostspecificscreenrc
    PROMPT_COLOR=&lt;span style="color: #cc9393;"&gt;"\[\e[33;32m\]"&lt;/span&gt;
elif [ &lt;span style="color: #cc9393;"&gt;"remote.tequila.org"&lt;/span&gt; == &lt;span style="color: #cc9393;"&gt;"$HOSTNAME"&lt;/span&gt; ]; then
    echo 'hardstatus string &lt;span style="color: #cc9393;"&gt;"%{.bW} %-w%{.wB} %n %t %{-}%+w %=%{.bW} %H  %m/%d %C%a \
    "&lt;/span&gt;' &amp;gt; $HOME/configfiles/.hostspecificscreenrc
    PROMPT_COLOR=&lt;span style="color: #cc9393;"&gt;"\[\e[1;34m\]"&lt;/span&gt;
    HNAME=&lt;span style="color: #cc9393;"&gt;"vanntett"&lt;/span&gt;
fi

NAME_COLOR=${PROMPT_COLOR}

if [ &lt;span style="color: #cc9393;"&gt;"root"&lt;/span&gt; == &lt;span style="color: #cc9393;"&gt;"$USER"&lt;/span&gt; ]; then
    NAME_COLOR=&lt;span style="color: #cc9393;"&gt;"\[\e[1;31m\]"&lt;/span&gt;
    ISROOT=&lt;span style="color: #cc9393;"&gt;"root@"&lt;/span&gt;
fi

if [ &lt;span style="color: #cc9393;"&gt;"x"&lt;/span&gt; != &lt;span style="color: #cc9393;"&gt;"x$LC_SCREEN_RUNNING"&lt;/span&gt; ]; then
    export PROMPT_COMMAND='echo -ne &lt;span style="color: #cc9393;"&gt;"\ek${ISROOT}${HNAME}[`basename ${PWD}`]\e\\"&lt;/span&gt;'
fi

export PS1=&lt;span style="color: #cc9393;"&gt;"${NAME_COLOR}${debian_chroot:+($debian_chroot)}\u\[\e[1;34m\] \
${PROMPT_COLOR}@${HNAME}:\w\$ \[\e[0m\]"&lt;/span&gt;
&lt;/pre&gt;



&lt;ol&gt;
&lt;li&gt;
The first alias statement enables the use of 256 colors when running urxvt in screen. This must be combined with the sentence in .screenrc above to work.

&lt;/li&gt;
&lt;li&gt;
The second and third  aliases set the title of the screen-window they are run in (if any) before executing the application. So when running python within screen the title of the screen-window it is run in will change to python as long as python is running. For top, it will change to top. These are only two examples. I've created several other aliases also. Keep in mind that this is only useful for applications that don't immediately terminate.

&lt;/li&gt;
&lt;li&gt;
Next we make a variable that contains the host name of the host we are on. I use this later on because for some hosts I want to display their actual host names, for others I want to display a different name.

&lt;/li&gt;
&lt;li&gt;
Next is a three-part if-statement that will run slightly different commands based on what host we are on. Each branch has two commands. The first command creates a hardstatus string and puts it in the host specific screen resource file we talked about earlier. This gives me a different color layout within screen depending upon what host I'm on. The second command sets a variable containing a bash escape sequence representing a color different for each host (we will later use this to have different colored command prompts based on what host we are on). The final branch has an extra statement. The reason is that I don't want to display the standard host name for that host, but rather show the name &lt;i&gt;vanntett&lt;/i&gt;.

&lt;/li&gt;
&lt;li&gt;
Next we copy the prompt color variable we created above into a new variable. The reason for this is that we want to use the same color on usernames, unless we are root.

&lt;/li&gt;
&lt;li&gt;
Now we check if we are root. If we are two things are done: First we set the second color variable to red, next we create a new variable containing &lt;i&gt;@root&lt;/i&gt;. We do this because when creating screen window names later on we want to add &lt;i&gt;@root&lt;/i&gt; to them, if we are root.

&lt;/li&gt;
&lt;li&gt;
Next we check the special &lt;i&gt;LC_&lt;/i&gt;-variable we send over ssh. Checking this variable will tell us if we are running under screen or not even if we have ssh-ed in to a remote host. If we are running screen we export the &lt;i&gt;PROMPT&lt;sub&gt;COMMAND&lt;/sub&gt;&lt;/i&gt;-variable. The content of this variable will be run every time a terminal changes (so every time we run a command in a terminal, every time a new terminal is opened and every time we exit an application in a terminal). The command will set the title of the screen window the terminal is running in based on host name, current directory and if we are root or not.

&lt;/li&gt;
&lt;li&gt;
The final command is the command that gives us a different colored command prompt on each host.

&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Finally we will take a look at .emacs:
&lt;/p&gt;


&lt;pre class="src src-bash"&gt;(defun set-screen-title ()
  (send-string-to-terminal (concat &lt;span style="color: #cc9393;"&gt;"\ek"&lt;/span&gt;
        &lt;span style="color: #cc9393;"&gt;"emacs "&lt;/span&gt; (buffer-name) &lt;span style="color: #cc9393;"&gt;"\e\\"&lt;/span&gt;)))

(let ((term (getenv &lt;span style="color: #cc9393;"&gt;"TERM"&lt;/span&gt;)))
  (when (not window-system)
    (add-hook 'window-configuration-change-hook 'set-screen-title)
    (add-hook 'emacs-startup-hook 'set-screen-title)))
&lt;/pre&gt;



&lt;p&gt;
This tells emacs to update the screen window name with the name of the buffer we are currently viewing any time emacs is started (in screen running in terminal-mode) and any time we switch buffers.
&lt;/p&gt;
&lt;p&gt;
&lt;i&gt;You might have noticed that I have in no way, shape or form tried to make this a step by step tutorial or explain anything in details. Basically I figure that if you are interested in this stuff you should be able to figure out what is going on. If not, try looking over it again, or send me an angry email complaining about my superior intellect and sarcastic attitude.&lt;/i&gt;
&lt;/p&gt;
&lt;p&gt;
Finally I will sum up the fu of these files:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
The files are created to work automatically on all of the host I distribute them to.

&lt;/li&gt;
&lt;li&gt;
The color of my command prompt is different depending upon what host I am on. In addition, when logged on as root, the username in the command prompt will be red.

&lt;/li&gt;
&lt;li&gt;
The color of the status bar within screen will also have the same coloration depending on what host I am on

&lt;/li&gt;
&lt;li&gt;
The title of each screen window will be automatically updated in the following ways:

&lt;ol&gt;
&lt;li&gt;
As standard each window will have the title &lt;i&gt;hostname[current working directory]&lt;/i&gt;, or if the terminal in the screen window is logged on as root &lt;i&gt;root@hostname[current working directory]&lt;/i&gt;

&lt;/li&gt;
&lt;li&gt;
The host name will be correct even if one uses ssh from within screen to log on to a remote server

&lt;/li&gt;
&lt;li&gt;
Many programs will update the screen window title as long as they run, such as python. As soon as the programs terminate the title will fall back to the above default.

&lt;/li&gt;
&lt;li&gt;
If emacs is running in terminal-mode within a screen window the title of the screen window will always be the current emacs buffer

&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
All of the above name functions will work both locally and when one ssh-es in on a remote server from within screen. 

&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I hope this inspires you to so similar fu yourself. If you have any ideas about other things that should be done with screen and/or screen and emacs, please drop me a note, I'm itching to do more, but I need some inspiration.
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>TeX as input-method in GNU Emacs</title>
   <link href="http://blog.vanntett.net/2010/06/06/tex-as-input-method-in-gnu-emacs.html" />
   <updated>2010-06-06T00:00:00+00:00</updated>
   <id>http://blog.vanntett.net/2010/06/06/tex-as-input-method-in-gnu-emacs</id>
   <content type="html">&lt;div id="outline-container-1" class="outline-3"&gt;

&lt;div class="outline-text-3" id="text-1"&gt;


&lt;p&gt;
I have never payed attention to the input-method in Emacs before (since I don't write strange non-Latin languages). However I found out today that I should have. I came across an really great feature:
&lt;/p&gt;
&lt;p&gt;
By setting &lt;i&gt;M-x set-input-method TeX&lt;/i&gt; one can while typing type any TeX/LaTeX symbol and it automatically gets converted to UTF-8.
&lt;/p&gt;
&lt;p&gt;
Thus if you type for example &lt;code&gt;\infty&lt;/code&gt; Emacs automatically inserts ∞
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>Self-worth</title>
   <link href="http://blog.vanntett.net/2010/06/03/self-worth.html" />
   <updated>2010-06-03T00:00:00+00:00</updated>
   <id>http://blog.vanntett.net/2010/06/03/self-worth</id>
   <content type="html">&lt;div id="outline-container-1" class="outline-3"&gt;

&lt;div class="outline-text-3" id="text-1"&gt;

&lt;p&gt;Only you can achieve self-worth for yourself. Any group offering it to you, or demanding it of you, comes bearing chains of slavery.
&lt;/p&gt;
&lt;p&gt;
&lt;i&gt;Goodkind, 2003&lt;/i&gt;
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>org-mode blog finally up and running</title>
   <link href="http://blog.vanntett.net/2010/06/01/org-mode-blog-finally-up-and-running.html" />
   <updated>2010-06-01T00:00:00+00:00</updated>
   <id>http://blog.vanntett.net/2010/06/01/org-mode-blog-finally-up-and-running</id>
   <content type="html">&lt;div id="outline-container-1" class="outline-3"&gt;

&lt;div class="outline-text-3" id="text-1"&gt;


&lt;p&gt;
I quickly came to realize that &lt;a href="http://www.gsmblog.net"&gt;gsmblog.net&lt;/a&gt; would not be used as a day-to-day blog. The reason? It's just too much work to be publishing using traditional blog-software. Web-editors suck! Thus &lt;a href="http://www.gsmblog.net"&gt;gsmblog.net&lt;/a&gt; would never evolve beyond longer tutorials and howtos.
&lt;/p&gt;
&lt;p&gt;
I realized that if I wanted to have a day-to-day blog, I would have to create something simpler. Preferably something inside &lt;a href="http://www.gnu.org/software/emacs/"&gt;Emacs&lt;/a&gt; and/or &lt;a href="http://conkeror.org"&gt;Conkeror&lt;/a&gt;. After putting it off for a long time, I've finally got around to creating a proper blog solution. The result is this blog.
&lt;/p&gt;
&lt;p&gt;
It's very simple. Anywhere inside &lt;a href="http://www.gnu.org/software/emacs/"&gt;Emacs&lt;/a&gt; I hit &lt;i&gt;C-c 5 r c&lt;/i&gt; where &lt;i&gt;C-c 5 r&lt;/i&gt; runs org-remember and &lt;i&gt;c&lt;/i&gt; selects my blog template. I then write my blog entry, hit &lt;i&gt;C-c C-c&lt;/i&gt; saving the entry to my blog.org file, and finally hit &lt;i&gt;C-c 5 p&lt;/i&gt; to publish the blog to my server.
&lt;/p&gt;
&lt;p&gt;
Inside &lt;a href="http://conkeror.org"&gt;Conkeror&lt;/a&gt; the procedure is basically the same. The only difference is that &lt;i&gt;C-c 5 r&lt;/i&gt; pops up &lt;a href="http://www.gnu.org/software/emacs/"&gt;Emacs&lt;/a&gt; before calling org-remember, and that the URL of the website in focus in &lt;a href="http://conkeror.org"&gt;Conkeror&lt;/a&gt; is included automatically in the blog post, thus enabling me to blog about websites I come across in a very simple manner.
&lt;/p&gt;
&lt;p&gt;
So now bloging is just as simple and quick as saving a todo in org-mode. 
&lt;/p&gt;
&lt;p&gt;
Here is how the magic happens: I've created a special template in org-mode that is customized for blog posts that get sent to my blog.org file. In addition I've integrated org-remember into &lt;a href="http://conkeror.org"&gt;Conkeror&lt;/a&gt;. I've than done some magic in my .emacs-file that exports the content of my blog.org file to post-files to be used with &lt;a href="http://jekyllrb.com/"&gt;jekyll&lt;/a&gt;. Finally the directory containing the post-files (and the blog.org for that matter - but that really isn't part of the magic) is commited to my &lt;a href="http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way"&gt;gitosis&lt;/a&gt;-server.
&lt;/p&gt;
&lt;p&gt;
On the server I've created a post-receive-hook for the repository containing the post-files that automatically checks out the repository when checked in and then runs &lt;a href="http://jekyllrb.com/"&gt;jekyll&lt;/a&gt; to create the final html-files for the blog.
&lt;/p&gt;
&lt;p&gt;
So now I can blog from any machine anywhere, as long as I've checked out my emacs, blog, org-mode and configuration repositories.
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>Collection of git-tips</title>
   <link href="http://blog.vanntett.net/2010/06/01/collection-of-git-tips.html" />
   <updated>2010-06-01T00:00:00+00:00</updated>
   <id>http://blog.vanntett.net/2010/06/01/collection-of-git-tips</id>
   <content type="html">&lt;div id="outline-container-1" class="outline-3"&gt;

&lt;div class="outline-text-3" id="text-1"&gt;

&lt;p&gt;In the final stage of creating this blog I came across a good collection of tips on using git: &lt;a href="http://gitready.com/"&gt;http://gitready.com/&lt;/a&gt;
&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;
</content>
 </entry>
 
 
</feed>
