<?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" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">
<title>PerlStalker's SysAdmin Notes</title>
<link href="http://perlstalker.vuser.org/blog/sysadminnotes/" />

<author>

 <name>PerlStalker's SysAdmin Notes</name>

</author>

 


  <id>http://perlstalker.vuser.org/blog/sysadminnotes/</id>

<subtitle type="html">PerlStalker's SysAdmin Notes</subtitle>
<generator uri="http://ikiwiki.info/" version="3.20100122ubuntu1">ikiwiki</generator>
<updated>2012-05-01T14:27:30Z</updated>
<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/PerlstalkersSysadminNotes" /><feedburner:info uri="perlstalkerssysadminnotes" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry>
	<title>Testing for "Bitness" in Configuration Manager 2012 App Deployments</title>
	
	  <id>http://perlstalker.vuser.org/blog/sysadminnotes/posts/testing-bitness-configuration-manager-2012-app-deployments/</id>
	
	<link href="http://feedproxy.google.com/~r/PerlstalkersSysadminNotes/~3/cpZxWGrSd-0/" />
	
	 <author><name>PerlStalker</name></author>
	
	
	 
	
	
	 
	  <category term="configuration-manager-2012" />
	 
	  <category term="microsoft" />
	 
	  <category term="system-center" />
	 
	
	<updated>2012-05-01T14:27:30Z</updated>
	<published>2012-04-30T16:32:37Z</published>
	
	 <content type="html" xml:lang="en">
	  
&lt;p&gt;We started our deployment of System Center Configuration Manager 2012
last week and I ran into an interesting problem.
&lt;/p&gt;
&lt;p&gt;
One of the first apps I rolled out to test with was
&lt;a href="http://strawberryperl.com/"&gt;Strawberry Perl&lt;/a&gt;. I grabbed the 64-bit MSI and ran through the &lt;b&gt;Create Application&lt;/b&gt; wizard and added the MSI to the deployment types. One
quick deployment later and ConfigMgr was happily installing perl on my
servers. 
&lt;/p&gt;
&lt;p&gt;
&amp;hellip; Most of my servers.
&lt;/p&gt;
&lt;p&gt;
You see, I still have a couple of 32-bit servers hanging around and
the 64-bit MSI wouldn't install. D'oh. So, I figured it would be easy
to jump into the &lt;b&gt;Requirements&lt;/b&gt; of the distribution and limit the
package to 64-bit systems. It wasn't. While there are options for RAM
amounts, CPU speed and disk space there's nothing to test for CPU
architecture.
&lt;/p&gt;


&lt;a href="http://perlstalker.vuser.org/blog/sysadminnotes/./images/configmgr-deployment-requirements.png"&gt;&lt;img src="http://perlstalker.vuser.org/blog/sysadminnotes/./posts/testing-bitness-configuration-manager-2012-app-deployments/400x-configmgr-deployment-requirements.png" width="400" height="419" alt="Create
Requirements" /&gt;&lt;/a&gt;

&lt;p&gt;
To fix this, I created a new &lt;b&gt;Global Condition&lt;/b&gt; to test for the
"bitness" of a server.
&lt;/p&gt;
&lt;p&gt;
The information I'm looking for is in the &lt;code&gt;AddressWidth&lt;/code&gt; property of
the &lt;code&gt;Win32_Processor&lt;/code&gt; class. You can see the list of properties by
running &lt;code&gt;gwmi Win32_Processor&lt;/code&gt; in powershell. If you run
&lt;/p&gt;



&lt;pre class="example"&gt;gwmi -query "select * from Win32_Processor where AddressWidth = 32"
&lt;/pre&gt;


&lt;p&gt;
and get back a screen full of text, your system is 32 bit. If you
specify the wrong value for &lt;code&gt;AddressWidth&lt;/code&gt;, the command will exit with
no output.
&lt;/p&gt;
&lt;p&gt;
The condition properties should look something like this when you're done.
&lt;/p&gt;


&lt;a href="http://perlstalker.vuser.org/blog/sysadminnotes/./images/configmgr-bitness-properties.png"&gt;&lt;img src="http://perlstalker.vuser.org/blog/sysadminnotes/./posts/testing-bitness-configuration-manager-2012-app-deployments/400x-configmgr-bitness-properties.png" width="400" height="408" alt="bitness
Properties" /&gt;&lt;/a&gt;

&lt;p&gt;
Once that's done, it was a simple matter of adding the check to the
deployment.
&lt;/p&gt;


&lt;a href="http://perlstalker.vuser.org/blog/sysadminnotes/./images/configmgr-bitness-requirement.png"&gt;&lt;img src="http://perlstalker.vuser.org/blog/sysadminnotes/./posts/testing-bitness-configuration-manager-2012-app-deployments/400x-configmgr-bitness-requirement.png" width="400" height="420" alt="Create
Requirement" /&gt;&lt;/a&gt;

&lt;p&gt;
Set the &lt;b&gt;Value&lt;/b&gt; field to &lt;code&gt;64&lt;/code&gt; for 64-bit systems and &lt;code&gt;32&lt;/code&gt; for 32-bit
systems and you're done.
&lt;/p&gt;
&lt;p&gt;
Having said all that, I'm still not sure that I haven't missed a
setting somewhere. One would think that a test to see if an app
matches the target architecture would have been a no-brainer to
include. If there's a setting I missed, please let me know because
not having it just doesn't make any sense.
&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;Update &lt;span class="timestamp-wrapper"&gt; &lt;span class="timestamp"&gt;2012-05-01 Tue 08:25&lt;/span&gt;&lt;/span&gt;:&lt;/b&gt; One of my co-workers pointed out that
 there is, in fact, an "easier" way.
&lt;/p&gt;
&lt;p&gt;
When you add a requirement, there's an option for &lt;code&gt;Operating system&lt;/code&gt;. In the tree view at the bottom of the pane, you can select
just the 64-bit version of the OS that you're targeting.
&lt;/p&gt;


&lt;a href="http://perlstalker.vuser.org/blog/sysadminnotes/./images/configmgr-os-requirement.png"&gt;&lt;img src="http://perlstalker.vuser.org/blog/sysadminnotes/./posts/testing-bitness-configuration-manager-2012-app-deployments/400x-configmgr-os-requirement.png" width="400" height="419" alt="OS Requirements" /&gt;&lt;/a&gt;

&lt;p&gt;
I totally missed that before. It takes a bit more clicky-clicky to use
for every 64-bit or 32-bit only package you deploy but it may be more
obvious to the next admin.
&lt;/p&gt;


	 
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/9w_aWqY-KR-UqjGegwBvL86Da8o/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/9w_aWqY-KR-UqjGegwBvL86Da8o/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/9w_aWqY-KR-UqjGegwBvL86Da8o/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/9w_aWqY-KR-UqjGegwBvL86Da8o/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?a=cpZxWGrSd-0:dC8k9WDmQmQ:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?a=cpZxWGrSd-0:dC8k9WDmQmQ:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?a=cpZxWGrSd-0:dC8k9WDmQmQ:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?i=cpZxWGrSd-0:dC8k9WDmQmQ:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/PerlstalkersSysadminNotes/~4/cpZxWGrSd-0" height="1" width="1"/&gt;</content>
	
	
	
<feedburner:origLink>http://perlstalker.vuser.org/blog/sysadminnotes/posts/testing-bitness-configuration-manager-2012-app-deployments/</feedburner:origLink></entry>
<entry>
	<title>gPodder and EMMS</title>
	
	  <id>http://perlstalker.vuser.org/blog/sysadminnotes/posts/gpodder-emms/</id>
	
	<link href="http://feedproxy.google.com/~r/PerlstalkersSysadminNotes/~3/QV4XvuMPE9Q/" />
	
	 <author><name>PerlStalker</name></author>
	
	
	 
	
	
	 
	  <category term="emacs" />
	 
	  <category term="gpodder" />
	 
	
	<updated>2012-04-30T16:32:37Z</updated>
	<published>2012-03-28T19:58:52Z</published>
	
	 <content type="html" xml:lang="en">
	  
&lt;p&gt;I use &lt;a href="http://gpodder.org/"&gt;gPodder&lt;/a&gt; to pull podcasts for all my listening pleasure at
work. I had been using gnome-mplayer to listen to them but after a
recent re-install, gnome-mplayer started to hanging every when I pause
the playback. Gmplayer works fine so I know that mplayer, by itself,
is not the problem but that does have a systray icon to make it easy
to click and pause playback.
&lt;/p&gt;
&lt;p&gt;
Since I'm so frequently using emacs, I thought to myself "I wonder if
I can do this in emacs?" Of course, I can. Enter &lt;a href="http://www.gnu.org/software/emms/"&gt;emms&lt;/a&gt;.
&lt;/p&gt;

&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;h2 id="sec-1"&gt;emms Configuration&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-1"&gt;


&lt;p&gt;
Based on a little bit of research, I decided to use mplayer as the
backend. The setup is pretty easy. This is what I'm using based on
&lt;a href="http://dryice.name/blog/emacs/emms-using-mplayer/"&gt;this blog post&lt;/a&gt;.
&lt;/p&gt;



&lt;pre class="src src-emacs-lisp"&gt;&lt;span&gt;;; &lt;/span&gt;&lt;span&gt;emms&lt;/span&gt;

(&lt;span&gt;require&lt;/span&gt; '&lt;span&gt;emms-player-mplayer&lt;/span&gt;)
(&lt;span&gt;require&lt;/span&gt; '&lt;span&gt;emms-source-file&lt;/span&gt;)
(&lt;span&gt;require&lt;/span&gt; '&lt;span&gt;emms-source-playlist&lt;/span&gt;)

(setq emms-player-mplayer-command-name &lt;span&gt;"mplayer"&lt;/span&gt;
      emms-player-mplayer-parameters '(&lt;span&gt;"-slave"&lt;/span&gt;)
      emms-player-mpg321-command-name &lt;span&gt;"mpg123"&lt;/span&gt;
      emms-player-list
      '(emms-player-mplayer
        emms-player-mplayer-playlist
        emms-player-mpg321
        emms-player-ogg123))
&lt;/pre&gt;


&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-2" class="outline-2"&gt;
&lt;h2 id="sec-2"&gt;gPodder Configuration&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-2"&gt;


&lt;p&gt;
Now that I can listen to the music via emacs, I need to tell gPodder
how to feed the podcasts into emms. It's simple to add them to
playlist from outside of emacs with this:
&lt;/p&gt;



&lt;pre class="src src-sh"&gt;emacsclient --server-file=work --eval &lt;span&gt;'(emms-add-file "TD140.mp3")'&lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;
In &lt;code&gt;$HOME/.config/gpodder/gpodder.conf&lt;/code&gt;, you can set the &lt;code&gt;player&lt;/code&gt;
setting. gPodder replaces the &lt;code&gt;%U&lt;/code&gt; with the file name. &amp;hellip; In
theory. In practice, gPodder only replaces &lt;code&gt;%U&lt;/code&gt; if it's at the end of
the line. That means I needed to write a quick wrapper.
&lt;/p&gt;
&lt;p&gt;
CANNOT INCLUDE FILE upload/add2emms.pl
&lt;/p&gt;
&lt;p&gt;
I run emacs in daemon mode (with TCP). If you don't, you'll want to
change the &lt;code&gt;$emacs&lt;/code&gt; variable.
&lt;/p&gt;
&lt;p&gt;
And you're done. Happy listening.
&lt;/p&gt;


&lt;/div&gt;
&lt;/div&gt;

	 
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Q5rhF0lDDWwt9kTbJajgvtZrS2s/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Q5rhF0lDDWwt9kTbJajgvtZrS2s/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Q5rhF0lDDWwt9kTbJajgvtZrS2s/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Q5rhF0lDDWwt9kTbJajgvtZrS2s/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?a=QV4XvuMPE9Q:WIssyKx1POk:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?a=QV4XvuMPE9Q:WIssyKx1POk:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?a=QV4XvuMPE9Q:WIssyKx1POk:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?i=QV4XvuMPE9Q:WIssyKx1POk:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/PerlstalkersSysadminNotes/~4/QV4XvuMPE9Q" height="1" width="1"/&gt;</content>
	
	
	
<feedburner:origLink>http://perlstalker.vuser.org/blog/sysadminnotes/posts/gpodder-emms/</feedburner:origLink></entry>
<entry>
	<title>IkiWiki and Org-mode</title>
	
	  <id>http://perlstalker.vuser.org/blog/sysadminnotes/posts/ikiwiki-org-mode/</id>
	
	<link href="http://feedproxy.google.com/~r/PerlstalkersSysadminNotes/~3/sQL_ae1MDx0/" />
	
	 <author><name>PerlStalker</name></author>
	
	
	 
	
	
	 
	  <category term="emacs" />
	 
	  <category term="ikiwiki" />
	 
	  <category term="org-mode" />
	 
	
	<updated>2012-03-26T04:02:39Z</updated>
	<published>2012-03-26T03:58:55Z</published>
	
	 <content type="html" xml:lang="en">
	  
&lt;p&gt;I love emacs. I practically live in emacs at work. One of my favorite
features is &lt;a href="http://orgmode.org/"&gt;org-mode&lt;/a&gt;. At its simplest, org-mode is simply a markup
language similar to wiki-text or markdown. When you get into it more,
the real power of scheduling and task management comes out. In my
case, it's the only system that's I've been able to use to stay
organized. I've been so happy with org-mode that I start to looking
into using for this blog.
&lt;/p&gt;
&lt;p&gt;
I looked at several options from using org-mode's publish feature to
publish HTML that I could paste into Drupal or using the native
publish feature on its own. In the end &lt;a href="http://ikiwiki.info/"&gt;IkiWiki&lt;/a&gt; won out.
&lt;/p&gt;
&lt;p&gt;
IkiWiki has several useful features for me; mainly, the RSS/Atom feeds
and a tag cloud. Most important, the formatting language is pluggable
and there's a plugin to use org-mode instead of the native
markdown. Getting it setup was pretty straight forward but had a
couple of hang-ups because of my personal setup and there are a couple
of things to look out for when actually using it.
&lt;/p&gt;

&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;h2 id="sec-1"&gt;Installing&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-1"&gt;


&lt;p&gt;
The first step (after installing IkiWiki) was to get Chris Gray's
excellent &lt;a href="https://github.com/chrismgray/ikiwiki-org-plugin"&gt;new_org&lt;/a&gt; plugin. This is what does the translation of the org
files to HTML. Actually, it doesn't do the translation. Instead if
feeds the file to emacs to spit out the HTML. That's were my first
problem hit.
&lt;/p&gt;
&lt;p&gt;
As I said, I already use emacs and one of the things I did on my
server was start emacs in server mode. Once in server mode, I use
emacsclient as my editor which really fast. The problem is that
new_org also uses emacs server to keep from starting emacs for every
change which speed up the translations. Unfortunately, the two servers
conflicted. I think there was an issue with the two trying to use the
same unix socket or something. I eventually switched emacs to use tcp
sockets by putting &lt;code&gt;(setq server-use-tcp t)&lt;/code&gt; in &lt;code&gt;$HOME/.emacs&lt;/code&gt;.
&lt;/p&gt;
&lt;p&gt;
There are also a few changes in &lt;code&gt;new_org.pm&lt;/code&gt; needed to support tcp
sockets. First &lt;code&gt;emacsclient -s org-ikiwiki-compiler&lt;/code&gt; needs to be changed to
&lt;code&gt;emacsclient --server-file=org-ikiwiki-compiler&lt;/code&gt;. Second &lt;code&gt;emacs --daemon&lt;/code&gt; needs to be
changed to &lt;code&gt;emacs --daemon=org-ikiwiki-compiler&lt;/code&gt;. There are a couple
of places where those changes needed to be made. Once those were in
place, I was &lt;i&gt;almost&lt;/i&gt; able to publish files.
&lt;/p&gt;
&lt;p&gt;
I ran into a problem with emacs hanging when I tried to publish with
&lt;code&gt;ikiwiki --refresh&lt;/code&gt;. It turns out that I was still using the ancient
version of org-mode that came with emacs on Ubuntu Lucid. My problems
went away after upgrading org-mode to the latest version.
&lt;/p&gt;
&lt;p&gt;
Those items done, I was able to publish new posts all day long.
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-2" class="outline-2"&gt;
&lt;h2 id="sec-2"&gt;Publishing&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-2"&gt;



&lt;/div&gt;

&lt;div id="outline-container-2-1" class="outline-3"&gt;
&lt;h3 id="sec-2-1"&gt;Blog System Files&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-2-1"&gt;


&lt;p&gt;
The first thing to keep in mind is that the index, sidebar and tag
files all need to remain in markdown with &lt;code&gt;.mdwn&lt;/code&gt; extensions. When I
tried to change them to org-mode, IkiWiki would not process them
correctly. That's a little annoying but no big deal, really, since I
hardly ever need to touch them. I mostly org-mode for the blog posts.
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-2-2" class="outline-3"&gt;
&lt;h3 id="sec-2-2"&gt;IkiWiki Directives&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-2-2"&gt;


&lt;p&gt;
This is where things got a little weird. IkiWiki directives use the
same syntax as org-mode does for links. For the most part, the two
play well together. For example, the &lt;code&gt;tag&lt;/code&gt; directive does, in fact, add
tags to the post. I did run into an issue with images, however. It's
possible to use the basic org-mode link syntax to add an image but it
doesn't properly deal with paths. IkiWiki's &lt;code&gt;img&lt;/code&gt; directive takes care
of that but emacs would see the HTML that the directive wrote and
happily escape the HTML.
&lt;/p&gt;
&lt;p&gt;
The solution is to wrap the &lt;code&gt;img&lt;/code&gt; directive in &lt;code&gt;#+BEGIN_HTML&lt;/code&gt; and
&lt;code&gt;#+END_HTML&lt;/code&gt; blocks and everything is happy.
&lt;/p&gt;
&lt;p&gt;
I haven't used any of the other directives yet so I can't tell you
how well they work. Though that may be why the index and tag pages
where giving me grief.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-3" class="outline-2"&gt;
&lt;h2 id="sec-3"&gt;Conclusion&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-3"&gt;


&lt;p&gt;
With those little snags out of the way, everything is full steam
ahead. I'll keep y'all informed of anything else I run into but it's
been smooth sailing so far.
&lt;/p&gt;

&lt;/div&gt;
&lt;/div&gt;

	 
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/R0s2Dhj4v-EvLofOlTKaUJUI7Us/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/R0s2Dhj4v-EvLofOlTKaUJUI7Us/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/R0s2Dhj4v-EvLofOlTKaUJUI7Us/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/R0s2Dhj4v-EvLofOlTKaUJUI7Us/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?a=sQL_ae1MDx0:7y-s46EnZrQ:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?a=sQL_ae1MDx0:7y-s46EnZrQ:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?a=sQL_ae1MDx0:7y-s46EnZrQ:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?i=sQL_ae1MDx0:7y-s46EnZrQ:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/PerlstalkersSysadminNotes/~4/sQL_ae1MDx0" height="1" width="1"/&gt;</content>
	
	
	
<feedburner:origLink>http://perlstalker.vuser.org/blog/sysadminnotes/posts/ikiwiki-org-mode/</feedburner:origLink></entry>
<entry>
	<title>Renovations</title>
	
	  <id>http://perlstalker.vuser.org/blog/sysadminnotes/posts/renovations/</id>
	
	<link href="http://feedproxy.google.com/~r/PerlstalkersSysadminNotes/~3/f93xCKxSIS8/" />
	
	 <author><name>PerlStalker</name></author>
	
	
	 
	
	
	 
	  <category term="meta" />
	 
	
	<updated>2012-03-25T22:52:26Z</updated>
	<published>2012-03-25T22:52:26Z</published>
	
	 <content type="html" xml:lang="en">
	  
&lt;p&gt;I've been a busy PerlStalker this week. As you may have noticed, this
site has changed somewhat. I've recently decided to drop Drupal and
switch to IkiWiki. Drupal has been good to me but it's really too
heavy for my little blog. I have no use for most of the features that
Drupal provides and it's not worth it to me to keep it up-to-date.
&lt;/p&gt;
&lt;p&gt;
IkiWiki has a couple of really nice things going for it. First, it
spits out static pages. Except for search and comments, there's no need for
any dynamic content on my site. Google and Disqus fill both needs. I
could use the IkiWiki CGI but there's really no need.
&lt;/p&gt;
&lt;p&gt;
Second, I can compose my posts in emacs org-mode. It beats the heck
out of writing all of my posts in straight HTML. I had to jump through
a few hoops to use org-mode but it's working great now. I'll post more
on that later.
&lt;/p&gt;
&lt;p&gt;
By default, IkiWiki uses a pretty nice syntax called markdown. I chose
not to use it because org-mode is, in many ways, simpler and more
powerful than markdown and I use it for all of my note taking and
documentation at work.
&lt;/p&gt;
&lt;p&gt;
Now, a little housekeeping. One of the drawbacks to moving to IkiWiki
was that I was unable to get it to use the original posting dates from
Drupal. All of the imported posts have a line at the top that has the
original posting date.
&lt;/p&gt;
&lt;p&gt;
Along those lines, you've probably already seen the slew of reposts in
your feed reader. That's a symptom of the conversion to IkiWiki. This
should be the only time it'll be a problem.
&lt;/p&gt;
&lt;p&gt;
Thanks for reading.
&lt;/p&gt;


	 
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/1YXvI-vkF2eJA6iiU1PecmfZrWQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/1YXvI-vkF2eJA6iiU1PecmfZrWQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/1YXvI-vkF2eJA6iiU1PecmfZrWQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/1YXvI-vkF2eJA6iiU1PecmfZrWQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?a=f93xCKxSIS8:p1bxrl89BxM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?a=f93xCKxSIS8:p1bxrl89BxM:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?a=f93xCKxSIS8:p1bxrl89BxM:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?i=f93xCKxSIS8:p1bxrl89BxM:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/PerlstalkersSysadminNotes/~4/f93xCKxSIS8" height="1" width="1"/&gt;</content>
	
	
	
<feedburner:origLink>http://perlstalker.vuser.org/blog/sysadminnotes/posts/renovations/</feedburner:origLink></entry>
<entry>
	<title>Setting the Default Monospace font in XFCE</title>
	
	  <id>http://perlstalker.vuser.org/blog/sysadminnotes/posts/setting-default-monospace-font-xfce/</id>
	
	<link href="http://feedproxy.google.com/~r/PerlstalkersSysadminNotes/~3/703w5KgcU1k/" />
	
	 <author><name>PerlStalker</name></author>
	
	
	 
	
	
	 
	  <category term="fonts" />
	 
	  <category term="xfce" />
	 
	
	<updated>2012-03-23T04:59:43Z</updated>
	<published>2012-03-23T04:59:43Z</published>
	
	 <content type="html" xml:lang="en">
	  
&lt;p&gt;&lt;i&gt;Originally posted at &lt;span class="timestamp-wrapper"&gt; &lt;span class="timestamp"&gt;2011-12-19 Mon 09:38&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;
&lt;/p&gt;
&lt;p&gt;
I use XFCE4 on my box at work because it's lightweight and still
provide the features I want. I wanted to change the default font so
that emacs used the font I wanted without having to change my .emacs
file. Unfortunately, XFCE4 only lets you set system default but not
the monospace font. Fortunately, XFCE4 uses fontconfig. All you need
to do is edit &lt;code&gt;$HOME/.fonts.conf&lt;/code&gt; and add this little XML
snippet. (See &lt;a href="http://www.freedesktop.org/software/fontconfig/fontconfig-user.html"&gt;the fonts.conf manpage&lt;/a&gt;.)
&lt;/p&gt;



&lt;pre class="example"&gt;&amp;lt;match target="pattern"&amp;gt;
        &amp;lt;test qual="any" name="family"&amp;gt;
                &amp;lt;string&amp;gt;monospace&amp;lt;/string&amp;gt;
        &amp;lt;/test&amp;gt;
        &amp;lt;edit name="family" mode="assign"&amp;gt;
                &amp;lt;string&amp;gt;Terminus-9&amp;lt;/string&amp;gt;
        &amp;lt;/edit&amp;gt;
&amp;lt;/match&amp;gt;
&lt;/pre&gt;


&lt;p&gt;
If you have to create &lt;code&gt;$HOME/.fonts.conf&lt;/code&gt;, make sure you wrap that snippet in
&lt;code&gt;&amp;lt;fontconfig&amp;gt;&lt;/code&gt; tags.
&lt;/p&gt;


	 
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/41opMtU0-fedcx1JA5Nfyfv-pk4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/41opMtU0-fedcx1JA5Nfyfv-pk4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/41opMtU0-fedcx1JA5Nfyfv-pk4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/41opMtU0-fedcx1JA5Nfyfv-pk4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?a=703w5KgcU1k:v_z3bV62bM8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?a=703w5KgcU1k:v_z3bV62bM8:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?a=703w5KgcU1k:v_z3bV62bM8:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?i=703w5KgcU1k:v_z3bV62bM8:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/PerlstalkersSysadminNotes/~4/703w5KgcU1k" height="1" width="1"/&gt;</content>
	
	
	
<feedburner:origLink>http://perlstalker.vuser.org/blog/sysadminnotes/posts/setting-default-monospace-font-xfce/</feedburner:origLink></entry>
<entry>
	<title>Running Emacs Functions in Batch Mode</title>
	
	  <id>http://perlstalker.vuser.org/blog/sysadminnotes/posts/running-emacs-functions-batch-mode/</id>
	
	<link href="http://feedproxy.google.com/~r/PerlstalkersSysadminNotes/~3/8T33Xyv0Ix4/" />
	
	 <author><name>PerlStalker</name></author>
	
	
	 
	
	
	 
	  <category term="emacs" />
	 
	
	<updated>2012-03-23T04:52:15Z</updated>
	<published>2012-03-23T04:51:25Z</published>
	
	 <content type="html" xml:lang="en">
	  
&lt;p&gt;&lt;i&gt;Originally posted at &lt;span class="timestamp-wrapper"&gt; &lt;span class="timestamp"&gt;2011-11-10 Thu 10:22&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;
&lt;/p&gt;
&lt;p&gt;
I use emacs for a lot of things at work. One of the more useful is &lt;a href="http://orgmode.org/"&gt;org-mode&lt;/a&gt;
for to do lists, scheduling and meeting notes. Org-mode can sync to mobile
devices running the app MobileOrg. Unfortunately, that sync is a manual
process. The good news, emacs is scriptable and can be run in batch mode to
automate things. Here are a couple of things I use.
&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;Note:&lt;/b&gt; Emacs batch mode spews a huge amount of crap to stderr. If you're
putting these in cron, you may want to slap a &lt;code&gt;2&amp;gt;/dev/null&lt;/code&gt; on there to keep it
quiet.
&lt;/p&gt;

&lt;div id="outline-container-1" class="outline-2"&gt;
&lt;h2 id="sec-1"&gt;Sync with MobileOrg&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-1"&gt;


&lt;p&gt;
The first line pushes the local org files to sync and the second pulls changes
coming from the device.
&lt;/p&gt;



&lt;pre class="src src-sh"&gt;emacs --batch -l $&lt;span&gt;HOME&lt;/span&gt;/.emacs -f org-mobile-push
emacs --batch -l $&lt;span&gt;HOME&lt;/span&gt;/.emacs -f org-mobile-pull
&lt;/pre&gt;


&lt;/div&gt;

&lt;/div&gt;

&lt;div id="outline-container-2" class="outline-2"&gt;
&lt;h2 id="sec-2"&gt;Publish Meeting Minutes&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-2"&gt;


&lt;p&gt;
I keep meeting minutes using org-mode and then publish them to my web site. I
also maintain my personal work site using org-mode. To publish all configured
sites, you can use the script below.
&lt;/p&gt;



&lt;pre class="src src-sh"&gt;emacs --batch -l $&lt;span&gt;HOME&lt;/span&gt;/.emacs -f org-publish-all
&lt;/pre&gt;


&lt;p&gt;
If you want to publish a specific site rather than all of them, you can use
this incantation.
&lt;/p&gt;



&lt;pre class="src src-sh"&gt;emacs --batch -l $&lt;span&gt;HOME&lt;/span&gt;/.emacs --eval &lt;span&gt;'(org-publish "meetings")'&lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;
&lt;b&gt;Updated &lt;span class="timestamp-wrapper"&gt; &lt;span class="timestamp"&gt;2012-03-22 Thu 22:49&lt;/span&gt;&lt;/span&gt;:&lt;/b&gt; It's also possible to use &lt;code&gt;--eval&lt;/code&gt;
 with &lt;code&gt;emacsclient&lt;/code&gt;. You, of course, need emacs server running but it makes
 those batch runs much faster.
&lt;/p&gt;

&lt;/div&gt;
&lt;/div&gt;

	 
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/9_EfmgQdJE47NshhtUaaiFS_kb0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/9_EfmgQdJE47NshhtUaaiFS_kb0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/9_EfmgQdJE47NshhtUaaiFS_kb0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/9_EfmgQdJE47NshhtUaaiFS_kb0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?a=8T33Xyv0Ix4:z6XxuETGLR8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?a=8T33Xyv0Ix4:z6XxuETGLR8:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?a=8T33Xyv0Ix4:z6XxuETGLR8:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?i=8T33Xyv0Ix4:z6XxuETGLR8:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/PerlstalkersSysadminNotes/~4/8T33Xyv0Ix4" height="1" width="1"/&gt;</content>
	
	
	
<feedburner:origLink>http://perlstalker.vuser.org/blog/sysadminnotes/posts/running-emacs-functions-batch-mode/</feedburner:origLink></entry>
<entry>
	<title>Finding Old Computer Accounts in Active Directory with Powershell</title>
	
	  <id>http://perlstalker.vuser.org/blog/sysadminnotes/posts/finding-old-computer-accounts-active-directory-powershell/</id>
	
	<link href="http://feedproxy.google.com/~r/PerlstalkersSysadminNotes/~3/ptgomQwpRnk/" />
	
	 <author><name>PerlStalker</name></author>
	
	
	 
	
	
	 
	  <category term="active-directory" />
	 
	  <category term="powershell" />
	 
	
	<updated>2012-03-23T04:44:47Z</updated>
	<published>2012-03-23T04:44:47Z</published>
	
	 <content type="html" xml:lang="en">
	  
&lt;p&gt;&lt;i&gt;Originally posted at &lt;span class="timestamp-wrapper"&gt; &lt;span class="timestamp"&gt;2011-06-20 Mon 13:31&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;
&lt;/p&gt;
&lt;p&gt;
Following up on a previous post discussing finding old user accounts in Active
Directory, here's how you find old computer accounts.
&lt;/p&gt;
&lt;p&gt;
This works on basically the same premise as the user script. In short, we're
going to check the last time the computer logged into Active Directory. That
happens on every reboot and from time to time while the machine is up. The
same warning applies to computers as it does for user accounts. The last logon
timestamp is only accurate to about a week. Since people are generally
checking back six months or more, it isn't much of an issue.
&lt;/p&gt;
&lt;p&gt;
To get the list of stale machines:
&lt;/p&gt;



&lt;pre class="example"&gt;get-adcomputer -properties lastLogonDate -filter * | where { $_.lastLogonDate
-lt (get-date).addmonths(-12) } | FT Name,LastLogonDate
&lt;/pre&gt;


&lt;p&gt;
You can throw a sort in there if you'd like.
&lt;/p&gt;



&lt;pre class="example"&gt;get-adcomputer -properties lastLogonDate -filter * | where { $_.lastLogonDate
-lt (get-date).addmonths(-12) } | sort Name | FT Name,LastLogonDate
&lt;/pre&gt;


&lt;p&gt;
It's just as easy to delete all of those accounts. I've added a &lt;code&gt;-whatif&lt;/code&gt; to
make it harder to do something stupid with cut-and-paste. Take it off to
actually delete the computer accounts.
&lt;/p&gt;



&lt;pre class="example"&gt;get-adcomputer -properties lastLogonDate -filter * | where { $_.lastLogonDate
-lt (get-date).addmonths(-12) } | Remove-ADComputer -whatif
&lt;/pre&gt;


&lt;p&gt;
&lt;b&gt;Updated 2011-06-20 14:15:&lt;/b&gt; Added a missing &lt;code&gt;}&lt;/code&gt; to every example. Don't you hate
it when you have a bug in your code and you copy and paste that same line over
and over again? Me, too.
&lt;/p&gt;


	 
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/oBl-xm4i_7vVkBknSLq0ZWAYOSs/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/oBl-xm4i_7vVkBknSLq0ZWAYOSs/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/oBl-xm4i_7vVkBknSLq0ZWAYOSs/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/oBl-xm4i_7vVkBknSLq0ZWAYOSs/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?a=ptgomQwpRnk:mTbzfbhUWJQ:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?a=ptgomQwpRnk:mTbzfbhUWJQ:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?a=ptgomQwpRnk:mTbzfbhUWJQ:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?i=ptgomQwpRnk:mTbzfbhUWJQ:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/PerlstalkersSysadminNotes/~4/ptgomQwpRnk" height="1" width="1"/&gt;</content>
	
	
	
<feedburner:origLink>http://perlstalker.vuser.org/blog/sysadminnotes/posts/finding-old-computer-accounts-active-directory-powershell/</feedburner:origLink></entry>
<entry>
	<title>Convert a Moose Object into a Subtype</title>
	
	  <id>http://perlstalker.vuser.org/blog/sysadminnotes/posts/convert-moose-object-into-subtype/</id>
	
	<link href="http://feedproxy.google.com/~r/PerlstalkersSysadminNotes/~3/wuunFW0V8fI/" />
	
	 <author><name>PerlStalker</name></author>
	
	
	 
	
	
	 
	  <category term="Moose" />
	 
	  <category term="perl" />
	 
	
	<updated>2012-03-23T04:38:53Z</updated>
	<published>2012-03-23T04:38:53Z</published>
	
	 <content type="html" xml:lang="en">
	  
&lt;p&gt;&lt;i&gt;Originally posted at &lt;span class="timestamp-wrapper"&gt; &lt;span class="timestamp"&gt;2011-06-03 Fri 14:01&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;
&lt;/p&gt;
&lt;p&gt;
Have you ever had the situation where you had a parent class but you find out
later in the code that you really want a subclass? With perl Moose, it's
really easy to do.
&lt;/p&gt;
&lt;p&gt;
Consider the classic point example described in 
&lt;a href="http://search.cpan.org/~doy/Moose-2.0001/lib/Moose/Cookbook/Basics/Recipe1.pod"&gt;Moose::Cookbook::Basics::Recipe1&lt;/a&gt;. Suppose I start with a Point but I decide
later that I need that point to shift into 3D. I don't want to change the
values for x and y, I just want to add the new z point. I could brute force it
by creating a new point and copying the values over from the old point but
that feels like more work than it should be. Well, it is.
&lt;/p&gt;
&lt;p&gt;
Fortunately, Moose uses Class::MOP::Class which provides the rebless_instance
method which can convert a object into a subtype.
&lt;/p&gt;



&lt;pre class="src src-perl"&gt;&lt;span&gt;package&lt;/span&gt; &lt;span&gt;Point&lt;/span&gt;;
&lt;span&gt;use&lt;/span&gt; &lt;span&gt;Moose&lt;/span&gt;;

has &lt;span&gt;'x'&lt;/span&gt; =&amp;gt; (isa =&amp;gt; &lt;span&gt;'Int'&lt;/span&gt;, is =&amp;gt; &lt;span&gt;'rw'&lt;/span&gt;);
has &lt;span&gt;'y'&lt;/span&gt; =&amp;gt; (isa =&amp;gt; &lt;span&gt;'Int'&lt;/span&gt;, is =&amp;gt; &lt;span&gt;'rw'&lt;/span&gt;);

&lt;span&gt;package&lt;/span&gt; &lt;span&gt;Point3D&lt;/span&gt;;
&lt;span&gt;use&lt;/span&gt; &lt;span&gt;Moose&lt;/span&gt;;
extends &lt;span&gt;'Point'&lt;/span&gt;;

has &lt;span&gt;'z'&lt;/span&gt; =&amp;gt; (isa =&amp;gt; &lt;span&gt;'Int'&lt;/span&gt;, is =&amp;gt; &lt;span&gt;'rw'&lt;/span&gt;);

&lt;span&gt;package&lt;/span&gt; &lt;span&gt;main&lt;/span&gt;;
&lt;span&gt;use&lt;/span&gt; &lt;span&gt;Data&lt;/span&gt;::Dumper;

&lt;span&gt;my&lt;/span&gt; $&lt;span&gt;p1&lt;/span&gt;  = Point-&amp;gt;new(x =&amp;gt; 4, y &lt;span&gt;=&amp;gt; 3);&lt;/span&gt;
&lt;span&gt;print Dumper $p1;&lt;/span&gt;

&lt;span&gt;$p1 = Point3D-&amp;gt;meta-&amp;gt;rebless_instance($p1);&lt;/span&gt;
&lt;span&gt;print Dumper $p1;&lt;/span&gt;
&lt;/pre&gt;


&lt;p&gt;
And the output:
&lt;/p&gt;



&lt;pre class="example"&gt;$VAR1 = bless( {
                 'y' =&amp;gt; 3,
                 'x' =&amp;gt; 4
               }, 'Point' );
$VAR1 = bless( {
                 'y' =&amp;gt; 3,
                 'x' =&amp;gt; 4
               }, 'Point3D' );
&lt;/pre&gt;


&lt;p&gt;
Now &lt;code&gt;$p1&lt;/code&gt; is a Point3D object rather than a Point object.
&lt;/p&gt;
&lt;p&gt;
You can go backwards, too, with the &lt;code&gt;rebless_instance_back&lt;/code&gt; method but you face
the potential for data loss when you do that.
&lt;/p&gt;


	 
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Hoq-dxm7OjbtkwJzipR_kRfOtDI/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Hoq-dxm7OjbtkwJzipR_kRfOtDI/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Hoq-dxm7OjbtkwJzipR_kRfOtDI/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Hoq-dxm7OjbtkwJzipR_kRfOtDI/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?a=wuunFW0V8fI:lHkqdLCNHVQ:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?a=wuunFW0V8fI:lHkqdLCNHVQ:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?a=wuunFW0V8fI:lHkqdLCNHVQ:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?i=wuunFW0V8fI:lHkqdLCNHVQ:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/PerlstalkersSysadminNotes/~4/wuunFW0V8fI" height="1" width="1"/&gt;</content>
	
	
	
<feedburner:origLink>http://perlstalker.vuser.org/blog/sysadminnotes/posts/convert-moose-object-into-subtype/</feedburner:origLink></entry>
<entry>
	<title>JSON Serialization with Dancer and MooseX::Storage</title>
	
	  <id>http://perlstalker.vuser.org/blog/sysadminnotes/posts/json-serialization-dancer-moosex-storage/</id>
	
	<link href="http://feedproxy.google.com/~r/PerlstalkersSysadminNotes/~3/3DE9v0XMk7A/" />
	
	 <author><name>PerlStalker</name></author>
	
	
	 
	
	
	 
	  <category term="MooseX::Storage" />
	 
	  <category term="dancer" />
	 
	  <category term="json" />
	 
	  <category term="perl" />
	 
	
	<updated>2012-03-23T04:31:34Z</updated>
	<published>2012-03-23T04:31:34Z</published>
	
	 <content type="html" xml:lang="en">
	  
&lt;p&gt;&lt;i&gt;Originally posted at &lt;span class="timestamp-wrapper"&gt; &lt;span class="timestamp"&gt;2011-04-27 Wed 16:07&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;
&lt;/p&gt;
&lt;p&gt;
I'm hacking on a new tool in perl to manage my KVM cluster. Part of it is a
RESTful interface using JSON. The objects I'm using are written using Moose
and MooseX::Storable to simplify serialization. I can convert objects back and
forth between perl objects and JSON all day. Unfortunately, there's a fly in
the ointment.
&lt;/p&gt;
&lt;p&gt;
I'm using Dancer to provide the framework for the RESTful interface. The nice
thing about Dancer is that it can automatically serialize perl data structures
and it can do it via JSON. That's all shiny except Dancer's serializer doesn't
know about MooseX::Storable. In fact, Dancer chokes when I try to send an
object back from one of the handlers.
&lt;/p&gt;
&lt;p&gt;
All is not lost. There is a work around that appears to work in my tests.
First of all, I needed to tell Dancer that it's okay to try and convert my
objects. This is done in &lt;code&gt;config.yml&lt;/code&gt;.
&lt;/p&gt;



&lt;pre class="example"&gt;engines:
  JSON:
    convert_blessed: '1'
&lt;/pre&gt;


&lt;p&gt;
That tells Dancer, via the JSON package, to try to convert objects using the
method TO_JSON. But, wait! I don't have one of those. Yet. Fortunately,
MooseX::Storable has everything I need.
&lt;/p&gt;
&lt;p&gt;
The MooseX::Storable API offers a couple of options. The first is to use
freeze() to turn the object into a JSON string. That works if I'm only
returning a single object but I'm often returning lists of things which
complicates things.
&lt;/p&gt;



&lt;pre class="src src-perl"&gt;&lt;span&gt;sub&lt;/span&gt; &lt;span&gt;TO_JSON&lt;/span&gt; { $&lt;span&gt;_&lt;/span&gt;[0]-&amp;gt;freeze }
&lt;/pre&gt;


&lt;p&gt;
Actually, it seems to work but Dancer has goes through the returned JSON
string and encodes before sending it on. That's actually a second round of
encoding since MooseX::Storable did it once already. Here's what a list
containing an object looks like.
&lt;/p&gt;



&lt;pre class="example"&gt;[
   "{\"__CLASS__\":\"YAVMM::Host-0.01\",\"cluster\":\"dev\",\"name\":\
"rbsmith-desktop\",\"ram\":3924056,\"num_cpus\":4}"
]
&lt;/pre&gt;


&lt;p&gt;
Ugly, huh? In fact, that might screw up anything non-perl that tries to use
the RESTful interface. We can get around that by going down one level and
using &lt;code&gt;pack()&lt;/code&gt; instead.
&lt;/p&gt;
&lt;p&gt;
&lt;code&gt;pack()&lt;/code&gt; and the corresponding &lt;code&gt;unpack()&lt;/code&gt; are required by anything implementing
the MooseX::Storage API. Rather than going all the way to JSON, &lt;code&gt;pack()&lt;/code&gt; spits
back a serialized perl hashref. It turns out that that is exactly what Dancer
needs to properly encode the object. So, I changed &lt;code&gt;TO_JSON&lt;/code&gt; to look like this:
&lt;/p&gt;



&lt;pre class="src src-perl"&gt;&lt;span&gt;sub&lt;/span&gt; &lt;span&gt;TO_JSON&lt;/span&gt; { $&lt;span&gt;_&lt;/span&gt;[0]-&amp;gt;pack }
&lt;/pre&gt;


&lt;p&gt;
The new output is below. Isn't it pretty? That's exactly what the JSON should
look like.
&lt;/p&gt;



&lt;pre class="example"&gt;[
   {
      "__CLASS__" : "YAVMM::Host-0.01",
      "cluster" : "dev",
      "name" : "rbsmith-desktop",
      "ram" : 3924056,
      "num_cpus" : 4
   }
]
&lt;/pre&gt;


&lt;p&gt;
On the client side, I still need to decode that mess. That's actually very
easy using the JSON module and feeding the JSON text into &lt;code&gt;decode_json()&lt;/code&gt;. That
spits back a perl hash or list reference that has the (mostly) deserialized
data. I say mostly because my objects are still hashes and not objects. All
that I need to do is feed those hashrefs to &lt;code&gt;unpack()&lt;/code&gt; and I get my object back.
&lt;/p&gt;
&lt;p&gt;
Here's how I would translate that list above. &lt;b&gt;Note:&lt;/b&gt; My object is called
YAVMM::Host. You would, of course, use your own class name instead. Also,
assume that &lt;code&gt;$json_text&lt;/code&gt; has the JSON text. How it got there is beyond the scope
of this document.
&lt;/p&gt;



&lt;pre class="src src-perl"&gt;&lt;span&gt;my&lt;/span&gt; @&lt;span&gt;hosts&lt;/span&gt; = map { YAVMM::Host-&amp;gt;unpack($&lt;span&gt;_&lt;/span&gt;) } @{ decode_json($&lt;span&gt;json_text&lt;/span&gt;) };
&lt;/pre&gt;


&lt;p&gt;
Now &lt;code&gt;@hosts&lt;/code&gt; is a list with a bunch of YAVMM::Host objects that I can have all
sorts of fun with.
&lt;/p&gt;


	 
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Oawfv8Lq-ks4mK13216VOgS7GNM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Oawfv8Lq-ks4mK13216VOgS7GNM/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Oawfv8Lq-ks4mK13216VOgS7GNM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Oawfv8Lq-ks4mK13216VOgS7GNM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?a=3DE9v0XMk7A:KaTy35IHTiw:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?a=3DE9v0XMk7A:KaTy35IHTiw:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?a=3DE9v0XMk7A:KaTy35IHTiw:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?i=3DE9v0XMk7A:KaTy35IHTiw:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/PerlstalkersSysadminNotes/~4/3DE9v0XMk7A" height="1" width="1"/&gt;</content>
	
	
	
<feedburner:origLink>http://perlstalker.vuser.org/blog/sysadminnotes/posts/json-serialization-dancer-moosex-storage/</feedburner:origLink></entry>
<entry>
	<title>Ubuntu Fails to Boot with Spice Console</title>
	
	  <id>http://perlstalker.vuser.org/blog/sysadminnotes/posts/ubuntu-fails-to-boot-with-spice-console/</id>
	
	<link href="http://feedproxy.google.com/~r/PerlstalkersSysadminNotes/~3/Qbgs_aCochc/" />
	
	 <author><name>PerlStalker</name></author>
	
	
	 
	
	
	 
	  <category term="grub" />
	 
	  <category term="kvm" />
	 
	  <category term="spice" />
	 
	  <category term="ubuntu" />
	 
	
	<updated>2012-03-23T04:31:34Z</updated>
	<published>2012-03-19T04:10:32Z</published>
	
	 <content type="html" xml:lang="en">
	  
&lt;p&gt;&lt;i&gt;Originally posted at &lt;span class="timestamp-wrapper"&gt; &lt;span class="timestamp"&gt;2011-04-12 Tue 15:44&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;
&lt;/p&gt;
&lt;p&gt;
I needed to roll a couple of debs for my Ubuntu servers at work. Since I run
Gentoo on my desktop, I rolled a 64-bit Lucid VM. Unfortunately, after the
install finished, I got the following error on the console and the VM wouldn't
boot.
&lt;/p&gt;



&lt;pre class="example"&gt;error: no suitable mode found
error: unknown command 'terminal'
&lt;/pre&gt;


&lt;p&gt;
I figured the problem had something to do with the interaction with spice
console (which I'm using instead of VNC). Fortunately, the fix is pretty easy.
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Boot the install CD and go into Recovery mode.
&lt;/li&gt;
&lt;li&gt;Drop into a shell on the system.
&lt;/li&gt;
&lt;li&gt;Make sure /boot is mounted in case it's on a separate partition.
&lt;/li&gt;
&lt;li&gt;Edit &lt;code&gt;/etc/default/grub&lt;/code&gt; and set &lt;code&gt;GRUB_TERMINAL=console&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;/usr/sbin/grub-mkconfig &amp;gt; /boot/grub/grub.cfg&lt;/code&gt; to update &lt;code&gt;/boot/grub/grub.cfg&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Exit the recovery shell and reboot
&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;
Poof! The VM now boots and I can log in.
&lt;/p&gt;


	 
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/rblS1CcHuthjOcM9d5XGgU3RWJw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rblS1CcHuthjOcM9d5XGgU3RWJw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/rblS1CcHuthjOcM9d5XGgU3RWJw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rblS1CcHuthjOcM9d5XGgU3RWJw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?a=Qbgs_aCochc:e1UKsW0VPSU:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?a=Qbgs_aCochc:e1UKsW0VPSU:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?a=Qbgs_aCochc:e1UKsW0VPSU:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/PerlstalkersSysadminNotes?i=Qbgs_aCochc:e1UKsW0VPSU:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/PerlstalkersSysadminNotes/~4/Qbgs_aCochc" height="1" width="1"/&gt;</content>
	
	
	
<feedburner:origLink>http://perlstalker.vuser.org/blog/sysadminnotes/posts/ubuntu-fails-to-boot-with-spice-console/</feedburner:origLink></entry>

</feed>

