Wednesday, March 20, 2019

asp.net core using existing db

https://docs.microsoft.com/en-us/ef/core/get-started/aspnetcore/existing-db

1) in Packet-Manager-Console: Scaffold-DbContext "Server=localhost\sqlexpress;Database=test;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
=> erzeugt Context und EF Models
2) in Startup.cs Context regisitrieren:
services.AddDbContext<testContext>();

3) rechts click auf Controllers, Add Controller, MVC Controller mit Ansichten (Views) unter Verwendung von EF

4) Starten, und in adresszeile den Modellnamen hinzufügen

Monday, March 18, 2019

einfaches css beispiel

<link rel="stylesheet" type="text/css" href="style.css" />
<h1>header1</h1>
normal
<p style="color:green; font-weight: bold; ">absatz</p>

direkt im code: style="Eigenschaft:wert"

in style.css (einbinden mit link rel="stylesheet" type="text/css" href="style.css" )

h1 { color:red}

wordpress grundlagen

https://www.miss-webdesign.at/wordpress-grundlagen/

theme:
jedes jahr bringt wordpress ein neues theme raus - 2015 twentyFifteen stellt das menü in der sidebar als Baum dar, 2017 twentySeventeen bringt die menüpunkte nebeneinander

child theme:
neuen ordner in wp_content/themes mit parentTheme-child name und 3 dateien: style.css, functions.php und screenshot.png:

siteurls usw. in db in wp_options tabelle

define('FS_METHOD','direct');
chown www-data:www-data wordpress -R


wordpress auf linux

Apache, php installieren und testen:

sudo apt install apache2 php libapache2-mod-php -y
sudo service apache2 restart
cd /var/www/html/
create index.php:
<?php echo "hello world"; ?>
<?php echo date('Y-m-d H:i:s'); ?>
<?php phpinfo(); ?>

mysql installieren

sudo apt install mysql-server php-mysql phpmyadmin -y
sudo wget http://wordpress.org/latest.tar.gz
sudo tar xzf latest.tar.gz
=> test localhost/wordpress Directory sollte etwas anzeigen
sudo chown -R www-data: .
sudo mysql_secure_installation

Datenbank anlegen

sudo mysql -uroot -p
create database wordpress;
GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'PASSWORD';
FLUSH PRIVILEGES;
Exit the MariaDB database management tool with Ctrl + D.

Wordpress installieren

initial Seite wordpress aufrufen und db daten eingeben

Thursday, March 14, 2019

wpf dependency Properties

Definition 

in z.b. UserControl
public partial class MyUserControl : UserControl
{
        public static readonly DependencyProperty HeaderProperty =
            DependencyProperty.Register("Header", typeof(string), typeof(MyUserControl ), new FrameworkPropertyMetadata("DefaultHeaderText"));

//zusätzlich um einfacheen Setzten / Lesen der Dep.property:
        public string Header
        {
            get => (string)GetValue(HeaderProperty);
            set => SetValue(HeaderProperty, value);
        }
...

Binding 

im Usercontrol:
<UserControl x:Name="myUserControl"

<TextBlock Text="{Binding Header, ElementName=myUserControl}"/>

wichtig mit ElementName=myUserControl wird richtiger Context hergestellt

asp.net core simple web

create a dir
dotnet new web
creates Startup.cs and other files
dotnet run
browse localhost:5000


static files:
https://docs.microsoft.com/en-us/aspnet/core/fundamentals/static-files?view=aspnetcore-2.2
in Startup.cs

  public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {

            app.UseStaticFiles(); }

then create test.htm in wwwroot with any text in it
browse localhost:5000/test.htm

or:
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {

            app.UseStaticFiles();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.Run(async (context) =>
            {
                await context.Response.WriteAsync("Hello World!");
            });
        }

Wednesday, March 13, 2019

asp.net core on raspi (rasbian)

Installieren .netcore am rasperry:

This section is sourced from Dave the Engineer’s post on the Microsoft blog website.
The following commands need to be run on the Raspberry Pi whilst connected over an SSH session or via a terminal in the PIXEL desktop environment.
  • Run sudo apt-get install curl libunwind8 gettext. This will use the apt-get package manager to install three prerequiste packages.
  • Run curl -sSL -o dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/Runtime/release/2.0.0/dotnet-runtime-latest-linux-arm.tar.gz to download the latest .NET Core Runtime for ARM32. This is refereed to as armhf on the Daily Builds page.
  • Run sudo mkdir -p /opt/dotnet && sudo tar zxf dotnet.tar.gz -C /opt/dotnet to create a destination folder and extract the downloaded package into it.
  • Run sudo ln -s /opt/dotnet/dotnet /usr/local/bin` to set up a symbolic link…a shortcut to you Windows folks 😉 to the dotnet executable.
  • Test the installation by typing dotnet -h or dotnet --help

Erstellen einer hello world console app mit windows .net core sdk:

dotnet new console --output sample1 dotnet run --project sample1

Monday, February 25, 2019

WPF SPY Tool SNOOP

1) Fadenkreuz auf das Fenster der WPF Anwendung drag & droppen => Fenster mit GUI-Baum der WPF App öffnet sich
2) mit CRT-SHIFT Mause over wird das Control, über dem sich die Maus befindet im Snoop GUI Baum ausgewählt
3) Datacontext zeigt View Model an

Wednesday, February 20, 2019

powershell Ja Nein (Yes No)

1) mit GridView

        $Answer = "J","N" | Out-GridView -PassThru -Title "Obige Schichten wirklich löschen ?"


2) mit Read-Host

        do
        {
            $Answer = Read-Host "Obige Schichten wirklich löschen ? (J/N)"
        }
        While ($Answer -ne "J" -and $Answer -ne "N")

Powershell Ergebnis sql Abfrage anzeigen Out-Gridview

display sql return:


Write-Verbose $sql;

# if windows user has not enough rights use other eg.: -Username sa -Password xxx
$ret=invoke-sqlcmd  -Query $sql -serverinstance $ServerInstance -Database $Database 

#display in cmd window
write-host ($ret | Format-Table | Out-String)

#display in new window with columns
$Ret | Out-GridView


Tuesday, February 19, 2019

powershell Debug Verbose



  • Run $DebugPreference = 'Continue' to start seeing output from Write-Debug calls.
  • When you're done, restore preference variable $DebugPreference to its default value, using $DebugPreference = 'SilentlyContinue'
  •   $VerbosePreference = "continue"

Wednesday, February 13, 2019

hardlink link erstellen mit miklink (windows )


/J für Verzeichnis:

mklink /J Git C:\Users\myUser\AppData\Local\Programs\Git\

Monday, February 04, 2019

constraint system views sql server


select * from sys.indexes
select * from sys.check_constraints
select * from sys.key_constraints
select * from sys.default_constraints
select * from sys.sysconstraints
select * from sys.foreign_keys

Friday, January 25, 2019

Hinzufügen einer neuen Windows Installation mit bcdboot d:\windows und bcdedit / Adding another Windows Installation with bcdboot D:\Windows and bcdedit

1) make a new partition or add a new hD
2) open admin cmd
3a) bcdedit shows the current bootmenu
3b) change name with bcdedit /set {current} description "my Existing Old Windows"
4) add new partition with bcdboot D:\Windows
5) change name with bcdedit /set {id} description "myNewWindows"

bcdedit /delete {id} deletes an entry in bootmenu / löscht einen eintrag im bootmenu

mit msconfig lassen sich die boot partitionen auch anzeigen


mit shutdown.exe /r /o /t 00
kann das boot menü auffgerufen werden beim neustart

Wednesday, January 23, 2019

linux mount readonly -o ro

sudo mount -o ro /dev/sda5 /media/DatenRo

Friday, January 04, 2019

Ubuntu Mate auf Raspberry


remote Desktop raspberry pi

Server:
 sudo apt-get install xrdp
Client:
 sudo apt-get install Remmina

open ssh

open-ssh installieren (aus ubunto Software Boutique)

wenn ssh nicht startet:
sudo service ssh restart

im /etc/rc.local
service ssh restart
einfügen

Monday, December 31, 2018

Tuesday, December 11, 2018

ssrs Berechtigungen STAMM Ordner



Als Admin einen Browser öffnen, dann localhost/Reports/browse/ aufrufen, dort finden sich die Funktion Neu, Hochladen, Ordner verwalten, Sicht, Suchen
Ordner verwalten erlaubt es die Berechtigungen für den Stamm Ordner zu vergeben

Monday, December 03, 2018

linux scan network (rasperry)

sudo apt-get install nmap

sudo nmap -sn 192.168.1.0/24

https://nmap.org/book/man.html


Friday, November 30, 2018

SSRS Sql Server Reporting Services Basics

Insert Chart (rechte Maustaste) 

1) Charttyp auswählen
2) Felder aus Dataset mit Drag and Drop in die Chart Data ziehen: Summe Values Y Achse, Category Groups X Achse, Series Group: Legende

Toggle Visibility

1) Properties / ToggleItem auf eine Textbox setzen (z.b. tbToggle), neben dieser erscheint ein +- Symbol, Hidden Eigenschaft gibt an, ob die Gruppe anfangs sichtbar ist oder nicht
2) Bei der Toggle Textbox die Eigenschaft InitialToggleState setzten