... newer stories
|| Beitrag erstellt von: develop am 19. August ||
CSS - Seite zentrieren
body {
padding: 0;
margin: 0;
}
#zentrieren {
margin-left:auto;
margin-right:auto;
Width: 800px;
}
aufzurufen:
<**div id="zentrieren">
Dieses 800px breite Div ist zentriert!
<**/div>
** entfernen
|| Beitrag erstellt von: develop am 19. August ||
PowerShell - Parameter übergeben
function global:Schreib-Para
{
param($text="");
write-host $text;
}
um die Funktion aufzurufen und ihr den Parameter zu übergeben, geben wir folgendes in der Eingabeaufforderung oder im Script ein:
Schreib-Para -text IchBinDerVariablenInhalt
oder wenn man die Reihenfolge der Parameter kennt, kann man sie auch ohne -text übergeben, also
Schreib-Para IchBinDerVariablenInhalt
|| Beitrag erstellt von: develop am 19. August ||
PowerShell - Funktionen aufrufen
function global:schreib-alle
{
schreib-2 ;
schreib-3 ;
schreib-4 ;
}
{
schreib-2 ;
schreib-3 ;
schreib-4 ;
}
function global:schreib-2
{
write-host "Test2";
}
{
write-host "Test2";
}
function global:schreib-3
{
write-host "Test3";
}
{
write-host "Test3";
}
function global:schreib-4
{
write-host "Test4";
}
{
write-host "Test4";
}
|| Beitrag erstellt von: develop am 14. August ||
PowerShell - Upload File to FTP Server
Write-Host "Upload File 1"
$web = new-object -typename Net.WebClient
$web.Credentials("username","mypasswort");
$web.UploadFile("ftp://ftp.account.de/myfolder/","c:\myfolder\myfile.txt");
|| Beitrag erstellt von: develop am 14. August ||
PowerShell - Grundkenntnisse
1. CMD erstellen
@echo off
powershell /noexit .\meinfile.ps1
2. meinfile.ps1 erstellen
Syntax - Kommentare in PowerShell
# Ich bin ein Kommentar
# Scriptausführung erlauben
set-executionpolicy Execution Policy
set-executionpolicy Remotesigned
Execution policy
- Unrestricted Alle Scripts dürfen uneingeschränkt ausgeführt werden
- RemoteSigned Nur lokal geschriebene Scripts dürfen ausgeführt werden, alle anderen müssen signiert werden. (siehe Get-Help about_signing)
- AllSigned Ausschließlich signierte Scripts dürfen ausgeführt werden
- Restricted KEIN Script darf ausgeführt werden (Grundeinstellung)
Syntax - Variablen
$all = Test-Path c:\test.txt
Syntax - Arrays
$array = @("value1", "value2", "value3")
Syntax - If Abfragen
if ($all -eq $false)
{
# File nicht vorhanden
}
else
{
# File vorhanden
}
Syntax - Schleifen
- foreach
$dir = Get-Childitem irgend ein Verzeichnis
foreach ($i in $dir)
{
Write-Host $i
}
- for
$array = @("A", "B", "C", "D")
for ($i = 0; $i -le $array.count; $i++)
{
Write-Host $array[$i]
}
- do-while
do
{
[Int]$input = Read-Host "Geben Sie eine Zahl ein: (Zum Beenden 0 drücken)"
} while (! $input -eq 0)
Syntax - Textausgabe
Write-Host "Text ausgabe"
Write-Host "`n - ist ein Zeilenumbruch"
Syntax - Funktionen
function global:Write-Text
{
# ich bin eine Funktion
# und nun kommt ein parameter
param($text="")
Write-Host $text
}
Download:
http://www.microsoft.com/downloadS/details.aspx?familyid=60DEAC2B-975B-41E6-9FA0-C2FD6AA6BC89&displaylang=en
|| Beitrag erstellt von: develop am 14. August ||
PowerShell - Email verschicken
function global:sendmails
{
param($From, $To, $Subject, $Body)
$SmtpClient = New-Object System.Net.Mail.SmtpClient
$SmtpClient.host = "smtpmailaccout.de"
$SmtpClient.Send($Form, $To, $Subject, $Body)
}
Aufzurufen:
sendmails -From me@email.com -To myfriend@email.com -Subject AnEmail -Body WhatIHaveToSay
|| Beitrag erstellt von: develop am 14. August ||
PowerShell - File Downloaden
#Write-Host "Download File 1"
$web = new-object -typename Net.WebClient
$web.DownloadFile("http://GewünschteAdresse.de/datei.exe", "c:\MeinOrdner\datei.exe");
|| Beitrag erstellt von: develop am 14. August ||
Sql Grundlagen
--Datenbank erstellen
CREATE DATABASE TestData
GO
Use TestData;
GO
-- Tabelle erstellen
CREATE TABLE dbo.Products
(ProductID int PRIMARY KEY NOT NULL,
ProductName varchar(25) NOT NULL,
Price money NULL,
ProductDescription text NULL)
GO
-- Standard syntax
INSERT dbo.Products (ProductID, ProductName, Price, ProductDescription)
VALUES (1, 'Clamp', 12.48, 'Workbench clamp')
GO
-- oder
INSERT dbo.Products
VALUES (75, 'Tire Bar', NULL, 'Tool for changing tires.')
GO
-- Update
UPDATE dbo.Products
SET ProductName = 'Flat Head Screwdriver'
WHERE ProductID = 50
GO
-- The basic syntax for reading data from a single table
SELECT ProductID, ProductName, Price, ProductDescription
FROM dbo.Products
GO
-- Returns all columns in the table
-- Does not use the optional schema, dbo
SELECT * FROM Products
GO
-- Returns only two of the columns from the table
SELECT ProductName, Price
FROM dbo.Products
GO
-- Create Procedures
CREATE PROCEDURE pr_Names @VarPrice money
AS
BEGIN
-- The print statement returns text to the user
PRINT 'Products less than ' + CAST(@VarPrice AS varchar(10));
-- A second statement starts here
SELECT ProductName, Price FROM vw_Names
WHERE Price < @varPrice;
END
GO
-- Stored Procedures ausführen
EXECUTE pr_Names 10.00;
GO
|| Beitrag erstellt von: develop am 13. August ||
HTML - FavIcon einbinden
<**link rel="shortcut icon" href="favicon.ico" >
**entfernen
... older stories