top ... zeigt cpu und memory auslastung
/var/log/ ... log dateien
meine Sys/Db admin & Developper Notitzen - wer Rechtschreibfehler findet darf sie behalten ... my Sys/Db Admin and developper notes - I don't care about typos
Thursday, June 01, 2017
Wednesday, May 31, 2017
xamarin
Error: Embedded Resource ... edit xaml
Anroid Sdk: C:\Program Files (x86)\Android\android-sdk\temp ... zip entzippen und nach tools kopieren
Java must be installed
Anroid Handy: 7 mal in Einstellungen auf Buildnummer tippen, dann in Entwickleroptionen USB Debugging zulassen => wird in VS angezeigt als ... (Android 6 - APi23)
Anroid Sdk: C:\Program Files (x86)\Android\android-sdk\temp ... zip entzippen und nach tools kopieren
Java must be installed
Anroid Handy: 7 mal in Einstellungen auf Buildnummer tippen, dann in Entwickleroptionen USB Debugging zulassen => wird in VS angezeigt als ... (Android 6 - APi23)
Monday, May 29, 2017
Tasks zusammanhängen mit ContinueWith und Fehlerbehandlung
private void CreateAnys(Dictionary<string,Action> createAnyDict)
{
var sbNames= new StringBuilder();
foreach (var AnyName in createAnyDict.Keys)
{
sbNames.Append(AnyName);
}
if (MessageBox.Show($"create {sbNames} Any ?", "Create Any", MessageBoxButton.YesNo) ==
MessageBoxResult.No) return;
SetBusy();
var firstTask = new Task(() => SetStatusLabel("Creating Any(s)"));
var nextTask = firstTask;
foreach (var dictEntry in createAnyDict)
{
nextTask = nextTask.ContinueWith(antecedent =>
{
Trace.WriteLine("Result last Task:");
if (antecedent.IsFaulted)
{
Trace.WriteLine("Error: "+antecedent.Exception?.Message);
}
else if (antecedent.IsCanceled)
{
Trace.WriteLine("Cancled !");
}
else
{
Trace.WriteLine("Succeeded !");
}
SetStatusLabel($"creating Any {dictEntry.Key}");
try
{
dictEntry.Value.Invoke();
}
catch (Exception ex)
{
Trace.WriteLine($"Error creating {dictEntry.Key}:{ex.Message}");
}
});
}
nextTask = nextTask.ContinueWith((t) =>
{
SetStatusLabel("finished creating Any(s) - ready ...");
SetReady();
});
try
{
firstTask.Start();
//task0.Wait();
}
catch (AggregateException ex)
{
MessageBox.Show(ex.Message);
}
}
create ssh key for git
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
list all ssh keys: ls ~/.ssh
create key: ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
passphrase eingeben
zu github unter profil ssh keys hinzufügen durch cat ~/.ssh/id_rsa.pub, kopieren und einfuegen
start ssh agent: eval $(ssh-agent -s)
ssh-add ~/.ssh/id_rsa
z.b. zum .profile file im homedir hinzugeben
git config --global user.name "Your Name"
list all ssh keys: ls ~/.ssh
create key: ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
passphrase eingeben
zu github unter profil ssh keys hinzufügen durch cat ~/.ssh/id_rsa.pub, kopieren und einfuegen
start ssh agent: eval $(ssh-agent -s)
ssh-add ~/.ssh/id_rsa
z.b. zum .profile file im homedir hinzugeben
WPF Gui Thread Label aktualisieren
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
{ lbConStr.Content = DbHelper.GetConnectionString(); }
));
Tuesday, May 23, 2017
raspberry pi one wire Temperaturmessung / temperature measurement 1 wire
One wire treiber unterstützt 10 sensoren gleichzeitig
One Wire kann im Setup Menü von Rasperry unter Interfaces eingeschalten werden
One Wire kann im Setup Menü von Rasperry unter Interfaces eingeschalten werden
sudo apt-get install rrdtool python-rrdtool
Tuesday, May 16, 2017
invoke-sqlcmd try catch : need switch -ErrorAction
you need the switch -ErrorAction 'Stop' (of invoke-sqlcmd) to be able to catch a invoke-sqlcmd error:
try
{
invoke-sqlcmd -Query $sqlCmd -serverinstance $ServerInstance -ErrorAction 'Stop' # if windows user has not enough rights use other eg.: -Username sa -Password xxx
}
catch
{
Write-Host "-------------------------------------------------------------" -ForegroundColor Yellow
Write-Warning "Error in sqlcmd" $sqlCmd
Write-Warning $_.Exception.Message
}
Saturday, May 13, 2017
configure raspi raspberry pi noobs raspian statisch Ip
Grundlegendes
1) change password: passwd2) enable wifi by clicking on wifi icon top right
3) enable ssh and 1wire by menu/preferances/interfaces
static statische IP:
/etc/network/interfaces:
# Ethernet
auto eth0
allow-hotplug eth0
iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 192.168.1.1
/etc/dhcpcd.conf
interface wlan0
static ip_address=192.168.1.6/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1
Zusatz Pakete
update source lists (fetch): sudo apt-get update
bringt alle pakete auf neuersten stand: sudo apt-get upgrade
bringt alle pakete auf neuersten stand: sudo apt-get upgrade
sudo apt-get install git
git clone https://github.com/...raspi.git
chmod 744 allgemein/install.sh
7 rwx
4 r
xrdp (remote desktop)
git clone https://github.com/...raspi.git
chmod 744 allgemein/install.sh
7 rwx
4 r
xrdp (remote desktop)
apache2 -y (apache)
round robin Db (messwerte speichern): sudo apt-get install rrdtool python-rrdtoolmysql-server mysql-client
php
php-mysql phpmyadmin
emailserver citadelle
sudo modprobe ipv6sudo apt-get install citadel-suite
internen webserver starten mit webcit, lauscht auf port 2000
http://www.pc-magazin.de/ratgeber/raspberry-pi-als-mailserver-einrichten-installieren-1836244.html
Thursday, April 27, 2017
wpf datagrid simple bind
<Window x:Class="ldapTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ldapTest"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<StackPanel>
<DataGrid Name="grid1"></DataGrid>
</StackPanel>
</Window>
public MainWindow()
{
InitializeComponent();
grid1.ItemsSource = new ObservableCollection<MyData>()
{
new MyData("x@y.z", "my1"),
new MyData("m2@a.b","my2")
};
}
public class MyData
{
public string Email { get; set; }
public string Name { get; set; }
public MyData(string email, string name)
{
Email = email;
Name = name;
}
}
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ldapTest"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<StackPanel>
<DataGrid Name="grid1"></DataGrid>
</StackPanel>
</Window>
public MainWindow()
{
InitializeComponent();
grid1.ItemsSource = new ObservableCollection<MyData>()
{
new MyData("x@y.z", "my1"),
new MyData("m2@a.b","my2")
};
}
public class MyData
{
public string Email { get; set; }
public string Name { get; set; }
public MyData(string email, string name)
{
Email = email;
Name = name;
}
}
Wednesday, April 26, 2017
ldap basics
aus https://de.wikipedia.org/wiki/Lightweight_Directory_Access_Protocol:
" Ein einzelnes Objekt wird eindeutig durch den Distinguished Name (DN) identifiziert, wie zum Beispiel uid=juser,ou=People,ou=webdesign,c=de,o=acme. Dieser setzt sich aus einzelnen Relative Distinguished Names (RDN) zusammen. Eine andere Schreibweise für den DN ist der canonical name, der keine Attribut-Tags wie ou oder c enthält und bei dem die Trennung zwischen den RDNs durch Schrägstriche erfolgt. Außerdem beginnt die Reihenfolge, im Gegensatz zum dn, mit dem obersten Eintrag, also zum Beispiel acme/de/webdesign/People/juser."
" Ein einzelnes Objekt wird eindeutig durch den Distinguished Name (DN) identifiziert, wie zum Beispiel uid=juser,ou=People,ou=webdesign,c=de,o=acme. Dieser setzt sich aus einzelnen Relative Distinguished Names (RDN) zusammen. Eine andere Schreibweise für den DN ist der canonical name, der keine Attribut-Tags wie ou oder c enthält und bei dem die Trennung zwischen den RDNs durch Schrägstriche erfolgt. Außerdem beginnt die Reihenfolge, im Gegensatz zum dn, mit dem obersten Eintrag, also zum Beispiel acme/de/webdesign/People/juser."
|
Tuesday, April 25, 2017
ldap query c#
using public ldap test server:
DirectoryEntry rootEntry = new DirectoryEntry("LDAP://ldap.forumsys.com/cn=read-only-admin,dc=example,dc=com");
rootEntry.AuthenticationType = AuthenticationTypes.None; //Or whatever it need be
DirectorySearcher searcher = new DirectorySearcher(rootEntry);
var queryFormat = "(&(objectClass=user)(objectCategory=person)(|(SAMAccountName=*{0}*)(cn=*{0}*)(gn=*{0}*)(sn=*{0}*)(email=*{0}*)))";
//TODO searcher.Filter = string.Format(queryFormat, "michael");
foreach (SearchResult result in searcher.FindAll())
{
Console.WriteLine("account name: {0}", result.Properties["samaccountname"].Count > 0 ? result.Properties["samaccountname"][0] : string.Empty);
Console.WriteLine("common name: {0}", result.Properties["cn"].Count > 0 ? result.Properties["cn"][0] : string.Empty);
}
read all props:
var rootEntry = new DirectoryEntry("LDAP://ldap.forumsys.com/cn=read-only-admin,dc=example,dc=com");
rootEntry.AuthenticationType = AuthenticationTypes.None; //Or whatever it need be
var searcher = new DirectorySearcher(rootEntry);
//var queryFormat = "(&(objectClass=user)(objectCategory=person)(|(SAMAccountName=*{0}*)(cn=*{0}*)(gn=*{0}*)(sn=*{0}*)(email=*{0}*)))";
//TODO searcher.Filter = string.Format(queryFormat, "michael");
foreach (SearchResult result in searcher.FindAll())
{
foreach (var propertyName in result.Properties.PropertyNames)
{
StringBuilder sb = new StringBuilder();
string sPropName = propertyName?.ToString();
if (!string.IsNullOrEmpty(sPropName))
{
sb.Append(sPropName + ":");
var vals = result.Properties[sPropName];
foreach (var val in vals)
{
sb.Append(val);
}
Console.WriteLine(sb);
}
}
Console.WriteLine("-------------------------------------------------------");
}
DirectoryEntry rootEntry = new DirectoryEntry("LDAP://ldap.forumsys.com/cn=read-only-admin,dc=example,dc=com");
rootEntry.AuthenticationType = AuthenticationTypes.None; //Or whatever it need be
DirectorySearcher searcher = new DirectorySearcher(rootEntry);
var queryFormat = "(&(objectClass=user)(objectCategory=person)(|(SAMAccountName=*{0}*)(cn=*{0}*)(gn=*{0}*)(sn=*{0}*)(email=*{0}*)))";
//TODO searcher.Filter = string.Format(queryFormat, "michael");
foreach (SearchResult result in searcher.FindAll())
{
Console.WriteLine("account name: {0}", result.Properties["samaccountname"].Count > 0 ? result.Properties["samaccountname"][0] : string.Empty);
Console.WriteLine("common name: {0}", result.Properties["cn"].Count > 0 ? result.Properties["cn"][0] : string.Empty);
}
read all props:
var rootEntry = new DirectoryEntry("LDAP://ldap.forumsys.com/cn=read-only-admin,dc=example,dc=com");
rootEntry.AuthenticationType = AuthenticationTypes.None; //Or whatever it need be
var searcher = new DirectorySearcher(rootEntry);
//var queryFormat = "(&(objectClass=user)(objectCategory=person)(|(SAMAccountName=*{0}*)(cn=*{0}*)(gn=*{0}*)(sn=*{0}*)(email=*{0}*)))";
//TODO searcher.Filter = string.Format(queryFormat, "michael");
foreach (SearchResult result in searcher.FindAll())
{
foreach (var propertyName in result.Properties.PropertyNames)
{
StringBuilder sb = new StringBuilder();
string sPropName = propertyName?.ToString();
if (!string.IsNullOrEmpty(sPropName))
{
sb.Append(sPropName + ":");
var vals = result.Properties[sPropName];
foreach (var val in vals)
{
sb.Append(val);
}
Console.WriteLine(sb);
}
}
Console.WriteLine("-------------------------------------------------------");
}
Wednesday, April 19, 2017
c# format Timespan
string s = String.Format("{0} {1:00}:{2:00}:{3:00}", ts.Days, ts.Hours, ts.Minutes, ts.Seconds);
linux rasperry pi rrdtool
erzeuge rrd db beispiel:
echo "Erzeuge rrd Datenbank fuer 3 Werte (Temp, Luftdruck und Höhe), 100 Tage aufbewahrung viertelstuendlicher AVG 100 Jahre aufbewahrung min /max / avg"
#step 900 sec (60*15=900) alle viiertelstunden
#DS Datasource:name:GAUGE:heartbeat 20min=1200sec:min::max
#RRA RoundRobinArchive alle 9600 Zeilen (pro Tag 96 Zeilen (=24*4)
# 100 Jahre aufbewahrung min, max, AVG
rrdtool create bmp.rrd --step 900 \
DS:t0:GAUGE:1200:-50:200 \
DS:t1:GAUGE:1200:-50:200 \
DS:t2:GAUGE:1200:-50:200 \
RRA:AVERAGE:0.5:1:9600 \
RRA:MIN:0.5:96:36000 \
RRA:MAX:0.5:96:36000 \
RRA:AVERAGE:0.5:96:36000
zeige letzten eintrag in db an:
rrdtool lastupdate bmp.rrdhttps://www.epochconverter.com/ rechnet unix timestamp in datum/zeit um
erzeuge Graph
rrdtool graph tempweek.png \
-s 'now - 1 week' -e 'now' \
DEF:temp0=temperature.rrd:temp0:AVERAGE \
LINE2:temp0#00FF00:Innen \
DEF:temp1=temperature.rrd:temp1:AVERAGE \
LINE2:temp1#0000FF:Außen
rrdtool graph temperaturDay.png \
-s 'now - 1 day' -e 'now' \
DEF:temp0=temperature.rrd:temp0:AVERAGE \
LINE2:temp0#00FF00:Innen \
DEF:temp1=temperature.rrd:temp1:AVERAGE \
LINE2:temp1#0000FF:Außen
Sunday, April 16, 2017
webserver iis leerlaufzeit (idle time) anwendungspool
in erweiterte eigenschaften des anwendungspoll läßt sich die webserver iis leerlaufzeit (idle time) einstellen, damit eine webseite schneller reagiert (nicht so lange zum Laden braucht) nachdem sie längere Zeit nicht genutzt wurde
Tuesday, April 11, 2017
git basics
basic workflow
Get bzw Checkout - from server to local repro
git config --list //listgit config --global user.email "you@example.com"
git config --global user.name "Your Name"
git clone https://github.com/username/reproname.git localDirName //get repro
git status //show changes
git log //show last commits
git cherry -v //show commits needed to push
git fetch
git pull
anzeigen orgiginal url
git remote -v oder git config --get remote.origin.url.
push / checkin - from local to server
git add -A //stage changesgit commit -m "message"
ändern:
git commit --amend
git commit --amend -m "New commit message"
revert initial commit: git update-ref -d HEAD
git push
Revert
git checkout Dateiname
Stash
git stash list
git stash
git stash drop 1
Branches
switch to branch: git checkout branchname
https://git-scm.com/book/de/v1/Git-Branching-Einfaches-Branching-und-Merging
list all: git branch -a
https://git-scm.com/book/de/v1/Git-Branching-Einfaches-Branching-und-Merging
list all: git branch -a
list local: git branch -r
create: git branch myNewBranchName
merge:
git checkout destinationBranch (eg. master)
git merge branch (e.g. hotfix)
git branch -d hotfix //löschen
rebase:
git rebase -i HEAD~2
rebase:
git rebase -i HEAD~2
letzte 2 commits zusammenführen, es öffnet sich Editor, squash vor den commit schreiben den man "entfernen" will
Special
suda apt-get install git
git init --bare
git init
git remote -v
git remote add
Git Atlassian Source Tree Basics
shows all commits in one timeline
get: clone / new (from server to local repro and files)
commit => files to local repro
push => from local repro to server
get: clone / new (from server to local repro and files)
commit => files to local repro
push => from local repro to server
Wednesday, April 05, 2017
Monday, April 03, 2017
update Asp.Net USer Db
doesn't help:
ALTER TABLE [dbo].[AspNetUsers] add [Email] [nvarchar](256) NULL
ALTER TABLE [dbo].[AspNetUsers] add [EmailConfirmed] [bit] NOT NULL DEFAULT (0)
ALTER TABLE [dbo].[AspNetUsers] add [PhoneNumber] [nvarchar](max) NULL
ALTER TABLE [dbo].[AspNetUsers] add [PhoneNumberConfirmed] [bit] NOT NULL DEFAULT (0)
ALTER TABLE [dbo].[AspNetUsers] add [TwoFactorEnabled] [bit] NOT NULL DEFAULT (0)
ALTER TABLE [dbo].[AspNetUsers] add [LockoutEndDateUtc] [datetime] NULL
ALTER TABLE [dbo].[AspNetUsers] add [LockoutEnabled] [bit] NOT NULL DEFAULT (0)
ALTER TABLE [dbo].[AspNetUsers] add [AccessFailedCount] [int] NOT NULL DEFAULT (0)
ALTER TABLE [dbo].[AspNetUsers] add [Email] [nvarchar](256) NULL
ALTER TABLE [dbo].[AspNetUsers] add [EmailConfirmed] [bit] NOT NULL DEFAULT (0)
ALTER TABLE [dbo].[AspNetUsers] add [PhoneNumber] [nvarchar](max) NULL
ALTER TABLE [dbo].[AspNetUsers] add [PhoneNumberConfirmed] [bit] NOT NULL DEFAULT (0)
ALTER TABLE [dbo].[AspNetUsers] add [TwoFactorEnabled] [bit] NOT NULL DEFAULT (0)
ALTER TABLE [dbo].[AspNetUsers] add [LockoutEndDateUtc] [datetime] NULL
ALTER TABLE [dbo].[AspNetUsers] add [LockoutEnabled] [bit] NOT NULL DEFAULT (0)
ALTER TABLE [dbo].[AspNetUsers] add [AccessFailedCount] [int] NOT NULL DEFAULT (0)
f
Saturday, April 01, 2017
register wcf asp.net on iis
before: ASPNET_REGIIS /I
now: dism /online /enable-feature /featurename:IIS-ASPNET45 /all
now: dism /online /enable-feature /featurename:IIS-ASPNET45 /all
Subscribe to:
Posts (Atom)

