How to add CMDER (Console Emulation) on right-click to the context menu of the Windows Explorer

Problem

You want to see an entry that opens cmder.exe in Windows Explorer at the location where you use it.

Approach

Create or download the Windows registry key that enables to open CMDER on right-click with the parameters of the Directory that you are in passed.

Solution

As Code:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\Cmder]
@="Open in Cmder"
"Icon"="D:\\cmder\\Cmder.exe,0"

[HKEY_CLASSES_ROOT\Directory\Background\shell\Cmder\command]
@="\"D:\\cmder\\Cmder.exe\" \"%V\""

[HKEY_CLASSES_ROOT\Directory\shell\Cmder]
@="Open in Cmder"
"Icon"="D:\\cmder\\Cmder.exe,0"

[HKEY_CLASSES_ROOT\Directory\shell\Cmder\command]
@="\"D:\\cmder\\Cmder.exe\" \"%1\""

or download it here.

Visual Studio 2013 : Show folders with *.cs files in the solution explorer after they suddenly disappeared / hidden

Problem

Sometimes it happens, that you have created folders in Visual Studio for your application and had put some *.cs C# Source Code files that suddenly disappeard in the solution explorer.

Analysis

I.e. that can happen when you have forgotten to save your Visual Studio application project, berfore you have closed the IDE.

Solution

Use the file explorer and navigate to your Visual Studio solution (alternatively you can right-click a source code file in your folder and select „Open contained folder“ from the context menu).

Open the .csproj file in your solution in a text editor of your choice:

.csproj files store the project structure of the solution explorer

Go to the section where the <ItemGroup /> tags are declared and add a new section with the folders and source code files you want to show in your solution like in the screenshot below

My folders Command, ViewModelBase, ViewModel and Model disappeard over night, so i readded the marked group

You can add all cs-files with a wildcard star like it is shown in the screenshot above.

Bei Popmusik ist es nicht die Musik selber, mit der wir ein positives Empfinden / Identifikation aufbauen. Die Geschichte und das Image der Band / des Musikers beeinflussen maßgeblich die Musikbewertung.

Intention

Es gibt heute sehr viel richtig gute und anspruchsvolle Musik, die professionell und mit viel Herzblut produziert wird und dennoch wird vielen Titeln niemals Gehör geschenkt. Warum ist das so? Nachdem ich nun einige Studien und Artikel über Musik-Image gelesen habe, möchte ich in diesem Blog-Eintrag meine persönlichen Gedanken und Interpretation niederschreiben.

Analyse

Warum gibt es anspruchsvolle, perfekt aufgenommene und abgemischte Musik, die niemals gehört wird und weitere primitive Werke, welche die deutschen Charts stürmen?

Um dies zu beleuchten kann man sich vor Augen führen, dass unkomplizierte, weniger anspruchsvolle Musik für das untrainierte Gehör eingängiger ist, als komplexe und durchdachte Harmonie-Strukturen. Man könnte nun meinen, dass ein ausgebildeter Musiker einem 3 bis 4 Akkordschema Folge leisten muss um eingängige Songs zu schreiben. Ist es wirklich so einfach?

Die Antwort ist: „Nein!“ – wieso erleben wir zur Zeit eine Gangster-Rap/Gangster-Hip Hop Herrschaft in den deutschen Charts wenn es wirklich um Harmonien ginge? Könnte man sich nicht einfach eine Loopstation kaufen und fette gesamplete Beats in einen Lautheits-maximierenden Limiter drücken, während man ein bisschen rappt und die Sprachmelodie mit einer Autotune-gefütterte Schlangenbeschwörermusik (oder orientalischem Gedudel) belegt, so wie es in den deutschen Charts z.Zt. Gang und gebe ist?

Die Antwort ist: Nein!“. Es ist nicht alleine die Fähigkeit des guten Musikers, sich für niedere Zwecke zu prostituieren, es ist viel mehr die Art wie er seine Geschichte vermarktet. Über die Geschichte des Musikers baut das Publikum eine Identifikation zu ihm auf. Wenn man über die eigenen Idole nachdenkt, so hatte jedes dieser Idole eine ganz besondere Geschichte die den Zuhörer fasziniert hat und zu der er eine Bindung aufgebaut hat.

Denken wir mal über einige 80er/90er Klassiker nach …

  • Bob Marly
  • Jimi Hendrix
  • Queen
  • …. oder wie wärs mit Böhse Onkelz…?

Jeder der oben genannten Chart-Stars verkörpert eine ganz spezielle Geschichte die das Publikum angesprochen hat. Bei den modernen Gangstar-Rap/Hip Hop-Stars ist das ähnlich …

  • Capital Bra
  • Bushido
  • Kollegah …

Die jüngeren Künstler sind Personen, die dem älteren Publikum nichts sagen. Sie haben in der Regel keinerlei instrumentelle Kenntnisse sondern beherrschen lediglich ihre Rap-Betonung und den Rythmus (über „gute“ Texte mag man streiten).

Hauptaufgabe von Musiker-Images

Viele der nachfolgend genannten Hauptaufgaben beziehen sich hauptsächlich auf Jugendliche, da bei diesen die Musik maßgeblich zur Identitätsfindung beiträgt. Menschen ab einem Alter von 31 Jahren hingegen versperren sich oftmals neuer Musik.

  • Soziale Identität / Identitätsbildung
    • Die Musik hilft die eigene Identität auszudrücken
  • Selbstkategorisierung / Abgrenzung
    • Individualität zeigen
  • Gruppenprozesse
    • Abgrenzung zu anderen Gruppen
    • Gruppenzugehörigkeit
    • Gruppennorm
    • Gruppenzwang

Fazit

Wie wir damals eine Bindung zu unseren Idolen aufgebaut haben, bauen vielen Menschen auch nur eine Bindung zu Musik auf, indem sie durch die Geschichte des Musikers oder das Musiker-Image beeinflusst werden. Ein Pop-Musiker ohne Geschichte wird in den seltensten Fällen Erfolg haben, weil er seinem Publikum nicht die Möglichkeit zum Aufbau einer Identifikation oder Bindung ermöglicht.

Visual Studio 2013 .NET WPF : Where do i get / can i find the WPF Ribbon Control?

Problem

According to the .NET documentation the Ribbon Control should be available since WPF 4.5, what means is available since .NET Framework 4.5 . But you can not find it? Are you even thinking about the download of the Ribbon control for older versions? Not necessary, please see the following points…

Approach

We have to find out the right moment when it is generally possible to use the Ribbon control.

The following table shows, that the first version of WPF (3.0) was released with the .NET Framework 3.0. As you can see the version number of WPF is maintained synchron with the version number of the .NET framework.

WPF VersionRelease (YYYY-MM).NET VersionVisual Studio VersionMajor Features
3.02006-113.0N/AInitial Release.
WPF development can be done with VS 2005 (released in Nov 2005) too with few additions as described here.
3.52007-113.5VS 2008Changes and improvements in:
Application model, data binding, controls, documents, annotations, and 3-D UI elements.
3.5 SP12008-083.5 SP1N/ANative splash screen support, New WebBrowser control, DirectX pixel shader support.
Faster startup time and improved performance for Bitmap effects.
4.02010-044.0VS 2010New controls: Calendar, DataGrid, and DatePicker.
Multi-Touch and Manipulation
4.52012-084.5VS 2012New Ribbon control
New INotifyDataErrorInfo interface
4.5.12013-104.5.1VS 2013No Major Change
4.5.22014-054.5.2N/ANo Major Change
4.62015-074.6VS 2015Transparent child window support
HDPI and Touch improvements
Which WPF Version is included in which version of the .NET Framework?

Solution

When you have installed at least .NET Framework 4.5 you can Add the Reference „System.Windows.Control.Ribbon“ as follows:

1.) Expand the tree in in your Solution Explorer of you WPF application

2.) Right-click the „Add References“ entry and choose „Add Reference“

In the Solution Explorer of your WPF Application right-click the References entry and choose „Add Reference“

3.) In the following dialog search for „Ribbon“ in the search field on the upper right

Search for Ribbon in the Dialog that appears by using the textbox on the upper right corner

4.) After that you should be able to add the reference by using the checkbox

5.) In your XAML Code you are now able to use the <Ribbon/> Tag

Optional: 6.) If you want to use a RibbonWindow instead of a WPF Window which allows you to have the Quick Access Controls at the top of the window, you have to do the declaration in the head of MainWindow.xaml as follows:

<ribbon:RibbonWindow x:Class="WPFTutorial.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ribbon="clr-namespace:System.Windows.Controls.Ribbon;assembly=System.Windows.Controls.Ribbon"
        Title="WPF Layoutmanager" Height="399" Width="763">
    <DockPanel LastChildFill="True">
        <Ribbon DockPanel.Dock="Top" >
        </Ribbon>
         <!-- Put the last Child here -->
    </DockPanel>
</ribbon:RibbonWindow>

Additionally you have to change the base class name in the code behind window and add the using System.Windows.Controls.Ribbon :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Ribbon;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WPFTutorial
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : RibbonWindow
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("Test");
        }
    }
}

.NET WPF : XAML locations to place and change WPF Styles

Intention

Like in HTML/CSS there are different source code locations where it is possible to apply appearance styles to WPF controls. In this article i want to make a really short summary of those points.

Approach

The following examples are showing the declaration places for styles in the order from local control styles to global application styles

Location examples

App.xaml (global application wide styles)

<Application x:Class="WPFTutorial.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             StartupUri="MainWindow.xaml">
    <Application.Resources>
            <Style TargetType="TextBlock">
                <Setter Property="Foreground" Value="#ff0000" />
                <Setter Property="FontSize" Value="24" />
            </Style>
    </Application.Resources>
</Application>

MainWindow.xaml (local hierarchical inheritance from the WPF DOM)

<Window x:Class="WPFTutorial.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="WPF Layoutmanager" Height="322" Width="528">
    <Window.Resources>
        <Style TargetType="TextBlock">
            <!-- This sets all TextBlock FontSize Styles within the Grid -->
            <Setter Property="FontSize" Value="15" />
            <Setter Property="Foreground" Value="red" />
        </Style>
        <Style TargetType="TabControl">
            <Setter Property="VerticalContentAlignment" Value="Stretch"/>
            <Setter Property="VerticalAlignment" Value="Stretch"/>
        </Style>
    </Window.Resources>
    <DockPanel>
        <TextBlock DockPanel.Dock="Top" VerticalAlignment="Center" Text="Ein Dockpanel.Dock=Top ist das hier und TabControl als LastChild gestretcht" />
        <TabControl>
            <TabItem Header="Grid">
                <Grid>
                    <Grid.Resources>
                        <Style TargetType="TextBlock">
                            <!-- This sets all TextBlock FontSize Styles within the Grid -->
                            <Setter Property="FontSize" Value="15" />
                        </Style>
                    </Grid.Resources>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="1*" />
                        <ColumnDefinition Width="1*" />
                        <ColumnDefinition Width="1*" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="1*" />
                        <RowDefinition Height="1*" />
                        <RowDefinition Height="1*" />
                    </Grid.RowDefinitions>
                    <Button Width="140" Height="50" Click="Button_Click">
                        <StackPanel Orientation="Horizontal">
                            <Image Margin="10"  Source="Images/haken.png" Stretch="UniformToFill"/>
                            <TextBlock VerticalAlignment="Center" Text="Play Sound" />
                        </StackPanel>
                    </Button>
                    <Button Grid.Column="1" Grid.Row="2" Width="140" Height="50" Click="Button_Click">
                        <StackPanel Orientation="Horizontal">
                            <Image Margin="10"  Source="Images/haken.png" Stretch="UniformToFill"/>
                            <TextBlock VerticalAlignment="Center" Text="Play Sound" />
                        </StackPanel>
                    </Button>
                    <Button Grid.Column="2" Grid.Row="1" Width="140" Height="50" Click="Button_Click">
                        <StackPanel Orientation="Horizontal">
                            <Image Margin="10"  Source="Images/haken.png" Stretch="UniformToFill"/>
                            <TextBlock VerticalAlignment="Center" Text="Play Sound" >
                                <TextBlock.Style>
                                    <!-- Dieser Style gilt nur für den Textblock local und überschreibt den GRID Style -->
                                    <Style>
                                        <Setter Property="TextBlock.FontSize" Value="10" />
                                        <Setter Property="TextBlock.FontWeight" Value="Bold" />
                                        <Setter Property="TextBlock.Foreground" Value="#ff00ff" />
                                    </Style>
                                </TextBlock.Style>
                            </TextBlock>
                        </StackPanel>
                    </Button>
                </Grid>
            </TabItem>
            <TabItem Header="StackPanel">
                <StackPanel Orientation="Vertical">
                    <TextBlock Text="Dummfug ersetzt Irrsinn"/>
                    <TextBlock Text="Irrsinn ersetzt Dummfug" />
                    <TextBlock Text="Das letzte Child ist im Gegensatz zum Dockpanel nicht gestretcht" >
                        <TextBlock.Style>
                            <Style>
                                <Setter Property="TextBlock.Foreground" Value="#ff00ff" />
                            </Style>
                        </TextBlock.Style>
                    </TextBlock>
                </StackPanel>
            </TabItem>
        </TabControl>
    </DockPanel>
</Window>

C# .NET : Collections im .NET Framework

Intention

Eines der wichtigsten .NET Elemente zum Verwalten vom Datenbeständen im Speicher sind Collections (Auflistungen). Im Vergleich zu normalen Array-Typen bieten diese die Möglichkeit zur Laufzeit Objekte hinzuzufügen, ohne vorher die Größe/die Anzahl der Objekte in der Collection zu kennen. Collections bieten Funktionen zum Hinzufügen, Entfernen und Suchen/Finden von Objekten. Ist ein Objekt in einer Auflistung erstmal gefunden, kann dieses über die Objektreferenz auch direkt in der Auflistung geändert werden.

Typsicher
  • Bessere Leistung
  • keine explizite Umwandlung notwendig um auf Objekteigenschaften zuzugreifen
  • Akzeptieren beim Erstellen einen Typparamter <T>
  • Unterstützung für Windows-Store-Apps
Typsicher…
Generische Auflistungen
Generische Auflistun…
Nicht
generische Auflistungen
Nicht…
Auflistungen
(Collections)
Auflistungen…
Nicht typsicher
  • Speichern Elemente als Objekt (Object)
  • erfordern explizite Umwandlung in den Objekttyp um auf Objekteigenschaften zuzugreifen
  • keine Unterstützung für Windows-Store-Apps
Nicht typsicher…
System.Collections.Concurrent
System.Collections.Concurrent
System.Collections
System.Collections
System.Array
System.Array
System.Collections.Generic
System.Collections.Generic
Threadsicher
Threadsicher
Findet man oft in älterem Code
Findet man oft…
System.Collections.Immutable
System.Collections.Immutable
NuGet-Paket
NuGet-Paket
Actor
Actor
Hinzufügen
Hinzufügen
Ändern
Ändern
Entfernen
Entfernen
Suchen
Suchen
        Collection
  1. Object 1
  2. Object 2
  3. Object 3
  4. Object n
Collectio…
«interface»
 System.Collections.IEnumerable
«interface»…
foreach(Object o in Collection) 
{
  o.Property…
}
foreach(Object o in Collectio…
«interface»
 System.Collections.Generic.IEnumerable
«interface»…
LINQ
var
query = from Object o in Collection
where o.Attribute > 95
select o;

foreach (Object o in query) {
Console.WriteLine(o.Attribute + „“
);
}
LINQ…
Viewer does not support full SVG 1.1

Auflistungen implementieren das Interface „IEnumerable“, um das Iterieren durch die Objekte in der Liste zu ermöglichen. Die foreach-Schleife nutzt beispielsweise dieses Interface um durch alle Objekte einer Collection zu iterieren.

Über die Abfragesprache LINQ (Language Integrated Query) lassen sich SQL-ähnliche Abfragen auf Collections durchführen,

Namespaces / Namensräume

Der Namensraum für .NET Framework Collections liegt unter System.Collections.*, wobei weitere Sub-Namensräume existieren.

  • System.Collections.Concurrent (mehrere Threads / Tasks können parallel auf diesen Collections im Speicher operieren)
  • System.Collections.Immutable (man arbeitet hierbei nur auf Kopien / die ursprünglichen Daten werden nicht geändert – muss zusätzlich über NuGet-Paket installiert werden)
  • System.Collections.Generic

Dynamische Strukturen/Collections allokieren immer 2^n Speicher-Plätze

Die Property „Capacity“, welche an jeder Collection anhängt, zeigt die Anzahl der Speicherplätze, die die Collection intern als Array alloziert hat. Bei 1025 Elementen werden intern 2048 Plätze vorbereitet. Bei 2049 Elementen werden intern 4096 Plätze vorbereitet.

IBM Doors DXL: Simple String DIFF Comparation in Layout DXL

Problem

Two strings shall be compared with the DIFF function of Doors

Approach

Assign the string to a buffer using the += operator

Solution

void compareStrings(string string1, string string2)
{
	Buffer string1Buff = create;
	Buffer string2Buff = create;
	Buffer result = create;
	
	string1Buff+=string1;
	string2Buff+=string2;
	
	diff(result, string1Buff, string2Buff);
	
	displayRichWithColor(stringOf(result));
	
	delete string1Buff;
	delete string2Buff;
	delete result;	
}

IBM Doors DXL: Simple Incoming Links / In-Links / Input Links Layout DXL

string linkModuleString="/Product Lifecycle Management/10 Administration/Accords";

Link lnk;
LinkRef lnkRef;
ModName_ otherMod = null;
Item linkModItem = itemFromID(uniqueID(item(linkModuleString)));
linkModName = fullName(linkModItem);
     
for lnkRef in all(obj<-linkModName) do
{
  otherMod = module (sourceVersion lnkRef);
  if (!null otherMod) 
  {
    if ((!isDeleted otherMod) && (null data(sourceVersion lnkRef))) 
    {
      load((sourceVersion lnkRef),false);
    }
  }
}
     
for lnk in all(obj<-linkModName) do
{
  Object src = source lnk;
  if ( isDeleted(src) || null(src) ) continue;
     
	display src."Object Text" "";
}

by Björn Karpenstein