<?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>Stephan&#039;s Blog &#187; Computer Science</title>
	<atom:link href="http://www.arlt.eu/blog/category/computer-science/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.arlt.eu/blog</link>
	<description>Life in Technicolor.</description>
	<lastBuildDate>Fri, 27 Jan 2012 00:00:00 +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>Office 365 PowerShell Snippets</title>
		<link>http://www.arlt.eu/blog/2012/01/27/office-365-powershell-snippets/</link>
		<comments>http://www.arlt.eu/blog/2012/01/27/office-365-powershell-snippets/#comments</comments>
		<pubDate>Fri, 27 Jan 2012 00:00:00 +0000</pubDate>
		<dc:creator>Stephan</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Office 365]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.arlt.eu/blog/?p=423</guid>
		<description><![CDATA[Well, there exist dozens of Blog posts like &#8220;Howto connect PowerShell to Office 365&#8243; etc. In this post I want to share those commands that I use frequently: First, creating a connection to Office 365: PS &#62; $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection PS &#62; Set-ExecutionPolicy -ExecutionPolicy unrestricted PS [...]]]></description>
			<content:encoded><![CDATA[<p>Well, there exist dozens of Blog posts like &#8220;Howto connect PowerShell to Office 365&#8243; etc. In this post I want to share those commands that I use frequently:</p>
<p>First, creating a connection to Office 365:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">PS &gt; $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
PS &gt; Set-ExecutionPolicy -ExecutionPolicy unrestricted
PS &gt; Import-PSSession $Session</pre></div></div>

<p>Changing the principal name of a user:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">PS &gt; Set-MsolUserPrincipalName –UserPrincipalName user@example.onmicrosoft.com -newUserPrincipalName user@example.com</pre></div></div>

<p>Set the passwords of all users to <em>never expire</em>:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">PS &gt; Get-MSOLUser | Set-MsolUser -PasswordNeverExpires $true</pre></div></div>

<p>Add/Remove mailbox permissions:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">PS &gt; Add-MailboxPermission user@example.com -User admin@example.com -AccessRights FullAccess -InheritanceType All -AutoMapping $false
PS &gt; Remove-MailboxPermission user@example.com -User admin@example.com -AccessRights FullAccess -InheritanceType All -AutoMapping $false</pre></div></div>

<p>Hide/Show a mailbox in the GAL:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">PS &gt; Set-Mailbox user@example.com -HiddenFromAddressListsEnabled $true</pre></div></div>

<p>To be contd.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.arlt.eu/blog/2012/01/27/office-365-powershell-snippets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Accessing KeePass databases from PHP scripts</title>
		<link>http://www.arlt.eu/blog/2011/12/27/accessing-keepass-databases-from-php-scripts/</link>
		<comments>http://www.arlt.eu/blog/2011/12/27/accessing-keepass-databases-from-php-scripts/#comments</comments>
		<pubDate>Tue, 27 Dec 2011 00:00:00 +0000</pubDate>
		<dc:creator>Stephan</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[C/C++]]></category>
		<category><![CDATA[Extension]]></category>
		<category><![CDATA[KeePass]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.arlt.eu/blog/?p=420</guid>
		<description><![CDATA[Always wanted to write an extension for PHP! More precisely, an extension which allows PHP scripts to access KeePass databases. Today I finally found time to read some articles (here, here, and here) on PHP extension writing. I compiled PHP 5.x and KeePass 2., and started the project PHPpw, which is supposed to bring together [...]]]></description>
			<content:encoded><![CDATA[<p>Always wanted to write an extension for <a href="http://www.php.net/">PHP</a>! <img src='http://www.arlt.eu/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  More precisely, an extension which allows PHP scripts to access <a href="http://keepass.info/">KeePass</a> databases. Today I finally found time to read some articles (<a href="http://devzone.zend.com/303/extension-writing-part-i-introduction-to-php-and-zend/">here</a>, <a href="http://devzone.zend.com/317/extension-writing-part-ii-parameters-arrays-and-zvals/">here</a>, and <a href="http://devzone.zend.com/446/extension-writing-part-iii-resources/">here</a>) on PHP extension writing. I compiled PHP 5.x and KeePass 2., and started the project <a href="http://sourceforge.net/projects/phppw/">PHPpw</a>, which is supposed to bring together these 2 worlds (PHP &#038; KeePass). PHPpw (pw = <strong>p</strong>ass<strong>w</strong>ord) is open source and available at <a href="http://sourceforge.net/projects/phppw/">SourceForge.net</a>. The extension is a proof of concept and provides the following PHP functions:</p>
<ul>
<li><strong>keepass_open()</strong>: Opens a KeePass database. The first argument is the filename of the database; the second argument is the masterkey.</li>
<li><strong>keepass_close()</strong>: Closes a previously opened KeePass database.</li>
<li><strong>keepass_get_name()</strong>: Delivers the name of the root folder of the KeePass database.</li>
</ul>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span>keepass_open<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;test.kdbx&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;test1234&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">echo</span> keepass_get_name<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
keepass_close<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>The project has several limitations, e.g., only <strong>one</strong> KeePass database can be used. Further, once a KeePass database is opened, it is accessible to <strong>all</strong> users. Anyway, check out the source code and feel free to join this project today!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.arlt.eu/blog/2011/12/27/accessing-keepass-databases-from-php-scripts/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fehler bei der Synchronisierung einiger Löschungen</title>
		<link>http://www.arlt.eu/blog/2011/07/19/fehler-bei-der-synchronisierung-einiger-loschungen/</link>
		<comments>http://www.arlt.eu/blog/2011/07/19/fehler-bei-der-synchronisierung-einiger-loschungen/#comments</comments>
		<pubDate>Tue, 19 Jul 2011 00:00:00 +0000</pubDate>
		<dc:creator>Stephan</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Fehler]]></category>
		<category><![CDATA[Kommunikation]]></category>
		<category><![CDATA[Mail]]></category>
		<category><![CDATA[Office 365]]></category>
		<category><![CDATA[Outlook 2010]]></category>
		<category><![CDATA[Synchronisation]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.arlt.eu/blog/?p=409</guid>
		<description><![CDATA[Das Zusammenspiel von Office 365 und Outlook 2010 funktioniert noch nicht 100%ig. Nach dem Löschen von Elementen in Outlook 2010 (Mails, Kontakte etc.) wird im Ordner Synchronisierungsprobleme (Sync Issues) die folgende Fehlermeldung erzeugt: Fehler bei der Synchronisierung einiger Löschungen. bzw. Synchronization of some deletions failed. Die Synchronisierung selbst funktioniert fehlerfrei. Das Problem wird schon seit [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-413" title="Office 365" src="http://www.arlt.eu/blog/wp-content/uploads/2011/07/office365.jpg" alt="" width="170" height="170" /> Das Zusammenspiel von Office 365 und Outlook 2010 funktioniert noch nicht 100%ig. Nach dem Löschen von Elementen in Outlook 2010 (Mails, Kontakte etc.) wird im Ordner <strong>Synchronisierungsprobleme</strong> (<strong>Sync Issues</strong>) die folgende Fehlermeldung erzeugt: <strong>Fehler bei der Synchronisierung einiger Löschungen.</strong> bzw. <strong>Synchronization of some deletions failed.</strong></p>
<p>Die Synchronisierung selbst funktioniert fehlerfrei. Das Problem wird schon seit langer Zeit in verschiedenen Microsoft-Foren diskutiert, z.B. <a href="http://community.office365.com/de-de/f/118/t/3549.aspx">hier</a>. Der Workaround, <strong>EnableConflictLogging</strong> in der Registry auf <strong>0</strong> zu setzen, funktioniert nicht. Immerhin bestätigte mir der Support von Office 365, dass der Fehler bekannt sei:</p>
<blockquote><p>Bezüglich Ihrer Serviceanfrage 1157274502 habe ich folgende Informationen für Sie.<br />
Das Problem mit der Outlook ist bei Design. Ich habe es selber getestet und ich bekomme die selben Fehlermeldungen wie Sie. Andere Kollegen von mir, bei reproduzieren, haben das gleichen Problem. Microsoft arbeitet an das Problem zu beseitigen. Wenn Sie möchten Sie können gerne die Abteilung, die sich mit Officepacket beschäftigen, zu kontaktieren.</p></blockquote>
<p>Der einzig funktionierende Workaround ist also, bis zur Problembeseitigung Outlook 2007 einzusetzen. Dort tritt dieses Problem nämlich nicht auf.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.arlt.eu/blog/2011/07/19/fehler-bei-der-synchronisierung-einiger-loschungen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Howto Resize a VirtualBox Disk (VDI)</title>
		<link>http://www.arlt.eu/blog/2011/07/01/howto-resize-a-virtualbox-disk-vdi/</link>
		<comments>http://www.arlt.eu/blog/2011/07/01/howto-resize-a-virtualbox-disk-vdi/#comments</comments>
		<pubDate>Fri, 01 Jul 2011 00:00:00 +0000</pubDate>
		<dc:creator>Stephan</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Datei]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Tool]]></category>
		<category><![CDATA[VirtualBox]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.arlt.eu/blog/?p=410</guid>
		<description><![CDATA[In case you didn&#8217;t know: Finally VirtualBox version >= 4 can resize existing disks (i.e., VDI files). Just use the following VBoxManage command and provide your disk file (VDI) and the needed size in megabytes: VBoxManage modifyhd YOUR_DISK.vdi --resize SIZE_IN_MB]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-thumbnail wp-image-416" title="VirtualBox" src="http://www.arlt.eu/blog/wp-content/uploads/2011/07/virtualbox-150x150.png" alt="" width="150" height="150" />In case you didn&#8217;t know: Finally VirtualBox version >= 4 can resize existing disks (i.e., VDI files). Just use the following <strong>VBoxManage</strong> command and provide your disk file (VDI) and the needed size in megabytes:</p>

<div class="wp_syntax"><div class="code"><pre class="txt" style="font-family:monospace;">VBoxManage modifyhd YOUR_DISK.vdi --resize SIZE_IN_MB</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.arlt.eu/blog/2011/07/01/howto-resize-a-virtualbox-disk-vdi/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Enumerating Child Windows in Silverlight</title>
		<link>http://www.arlt.eu/blog/2011/06/19/enumerating-child-windows-in-silverlight/</link>
		<comments>http://www.arlt.eu/blog/2011/06/19/enumerating-child-windows-in-silverlight/#comments</comments>
		<pubDate>Sun, 19 Jun 2011 00:00:00 +0000</pubDate>
		<dc:creator>Stephan</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Button]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.arlt.eu/blog/?p=407</guid>
		<description><![CDATA[Today I&#8217;d like to give you a short example how to enumerate all child windows in a Silverlight application: 1 2 3 4 5 6 7 8 9 10 11 12 13 void EnumChildWindows&#40;Visual visualParent&#41; &#123; for &#40;int i = 0; i &#60; VisualTreeHelper.GetChildrenCount&#40;visualParent&#41;; i++&#41; &#123; Visual visual = &#40;Visual&#41;VisualTreeHelper.GetChild&#40;visualParent, i&#41;; EnumChildWindows&#40;visual&#41;; &#160; if &#40;visual [...]]]></description>
			<content:encoded><![CDATA[<p>Today I&#8217;d like to give you a short example how to enumerate all child windows in a Silverlight application:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #6666cc; font-weight: bold;">void</span> EnumChildWindows<span style="color: #008000;">&#40;</span>Visual visualParent<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">int</span> i <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span> i <span style="color: #008000;">&lt;</span> VisualTreeHelper<span style="color: #008000;">.</span><span style="color: #0000FF;">GetChildrenCount</span><span style="color: #008000;">&#40;</span>visualParent<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> i<span style="color: #008000;">++</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        Visual visual <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span>Visual<span style="color: #008000;">&#41;</span>VisualTreeHelper<span style="color: #008000;">.</span><span style="color: #0000FF;">GetChild</span><span style="color: #008000;">&#40;</span>visualParent, i<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        EnumChildWindows<span style="color: #008000;">&#40;</span>visual<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>visual <span style="color: #008000;">is</span> Button<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #008080; font-style: italic;">// do something</span>
        <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>In the code snippet above, the child windows are collected recursively. Since EnumChildWindows accepts a visualParent of Type Visual, one can start using the MainWindow object, e.g. obtained via reflection. This technique even finds child windows (buttons, text boxes, etc.) not defined in a XAML file.</p>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.arlt.eu/blog/2011/06/19/enumerating-child-windows-in-silverlight/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>T-Mobile MultiSIM SMS-Empfang</title>
		<link>http://www.arlt.eu/blog/2011/06/10/t-mobile-multisim-sms-empfang/</link>
		<comments>http://www.arlt.eu/blog/2011/06/10/t-mobile-multisim-sms-empfang/#comments</comments>
		<pubDate>Fri, 10 Jun 2011 00:00:00 +0000</pubDate>
		<dc:creator>Stephan</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[MultiSIM]]></category>
		<category><![CDATA[SMS]]></category>
		<category><![CDATA[T-Mobile]]></category>

		<guid isPermaLink="false">http://www.arlt.eu/blog/?p=406</guid>
		<description><![CDATA[Dieser Post ist eigentlich nur eine Gedankenstütze für mich: Wie aktiviert man den SMS-Empfang bei einer MultiSIM von T-Mobile? Lösung: *222# Wie fragt man den Status ab? Lösung: *221# Quelle: http://www.t-mobile.de/T-D1/cds/td1_cds_popup/1,1132,108350-0-,00.html]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.arlt.eu/blog/wp-content/uploads/2011/06/t-mobile-300x88.jpg" alt="" title="T-Mobile" width="300" height="88" class="aligncenter size-medium wp-image-414" /></p>
<p>Dieser Post ist eigentlich nur eine Gedankenstütze für mich: <img src='http://www.arlt.eu/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<ul>
<li>Wie aktiviert man den SMS-Empfang bei einer MultiSIM von T-Mobile?<br />
Lösung: <code>*222#</code></li>
<li>Wie fragt man den Status ab?<br />
Lösung: <code>*221#</code></li>
</ul>
<p>Quelle: <a href="http://www.t-mobile.de/T-D1/cds/td1_cds_popup/1,1132,108350-0-,00.html">http://www.t-mobile.de/T-D1/cds/td1_cds_popup/1,1132,108350-0-,00.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.arlt.eu/blog/2011/06/10/t-mobile-multisim-sms-empfang/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenSSL: Create a self-signed Certificate</title>
		<link>http://www.arlt.eu/blog/2011/02/27/openssl-create-a-self-signed-certificate/</link>
		<comments>http://www.arlt.eu/blog/2011/02/27/openssl-create-a-self-signed-certificate/#comments</comments>
		<pubDate>Sun, 27 Feb 2011 00:00:00 +0000</pubDate>
		<dc:creator>Stephan</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[SSL]]></category>

		<guid isPermaLink="false">http://www.arlt.eu/blog/?p=401</guid>
		<description><![CDATA[This post is just a sticky note, because for testing purposes I have to create a self-signed certificate from time to time. openssl genrsa -des3 -out server.key 1024 openssl req -new -key server.key -out server.csr cp server.key server.key.org openssl rsa -in server.key.org -out server.key openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt [...]]]></description>
			<content:encoded><![CDATA[<p>This post is just a sticky note, because for testing purposes I have to create a self-signed certificate from time to time.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">openssl genrsa -des3 -out server.key 1024
openssl req -new -key server.key -out server.csr
cp server.key server.key.org
openssl rsa -in server.key.org -out server.key
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt</pre></div></div>

<p>These commands have been taken from <a href="http://www.akadia.com/services/ssh_test_certificate.html">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.arlt.eu/blog/2011/02/27/openssl-create-a-self-signed-certificate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenSSL: Convert &amp; Merge Key with Certificate</title>
		<link>http://www.arlt.eu/blog/2011/02/27/openssl-convert-merge-key-with-certificate/</link>
		<comments>http://www.arlt.eu/blog/2011/02/27/openssl-convert-merge-key-with-certificate/#comments</comments>
		<pubDate>Sun, 27 Feb 2011 00:00:00 +0000</pubDate>
		<dc:creator>Stephan</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[SSL]]></category>

		<guid isPermaLink="false">http://www.arlt.eu/blog/?p=400</guid>
		<description><![CDATA[This second sticky note describes how to (1) convert a P12 file to PEM, and how to (2) merge a PEM and a CRT file to P12. # covert openssl pkcs12 -nocerts -in key_in.p12 -out key.pem &#160; # merge openssl pkcs12 -export -inkey key.pem -in pki.crt -out key_out.p12 These commands have been taken from here.]]></description>
			<content:encoded><![CDATA[<p>This second sticky note describes how to (1) convert a P12 file to PEM, and how to (2) merge a PEM and a CRT file to P12.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># covert
openssl pkcs12 -nocerts -in key_in.p12 -out key.pem
&nbsp;
# merge
openssl pkcs12 -export -inkey key.pem -in pki.crt -out key_out.p12</pre></div></div>

<p>These commands have been taken from <a href="http://www.herongyang.com/Cryptography/keytool-Import-Key-openssl-pkcs12-Command.html">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.arlt.eu/blog/2011/02/27/openssl-convert-merge-key-with-certificate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Handling multiple Keyboards in MFC</title>
		<link>http://www.arlt.eu/blog/2010/11/30/handling-multiple-keyboards-in-mfc/</link>
		<comments>http://www.arlt.eu/blog/2010/11/30/handling-multiple-keyboards-in-mfc/#comments</comments>
		<pubDate>Tue, 30 Nov 2010 00:00:00 +0000</pubDate>
		<dc:creator>Stephan</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[input]]></category>
		<category><![CDATA[Keyboard]]></category>
		<category><![CDATA[MFC]]></category>
		<category><![CDATA[raw]]></category>

		<guid isPermaLink="false">http://www.arlt.eu/blog/?p=398</guid>
		<description><![CDATA[If you want to handle more than one keyboard in your MFC application (e.g. a keyboard and a barcode scanner), you can make use of Win API&#8217;s raw input functionality. It allows to determine the associated keyboard of an occurred key press &#8211; just to highlight one interesting use case. The first thing you have [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to handle more than one keyboard in your MFC application (e.g. a keyboard and a barcode scanner), you can make use of Win API&#8217;s raw input functionality. It allows to determine the associated keyboard of an occurred key press &#8211; just to highlight one interesting use case.</p>
<p>The first thing you have to do is the registration of the raw input devices by initializing the <strong>RAWINPUTDEVICE</strong> structure and calling the <strong>RegisterRawInputDevices</strong> method. A detailed description of the magic numbers in the listing below can be found <a href="http://www.microsoft.com/whdc/archive/HID_HWID.mspx">here</a>.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code"><pre class="cpp" style="font-family:monospace;">BOOL CApplication<span style="color: #008080;">::</span><span style="color: #007788;">InitInstance</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
  <span style="color: #666666;">// ...</span>
&nbsp;
  RAWINPUTDEVICE ltDevice<span style="color: #008080;">;</span>
  ltDevice.<span style="color: #007788;">usUsagePage</span> <span style="color: #000080;">=</span> <span style="color: #208080;">0x01</span><span style="color: #008080;">;</span>
  ltDevice.<span style="color: #007788;">usUsage</span> <span style="color: #000080;">=</span> <span style="color: #208080;">0x06</span><span style="color: #008080;">;</span>
  ltDevice.<span style="color: #007788;">dwFlags</span> <span style="color: #000080;">=</span> RIDEV_INPUTSINK<span style="color: #008080;">;</span>
  ltDevice.<span style="color: #007788;">hwndTarget</span> <span style="color: #000080;">=</span> AfxGetMainWnd<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>GetSafeHwnd<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
  <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span> <span style="color: #000040;">!</span>RegisterRawInputDevices<span style="color: #008000;">&#40;</span><span style="color: #000040;">&amp;</span>ltDevice, <span style="color: #0000dd;">1</span>, <span style="color: #0000dd;">sizeof</span><span style="color: #008000;">&#40;</span>RAWINPUTDEVICE<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#41;</span>
  <span style="color: #008000;">&#123;</span>
    <span style="color: #0000ff;">return</span> FALSE<span style="color: #008080;">;</span>
  <span style="color: #008000;">&#125;</span>
&nbsp;
  <span style="color: #666666;">// ...</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>Secondly, you have to implement the <strong>OnRawInput</strong> method of the related CWnd-based class. And, don&#8217;t forget to enable this event handler by inserting <strong>ON_WM_INPUT()</strong> in the message map. The following example illustrates how to extract the keyboard&#8217;s device name of a pressed key.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
</pre></td><td class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">void</span> CMainFrame<span style="color: #008080;">::</span><span style="color: #007788;">OnRawInput</span><span style="color: #008000;">&#40;</span>UINT piInputCode, HRAWINPUT phRawInput<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
  <span style="color: #666666;">// only process foreground inputs</span>
  <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span> RIM_INPUT <span style="color: #000040;">!</span><span style="color: #000080;">=</span> piInputCode <span style="color: #008000;">&#41;</span>
    <span style="color: #0000ff;">return</span><span style="color: #008080;">;</span>
&nbsp;
  <span style="color: #666666;">// determine the size of the resulting RAWINPUTHEADER structure</span>
  UINT liSize<span style="color: #008080;">;</span>
  <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span> <span style="color: #0000dd;">0</span> <span style="color: #000040;">!</span><span style="color: #000080;">=</span> GetRawInputData<span style="color: #008000;">&#40;</span>phRawInput, RID_INPUT, <span style="color: #0000ff;">NULL</span>, <span style="color: #000040;">&amp;</span>liSize, <span style="color: #0000dd;">sizeof</span><span style="color: #008000;">&#40;</span>RAWINPUTHEADER<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#41;</span>
    <span style="color: #0000ff;">return</span><span style="color: #008080;">;</span>
&nbsp;
  <span style="color: #666666;">// determine the actual RAWINPUTHEADER structure</span>
  LPBYTE lpbBuffer <span style="color: #000080;">=</span> <span style="color: #0000dd;">new</span> BYTE<span style="color: #008000;">&#91;</span>liSize<span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
  <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span> liSize <span style="color: #000040;">!</span><span style="color: #000080;">=</span> GetRawInputData<span style="color: #008000;">&#40;</span>phRawInput, RID_INPUT, lpbBuffer, <span style="color: #000040;">&amp;</span>liSize, <span style="color: #0000dd;">sizeof</span><span style="color: #008000;">&#40;</span>RAWINPUTHEADER<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#41;</span>
    <span style="color: #0000ff;">return</span><span style="color: #008080;">;</span>
&nbsp;
  <span style="color: #666666;">// determine the size of the resulting device name's string</span>
  <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span> <span style="color: #0000dd;">0</span> <span style="color: #000040;">!</span><span style="color: #000080;">=</span> GetRawInputDeviceInfo<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>RAWINPUT<span style="color: #000040;">*</span><span style="color: #008000;">&#41;</span>lpbBuffer<span style="color: #008000;">&#41;</span><span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>header.<span style="color: #007788;">hDevice</span>, RIDI_DEVICENAME, <span style="color: #0000ff;">NULL</span>, <span style="color: #000040;">&amp;</span>liSize<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#41;</span>
    <span style="color: #0000ff;">return</span><span style="color: #008080;">;</span>
&nbsp;
  <span style="color: #666666;">// determine the actual string of the device name</span>
  TCHAR <span style="color: #000040;">*</span>lpszDeviceName <span style="color: #000080;">=</span> <span style="color: #0000dd;">new</span> TCHAR<span style="color: #008000;">&#91;</span>liSize<span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
  <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span> <span style="color: #0000dd;">0</span> <span style="color: #000080;">&gt;</span> GetRawInputDeviceInfo<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>RAWINPUT<span style="color: #000040;">*</span><span style="color: #008000;">&#41;</span>lpbBuffer<span style="color: #008000;">&#41;</span><span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>header.<span style="color: #007788;">hDevice</span>, RIDI_DEVICENAME, lpszDeviceName, <span style="color: #000040;">&amp;</span>liSize<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#41;</span>
    <span style="color: #0000ff;">return</span><span style="color: #008080;">;</span>
&nbsp;
  TRACE<span style="color: #008000;">&#40;</span>_T<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;%s<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #008000;">&#41;</span>, lpszDeviceName<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
  <span style="color: #0000dd;">delete</span> <span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> lpbBuffer<span style="color: #008080;">;</span>
  <span style="color: #0000dd;">delete</span> <span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> lpszDeviceName<span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.arlt.eu/blog/2010/11/30/handling-multiple-keyboards-in-mfc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enumerating Metadata of AVAssets in iOS</title>
		<link>http://www.arlt.eu/blog/2010/11/30/enumerating-metadata-of-avassets-in-ios/</link>
		<comments>http://www.arlt.eu/blog/2010/11/30/enumerating-metadata-of-avassets-in-ios/#comments</comments>
		<pubDate>Tue, 30 Nov 2010 00:00:00 +0000</pubDate>
		<dc:creator>Stephan</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[ID3]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[Metadata]]></category>
		<category><![CDATA[MP3]]></category>

		<guid isPermaLink="false">http://www.arlt.eu/blog/?p=397</guid>
		<description><![CDATA[The AV Foundation Framework provides an interface for managing audio-visual media in iOS applications. Furthermore, the class AVAsset is an abstract class of this framework to represent audio-visual media such as videos and sounds. The following code snippet illustrates how to enumerate metadata (e.g. ID3 tags) of an asset (e.g. a MP3 file). Just replace [...]]]></description>
			<content:encoded><![CDATA[<p>The <strong>AV Foundation Framework</strong> provides an interface for managing audio-visual media in iOS applications. Furthermore, the class <strong>AVAsset</strong> is an abstract class of this framework to represent audio-visual media such as videos and sounds. The following code snippet illustrates how to enumerate metadata (e.g. ID3 tags) of an asset (e.g. a MP3 file). Just replace <em>FILENAME</em> by the name of the file you want to investigate.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>path <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSBundle</span> mainBundle<span style="color: #002200;">&#93;</span> pathForResource<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;FILENAME&quot;</span> ofType<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;mp3&quot;</span><span style="color: #002200;">&#93;</span>;
<span style="color: #400080;">NSURL</span> <span style="color: #002200;">*</span>url <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSURL</span> alloc<span style="color: #002200;">&#93;</span> initFileURLWithPath<span style="color: #002200;">:</span>path<span style="color: #002200;">&#93;</span>;
AVAsset <span style="color: #002200;">*</span>asset <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>AVURLAsset URLAssetWithURL<span style="color: #002200;">:</span>url options<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #400080;">NSArray</span> <span style="color: #002200;">*</span>metadata <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>asset commonMetadata<span style="color: #002200;">&#93;</span>;
<span style="color: #a61390;">for</span> <span style="color: #002200;">&#40;</span> AVMetadataItem<span style="color: #002200;">*</span> item <span style="color: #a61390;">in</span> metadata <span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
  <span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>key <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>item commonKey<span style="color: #002200;">&#93;</span>;
  <span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>value <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>item stringValue<span style="color: #002200;">&#93;</span>;
  NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;key = %@, value = %@&quot;</span>, key, value<span style="color: #002200;">&#41;</span>;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p>BTW: In the example above the metadata is loaded synchronously. This means that the calling thread is blocked in order to so. An alternative is the usage of the method <strong>loadValuesAsynchronouslyForKeys</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.arlt.eu/blog/2010/11/30/enumerating-metadata-of-avassets-in-ios/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

