Wednesday, December 18, 2019

css selektoren

element .. alle html elemente dieses typs (h1..)
#id ... genau ein Html element
.classname ... alle elemente mit dieser klasse


Beispiele:

h1 { color:red}
h2,h3 { color:blue}

.myClass {color:orange}

#myId {color:yellow}

Sunday, December 15, 2019

treecomp filter


desktop.ini;AlbumArt*;Thumbs.db;Folder.jpg
*Recycle*;Recovery;System Volume Information;Config.Msi

Wednesday, December 11, 2019

linux partitionen anzeigen

sfdisk -l
lsblk -f
cat /proc/partitions
lshw -class disk -short
df -h
du -h 

Thursday, December 05, 2019

git lokalen mit remote branch verbinden

remote branch nach lokal auschecken: (legt lokal einen gleichnamigen branch an):
git checkout --track origin/<branchname>


bereits existierenden lokalen branch (der gerade aktiv ist):
git branch --set-upstream-to=origin/<branchname>

Sunday, November 17, 2019

wake up

powercfg befehle für cmd:


from
https://answers.microsoft.com/en-us/windows/forum/windows_10-other_settings/windows-10-keeps-waking-up-from-sleep-in-the/58052fd3-87fe-4457-aeaf-974b5ea15080?auth=1

eventlog: powertroubleshooter, Kernel-Boot, Kernel-Power, Kernel-General

powercfg/lastwake
powercfg /devicequery wake_armed
powercfg/waketimers

z.b. weckt Universal Orchestrator Start einmal täglich auf



Einschalt / Abschaltzeiten:

Kernel-Power würde prinzipiell genügen, hat aber noch die falsche (EinschlafZeit) beim Aufwachen. Daher muß eine zusätzliche Aufwach Meldung über Kernel-General eingeblendet werden.
Die Kernel-Power Meldungen geben leider nur den Einschalfzeitpunkt bekannt.
Kernel-General,  Kernel-Power
Ereignis Ids: 1, 42, (107)
1 .. Time Sync
42.. schlafen
107 Reaktivierung

besser:
Kernel-Power 42 einschalfZeit +Erklärung
Power-Troubleshooter 1: AufwachZeitpunkt + Erklärung

Meldungen beim Aufwachen:

1)  Kernel-Power 107: Das System wurde aus dem Energiesparmodus reaktiviert -- ACHTUNG: FALSCHE UHRZEIT (noch alte Uhrzeit)
2) Kernel-General 1: Systemzeit wird synchronisiert
3) ... Hyper_V_Vm_Switch ...

4) Kernel Boot ...
5) Power-Troubleshooter 1: Das System wurde aus einem Standbymodus reaktiviert.

Zeit im Energiesparmodus: ‎2019‎-‎11‎-‎28T16:20:24.825454800Z
Reaktivierungszeit: ‎2019‎-‎11‎-‎28T20:22:06.250093500Z

Reaktivierungsquelle: Unbekannt


Medlungen beim Einschlafen:

Kernel-Power 42: Das System wird in den Standbymodus versetzt.

nützliche powercfg Befehle

powercfg /SleepStudy ... erzeugt einen html bericht


Tuesday, November 05, 2019

raspi 4 dual monitor

neben Power anschluss ist linker monitor, der nächste dann rechter, kann man in Einstellungen / Screen Configuration ändern, rechts Click auf Leiste => Anzeige links ... und auf Monitor 1 oder 2, wenn dieser nicht mehr angeschlossen ist sieht man sie nicht mehr, Monitor 1 und 2 sind aber nicht fix zugeordnet, wenn nur einer angeschlossen ist dies Monitor 0

Monday, October 07, 2019

oracle stored proc

create or replace PROCEDURE CreateAliasPaths AS
        pos1 NUMBER:=0;
        pos2 NUMBER:=0;
        origName VARCHAR2(4000);
        origSearchStr VARCHAR2(4000);
        aliasName VARCHAR2(4000);
        aliasPath VARCHAR2(4000);
       
BEGIN
    dbms_output.put_line ('------------ CreateAliasPaths Beginn:' || TO_CHAR(SYSDATE, 'DD-MON-YYYY HH24:MI:SS'));

    FOR r IN (SELECT * FROM Table0) --for testing: where rownum<=3
    LOOP
        pos1:=INSTR(r.ALIAS,' ');
        origName:=SUBSTR(r.ALIAS,1, pos1-1); 
        origSearchStr:='%' || origName  || '%';
        pos2:=INSTR(r.ALIAS,' ',pos1+1);
        if (0=pos2) THEN
            pos2:=LENGTH(r.ALIAS);
        END IF;
        LOOP
            aliasName:=SUBSTR(r.ALIAS,pos1+1, pos2-pos1-1); 
            --dbms_output.put_line('AliasTabelle:' || r.ALIAS);
            --dbms_output.put_line('originalName:' || origName || ',' || pos1 || ' ' || pos2 || ' aliasName:>' || aliasName || '<' );

            FOR rRepro IN (SELECT * FROM table1 WHERE LOWER(PATH) like LOWER(origSearchStr))
            LOOP
                aliasPath:=REPLACE(rRepro.PATH, origName, aliasName);
                --dbms_output.put_line('aliasPath:' || aliasPath );
                UPDATE table1 SET ALIAS=rRepro.ALIAS || ' ' || aliasPath WHERE table1ID=rRepro.table1ID;
            END LOOP;
            --dbms_output.put_line( '-------------------------------------------------' );
            pos1:=pos2;
            EXIT WHEN (pos1>=LENGTH(r.ALIAS));
            pos2:=INSTR(r.ALIAS,' ',pos1+1);
            if (0=pos2) THEN
                pos2:=LENGTH(r.ALIAS);
            END IF;
         END LOOP;   
         --dbms_output.put_line( '=============================================================================' );
    END LOOP;
    COMMIT;   
    dbms_output.put_line ('------------ CreateAliasPaths End:' || TO_CHAR(SYSDATE, 'DD-MON-YYYY HH24:MI:SS'));
END CreateAliasPaths;

Oracle Sql Developper Debuggen:

Stored Procedure rechte Maustaste Debuggen, dann für Debug kompelieren
Breakpoint durch Click in linke breite Leiste

Rechte zum Oracle Debuggen:

grant debug connect session to myDebugUser;
grant debug any procedure to myDebugUser;
-- Wenn: ORA-24247: Netzwerkzugriff von Zugriffskontrollliste abgelehnt
grant execute on DBMS_DEBUG_JDWP to myDebugUser;

Thursday, October 03, 2019

oracle substr stored proc

create or replace
PROCEDURE TESTHM AS
BEGIN
    dbms_output.put_line ('TestHm');
    DECLARE str VARCHAR2(4000);
    BEGIN
        FOR r IN (SELECT * FROM myTable where rownum<=5)
        LOOP
            str:=SUBSTR(r.myStrField,1, 10);     
            dbms_output.put_line( str );
            dbms_output.put_line( r.myStrField);
        END LOOP;
    END;   

    dbms_output.put_line (CURRENT_DATE);
END TESTHM;

oracle stored procedure loop over records (withouth cursor)

create or replace
PROCEDURE TESTHM AS
BEGIN
    dbms_output.put_line ('TestHm');

    FOR r IN (SELECT * FROM myTable)
    LOOP
        dbms_output.put_line( r.myField );
    END LOOP;

    dbms_output.put_line (CURRENT_DATE);
END TESTHM;

set serveroutput on;     
execute testhm;

Thursday, September 12, 2019

From c# to Java - from Visual Studio to Eclipse



taskVisualStudioEclipse
go to definitionF12F3
last locationCRT -CRT Q
  

taskc#java
overrideoverride@Override
DatumDateTimeDate
  

Sunday, September 01, 2019

bildschirmaufloesung linux

zuerst mit cvt die konfig zeile für xrandr generieren cvt aufloesungx aufloesungy frequenz:
cvt 1920 1080 60

dann xrandr --addnew obigen output hinzufügen
dann in system/geräte/bildschirme neue auflösung auswählen

https://wiki.ubuntuusers.de/RandR/

# 1024x768 59.92 Hz (CVT 0.79M3) hsync: 47.82 kHz; pclk: 63.50 MHz
Modeline "1024x768_60.00"   63.50  1024 1072 1176 1328  768 771 775 798 -hsync +vsync

xrandr --newmode "1024x768_60.00"   63.50  1024 1072 1176 1328  768 771 775 798 -hsync +vsync
xrandr --addmode DVI-0 "1024x768_60.00"
xrandr --output DVI-0 --mode "1024x768_60.00" 

Monday, August 19, 2019

browser raspi

from gui: midori,luakit,
start from commandline: dillo, epiphany-browser, netsurf, lynx

Friday, June 14, 2019

gpio Raspberry

gpio read 23

php script test.php (www-data zu gruppe gpio hinzufügen )

<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Schalter</title>
</head>
GPIO 23 schalten:
<form method="get" action="pool.php">
<input type="submit" value="Licht ein" name="Lichtein">
<input type="submit" value="Licht aus" name="Lichtaus">
</form>
<?php
$modeon18 = exec("gpio mode 23 out");
if(isset($_GET["Lichtein"])){
$val = exec("gpio write 23 1");
echo "Licht an";
}
else if(isset($_GET["Lichtaus"])){
$val = exec("gpio write 23 0");
echo "Licht aus";
}
echo "<hr/>";
$val = exec("gpio read 23");
echo " gpio23 = $val ";
echo " <hr />"
?>
</body>
</html>

Friday, June 07, 2019

ownlcloud auf raspberry

Vorbedingungen

apt install -y apache2 mariadb-server libapache2-mod-php7.0 \
    php7.0-gd php7.0-json php7.0-mysql php7.0-curl \
    php7.0-intl php7.0-mcrypt php-imagick \
    php7.0-zip php7.0-xml php7.0-mbstring php-intl

anschließend rebooten

download und entpacken owncloud 

neueste version auf download page)
wget https://download.owncloud.org/community/owncloud-10.2.0.zip

das zip file dann nach /var/www/html verschieben und entpacken:
unzip -q owncloud-10.2.0.zip

owncloud data verzeichnis vorbereiten:
mkdir /var/www/html/owncloud/data
chown www-data:www-data /var/www/html/owncloud/data
chmod 750 /var/www/html/owncloud/data




hat nicht ganz funktioniert:

wget -nv https://download.owncloud.org/download/repositories/production/Debian_9.0/Release.key -O Release.key
apt-key add - < Release.key

echo 'deb http://download.owncloud.org/download/repositories/production/Debian_9.0/ /' > /etc/apt/sources.list.d/owncloud.list
apt-get update
apt-get install owncloud-files

ssms sql server management studio pfad

"C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio\Ssms.exe"


Thursday, May 23, 2019

configure grub

sudo nano /etc/default/grub
sudo update-grub

Sunday, May 19, 2019

wordpress Export/Import (einrichten der seite)

seiten importieren (Import, wordpress Importer installieren, starten, xml fiole
theme installieren (z.b. donovan)
Apeareance-Customize / HomepageSettings/StaticPage/Hauptseite=
Apeareance-Customize/Menu

WPF Binding ToolTip and ContextMenu with PlacementTarget

ToolTip und Contextmenü haben keinen übergeordneten visuellen Baum, da sie in eigenen Fenstern angezeigt werden

Friday, May 10, 2019

linux mysql basics

linux: apt install mysql-server
starten wenn nicht gestartet: /etc/init.d/mysql start

mysql -u user

show databases;

SELECT User FROM mysql.user; 


CREATE USER 'da'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'da'@'localhost' WITH GRANT OPTION;

FLUSH PRIVILEGES;

Monday, April 15, 2019

Razore Asp.net Core


  1. https://docs.microsoft.com/en-us/aspnet/core/tutorials/razor-pages/razor-pages-start?view=aspnetcore-3.0&tabs=visual-studio
  2. neue Web App anlegen (asp.net core web app, Type Web Application)
  3. starten & testen
  4. statische Seiten in wwwroot hinufügen
  5. https://docs.microsoft.com/en-us/aspnet/core/tutorials/razor-pages/model?view=aspnetcore-3.0&tabs=visual-studio
  6. Model Folder und Model Klasse Test.cs hinzufügen
  7. in Pages Folder Test hinzu
  8. rechte Maustaste auf Foldfer test, Hinzufügen, nues Gerüstelement
  9. Razor Pages EF (CRUD) hinzufügen
  10. Modelkalsse Test.cs auswählen und bei Context auf + drücken => neuer Context wird erzeugt
  11. RUN: Zu Root /Test hinzufügen um generierte Seiten anzuzeigen

Sunday, April 14, 2019

Citadel: Apache und webcit citadel Ports



server starten: sudo service citadel start
neu konfigurieren: sudo /usr/lib/citadel-server/setup



/etc/default/webcit
/etc/apache2/ports.conf
#service webcit restart && service apache2 restart

wennes nicht geht:
updaten, dann:
apt-get install build-essential curl g++ gettext shared-mime-info libssl-dev zlib1g-dev
und
curl http://easyinstall.citadel.org/install | bash

Friday, April 12, 2019

nützliche Raspi Raspberry Software

sudo apt install:

lynx #textbrowser
midori #old rasbian browser, fast light

xrdp #remote desktop server
rdesktop # remote desktop client

Thursday, March 28, 2019

wpf binding examples

Satic Resource und Converter:

Width="{Binding Source ={StaticResource ColorPickerColumnDefaultWidth}, Converter={StaticResource DoubleToGridLengthConverter},Mode=OneWay}" />

Dependency property in User Control:
Text="{Binding TitleText, ElementName=MyUserControl}"


<TextBlock Text="{Binding Name, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}} }"/>
<TextBlock Text="{Binding Name, ElementName=UcPaneHeader}"/>

<TextBlock Text="{Binding Name, ElementName=PaneTitle}"/>

Thursday, March 21, 2019

asp.net core and EF (asp.net types: empty, API)

Connection Strings

InMemory Datenbank:

services.AddDbContext<TodoContext>(opt => opt.UseInMemoryDatabase("TodoList"));

LocalDb

aus https://docs.microsoft.com/en-us/ef/core/get-started/aspnetcore/new-db?tabs=visual-studio

var connection = @"Server=(localdb)\mssqllocaldb;Database=EFGetStarted.AspNetCore.NewDb;Trusted_Connection=True;ConnectRetryCount=0";
    services.AddDbContext<BloggingContext>
        (options => options.UseSqlServer(connection));

leere Web App

Programm.cs startet Webhost mit class Startup und Methode Configure, z.b.: 

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

einfaches Webservice (API)

webApi Template Projekt erstellen - liefert value1, value2 durch ValuesController, der einfach auf GET Request mit Konstantem String antwortet, dazu genügen die Attribute:
    [Route("api/[controller]")] // antwortet auf SubDir mit Controllername (schneided Controller Suffix weg)
    [ApiController]

in Startup.cs: app.UseMvc();


füge Model Klasse und DbContext hinzu:

Model(s):

    public class TodoItem
    {
        public long Id { get; set; }
        public string Name { get; set; }
        public bool IsComplete { get; set; }
    }

DbContext:

public class TodoContext : DbContext
    {
        public TodoContext(DbContextOptions<TodoContext> options)
            : base(options)
        {
        }
        public DbSet<TodoItem> TodoItems { get; set; }
    }

in Startup.cs DbContext hinzufügen:
public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext<TodoContext>(opt => opt.UseInMemoryDatabase("TodoList"));
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
        }


Controller hinzufügen (rechte Maustaste auf Controller Ordner )

1)MVC-Controller leer
2) MVC Controller mit Ansichten unter Verwendung von EF
3) MVC Controller mit Lese/SchreibAktionen
4) API-Controller leer:
    [Route("api/[controller]")]
    [ApiController]
    public class EmptyController : ControllerBase
    {
    }
5) API-Controller mit Lese/Schreibaktionen:
fügt get, post,put und delete Methoden hinzu, unter Annahme einer id vom Typ int,, gibt string "value" zurück
6) API-Controller mit Aktionen unter Verwendung von EF:
in Maske Context und Modell Klasse auswählen => generiert API mit put, get usw.


Statische Files

schließlich jquery static file dass die api nutzt:
in Startup.onfigure:
            app.UseDefaultFiles();
            app.UseStaticFiles();



Wednesday, March 20, 2019

clean obj bin

Get-ChildItem .\ -include bin,obj -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse }

asp.net core EF core migrations

1) add a model
    public class TestEntity
    {
        public int Id { get; set; }

        public string TestString { get; set; }

    }

2) add a context
    public class TestContext1 : DbContext
    {
        DbSet<TestEntity> TestEntities { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            base.OnConfiguring(optionsBuilder);
            if (!optionsBuilder.IsConfigured)
            {
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.
                optionsBuilder.UseSqlServer(@"Server=localhost\sqlexpress;Database=test;Trusted_Connection=True;");
            }
         

        }
    }

3) start Nuget Package Manager Console: ALT T N O
select the project with your model and context as start project
Add-Migration M0001
update-database

WICHTIG: Projekt mit Context muß als Startup projekt und in Nuget Manager Console ausgewählt sein ! Bei Asp.Net muß der Context auch in der Startup Klasse sein ...

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!");
            });
        }