Alle Beiträge von Björn Karpenstein

Diplom Informatiker, Programmierer, Musikbegeisterter

Celtic Guitar Fingerpicking Style: Cock up your beaver

In this stately scottish Jacobite song a young man is encouraged to tilt his beaverskin hat at a rakish angle as he rides off to fight the English.

This is not the best played version but the video is good for remember it after a longer time 😉

Lyrics:
When first my brave Johnie lad came to this town,
He had a blue bonnet that wanted the crown;
But now he has gotten a hat and a feather,
Hey, brave Johnie lad, cock up your beaver!

Cock up your beaver, and cock it fu‘ sprush,
We’ll over the border, and gie them a brush;
There’s somebody there we’ll teach better behaviour,
Hey, brave Johnie lad, cock up your beaver!

Celtic Guitar Fingerpicking Style: Battle of aughrim

The Battle of Aughrim (Irish: Cath Eachroma) was the decisive battle of the Williamite War in Ireland. It was fought between the Jacobites and the forces of William III on 12 July 1691 (old style, equivalent to 22 July new style), near the village of Aughrim in County Galway.

The battle was one of the more bloody recorded fought on Irish soil – over 7,000 people were killed. It meant the effective end of Jacobitism in Ireland, although the city of Limerick held out until the autumn of 1691.

IBM Doors DXL: Iterate over Linkmodule

Problem

The links in a link module should be iterated

Approach

Link Modules can be read with the appropriate method like formal modules.

Solution

nSatisfiesLinkModule = "/NDS/90 Administration/Satisfies"; 
Object o = null; 
string src   = ""; 
string tgt   = ""; 
SatisfiesLinkModule = read(nSatisfiesLinkModule, false); 
for o in SatisfiesLinkModule do 
{ 
                // get names of source and target modules 
                src = o."source" "" 
                tgt = o."target" "" 
                print src " -> " tgt "\n" 
} 

IBM Doors DXL: Helpful Trigger Functions for persistent Triggers to block a module

Problem

The modification (Edit Mode / Edit Share) of a module shall be prevented.
Das Editieren eine Doors Modules (Edit Mode / Share Mode) soll verhindert werden.

Approach

Defining a library and using the existence of a trigger as condition for allowed modifications can be used to block the formal Module for edit/share mode.
Durch das definieren eine Triggers und der zugehörigen Trigger_Library kann man die Existenz eines Triggers als Bedingung für das Erlauben des Edit/Share Modes nehmen.

Solution

void listAllTriggerForMod (Module mod) 
{
	Trigger t;
	for t in mod do 
	{
		print name(t) "\n";	
	}
}

bool checkTriggerIfExistForMod (Module mod, string triggername) 
{
	Trigger t;
	for t in mod do 
	{
		if(name(t) "" == triggername)	
		{
			return true;
		}
	}
	
	return false;
}

string getDXLCodeForModWithTrigger (Module mod, string triggername) 
{
	Trigger t;
	for t in mod do 
	{
		if(name(t) "" == triggername)	
		{
			return dxl(t);
		}
	}
	
	return "not found";
}

void removeTriggerForModWithName(Module mod, string triggername) {

	Trigger t;
	string errorMsg;
	
	// first delete _all possible trigger_
	for t in mod do {
		if (name (t) "" == triggername) {
			errorMsg = delete(t);
		   	if(!null(errorMsg)) {
			  errorBox("Error occurred:\n" errorMsg"");
			  break;
		   }
		}
	}
}

void installTriggerForMod (Module mod) 
{
	string dxlCode = "Module cm = current Module;\n" //-
					"if ((isEdit(cm)||isShare(cm))){\n" //-
					"ack(\"During Wings LDT modifications it is not allowed to modify texts in the UIT/ALM Module.\");\n" //-
					"downgrade(cm)\n" //-
					"}\n";
	 
	string errors = checkDXL(dxlCode)
	
	if(null(errors)) 
	{
		string moduleName = name(mod)
		if(!checkTriggerIfExistForMod(mod, "Text_Tool_Block_Trigger"))
		{
			Trigger t = trigger("Text_Tool_Block_Trigger", project->module->moduleName, post, open, 15, dxlCode);
		}
		else ack "Trigger already exist!";
	}
	
	save(mod);
}

Module uitModule = read("/NDS/20 System/DS/UIT-User Interface Texts", false);
print "Vor der Installation...\n";
print "=======================\n";
listAllTriggerForMod(uitModule);
installTriggerForMod(uitModule);
print "\n\nNach der Installation...\n";
print "=======================\n";
listAllTriggerForMod(uitModule);
removeTriggerForModWithName(uitModule, "Text_Tool_Block_Trigger");
print "\n\nNach dem Entfernen...\n";
print "=======================\n";
listAllTriggerForMod(uitModule);

C#.NET Windows Forms: Allow only numbers and decimals in TextBox

Problem

A Textbox should only allow numbers and decimals

Approach

Using the Keypress method will validate on each key that is entered.
Call the code below onKeyPress Event of each Textbox with

validateNumber(sender, e);

after each

Solution

private void validateNumber(object sender, KeyPressEventArgs e)
{
  if ((e.KeyChar == ',') && (((TextBox)sender).Text.IndexOf(',') > -1))
  {
    e.Handled = true;
    return;
  }

  if (!Char.IsDigit(e.KeyChar))
  {
    if ((e.KeyChar != ',') &&
        (e.KeyChar != Convert.ToChar(Keys.Back)))
    {
        e.Handled = true;
        return;
    }
 }
}

Günstiges MIDI-Keyboard mit VST-Instrumenten

Problem

Die heutigen Synthesizer gehobener Klasse und authentischen Sounds haben z.Zt. einen Marktwert von mehreren tausend Euro. Die Synthesizer-Klänge sind proprietär und oftmals auf deren Platinen fest integriert. Die Erweiterbarkeit lässt im Rahmen der Produktlinie gewisse Freiheiten, die allerdings oftmals an einem engen Spektrum an Angeboten scheitert.

Es wird nach einer möglichst günstigen Alternative mit vielen Erweiterungsmöglichkeiten gesucht.

Ansatz

Die VST Schnittstelle erlaubt das Laden von VST Instrumenten am PC. Hierbei handelt es sich pro Instrument um ein Stück Software, welches zur Klangerzeugung genutzt wird und auf ein bestimmtes Genre/ein bestimmtes Klangbild spezielisiert ist. Hierdurch können die Kernkompetenzen der spezialisierten Anbieter besser ausgeschöpft werden um in einem entsprechendem Soundsegment einen bestmöglichen Klang zu erzahlen.

Lösung

Wir das nachfolgende Video werden die folgenden Kompoenten genutzt:
* Cubase LE 6 als DAW mit Halion (10 EUR)
* ASIO Soundkarte (60 EUR)
* Tastatur (39 EUR)

Beispielergebnis

Dialyseerfolg messen

Aufgabenstellung

Ein Patient wiegt 120 KG und wird 4 Stunden mit einem Dialysiator mit K=270 dialyisiert.
Wie lässt sich der zu erwartende Erfolg errechnen?

Ansatz

KTv = Kennzahl über die Effeziienz einer Dialysebehandlung

Lösung

Urea wird als Indikator für die Harnstoffkonzentration allgemein verwendet.

Patientengewicht/Volumen = 120 KG
V: 120 kg = 120 Liter Volumen. 58% davon sind das Urea Volumen. also 69,6 Liter = 69600 ml

K: Clearance [ml/min] 270
t: Dialysedauer = 4 h

Ein Patient wiegt 120 KG und

8,4 l = 840 ml darf man rausnehmen

BF = 480 ml/min
DF = 960 ml/min

K* t/V = 270 ml/min * 240 min / 69600