<?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>zach.blog &#187; howto</title>
	<atom:link href="http://blog.zachtib.com/tag/howto/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.zachtib.com</link>
	<description>General geekery and whatnot</description>
	<lastBuildDate>Mon, 28 Nov 2011 19:20:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Fast screenshot sharing in Linux</title>
		<link>http://blog.zachtib.com/2010/05/fast-screenshot-sharing-in-linux/</link>
		<comments>http://blog.zachtib.com/2010/05/fast-screenshot-sharing-in-linux/#comments</comments>
		<pubDate>Sun, 09 May 2010 10:30:58 +0000</pubDate>
		<dc:creator>Zach</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[screenshot]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blog.zachtib.com/?p=677</guid>
		<description><![CDATA[When I&#8217;m using Windows or OS X, I use a utility called Tinygrab to quickly share screenshots over the internet, whether it&#8217;s via Twitter, IM, email, etc. The concept is simple: you press a key combination, select a region of &#8230; <a href="http://blog.zachtib.com/2010/05/fast-screenshot-sharing-in-linux/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When I&#8217;m using Windows or OS X, I use a utility called Tinygrab to quickly share screenshots over the internet, whether it&#8217;s via Twitter, IM, email, etc. The concept is simple: you press a key combination, select a region of your screen, and it uploads a screenshot of that area and gives you a URL for sharing. Unfortunately, they don&#8217;t (currently) support Linux, and so I decided to create my own version.</p>
<p>Since this was the result of an hour or two of bash scripting, it&#8217;s somewhat limited in what it can do. I&#8217;m planning on expanding it in the near future to support GUI configuration and not rely on Compiz in order to take the screenshot. Since Compiz causes some wackyness when it comes to grabbing screens, I&#8217;m using Compiz&#8217;s Screenshot plugin, which you can enable in CompizConfigSettingsManager.  By default, the shortcut is to hold Super (aka, the Windows key) and drag your mouse button to select an area to grab. You&#8217;ll need to set two options in order for my script to work. First, the directory to save the images to. I used ~/Desktop, since the script deletes the image after it has been uploaded, however you could also use something like /tmp if you like. Second, the command to be run on the screenshot after it has been saved, which is the script you see below. I saved it to ~/bin/upload_image, but again, you can call it whatever you like, just be sure to make the file executable.</p>
<p>The next step is to install the necessary dependencies. Since I&#8217;m reply on a few applications, you&#8217;ll have to have the following packages installed (this is on Ubuntu 10.04), but again, I&#8217;m hoping to change this in the near future: <strong>libnotify-bin</strong> and <strong>xclip</strong>.</p>
<p>The script also assumes you have passwordless ssh set up with your server (yes, you do need your own server for the moment, I&#8217;m hoping I can change this in future versions) You can easily do this in Ubuntu via the &#8220;Password and Encryption Keys&#8221; item under Accessories.</p>
<p>Now that all that is in place, it&#8217;s time for the script. You&#8217;ll notice there are a few values you need to fill in:</p>
<blockquote><p>#!/bin/bash</p>
<p>user=<br />
server=<br />
destdir=<br />
httpstr=</p>
<p>if [ ! -e $1 ]; then<br />
&nbsp;&nbsp;&nbsp;&nbsp;notify-send &#8220;Error&#8221; &#8220;File does not exist&#8221; -i error<br />
&nbsp;&nbsp;&nbsp;&nbsp;exit<br />
fi</p>
<p>md5=`md5sum $1`<br />
if [ "$?" -ne 0 ]; then<br />
&nbsp;&nbsp;&nbsp;&nbsp;notify-send &#8220;Error&#8221; &#8220;Could not generate md5sum&#8221; -i error<br />
&nbsp;&nbsp;&nbsp;&nbsp;exit<br />
fi</p>
<p>md5=${md5/ */}</p>
<p>scp $1 &#8220;$user@$server:$destdir${md5}.png&#8221;<br />
if [ "$?" -ne 0 ]; then<br />
&nbsp;&nbsp;&nbsp;&nbsp;notify-send &#8220;Error&#8221; &#8220;Failed upload&#8221; -i error<br />
&nbsp;&nbsp;&nbsp;&nbsp;exit<br />
fi</p>
<p>longurl=$httpstr$md5.png</p>
<p>shorturl=`wget http://is.gd/api.php?longurl=$longurl -O-`<br />
if [ "$?" -ne 0 ]; then<br />
&nbsp;&nbsp;&nbsp;&nbsp;notify-send &#8220;Error&#8221; &#8220;Failed to shorten URL&#8221; -i error<br />
&nbsp;&nbsp;&nbsp;&nbsp;$shorturl=$longurl<br />
fi</p>
<p>echo $shorturl | xclip -selection clipboard</p>
<p>notify-send &#8220;Upload Complete&#8221; $shorturl</p>
<p>rm $1</p></blockquote>
<p>Those values that you need to fill in are:</p>
<p>user: your username on the server</p>
<p>server: the address of the server you&#8217;re uploading your images to</p>
<p>destdir: a directory on that server that&#8217;s accessible via the web, such as /var/www/screengrabs/</p>
<p>httpstr: the url to that directory, for example: http://www.mysite.com/screengrabs/</p>
<p>Once all that&#8217;s set up, try it out. Hold Super and drag your mouse to select an image on your screen. Wait a few seconds and you should either get an &#8220;Update Complete&#8221; notification, or an error with what went wrong. If the upload was a success, you&#8217;ll have a url on your clipboard shortened with is.gd, ready for the pasting.</p>
<p>Enjoy</p>
<p>Update: Bonus: Here&#8217;s how you can make use of my script without needing Compiz. I haven&#8217;t tested it yet, but it should work. You&#8217;ll need Imagemagick installed.</p>
<blockquote><p>#!/bin/bash</p>
<p>import /tmp/screenshot.png</p>
<p>/path/to/other/script /tmp/screenshot.png</p></blockquote>
<p>Save that and bind it to a hotkey and you should be good to go.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zachtib.com/2010/05/fast-screenshot-sharing-in-linux/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Automatic offsite WordPress backups</title>
		<link>http://blog.zachtib.com/2008/09/automatic-offsite-wordpress-backups/</link>
		<comments>http://blog.zachtib.com/2008/09/automatic-offsite-wordpress-backups/#comments</comments>
		<pubDate>Wed, 24 Sep 2008 15:38:27 +0000</pubDate>
		<dc:creator>Zach</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[howto]]></category>

		<guid isPermaLink="false">http://collegegeek.org/?p=363</guid>
		<description><![CDATA[Yesterday, I decided to set up a an automated backup solution for my site here.  Basically, it does an sqldump then sends the dump to another server over SCP. First, I had to enable SSH login without a password in &#8230; <a href="http://blog.zachtib.com/2008/09/automatic-offsite-wordpress-backups/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Yesterday, I decided to set up a an automated backup solution for my site here.  Basically, it does an sqldump then sends the dump to another server over SCP.</p>
<p>First, I had to enable SSH login without a password in order for SCP to work in a cronjob.  I followed <a href="http://www.spaceprogram.com/knowledge/cron_scp.html" target="_blank">this howto</a> and it worked perfectly.</p>
<p>Then, I created a backup script to be called by cron:</p>
<blockquote><p>#!/bin/sh</p>
<p>cd /home/backups/collegegeek</p>
<p>FNAME=collegegeek-`date +%F`.sql</p>
<p>mysqldump &#8211;add-drop-table -uroot -pPASSWORDHERE collegegeek &gt; $FNAME<br />
bzip2 $FNAME<br />
rm $FNAME<br />
scp $FNAME.bz2 zach@192.168.1.82:backups/<br />
echo &#8220;Nightly Backup Successful: $(date)&#8221; &gt;&gt; /home/backups/blogbackup.log</p></blockquote>
<p>This will also leave a copy on the local server on the /home partition.  Note that /home is on a different physical drive than /var, so if the drive with the SQL database goes down, I should have a local copy as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zachtib.com/2008/09/automatic-offsite-wordpress-backups/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using VMware to Build and Run XP Embedded</title>
		<link>http://blog.zachtib.com/2008/06/using-vmware-to-build-and-run-xp-embedded/</link>
		<comments>http://blog.zachtib.com/2008/06/using-vmware-to-build-and-run-xp-embedded/#comments</comments>
		<pubDate>Wed, 18 Jun 2008 01:28:24 +0000</pubDate>
		<dc:creator>Zach</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[XPe]]></category>

		<guid isPermaLink="false">http://collegegeek.org/?p=155</guid>
		<description><![CDATA[Update 9/2011: Unfortunately, I&#8217;ve lost the .sld files that are referenced in this article. At this point, the information here is probably quite out of date. While some of it may still be of use, you may want to look &#8230; <a href="http://blog.zachtib.com/2008/06/using-vmware-to-build-and-run-xp-embedded/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>Update 9/2011: </strong>Unfortunately, I&#8217;ve lost the .sld files that are referenced in this article. At this point, the information here is probably quite out of date. While some of it may still be of use, you may want to look elsewhere for getting XPe running in a virtual machine.</p>
<p>XP Embedded Studio isn&#8217;t actually a horrible application at it&#8217;s core.  Now, the user interface and documentation are God-awful, which is why I&#8217;m writing this post.  As you saw in my last two entries, I&#8217;ve been working with XPe for the last few days, and there has been plenty of frustration to go along with it.  What should have been a fifteen minute task wound up taking several days.  However, one week and a few dozen BSODs later, I present this how to:<br />
<span id="more-155"></span></p>
<p>The idea here is to use VMware to not only run, but create your XPe images, though you could easily do the development in your host environment with only minor changes to these directions.</p>
<h3><span style="text-decoration: underline;">Step 1: Prepare your development environment</span></h3>
<p>First, let&#8217;s get the virtual machines set up.  You&#8217;ll need at least two, one for doing the development, and another to test the image.  The first image is just a regular Windows XP virtual machine.  I already had a Windows XP Pro virtual machine that I use on a daily basis, so I just used that.  You&#8217;ll need to set up the Windows XP Embedded development environment.  If you don&#8217;t already have it, you can download a 30 day evaluation copy <a href="http://www.microsoft.com/downloads/details.aspx?familyid=dacd1722-256b-48c5-91c1-af6062340efc&amp;displaylang=en" target="_blank">from Microsoft.</a></p>
<p>Now, go ahead and create the second virtual machine, which you will use to run your XPe image.  Create a new VM in VMware and choose Windows XP Professional as the Guest OS. (Note: If you are using WS 6.5 or later, you don&#8217;t want to use easy install.  Choose to install the guest OS later.)  I selected some pretty basic specs for the VM:</p>
<ul>
<li>Memory: 256MB</li>
<li>Processors: 1</li>
<li>Hard Disk (IDE 0:0): 512MB</li>
</ul>
<p>It doesn&#8217;t take much to run XPe, and those listed specs should be fine unless you&#8217;ll be putting a lot of data on the image.</p>
<p>Now that your VM is created, you need to add it&#8217;s hard drive to your original XP VM.  Make sure your XP VM is shut down, then open the Virtual Machine Settings dialog and click Add.  Choose to add a new Hard Disk, and when prompted, choose to add an existing virtual disk.  Navigate to your XP Embedded Virtual Machine and choose the vmdk associated with it.  After it has been added, open the Advanced properties for that disk and make it Independent and Persistent.</p>
<h3><span style="text-decoration: underline;">Step 2: Load a profile of your virtual hardware</span></h3>
<p>This was the part that gave me grief.  Fortunately for you, you can benefit from my experience.  You need a profile of the hardware you will be running XPe on so that XPe knows which drivers to load.</p>
<h3><span style="text-decoration: underline;">Step 2a: The easy way</span></h3>
<p>I have prepared a component for Windows XPe that will automatically load in a set of generic drivers that are capable of running on VMware virtual hardware version 6, which is the version used in Workstation 6.0.  If you are using Workstation 6.5, it uses version 7 of VMware&#8217;s virtual hardware.  Chances are you&#8217;ll still be able to use my component, and you should definately try it.</p>
<p><a href="http://collegegeek.org/uploads/vmware/vmware6.sld">Download my XPe VMware Component</a></p>
<p>You&#8217;ll need to install the .sld file using the Component Database Manager.</p>
<p>If you ultimately wind up with an unbootable XPe image, you&#8217;ll want to come back and perform the steps in 2b, but for now, proceed to step 3.</p>
<h3><span style="text-decoration: underline;">Step 2b: The not-so-easy way</span></h3>
<p>So, you need to create your own profile for your virtual machine.  First, you&#8217;ll want to create a third VM.  Again, it should be Windows XP Professional, and the hardware should be as similar to your XPe VM as possible, though you&#8217;ll need more hard drive space.  I wound up needing about 1.5GB of disk space for this step, but it wouldn&#8217;t be a bad idea to allocate more just in case.</p>
<p>Install Windows XP Professional (Professional is important here) on the new virtual machine.  It&#8217;s very important that you DO NOT install VMware tools on this VM (This gave me trouble during my experimenting).  This means that if you&#8217;re using VMware 6.5 or later, you need to install the OS manually and not use Easy Install. (Note: You don&#8217;t need to bother activating this VM if you don&#8217;t want to, you&#8217;ll only need it for a minute.)</p>
<p>Once you have a vanilla installation of XP Pro up and running, you&#8217;ll need some of the XPe tools.  Go back to that link I posted near the beginning of this post and download and run the XPe downloader again.  This time, you only need the Windows XP Embedded SP1 Tools package, which is around 7 MB.</p>
<p>Let that download and start(You may get a warning, ignore it), then choose to Browse the CD.  Open the fodler named XPE and look for a file named TAP.EXE (Or probably just TAP, as XP will hide the file extensions by default).  Double-click it and it will run, leaving behind a file named devices.pmq in that same directory.  Now you need to get that pmq file back to your original XP VM where you&#8217;re doing the XPe development.  I just opened Internet Explorer and Gmailed it to myself.  Once you have the pmq file, you don&#8217;t need this extra VM anymore and you can delete it.</p>
<p>Back in your original VM, grab your devices.pmq file and put it somewhere on the hard drive.  Now open Microsoft Component Designer and choose File &gt; Import and open devices.pmq.  Go through the import process, then if you want you can give your component a name and other info.  Finally, save the component as a *.sld file and then import that sld using the Component Database Manager.  Now your component should be available when building XPe images.</p>
<h3><span style="text-decoration: underline;">Step 3: Create the Image</span></h3>
<p>Open the XPe Target Designer and start a new project.  On the left hand side of the window, you should see a list of components, including the VMware hardware profile that you either downloaded from me or created yourself.  Double click it to add it to the project.</p>
<p>Now, press F5 to perform a dependency check.  It will run through and automatically add most of the needed components, but it will need your input on a few of them.  If you are using my profile, you should wind up with 6 errors, which will be displayed at the bottom of the screen.  For each item, double click the icon next to it to see the list of available components that will satisfy that dependency.  Choose the components that best suit your need, but for a standard set up, I recommend using the following whenever they come up as options:</p>
<ul>
<li>NT Loader</li>
<li>FAT</li>
<li>Windows Logon</li>
</ul>
<p>After all of the dependencies are taken care of, it&#8217;s time to&#8230; run another dependency check!  For some reason, Microsoft doesn&#8217;t do recursive dependency checking here.  Press F5 again, and wait for it to finish.  At this point there should be one more error, the shell.  Handle this one just like the last set.  For a standard set up, I&#8217;d recommend just using the Explorer Shell.</p>
<p>Continue to run dependency checks until it comes back with no errors.</p>
<p>You&#8217;re almost there.  At this point, it&#8217;s a good idea to save your work.</p>
<h3><span style="text-decoration: underline;">Step 4: Prepare the virtual disk</span></h3>
<p>Open up XP&#8217;s built in disk manager and find your XPe VM&#8217;s hard drive that you attached to your original XP VM.  Make sure it is initialized, then partition and format the entire disk as FAT32.</p>
<p>You&#8217;ll also need to make sure that the partition is marked as bootable.  You can do this however you like, I booted the VM to an Ubuntu Live CD and used the built in partition editor.</p>
<h3><span style="text-decoration: underline;">Step 5: Build XP Embedded</span></h3>
<p>Back in the Target Designer, you need to build the XPe image.  To do this, press F7.  For build type, choose Release.  For Destination, enter the path where your XPe VM&#8217;s is mounted, for example, D: or E:.  Note that it will be mounted at C: in XPe.  Finally, press Build.  If all goes well, you will get no errors, and maybe a warning or two.</p>
<h3><span style="text-decoration: underline;">Step 6: Run it</span></h3>
<p>Only one VM can access a particular vmdk at a time, so you&#8217;ll want to suspend your XP VM now.  Once that&#8217;s done, switch over to your XPe VM and power it on.  If you&#8217;ve done everything correctly, you should be a Windows XP Embedded loading screen, then the First Boot Assistant, after which it will boot into your embedded environment.</p>
<p>Congratulations! You now have a minimal XPe system that is capable of running on virtual hardware.  In order to add additional components to your XPe image, shut down the VM and resume your original XP VM.  Modify the image as you see fit, then reformat the target disk and build again.  There shouldn&#8217;t be a need to mark the partition as bootable again.</p>
<p>If your XPe image crashed, you&#8217;ll need to do some debugging.  If you were using my pre-made profile, go back to Step 2b and create a profile yourself.  This should be guaranteed to work, but if not, I&#8217;d start by checking for information on MSDN.  If your image is crashing with a BSOD, try Googling the error number and seeing what you get.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zachtib.com/2008/06/using-vmware-to-build-and-run-xp-embedded/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
	</channel>
</rss>

