<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Hamstar &#187; how-to</title>
	<atom:link href="http://www.hamstar.co.nz/tag/how-to/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hamstar.co.nz</link>
	<description>Another Metal Car Computer Geek blog</description>
	<lastBuildDate>Sat, 06 Aug 2011 17:46:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Batch converting Works (WPS) to Word (DOC)</title>
		<link>http://www.hamstar.co.nz/2008/09/20/batch-converting-works-wps-to-word-doc/</link>
		<comments>http://www.hamstar.co.nz/2008/09/20/batch-converting-works-wps-to-word-doc/#comments</comments>
		<pubDate>Fri, 19 Sep 2008 16:20:09 +0000</pubDate>
		<dc:creator>hamstar</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://www.hamstar.co.nz/?p=87</guid>
		<description><![CDATA[My friends mum needed a bunch of works files to work on her PC, but I could so not be bothered searching around for a works install disc, plus the converter from the Microsoft site wasn&#8217;t working.
So I took the documents to work where I knew the converter was working but there was still like [...]]]></description>
			<content:encoded><![CDATA[<p>My friends mum needed a bunch of works files to work on her PC, but I could so not be bothered searching around for a works install disc, plus the converter from the Microsoft site wasn&#8217;t working.</p>
<p>So I took the documents to work where I knew the converter was working but there was still like over 100 documents and I didn&#8217;t want to open and save each one.</p>
<p>Luckily I found <a href="http://www.microsoft.com/communities/newsgroups/list/en-us/default.aspx?dg=microsoft.public.word.conversions&#038;tid=92325268-5910-4ede-af4e-0b2cc5cb04bb&#038;cat=en_us_7bf8bdfb-42bd-458f-8fef-7bd182f180c8&#038;lang=en&#038;cr=us&#038;sloc=&#038;p=1">this page</a> (can&#8217;t believe I&#8217;m linking to an MS site) which had a macro to use to convert a whole bunch of WPS&#8217;s to DOC&#8217;s.</p>
<p>I&#8217;ll re-post it here incase that other page disappears (also I made an adjustment so it works):<br />
<span id="more-87"></span></p>
<pre>
[code lang="vb"]
Sub Batch_Save_WPS_as_DOC97()

    Dim bConv As Boolean
    Dim strFileName As String
    Dim strDocName As String
    Dim strPath As String
    Dim oDoc As Document
    Dim Response As Long
    Dim fDialog As FileDialog

    bConv = Options.ConfirmConversions
    Options.ConfirmConversions = False
    Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)

    With fDialog
        .Title = "Select folder and click OK"
        .AllowMultiSelect = False
        .InitialView = msoFileDialogViewList

        If .Show <> -1 Then
            MsgBox "Cancelled By User", , "Save all as DOC"
            Exit Sub
        End If

        strPath = fDialog.SelectedItems.Item(1)
        If Right(strPath, 1) <> "\" Then strPath = strPath + "\"
    End With

    'If Documents.Count > 0 Then
    'Documents.Close SaveChanges:=wdPromptToSaveChanges
    'End If

    strFileName = Dir$(strPath &#038; "*.wps")

    While Len(strFileName) <> 0
        Set oDoc = Documents.Open(strPath &#038; strFileName)

        strDocName = ActiveDocument.FullName
        intPos = InStrRev(strDocName, ".")
        strDocName = Left(strDocName, intPos - 1)
        strDocName = strDocName &#038; ".doc"
        oDoc.SaveAs FileName:=strDocName, _
        FileFormat:=wdFormatDocument97
        oDoc.Close SaveChanges:=wdDoNotSaveChanges
        strFileName = Dir$()
    Wend
    Options.ConfirmConversions = bConv

End Sub
[/code]
</pre>
<p>Don&#8217;t worry about the fact it says doc97 format it just means the format between 97 and 2003 (i.e. doc and not docx).</p>
<p>So you just:</p>
<ol>
<li>Open up a new word doc</li>
<li>Press <strong>Alt+F11</strong> to open the VB editor</li>
<li>Insert a new module</li>
<li>Copy and paste the above code</li>
<li>Save the document</li>
<li>Press <strong>Alt+F8</strong> to open the macro window</li>
<li>Select <strong>Batch_Save_WPS_as_DOC97</strong> and hit <strong>Run</strong></li>
<li>Select the folder you want and hit OK</li>
<li>Watch it do its thing</li>
</ol>
<p>It won&#8217;t overwrite any of the original documents so you don&#8217;t need to stress (I made a backup anyway just in case).</p>
<p>Hope this helps anyone in need.</p>
<p>By the way thanks to <a href="http://wordpress.org/extend/plugins/codesnippet-20/">codesnippet</a> for the syntax highlighting <img src='http://www.hamstar.co.nz/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.hamstar.co.nz/2008/09/20/batch-converting-works-wps-to-word-doc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Process multiple items in command line</title>
		<link>http://www.hamstar.co.nz/2007/12/08/process-multiple-items-in-command-line/</link>
		<comments>http://www.hamstar.co.nz/2007/12/08/process-multiple-items-in-command-line/#comments</comments>
		<pubDate>Fri, 07 Dec 2007 16:00:13 +0000</pubDate>
		<dc:creator>hamstar</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[computer]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.hamstar.co.nz/?p=134</guid>
		<description><![CDATA[This is great, I saw it somewhere the other day but can&#8217;t remember where.  It is pretty simple too&#8230; sometimes when I do stuff on the command line with cut I try to run multiple commands on the output, but it never works cos I try to it with sed but with this method [...]]]></description>
			<content:encoded><![CDATA[<p>This is great, I saw it somewhere the other day but can&#8217;t remember where.  It is pretty simple too&#8230; sometimes when I do stuff on the command line with <strong>cut</strong> I try to run multiple commands on the output, but it never works cos I try to it with <strong>sed</strong> but with this method it works great.</p>
<p>Check it out:</p>
<blockquote><p>for i in <span style='color:red'>`ps auwx|grep hamstar|cut -f2 -d&#8217; &#8216;`</span>; do <span style='color:blue'>kill $i</span>; done</p></blockquote>
<p>That would kill all the processes that I have started under my username.  Notice the red part is where it takes all the entries (puts each one into $i as it uses it, and the blue part is where it does something with the entries ($i again)).  Adding kill to the start and ; to the end using sed would not work for this.</p>
<p>Ok that might a bit tricky for some of you, especially if you haven&#8217;t come across the miracle of piping yet, let me show you a simpler one.</p>
<blockquote><p>for i in *; do echo $i; done</p></blockquote>
<p>Basically another form of ls but thing of the things you can do with this.  Rename from lowercase to uppercase:</p>
<blockquote><p>for i in *; do mv $i `echo $i|tr [A-Z] [a-z]`; done</p></blockquote>
<p>So its basically limitless to what you can do with this cool thing.</p>
<p>I also found another cool thing while writing this.  Doing the following will covert all characters in a given file to lowercase or uppercase if you changed it:</p>
<blockquote><p>dd file.txt conv=lcase</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.hamstar.co.nz/2007/12/08/process-multiple-items-in-command-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Open a remote machines window on your desktop</title>
		<link>http://www.hamstar.co.nz/2007/08/21/open-a-remote-machines-window-on-your-desktop/</link>
		<comments>http://www.hamstar.co.nz/2007/08/21/open-a-remote-machines-window-on-your-desktop/#comments</comments>
		<pubDate>Mon, 20 Aug 2007 16:01:53 +0000</pubDate>
		<dc:creator>hamstar</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[computer]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.hamstar.co.nz/?p=136</guid>
		<description><![CDATA[So I found out a little while ago that the X server can do this thing where it outputs the window from the machine its running on, to a remote machine, also running an X server.  I did this a few times and its pretty damn cool.  Basically you simply open a console, [...]]]></description>
			<content:encoded><![CDATA[<p>So I found out a little while ago that the X server can do this thing where it outputs the window from the machine its running on, to a remote machine, also running an X server.  I did this a few times and its pretty damn cool.  Basically you simply open a console, set the DISPLAY variable to something like 10.0.0.2:0 and it will open on that IP and that display once you add your machine to that machines xhost list.  You follow me?  No?</p>
<p>Okay, here it is broken down.   Lets say, you have two linux boxes, both running GUI&#8217;s, and you want to open gedit on one machine (machine1), but display it on the other machine (machine2):</p>
<p><span id="more-136"></span></p>
<p>Getting the info:</p>
<p>On machine1, open a console and do:</p>
<blockquote><p>ifconfig eth0</p></blockquote>
<p>This should tell you your IP address (e.g. <strong>10.0.0.1</strong>).  Now go to the other machine and do following:</p>
<blockquote><p>xhost 10.0.0.1<br />
ifconfig eth0<br />
echo $DISPLAY</p></blockquote>
<p>OK, that has added machine1 to machine2s receiving trusted list.  Now grab your IP on that box (e.g. <strong>10.0.0.2</strong>) and the DISPLAY number (e.g. <strong>:0</strong>) and go back to machine1.  Do the following:</p>
<blockquote><p>DISPLAY=10.0.0.2:0<br />
export DISPLAY<br />
gedit</p></blockquote>
<p>Now with a bit a bit of luck, gedit should have opened on the other machine.</p>
<p><strong>Handy for:</strong></p>
<ul>
<li>Remote administration!  Put the box under the stairs without a screen or anything, ssh into it and open any windows on your own desktop.</li>
<li>Open stuff on other people desktops!  &#8220;I swear, that porn window came out of nowhere, I clicked nothing!&#8221;</li>
</ul>
<p><strong>Drawbacks:</strong></p>
<ul>
<li>The environment that the sent window runs in is still that of machine1.  So you can&#8217;t access machine2&#8217;s files even though you are using the window on machine2 (unless you set up a samba share or something)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.hamstar.co.nz/2007/08/21/open-a-remote-machines-window-on-your-desktop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Open a program from one linux box on another boxes screen</title>
		<link>http://www.hamstar.co.nz/2007/04/07/open-a-program-from-one-linux-box-on-another-boxes-screen/</link>
		<comments>http://www.hamstar.co.nz/2007/04/07/open-a-program-from-one-linux-box-on-another-boxes-screen/#comments</comments>
		<pubDate>Sat, 07 Apr 2007 11:45:51 +0000</pubDate>
		<dc:creator>hamstar</dc:creator>
				<category><![CDATA[HOW TOs]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[how-to]]></category>

		<guid isPermaLink="false">http://www.telescum.co.nz/hamstar/?p=9</guid>
		<description><![CDATA[How cool would it be to be able run a program from your main computer, but have the window for it come up on say, your laptop while you&#8217;re sitting on your bed?  Thats what I do.
My main problem is that I can&#8217;t get internet on my laptop at home.  I&#8217;m on dialup [...]]]></description>
			<content:encoded><![CDATA[<p>How cool would it be to be able run a program from your main computer, but have the window for it come up on say, your laptop while you&#8217;re sitting on your bed?  Thats what I do.</p>
<p>My main problem is that I can&#8217;t get internet on my laptop at home.  I&#8217;m on dialup and my external modem only connects by serial, which my laptop doesn&#8217;t have.  Problem.</p>
<p>Solution.  I can ssh into my main box which has the modem, connect it to the net and run firefox and it will open it on my laptop screen, using the network.  This is a built in feature of X, the display manager for linux.</p>
<p>This HOWTO assumes the following:</p>
<ol>
<li>You already have ssh setup on the main box</li>
<li>The main box is called serj with an IP of 10.0.0.1</li>
<li>The other box is called malakian with an IP of 10.0.0.4</li>
</ol>
<p>Here&#8217;s how ya do it:</p>
<ol>
<li>Open up a console window</li>
<li>Add the other box to your X &#8220;allow&#8221; list by typing the following:
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">xhost serj</div></div>
<p><br/></li>
<li>Find out your display number and remember it (lets say it is 1).  Type:
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">echo $DISPLAY</div></div>
<p><br/></li>
<li>SSH into your main box from the other box
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">ssh serj -l &lt;em&gt;username&lt;/em&gt;</div></div>
<p><br/></li>
<li>Once you&#8217;ve logged in, you need to edit the DISPLAY variable to be the IP and display number (1) of the box you&#8217;re on and export it:
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">DISPLAY=10.0.0.4:1; export DISPLAY</div></div>
<p><br/></li>
<li>Once you&#8217;ve done that check that it is set properly by echo&#8217;ing the DISPLAY variable again.  It should show 10.0.0.4:1
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">echo $DISPLAY</div></div>
</li>
<li>Now simply run a program like firefox from the command line and the window will open on your box:
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">firefox</div></div>
</li>
</ol>
<p>When you run a program it will open with all the settings from your main box.  Unfortunately it won&#8217;t work with 3D games but there are a few things it could be useful for e.g.:</p>
<ol>
<li>Administering one of your screenless servers through an actual GUI (provided you installed with KDE/gnome/some other window manager)</li>
<li>Opening dirty sites on your friends/workmates PC.  Open a console, set your display to your workmates IP/display and run
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">firefox http://nastyjapanesegirls.com</div></div>
<p>.  Of course it will be running of your profile so he won&#8217;t get done for porn if you do this at work&#8230; you will.</li>
</ol>
<p>There is one draw back though, all sound will run on the main box.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hamstar.co.nz/2007/04/07/open-a-program-from-one-linux-box-on-another-boxes-screen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

