<?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>Fortress of Solitude</title>
	<atom:link href="http://blag.koveras.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://blag.koveras.org</link>
	<description>Just Another Nerdy Blog</description>
	<lastBuildDate>Wed, 09 May 2012 13:23:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>How to install JDK from PowerShell silently</title>
		<link>http://blag.koveras.org/2011/12/24/how-to-install-jdk-from-powershell-silently/</link>
		<comments>http://blag.koveras.org/2011/12/24/how-to-install-jdk-from-powershell-silently/#comments</comments>
		<pubDate>Sat, 24 Dec 2011 10:24:39 +0000</pubDate>
		<dc:creator>Koveras</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[msi]]></category>
		<category><![CDATA[powershell]]></category>

		<guid isPermaLink="false">http://blag.koveras.org/?p=91</guid>
		<description><![CDATA[A couple of days ago, I have fought long and hard battle against JDK (Java Developer Kit) installation packages. The goal was to deploy the JDK offline to a custom path on a Windows (XP + 7) system using a &#8230; <a href="http://blag.koveras.org/2011/12/24/how-to-install-jdk-from-powershell-silently/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A couple of days ago, I have fought long and hard battle against JDK (Java Developer Kit) installation packages. The goal was to deploy the JDK offline to a custom path on a Windows (XP + 7) system using a PowerShell script. The problem was that the jdk.exe installer (the only one available from Sun) has trouble parsing INSTALLDIR value if it contains whitespace (e.g. &#8220;C:\Program Files&#8221;). Also, PowerShell has trouble interpreting parameters containing with escaped quotes in the middle, like <code>/v"something"</code>.</p>
<p><span id="more-91"></span></p>
<p>I have slowly pieces together a solution from following sources:</p>
<ul>
<li><a href="http://stackoverflow.com/questions/2624459/how-to-suppress-quotes-in-powershell-commands-to-executables/3999955#3999955">http://stackoverflow.com/questions/2624459/how-to-suppress-quotes-in-powershell-commands-to-executables/3999955#3999955</a></li>
<li><a href="http://docs.oracle.com/javase/1.5.0/docs/guide/deployment/deployment-guide/silent.html">http://docs.oracle.com/javase/1.5.0/docs/guide/deployment/deployment-guide/silent.html</a></li>
<li><a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4966488">http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4966488</a></li>
</ul>
<p>The final PowerShell script looks like this:</p>
<p><code>$installDir = 'C:\Program Files\JDK\' # Just an example, of course<br />
$arguments = @(<br />
'/s', "/v/qn`" INSTALLDIR=\`"$installDir\`" REBOOT=Supress IEXPLORER=0 MOZILLA=0 /L \`"install.log\`"`""<br />
)<br />
$proc = Start-Process "jdk.exe" -ArgumentList $arguments -Wait -PassThru<br />
if($proc.ExitCode -ne 0) {<br />
Throw "ERROR"<br />
}</code></p>
<p>Note the double escape characters in the second argument, which basically contains all the non-switch parameters for the installer. The backslash in &#8220;<code>\`"</code>&#8221; escapes the double quote for JDK installer program, while the grave accent escapes it for PowerShell. Also note the space before <code>INSTALLDIR=...</code>: for some reason, if it is omitted, the installer will fail.</p>
<p>I have tested that script on both WinXP (32bit JDK) and Win7 (64bit JDK) machines and it works like a charm. It also works for JRE installers, which have similar problems with passing arguments. Oh, and a bit of advice if you install 64bit JDK and 32 bit JRE on the same system: do it in the JRE-&gt;JDK order, not the other way around.</p>
<p><strong>UPDATE 21.03.12:</strong> Richard Neff suggested adding the info on setting the machine-level environment variable JAVA_HOME in the same script. It&#8217;s actually quite simple:</p>
<p><code>[environment]::SetEnvironmentVariable('JAVA_HOME', $installDir, 'machine')</code></p>
<p>Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://blag.koveras.org/2011/12/24/how-to-install-jdk-from-powershell-silently/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to copy HTML tables to MS Excel</title>
		<link>http://blag.koveras.org/2011/09/10/how-to-copy-html-tables-to-ms-excel/</link>
		<comments>http://blag.koveras.org/2011/09/10/how-to-copy-html-tables-to-ms-excel/#comments</comments>
		<pubDate>Sat, 10 Sep 2011 09:38:54 +0000</pubDate>
		<dc:creator>Koveras</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[ms office]]></category>

		<guid isPermaLink="false">http://blag.koveras.org/?p=83</guid>
		<description><![CDATA[A quite simple question, really, but I&#8217;ve had some trouble with it today. Basically, the answer depends on your browser: Internet Explorer (at least the v9.0.2 that I have) allows you to copy an HTML table with Ctrl-C and paste &#8230; <a href="http://blag.koveras.org/2011/09/10/how-to-copy-html-tables-to-ms-excel/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A quite simple question, really, but I&#8217;ve had some trouble with it today.</p>
<p><span id="more-83"></span>Basically, the answer depends on your browser:</p>
<ul>
<li>Internet Explorer (at least the v9.0.2 that I have) allows you to copy an HTML table with Ctrl-C and paste it directly into Excel with Ctrl-V. All data, including hyperlinks and images will be copied to Excel, which can become a problem if you only want text data.</li>
<li>Mozilla Firefox (I have the v6.0.2) isn&#8217;t on speaking terms with the MS Office, so when you try to copy-paste HTML tables into Excel, you get it all crammed into a single cell. There is a trick, however: copy-paste the table from Firefox to Notepad. This will create a tab-separated &#8220;table&#8221;, which can be then copy-pasted to Excel (at least the Excel 2007 SP2). This will strip the data off hyperlinks, formatting, and images (replaced by alt-texts), however.</li>
</ul>
<p>So there. Depending on whether you want to preserve the formatting or get rid of it, you should take one browser or the other.</p>
]]></content:encoded>
			<wfw:commentRss>http://blag.koveras.org/2011/09/10/how-to-copy-html-tables-to-ms-excel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to make Ace Combat 3 [JP] run on Windows 7 and XP</title>
		<link>http://blag.koveras.org/2011/09/05/how-to-make-ace-combat-3-jp-run-on-windows-7/</link>
		<comments>http://blag.koveras.org/2011/09/05/how-to-make-ace-combat-3-jp-run-on-windows-7/#comments</comments>
		<pubDate>Mon, 05 Sep 2011 09:32:45 +0000</pubDate>
		<dc:creator>Koveras</dc:creator>
				<category><![CDATA[emulators]]></category>
		<category><![CDATA[games]]></category>

		<guid isPermaLink="false">http://blag.koveras.org/?p=69</guid>
		<description><![CDATA[Ace Combat 3: Electrosphere was an amazing game. There are two problems with it, however. First, it&#8217;s real old. Like, PlayStation 1 old. Older than Jesus, as some would say. Second, the export version of it sucks. It&#8217;s not a &#8230; <a href="http://blag.koveras.org/2011/09/05/how-to-make-ace-combat-3-jp-run-on-windows-7/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a title="In this case, Wikia has better content than the Mighty Pedia." href="http://acecombat.wikia.com/wiki/Ace_Combat_3:_Electrosphere" target="_blank"><em>Ace Combat 3: Electrosphere</em></a> was an amazing game. There are two problems with it, however. First, it&#8217;s real old. Like, PlayStation 1 old. Older than Jesus, as some would say. Second, the export version of it sucks. It&#8217;s not a personal opinion but the harsh truth. Therefore, in order to play the original <em>Electrosphere</em>, you will have to put a lot of effort into it first.</p>
<p><span id="more-69"></span>What you will need:</p>
<ul>
<li>Images of the two original Japanese CDs of <em>Ace Combat 3: Electrosphere</em>. I will <strong>not</strong> tell you where to get them other than legally buying them from a collector or eBay.co.jp. Consider it the first test of your dedication to the series and this game in particular. You can&#8217;t proceed until you beat it.</li>
<li>A PlayStation 1 emulator. I used <a title="ePSXe download page" href="http://www.epsxe.com/download.php" target="_blank">ePSXe (1.7.0 for Win32)</a> because, really, it&#8217;s <em>the</em> industry standard PSX emulator by now (too bad it&#8217;s not available in 64 bit).</li>
<li>A PlayStation BIOS image. I used SCPH7502.bin, as recommended by the ePSXe crew. Again, I will not tell you where to download it, so <a title="Google is your friend." href="http://www.google.com/search?q=SCPH7502.bin" target="_blank">google it</a>.</li>
<li>An ePSXe GPU plugin for your graphic card. They are all available from <a title="Whoever that dude is, he's awesome." href="http://www.pbernert.com/html/gpu.htm" target="_blank">a certain Pete&#8217;s page</a>; I used the &#8220;Pete&#8217;s OpenGL2 PSX GPU&#8221; because I have an ATI Radeon HD 3200 in my laptop. If you are not certain which plugin to get, refer to the <a title="I'm fresh out of witty comments." href="http://www.epsxe.com/files/ePSXe_FAQ.txt" target="_blank">ePSXe FAQ</a>, the section titled &#8220;Choosing the best GPU plugin&#8221;.</li>
<li>And just in case your ePSXe installation decides to be bitchy, get the <a title="SourceForge is your friend, too." href="http://sourceforge.net/projects/libpng/files/zlib/1.2.3/zlib123-dll.zip/download" target="_blank">zlib1.dll file from SourceForge</a>.</li>
</ul>
<p>If you want to play the game using a real controller rather than on your keyboard (which I recommend unless your keyboard is designed for such abuse), you will further need:</p>
<ul>
<li>A PlayStation-compatible USB game controller. I took a DualShock 3 from my PS3 because I am used to it.</li>
<li>A Windows driver for DualShock controllers. Get the latest ZIP file appropriate for your operating system (32 or 64 bit) from <a title="I know it looks shady but it's been trustworthy... so far." href="http://www.motioninjoy.com/download" target="_blank">the MotionInJoy homepage</a>.</li>
</ul>
<p>Now that you have all the stuff, break out your shaman tambourine and begin:</p>
<ol>
<li>Unpack the contents of epsxe170.zip you just downloaded to somewhere. It can be C:\Program Files (x86)\epsxe170 but needs not be. I will henceforth refer to this root installation directory as &#8220;\epsxe170&#8243;.</li>
<li>Place your SCPH7502.bin into the \epsxe170\bios folder.</li>
<li>Open the ZIP archive you downloaded from Pete&#8217;s site and extract <em>only the file</em> gpuPeteOpenGL2.dll (or whatever the only DLL in your package is called) to the folder \epsxe170\plugins.</li>
<li>Open the ZIP archive you downloaded from SourceForge and extract <em>only the file</em> zlib1.dll to \epsxe170 (right next to ePSXe.exe).</li>
</ol>
<p>The next steps are only relevant if you want to play with a controller.</p>
<ol start="5">
<li>Unpack the MotionInJoy ZIP and start the EXE inside to install it. I recommend to do so in admin mode, because, you know, drivers.</li>
<li>Once MotionInJoy application is installed and starts up (again, preferably in admin mode), go to the &#8220;Driver Manager&#8221; tab.</li>
<li>Connect your controller to a USB port and wait for it to appear between the blue bar with instructions in it and the buttons bar underneath it. It may take some time but not longer than 2-3 minutes.</li>
<li>Select the controller and press the &#8220;Load driver&#8221; button. Again, it may take some time, but wait until a success log appears underneath the buttons.</li>
<li>Windows may say it needs to restart at this point but ignore and cancel it.</li>
<li>Go back to the &#8220;Profile&#8221; tab. Your controller should now appear in the drop down menu under &#8220;Connected game controller(s):&#8221; and the red bar to the right of it should be blinking.</li>
<li>Select the &#8220;PlayStation 3&#8243; radio button and click &#8220;Options&#8221; next to it.</li>
<li>For some reason, in my initial installation, two D-Pad buttons (up and down) were mapped to numbered &#8220;Directx input&#8221; keys (12 and 13) , while the other two weren&#8217;t. This led to me being later unable to map the controller keys to the &#8220;simulated&#8221; controller in ePSXe, so make sure all D-Pad buttons are mapped to numbered &#8220;Directx input&#8221; keys.</li>
<li>Also, while you are at it, you might want to set &#8220;Axis Rz&#8221; and &#8220;Axis Slider&#8221; inputs to &#8220;None&#8221; because you won&#8217;t need them anyway and it will be easier to map the controller&#8217;s other buttons that way.</li>
<li><strong>Press the &#8220;Enable&#8221; button</strong> (highlighted because it&#8217;s so easy to forget) to activate the analogue controls (thumb sticks)</li>
<li>Optionally, press the &#8220;Game Controller Panel&#8221; button. It will open the standard Windows controller overview, where you can check whether your controller works (via &#8220;Properties&#8221; button).</li>
</ol>
<p>OK, back to the general part:</p>
<ol start="16">
<li>Start \epsx170\ePSXe.exe. On first start, it should pop up a configuration wizard. Otherwise, select Config -&gt; Wizard Guide in the top menu.</li>
<li>For BIOS, choose the only one you&#8217;ve downloaded.</li>
<li>For Video, ditto.</li>
<li>For Sound, the default plugin that comes bundled with ePSXe (ePSXe SPU Core 1.7.0) will do.</li>
<li>For CDROM, confirm whichever standard option is pre-selected.</li>
<li>For controller, confirm the default values if you want to play with the keyboard, otherwise, see next section. You can also access the controller configuration from main menu: Config -&gt; Game Pad -&gt; Port 1 -&gt; Pad 1.</li>
</ol>
<p>Again, the next part is for controller users only:</p>
<ol start="22">
<li>Select &#8220;[SCPH-1200] DualShock (F5)&#8221; in the top-right corner drop down menu.</li>
<li>In the &#8220;Rumble&#8221; box on the right, select: &#8220;DXJoy1&#8243; for Type, &#8220;Sine&#8221; for both Big and Small Motor.</li>
<li>Inputting the key mappings in the central diagram was the tricky part, at least for me, because my controller seems to have been constantly sending the &#8220;Slider&#8221; signal to the PC because I didn&#8217;t hold it in a perfectly horizontal position. So, when I clicked onto an input field and pressed the corresponding button, it was instantly overridden by the continuous &#8220;Slider&#8221; signal. I have come up with this trick: click into an input field, press <em>and hold</em> the intended button, then click into the next input field with the mouse in your other hand. For the thumb sticks (red and blue lines on the diagram), I found that holding them all the way down in a certain direction would make the intended button code appear in the input field, after which I could click away. After inputting the final field, click OK.</li>
<li>Don&#8217;t look at me like that. If you want to use a controller, you should have at least this much finger dexterity. Anyway, here is a picture of what it should look like when done:
<p><div id="attachment_73" class="wp-caption aligncenter" style="width: 310px"><a href="http://blag.koveras.org/wp-content/uploads/2011/09/Controller.png"><img class="size-medium wp-image-73" title="Controller" src="http://blag.koveras.org/wp-content/uploads/2011/09/Controller-300x234.png" alt="My controller settings." width="300" height="234" /></a><p class="wp-caption-text">My ePSXe controller settings.</p></div></li>
</ol>
<p>This next part is relevant only if you have a wide screen or don&#8217;t like the original (notoriously low-res) video output of PS1 games to be stretched out, and only if you have an ATI graphic card like myself (though I am sure NVIDIA ones have something similar).</p>
<ol start="26">
<li>Go to Control Panel -&gt; Display -&gt; Display properties.</li>
<li>Reduce your resolution to 800 x 600.</li>
<li>Go to Advanced properties -&gt; Catalyst Control Center -&gt; ATI Catalyst Control Center.</li>
<li>Go to Graphics (top-left) -&gt; Desktops &amp; Display.</li>
<li>Click on the small triangle next to the <em>small display symbol underneath</em> to bring up a context menu. The large display above will not have the option you need. In the context menu, click &#8220;Configure&#8230;&#8221;</li>
<li>In the Attributes -&gt; Scaling box select either &#8220;Maintain aspect ratio&#8221; (video will be upscaled) or &#8220;Centered&#8221; (video will remain in original resolution) radio button.</li>
</ol>
<p>And back to the general part again:</p>
<ol start="32">
<li>In ePSXe, choose &#8220;File -&gt; Run ISO&#8221; in the main menu, then select your <em>Electrosphere</em> CD1 image.</li>
<li>If it shows the &#8220;Analog Off&#8221; message in the top-right corner on start up, press F5 (repeatedly, if it doesn&#8217;t work the first time) until it changes to &#8220;Analog On&#8221; and disappears.</li>
<li>Once you see the red Namco logo appear on the screen, you&#8217;ve made it.</li>
</ol>
<p>That is it. Now that you have reached this point, you <em>have</em> to beat all five endings of the game on Very Hard difficulty, simply to make the ridiculous amount of time and effort you invested into setting it up worth it. <img src='http://blag.koveras.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Oh, and one last thing: on PS1, especially in Japanese games, the Circle button meant &#8220;Confirm&#8221; and the Cross meant &#8220;Cancel&#8221;. Have fun.</p>
<p><strong>EDIT 2011-10-11</strong>: Just tested the guide above on my other PC with Windows XP x86. Essentially, it&#8217;s the same thing, though I couldn&#8217;t get MotionInJoy to work since it apparently only works with .NET 3.5 and I recently updated to 4.0. No matter, I found my old Saitek USB controller for PC and set it up. Worked like a charm. Also, I couldn&#8217;t bother to look for Aspect ratio settings in the Nvidia settings (have a GeForce on this machine), so I just found an option for this in my monitor hardware settings.</p>
]]></content:encoded>
			<wfw:commentRss>http://blag.koveras.org/2011/09/05/how-to-make-ace-combat-3-jp-run-on-windows-7/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>What is a trope?</title>
		<link>http://blag.koveras.org/2011/08/23/what-is-a-trope/</link>
		<comments>http://blag.koveras.org/2011/08/23/what-is-a-trope/#comments</comments>
		<pubDate>Tue, 23 Aug 2011 18:28:23 +0000</pubDate>
		<dc:creator>Koveras</dc:creator>
				<category><![CDATA[writing]]></category>

		<guid isPermaLink="false">http://blag.koveras.org/?p=55</guid>
		<description><![CDATA[Recently, I have been excessively active on the TV Tropes wiki, and I have noticed that a lot of new &#8220;trope&#8221; suggestions are not tropes at all. I believe the reason for this is the lack of understanding of  the &#8230; <a href="http://blag.koveras.org/2011/08/23/what-is-a-trope/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Recently, I have been excessively active on the <a title="Don't click here if you don't wanna be stuck for hours." href="http://tvtropes.org/" target="_blank">TV Tropes</a> wiki, and I have noticed that a lot of new &#8220;trope&#8221; suggestions are not tropes at all. I believe the reason for this is the lack of understanding of  the term &#8220;trope&#8221; in the TV Tropes&#8217; <a title="Don't click here, seriously." href="http://tvtropes.org/pmwiki/pmwiki.php/Main/Trope" target="_blank">sense of this word</a>. In the following discourse, I will attempt to answer the question &#8220;What is a trope?&#8221; to the best of my understanding.</p>
<p><span id="more-55"></span></p>
<p>To begin with the basic definitions, the <a title="Do. Not. Click. It." href="http://tvtropes.org/pmwiki/pmwiki.php/SoYouWantTo/WriteAStory" target="_blank">most universal formula</a> of a story I know reads &#8220;A character wants something badly and is having trouble getting it.&#8221; This is effectively what 99% of stories boil down to: the same thing repeated over and over again throughout thousands of books, plays, movies, TV series, etc.. And it&#8217;s not even a very complex or exciting one. From an alien point of view, we humans must be so weird, getting a kick out of such dumb and repetitive entertainment.</p>
<p>But the devil is in the details. Who is this character? What is it that they want? What trouble are they having? More importantly, why is the character sympathetic? Why do they want that which they do so badly? Why are they having so much trouble? The questions &#8220;who/what/when/where&#8221; relate to the outer side of a story; the question &#8220;why&#8221; prods its inner workings. The inner story is a swarm of emotions and ideas your readers want you to transmit to them.  The outer story is the medium you use for this transmission. The readers want to see the inner story through the prism of immediate experiences of the outer one.</p>
<p>The writer&#8217;s ability to tell both outer and inner stories in the same work by answering only the four &#8220;outer&#8221; questions is the measure of their skill. It sounds easy but our language makes it tricky by offering constructs to tell inner stories directly, rather than  through their outer manifestations. Thank gods for that, too: our science and other <em>analytical</em> disciplines wouldn&#8217;t get anywhere, had we not invented these abstract terms and concepts. But when it comes to <em>creative</em> storytelling, telling an inner story instead of letting it show through the outer one is deadly. This is the <a title="..." href="http://tvtropes.org/pmwiki/pmwiki.php/Main/ShowDontTell" target="_blank">&#8220;Show, Don&#8217;t Tell&#8221;</a> principle.</p>
<p>Tropes are the bridge between outer and inner stories. They are always twofold: a trope always <em>shows</em> something and it always <em>implies</em> something. What it shows is a small bit of the outer story; what it implies is a piece of the inner story: an emotion or an idea, packaged as a hint or a promise. A great story plays its tropes in such way that they build up to a consistent, logical outer plot but simultaneously offer a myriad of clues, which the readers &#8220;get&#8221;, &#8220;don&#8217;t get&#8221;, or &#8220;get&#8221; differently.</p>
<p>If a &#8220;trope&#8221; only shows something without implying more, it&#8217;s not a trope. For instance, &#8220;Red Hair&#8221; is not a trope but a description of personal appearance. On the other hand, &#8220;<a title="...fine, whatever. Click here, see if I care." href="http://tvtropes.org/pmwiki/pmwiki.php/Main/FieryRedhead" target="_blank">Fiery Redhead</a>&#8221; is, because it <em>shows</em> a character with red hair and <em>implies</em> that this character has a passionate personality. It doesn&#8217;t have to be true but the readers are invited to read between the actual lines. And the writer is invited to play with their expectations.</p>
]]></content:encoded>
			<wfw:commentRss>http://blag.koveras.org/2011/08/23/what-is-a-trope/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to configure Macaw in the &#8220;noob mode&#8221;</title>
		<link>http://blag.koveras.org/2010/12/11/how-to-configure-macaw-in-the-noob-mode/</link>
		<comments>http://blag.koveras.org/2010/12/11/how-to-configure-macaw-in-the-noob-mode/#comments</comments>
		<pubDate>Sat, 11 Dec 2010 19:09:12 +0000</pubDate>
		<dc:creator>Koveras</dc:creator>
				<category><![CDATA[midi]]></category>

		<guid isPermaLink="false">http://blag.koveras.org/?p=41</guid>
		<description><![CDATA[I have recently purchased a MIDI keyboard (this particular model, to be exact) to learn playing piano without annoying the neighbours. As I did, however, I had only a vague idea of how to actually synthesize sounds with it. I &#8230; <a href="http://blag.koveras.org/2010/12/11/how-to-configure-macaw-in-the-noob-mode/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I have recently purchased a <a title="Wikipedia explains" href="http://en.wikipedia.org/wiki/MIDI_keyboard" target="_blank">MIDI keyboard</a> (<a title="German online store" href="http://www.cyberport.de/apple-und-zubehoer/zubehoer-mac/audio/midi-keyboards/4F17-005/sinn7-kontrolux-61.html" target="_blank">this particular model</a>, to be exact) to learn playing piano without annoying the neighbours. As I did, however, I had only a vague idea of how to actually synthesize sounds with it. I thought, surely, there must be tons of software that would allow me to just plug-and-play my controller and enjoy. Reality proved me wrong.</p>
<p><span id="more-41"></span>First off, when I started looking for such software, I faced the immediate problem: what search words are associated with it? &#8220;Software to play a MIDI controller&#8221;? Long story short, it took a few hours before I discovered that what I&#8217;ve been looking for is called &#8220;<a href="http://en.wikipedia.org/wiki/Digital_audio_workstation" target="_blank">digital audio workstation</a>&#8220;. Using Wikipedia to help me, I have discovered that only a few such tools are available for Windows and most of them are not free to use. In the end of the day, the only free Windows program that remained was <a title="Official site" href="http://code.google.com/p/macaw/" target="_blank">Macaw</a>.</p>
<p>So I stuck with Macaw and found that it was perfect for just playing stuff, though getting there was not trivial. The biggest problem I had was that it reacted too well when I didn&#8217;t press a key hard enough and played it very quietly.  Now, it&#8217;s probably great for experienced pianists who can fine tune the volume of their playing that way but a beginner like me, I want to hear the same sound when I press the key and I want to hear it <em>loud</em>. I wanted to be able to play in what I dubbed &#8220;noob mode&#8221;, where the software always played the keys in the same loud volume.</p>
<p>It took some tinkering, as I said, but here is what you have to do:</p>
<ol>
<li>The first thing you&#8217;ll notice when you start up Macaw is that while it obviously recognizes keys being pressed on your keyboard (the MIDI input activity indicator square on the top-right turns yellow), it doesn&#8217;t play any sounds. This is because you first need to create at least one track.</li>
<li>To create a track, right-click under the &#8220;Master Track&#8221; label on the left and select &#8220;Track -&gt; Insert Track&#8221;. Create one track.</li>
<li>Now you need to configure it. To open the track properties, simply click on the &#8220;1: Master&#8221; label. This part is not trivial, by the way. It took me several days to find.</li>
<li>Set &#8220;Name&#8221; to &#8220;Main&#8221; or whatever you want to call it.</li>
<li>Drag Volume (&#8220;Vol&#8221;) all the way up to 127. This will ensure a nice, loud sound later.</li>
<li>Drag Velocity adjustment (&#8220;Vel+&#8221;) all the way up to 127, t00. This is the essential part, since it basically forces Macaw to play each note as if the key was hit with full strength every time.</li>
<li>Set &#8220;Track Output -&gt; Port&#8221; to whatever MIDI driver you prefer (I strongly recommend installing Timidity and a good SoundFont, see <a title="How to configure a SoundFont in Windows 7" href="http://blag.koveras.org/2010/12/04/how-to-configure-a-soundfont-in-windows-7/" target="_blank">my earlier post</a>). This will tell Macaw which sounds to actually play for you.</li>
<li>Optionally, you can also select a different instrument under &#8220;Track Output -&gt; Program/Patch&#8221;. Tip: If you have SGM-V2.01, choose Overdriven Guitar and play some power chords!</li>
<li>In the end, your track config should look something like this:
<p style="text-align: center;"><a href="/wp-content/uploads/2010/12/Macaw_Noob_Mode_Config.png"><img title="Macaw Noob Mode Config" src="/wp-content/uploads/2010/12/Macaw_Noob_Mode_Config-288x300.png" alt="Macaw Noob Mode Config" width="288" height="300" /></a></p>
</li>
<li>Now click OK and try playing something on your keyboard.</li>
</ol>
<p>If you hear those sounds, this how-to was a success. Now go and have fun.</p>
]]></content:encoded>
			<wfw:commentRss>http://blag.koveras.org/2010/12/11/how-to-configure-macaw-in-the-noob-mode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to wait for a remote process in PowerShell</title>
		<link>http://blag.koveras.org/2010/12/06/how-to-wait-for-a-remote-process-in-powershell/</link>
		<comments>http://blag.koveras.org/2010/12/06/how-to-wait-for-a-remote-process-in-powershell/#comments</comments>
		<pubDate>Mon, 06 Dec 2010 12:46:26 +0000</pubDate>
		<dc:creator>Koveras</dc:creator>
				<category><![CDATA[powershell]]></category>

		<guid isPermaLink="false">http://blag.koveras.org/?p=34</guid>
		<description><![CDATA[A short one today. I&#8217;ve been scripting in PowerShell (v1) recently, and had enormous trouble working on remote PCs (the full remoting functionality has not been enabled in our environment yet, so things like Enter-PSSession don&#8217;t work). One thing that &#8230; <a href="http://blag.koveras.org/2010/12/06/how-to-wait-for-a-remote-process-in-powershell/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A short one today. I&#8217;ve been scripting in <a title="Wikipedia's opinion" href="http://en.wikipedia.org/wiki/Windows_PowerShell" target="_blank">PowerShell</a> (v1) recently, and had enormous trouble working on remote PCs (the full remoting functionality has not been enabled in our environment yet, so things like <a title="Opens a remote session with PSExec" href="http://technet.microsoft.com/en-us/library/dd315384.aspx" target="_blank">Enter-PSSession</a> don&#8217;t work). One thing that cost me more nerve cells than usual was the synchronization of remote processes, since PS doesn&#8217;t really offer any means for that by default. I was, however, able to find a workaround.</p>
<p><span id="more-34"></span>Essentially, what you need is the cmdlet <a href="http://technet.microsoft.com/en-us/library/dd347630.aspx" target="_blank">Get-Process</a>. Normally, it returns the object representing a process identified by the PID you pass to it, but thanks to its ability to check for processes on remote computers and the fact that it sets the return code to True if a process corresponding to the PID is found and to False otherwise, it can be abused for our purpose. In fact, following code should do the trick:</p>
<pre>do {
  Get-Process -id $PID -computername $remoteComputerName
} while ($?)</pre>
<p>Where &#8220;$PID&#8221; contains the numeric ID of the process on the remote computer and &#8220;$?&#8221; is the boolean PS command return code. The do-while loop checks the return value of Get-Process inside it and exits once it turns to False (meaning that the remote process can no longer be found, i.e. it terminated).</p>
<p>However, you will soon notice that the Get-Process throws exceptions and prints totally unnecessary output once the process is not found. To avoid that, you need to suppress the exceptions and reroute the output into <a title="Yes, Windows has its own /dev/null" href="http://technet.microsoft.com/en-us/library/dd315279.aspx" target="_blank">Out-Null</a> by adding following to the cmdlet call:</p>
<pre>-ea SilentlyContinue | Out-Null</pre>
<p>Full code in a single line (remove the linebreak):</p>
<pre>do { Get-Process -id $PID -computername $remoteComputerName 
-ea SilentlyContinue | Out-Null } while ($?)</pre>
<p>Alternatively, you can just wrap the whole thing in a subroutine. Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://blag.koveras.org/2010/12/06/how-to-wait-for-a-remote-process-in-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to configure a SoundFont in Windows 7</title>
		<link>http://blag.koveras.org/2010/12/04/how-to-configure-a-soundfont-in-windows-7/</link>
		<comments>http://blag.koveras.org/2010/12/04/how-to-configure-a-soundfont-in-windows-7/#comments</comments>
		<pubDate>Sat, 04 Dec 2010 19:54:58 +0000</pubDate>
		<dc:creator>Koveras</dc:creator>
				<category><![CDATA[midi]]></category>

		<guid isPermaLink="false">http://blag.koveras.org/?p=26</guid>
		<description><![CDATA[As you may already know, the MIDI sound file format does not contain any sounds per se. Instead, it is something like a score sheet that tells your operating system which sounds to play at certain times and for how &#8230; <a href="http://blag.koveras.org/2010/12/04/how-to-configure-a-soundfont-in-windows-7/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>As you may already know, the <a title="Musical Instrument Digital Interface" href="http://en.wikipedia.org/wiki/Musical_Instrument_Digital_Interface" target="_blank">MIDI</a> sound file format does not contain any sounds per se. Instead, it is something like a score sheet that tells your operating system which sounds to play at certain times and for how long. Said sounds are stored on your own hard drive or synthesized in real time by the OS itself.</p>
<p>Long story short, the default sound synthesizers on Windows 7 (and probably earlier versions) suck. The only instrument that sound more or less natural is a piano, whereas the guitars, much less distorted or overdriven ones, sound awful. Those who don&#8217;t have to work with MIDIs often may be fine with just that, but if you would like to compose music on your PC, you definitely need a decent <a title="SoundFonts explained" href="http://en.wikipedia.org/wiki/SoundFont" target="_blank">SoundFont</a>.</p>
<p><span id="more-26"></span>As usual, there exists a perfectly legal and cost-free solution, but you&#8217;ll have to put in some effort. What you&#8217;ll need:</p>
<ul>
<li>An actual SoundFont with good sounds. I recommend <a title="Creator's homepage" href="http://www.geocities.jp/shansoundfont/" target="_blank">SGM-V2.01</a> (<a title="Hosted by FileFront" href="http://www.filefront.com/13962785/SGM-V2.01.zip/" target="_blank">download here</a>) because it&#8217;s free and of very high quality.</li>
<li>The <a title="Wikipedia explains" href="http://en.wikipedia.org/wiki/TiMidity%2B%2B" target="_blank">TiMidity++</a> driver for Windows, or better yet, its installer (<a title="Sourceforge provides" href="http://sourceforge.jp/projects/twsynth/downloads/36408/TiMidity-CVS081206_setup_ENG.exe/" target="_blank">here</a>, ignore the moonspeak, it&#8217;s still in English).</li>
<li><a title="Official site" href="http://www.dosbox.com/" target="_blank">DOSBox</a> (only on Windows 7 and Vista), unless you already have it.</li>
</ul>
<p>What you do:</p>
<ol>
<li>Install TiMidity. It&#8217;s pretty straightforward, you can do it. <strong>EDIT</strong>: The only thing important to remember is to launch the installer with admin privileges, otherwise the driver won&#8217;t get installed properly.</li>
<li>Unpack the SGM archive. Actually, we only need one file: &#8220;SGM-V2.01.sf2&#8243;.</li>
<li>Move the &#8220;SGM-V2.01.sf2&#8243; to &#8220;C:\Program Files (x86)\timidity\musix&#8221; (or wherever you have installed TiMidity).</li>
<li>Edit the configuration file. Actually, TiMidity keeps two config files, but you can edit both, just to be sure (note that both are write-protected by default): &#8220;C:\Windows\timidity.cfg&#8221; and &#8220;C:\Program Files (x86)\timidity\musix\timidity.cfg&#8221;. The files should contain following lines:
<pre>dir "C:\Program Files (x86)\timidity\Musix"

soundfont "SGM-V2.01.sf2" amp=200%</pre>
<p>If you want to know what that means, the driver installation also contain the documentation, go read it.</li>
<li>Reboot your PC.</li>
<li>If you are using XP or earlier Windows, simply go to &#8220;Control Panel -&gt; Sounds and Audio Devices -&gt; Audio&#8221; and select TiMidity++ from the drop down menu under &#8220;MIDI music playback&#8221;. That&#8217;s it, you are done.</li>
<li>Under Win7, you&#8217;ll have to install the DOSBox. In it, type &#8220;mixer /listmidi&#8221; to get he list of available MIDI drivers. It must output something along the lines of:
<pre> 0       "Microsoft GS Wavetable Synth"
 1       "Timidity++ Driver"</pre>
<p>Note the index corresponding to TiMidity.</li>
<li>Open regedit and look for the key &#8220;HKEY_CURRENT_USER\Software\Microsoft\ActiveMovie\devenum\{4EFE2452-168A-11D1-BC76-00C04FB9453B}\Default MidiOut Device&#8221;. There, edit the value of &#8220;MidiOutId&#8221; (default: 0xffffffff) and type in the index of TiMidity from step 7.</li>
<li>Reboot your PC. It must be working now.</li>
</ol>
<p><strong>UPDATE 08.08.2011:</strong> Alkel U3 pointed me towards a small utility called <a title="Vista Midi Picker" href="http://software.bootblock.co.uk/?id=vistamidipicker" target="_blank">Vista Midi Picker</a> that allows you to skip steps 7 through 9 on Win7/Vista. Haven&#8217;t tried it out yet, but it may be helpful.</p>
<p>To test your installation, try playing a MIDI that contains instruments other than piano (like guitars). Have fun.</p>
]]></content:encoded>
			<wfw:commentRss>http://blag.koveras.org/2010/12/04/how-to-configure-a-soundfont-in-windows-7/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>How to generate a deterministic GUID from two strings in Java</title>
		<link>http://blag.koveras.org/2010/12/03/how-to-generate-a-deterministic-guid-from-two-strings-in-java/</link>
		<comments>http://blag.koveras.org/2010/12/03/how-to-generate-a-deterministic-guid-from-two-strings-in-java/#comments</comments>
		<pubDate>Fri, 03 Dec 2010 12:08:13 +0000</pubDate>
		<dc:creator>Koveras</dc:creator>
				<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://blag.koveras.org/?p=12</guid>
		<description><![CDATA[Currently working on MSI packaging for our software and using WiX tool suite to automate the process. Since it was decided that we don&#8217;t want to use patches, I had to implement pseudo-major upgrades for each version.  Now, the problem &#8230; <a href="http://blag.koveras.org/2010/12/03/how-to-generate-a-deterministic-guid-from-two-strings-in-java/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Currently working on MSI packaging for our software and using <a title="WiX website" href="http://wix.sourceforge.net/" target="_blank">WiX tool suite</a> to automate the process. Since it was decided that we don&#8217;t want to use patches, I had to implement <a title="How-to" href="http://wix.sourceforge.net/manual-wix3/major_upgrade.htm" target="_self">pseudo-major upgrades</a> for each version.  Now, the problem with that is that MSI framework doesn&#8217;t really care for version number so much as for the product GUID. In other words, if the version is the same but the product GUID is different (which happens because our build process generates new MSIs every time a module is updated, even if others are not, and the product ID is generated anew with every build), it will run the full uninstall old/install new routine regardless of other factors. This costs extra time during the installation, so I wanted to avoid it if possible.</p>
<p>The idea I had was to write an algorithm that created a unique GUIDs out of a string (or two strings: module/product name and version number). This way I could ensure that the package whose version has not changed will always have the same product GUID, regardless how many times it is rebuilt. The only difficult part was to find a way to make the implementation of said algorithm as simple and stupid as possible.</p>
<p><span id="more-12"></span></p>
<p>As I set off, I discovered that Java (my primary programming language at the moment) already has a nifty <a title="java.util.UUID" href="http://download.oracle.com/javase/1.5.0/docs/api/java/util/UUID.html" target="_blank">UUID class</a>. However, it could only create random UUIDs (the universal term describing what Microsoft calls &#8220;GUID&#8221;) with the static <em>randomUUID()</em> method. Now, there was also <em>nameUUIDFromBytes()</em>, which made the algorithm pathetically easy:</p>
<pre>String tempResult =
  UUID.nameUUIDFromBytes(aSourceString.getBytes()).toString();
System.out.println(tempResult);</pre>
<p>However, the problem with that is that it generates Version 3 UUIDs (read more about versions on the <a title="UUID versions explained" href="http://en.wikipedia.org/wiki/UUID#Definition" target="_blank">Wikipedia</a>) and WiX only accepts Version 4 (like the ones generated by <em>randomUUID()</em>, which are, well, too random). Then I took a look at the standard constructors and saw that there&#8217;s only one and it generates a Version 4 GUID out of two Long numbers (basically, a GUID consists of two 64 bit arrays, read two Long numbers: least significant long and most significant long). Yay! Now, where can I get an <a title="Injective functions explained" href="http://en.wikipedia.org/wiki/Injective_function" target="_blank">injective function</a> that would map a string to a particular Long number?</p>
<p>Immediately, I thought of the MD5 hashes but a bit of googling revealed that there is no single pretty string-to-MD5 hashing function in the standard Java libraries. Unwilling to make my own implementation (simple-stupid, remember), however, I soon found the next best thing: the <a title="java.util.zip.CRC32" href="http://download.oracle.com/javase/1.5.0/docs/api/java/util/zip/CRC32.html" target="_blank">CRC32 class</a>. Now, the beauty of this solution lies in the fact that it&#8217;s a standard library class <em>and</em> it&#8217;s relatively easy to use:</p>
<pre>private CRC32 localCRC32Generator = new CRC32();

public String generateGUID(String anApplication, String aVersion) {
  localCRC32Generator.update(anApplication.getBytes());
  Long tempApplicationChecksum = localCRC32Generator.getValue();
  localCRC32Generator.update(aVersion.getBytes());
  Long tempVersionChecksum = localCRC32Generator.getValue();
  localCRC32Generator.reset();</pre>
<p>Basically, you initialize the CRC32 instance, update it with a byte array generated from the source string, read the Long value, then reset the instance. The last part is essential if you want to generate identical Longs during the entire runtime.</p>
<p>The rest seemed easy at first:</p>
<pre>    return UUID(tempApplicationChecksum, tempVersionChecksum).toString();</pre>
<p>However, I immediately noticed that the resulting UUIDs had a lot of nulls in them. This is because the return values of CRC32.getValue() are 10 digits long and the 64 bit Long is 20 digits. Hence, half of the numbers (higher registers) are padded with nulls in the UUID. So I thought, how to produce two 20 digit Longs out of two 10 digit Longs. The answer is trivial if you know some math:</p>
<pre>  Long tempMSBits = tempApplicationChecksum * tempVersionChecksum;
  Long tempLSBits = tempVersionChecksum * tempVersionChecksum;
  return UUID(tempMSBits, tempLSBits).toString();</pre>
<p>I chose to use tempVersionChecksum as the multiplier in both cases, because it is what actually changes across versions, whereas the tempApplicationChecksum is just there to avoid collisions between product GUIDs of different product packages with the same version. Apropos collisions: I decided that CRC32 has good enough collision resistance for my purposes and the products of the results are distinct enough on such scale.</p>
<p>However, even after that, I was again frustrated by failure. This time, the WiX compiler again claimed that the GUID is invalid. I consulted the Wikipedia again and remembered that the Version 4 GUIDs had several reserved bits, which, of course, are not present in the UUIDs generated by my algorithm thus far. However, that was a minor problem: all I had to do was to wrap the GUID string I got into a StringBuffer, replace the 15th character with a &#8220;4&#8243; and the 20th, with an &#8220;8&#8243;, &#8220;9&#8243;, &#8220;A&#8221;, or &#8220;B&#8221;. Actually, it doesn&#8217;t matter which of the four characters is in the 20th position, it can even be always the same, but I wrote a small subroutine for additional collision resistance. In the end my class looked like this:</p>
<pre>import java.util.UUID;
import java.util.zip.CRC32;

public class VersionToGuidConverter {

  private CRC32 localCRC32Generator = new CRC32();

  public static void main(String[] args) {
    VersionToGuidConverter tempConverter = new VersionToGuidConverter();
    System.out.println(tempConverter.generateGUID(args[0], args[1]));
  }

  public String generateGUID(String anApplication, String aVersion) {
    localCRC32Generator.update(anApplication.getBytes());
    Long tempApplicationChecksum = localCRC32Generator.getValue();
    localCRC32Generator.update(aVersion.getBytes());
    Long tempVersionChecksum = localCRC32Generator.getValue();
    localCRC32Generator.reset();

    Long tempMSBits = tempApplicationChecksum * tempVersionChecksum;
    Long tempLSBits = tempVersionChecksum * tempVersionChecksum;

    StringBuffer tempUUID =
      new StringBuffer(new UUID(tempMSBits, tempLSBits).toString());
    tempUUID.replace(14, 15, "4");
    tempUUID.replace(19, 20,
      convertSecondReservedCharacter(tempUUID.substring(19, 20)));

    return tempUUID.toString();
  }

  private String convertSecondReservedCharacter(String aString) {
    switch (aString.charAt(0) % 4) {
      case 0: return "8";
      case 1: return "9";
      case 2: return "a";
      case 3: return "b";
      default: return aString;
    }
  }
}</pre>
<p>For a cherry tapping, you can add a feature that generates truly random UUIDs (with <em>UUID.randomUUID()</em>) if the Version or Product have a specific value. But that should be easy. Now go and have fun.</p>
]]></content:encoded>
			<wfw:commentRss>http://blag.koveras.org/2010/12/03/how-to-generate-a-deterministic-guid-from-two-strings-in-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Another day, another blog</title>
		<link>http://blag.koveras.org/2010/12/02/another-day-another-blog/</link>
		<comments>http://blag.koveras.org/2010/12/02/another-day-another-blog/#comments</comments>
		<pubDate>Thu, 02 Dec 2010 11:13:18 +0000</pubDate>
		<dc:creator>Koveras</dc:creator>
				<category><![CDATA[blag organization]]></category>

		<guid isPermaLink="false">http://blag.koveras.org/?p=5</guid>
		<description><![CDATA[I&#8217;ve founded yet another blog, though this time, it&#8217;s on my own private site. Go me! Tinkered with the design a little, but I seem to like the default one best. The header image is courtesy of Dru! from Flickr, &#8230; <a href="http://blag.koveras.org/2010/12/02/another-day-another-blog/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve founded yet another blog, though this time, it&#8217;s on my own private site. Go me!</p>
<p>Tinkered with the design a little, but I seem to like the default one best. The header image is <a title="Original image" href="http://www.flickr.com/photos/druclimb/1074136564/" target="_blank">courtesy of Dru! from Flickr</a>, who has been kind enough to publish that awesome picture under the CC-BY-NC licence. Also, the term &#8220;blag&#8221; is an <a title="Blag explained" href="http://xkcd.com/148/" target="_blank">XKCD reference</a>.</p>
<p>That&#8217;s all for now, let&#8217;s see how far I get with this.</p>
]]></content:encoded>
			<wfw:commentRss>http://blag.koveras.org/2010/12/02/another-day-another-blog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

