C#

A Custom (Async) MessageBox for WPF and Windows Phone

The System.Windows.MessageBox provided by .NET is limited to a very small set of MessageBoxButtons (Yes/No/OK/Cancel) which do not allow for custom Button texts. The System.Windows.Forms.MessageBox also blocks the UI thread, which can be an annoying disadvantage as well. The MessageBox on Windows Phone has the same disadvantages. Custom buttons in a MessageBoxe simplify the decision for the user, because they can describe the results of the action: However you need to do this with a custom control, so for WPF as well as Windows Phone I designed a simple method for asynchronously showing a MessageBox with custom buttons. (The WPF implementation based on this control by Evan Wondrasek) So let’s bring some sample code.In WPF you can use multiple custom buttons: And on Windows Phone you’re limited to 2 buttons: To use CustomMessageBox, you need to get TCD.Controls from NuGet: And on Windows Phone 7.x you also need async support,…

Bio

03 Der Needleman-Wunsch-Algorithmus

Einführung in die Bioinformatik Vorbereiten der Software Grundlagen der objektorientierten Programmierung Einfaches Codebeispiel – manipulieren eines strings Referenzieren einzelner Zeichen in einem string Generieren einer zufälligen Aminosäure-Sequenz Scoring von Alignments Prüfen auf Identität Bewerten von Mutationen – Substitution Matrix Bewerten eines Alignments Der Needleman-Wunsch-Algorithmus Die F-Matrix (abstrakt) Auswählen des Alignments (abstrakt) F-Matrix (Code) Auswählen des Alignments (Code) Die F-Matrix (abstrakt) Der Needleman-Wunsch-Algorithmus geht bei der Berechnung des idealen Alignements in zwei Schritten vor, um exponentiell skalierende Rechenzeit zu vermeiden. Zunächst wird die sogenannte F-Matrix berechnet, aus welcher anschließend das ideale Alignment zusammengesetzt wird. Zur Veranschaulichung alignen wir die Sequenzen GACFC und GCFHC. Jedes Feld in der Matrix (jede Zelle der Tabelle) beinhaltet einen Score. Diese Punktzahl ist jene, die auf dem Weg zur Berechnung des Feldes gesammelt wurde. Zur Berechnung einer Zelle sind immer die Felder links oben, oben und links notwendig: Unter den drei Feldern wird jenes gewählt, durch…

C#

TCD.Mathematics

UPDATE: Source and samples for WinRT and WPF are now on GitHub: https://github.com/michaelosthege/TCD.Mathematics This is just a quick post to introduce you to TCD.Mathematics, which is a NuGet package that adds several extension methods to the System.Windows.Media.Media3D namespace. If you’re unfamiliar with this namespace, it contains Point3D, Vector3D, Line3D and Plane3D classes which can be used for three-dimensional calculations. EDIT: I just submitted an update to the NuGet package, wich adds support for WinRT. Please not that WinRT does not have neither Point3D, Vector3D, nor the System.Windows.Media.Media3D namespace. So in WinRT all classes, including substitutes for Point3D/Vector3D are located under TCD.Mathematics. EDIT: Since version 1.2.0 TCD.Mathematics is a Portable Class Library that targets everything: Silverlight 4+, .NET4+, .NET for Windows Store, Windows Phone 7+, Xbox360 – make sure you’re running version 2.1+ of NuGet Package Manager! The extension methods, which are added to the mentioned Point3D/Vector3D classes are: Vector3D.AsPoint3D() Point3D.AsVector3D() Vector3D.Normalized() Point3D.CenterOfClusterWithOtherPoint3Ds () Point3D.ProjectOnLine3D() Point3D…

Software

TouchInjector

Hello world, Today I proudly present: TouchInjector TouchInjector is a Windows 8 Desktop application that translates TUIO into Windows Touch messages. It’s lightweight, easy to use and does not get in the way. No installation is required and with one click you can customize it to autorun with the system (on logon). As I frequently change my display settings, TouchInjector observes them and reacts accordingly. You can download it here. There are no further software requirements than a Windows 8 system. Just unzip, unblock and run it. (Allow access through the firewall and make sure that no other TUIO clients block the port.) Have fun! ~theCake

C#

Windows 8 TouchInjection with C#

The Windows 8 platform provides an API to inject touch events (WM_TOUCH..) via a C++ API. The API is relatively easy to use, but not available in C#, unless you do DllImport/PInvoke. I found this to be kind of tricky, but finally I succeeded to make a C# library that can be used to use the TouchInjection API from C#. You can find TCD.System.TouchInjection on NuGet, or have a look at the TouchInjection.cs file itself. You may notice that I renamed all the strucs, enums and classes to look nicer than their C++ counterparts. The IntelliSense descriptions are available for almost everything! (I got them from the documentation on msdn..) I’ve made a sample application for the MSDN Code Gallery as well. Here’s a small collection of useful resources regarding the TouchInjection API: C++ sample application C++ TouchInjection API walkthrough

Root

Q&A App

Hey, When my professor put a machine-readable quiz on his website, I made an app for my Phone to do the quiz.. Today I ported it to the desktop and I’d like to share it: Download Q&A App.zip It requires .NET Framework 4.0. To feed it with questions, you need a text file (preferable in UTF-8 encoding) that follows these simple rules: question-answer blocks are separated by one empty line question-lines begin with ‘Q: ’ answer-lines begin with ‘A: ‘ category-lines begin with ‘C: ‘ multiple Q/A/C-lines per block are allowed There’s a sample file in the *.zip. You can load a file from your computer, or from a remote location (eg. a textfile in a public dropbox folder). have fun!