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)


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

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



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: passwd
2) 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

sudo apt-get install git
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-rrdtool
mysql-server mysql-client
php
php-mysql phpmyadmin


emailserver citadelle

sudo modprobe ipv6
sudo 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