Mittwoch, 20. Dezember 2023

https://www.msxfaq.de/code/powershell/pserrhandling.htm

Try / Catch
 try {
   write-host "Hier wird was versucht, was schief gehen kann, z.B. Division durch 0"
   $a = 1/0
}
catch {
   write-host "Fehler abgefangen: `r`n $_.Exception.Message"

								}
finally {
    write-host "Finalize wird immer ausgeführt"
}
# Der Fehler wird zusaetzlich auch in $error hinterlegt
write-host $Error

Kategorie: programmierung

    anzeigen   



https://talkingpdf.org/forms-data-format-fdf/

http://www.lagotzki.de/pdftk/index.html#burst_cat

https://www-user.tu-chemnitz.de/~hot/pdf_formulare/

https://wiki.ubuntuusers.de/pdftk/

Kategorie: programmierung

    anzeigen   



https://www.itnator.net/akku-zustand-ermitteln-mit-powercfg-und-powershell/

Kategorie: programmierung

    anzeigen   



Funktion von itnator.net


 # Funktion deklarieren
function testfunktion ([int]$zahl){

    #Auszuführende Anweisung
    $ergebnis = $zahl * 2

    #Ergebnis ausgeben / zurück geben
    return $ergebnis
}

# Funktion aufrufen
testfunktion(80)

Kategorie: programmierung

    anzeigen   



PowerShell: Prüfen, ob Administrator-Rechte vorhanden

Run only as Admin
 if (! ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
    throw "Run with administrator rights"
} 

Kategorie: programmierung

    anzeigen   


Mittwoch, 4. Juni 2014

Das Zauberwort heisst Raycasting und wurde bei Spielen wie Daggerfall und Duke Nukem 3D eingesetzt.

Here's the trick: a raycasting engine doesn't draw the whole scene at once. Instead, it divides the scene into independent columns and renders them one-by-one. Each column represents a single ray cast out from the player at a particular angle. If the ray hits a wall, it measures the distance to that wall and draws a rectangle in its column. The height of the rectangle is determined by the distance the ray traveled - more distant walls are drawn shorter.

http://www.playfuljs.com/a-first-person-engine-in-265-lines/ - Via reddit .com
Kategorie: programmierung

    anzeigen   



Die PlayCanvas WebGL Game Engine ist nun Open Source.

Was ist PlayCanvas eigentlich?

Es ist eine JavaScript-Bibliothek, die speziell für den Aufbau von Videospielen entwickelt. Es implementiert alle wichtigen Komponenten wie:
  • Graphics: model loading, per-pixel lighting, shadow mapping, post effects
  • Physics: rigid body simulation, ray casting, joints, trigger volumes, vehicles
  • Animation: keyframing, skeletal blending, skinning
  • Audio engine: 2D and 3D audio sources
  • Input devices: mouse, keyboard, touch and gamepad support
  • Entity-component system: high level game object management
SWOOOP zeigt zum Beispiel, was man mit HTML5 und WebGL anfangen kann.

Weiter Links:
Samples, API Referenze, Developer Resources, Anleitungen
Kategorie: programmierung

    anzeigen   


Dienstag, 4. Februar 2014

Fade mit der ColorMatrix.

OrginalText codeproject.com
using System;
using System.Drawing;
using System.Drawing.Imaging;
 
namespace ImageUtils
{
    class ImageTransparency
    {
        public static Bitmap ChangeOpacity(Image img, float opacityvalue)
        {
            Bitmap bmp = new Bitmap(img.Width,img.Height); // Determining Width and Height of Source Image
            Graphics graphics = Graphics.FromImage(bmp);
            ColorMatrix colormatrix = new ColorMatrix();
            colormatrix.Matrix33 = opacityvalue;
            ImageAttributes imgAttribute = new ImageAttributes();
            imgAttribute.SetColorMatrix(colormatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
            graphics.DrawImage(img, new Rectangle(0, 0, bmp.Width, bmp.Height), 0, 0, img.Width, img.Height, GraphicsUnit.Pixel, imgAttribute);
            graphics.Dispose();   // Releasing all resource used by graphics 
            return bmp;
        }
    }
}
pictureBox1.Image = ImageUtils.ImageTransparency.ChangeOpacity(Image.FromFile("filename"),opacityvalue);
Fade mit Alpha.

OrginalText stackoverflow.com
int alpha = 0;

private void timer1_Tick(object sender, EventArgs e)
{
    if (alpha++ < 255)
    {
    	Image image = pictureBox1.Image;
    	using (Graphics g = Graphics.FromImage(image))
    	{
    		Pen pen = new Pen(Color.FromArgb(alpha, 255, 255, 255), image.Width);
    		g.DrawLine(pen, -1, -1, image.Width, image.Height);
    		g.Save();
    	}
    	pictureBox1.Image = image;
    }
    else
    {
    	timer1.Stop();
    }
}
Fade mit Blur Effekt.

OrginalText Josh Jordan
        public static Bitmap Fade(Bitmap image1, Bitmap image2, int opacity)
        {
            Bitmap newBmp = new Bitmap(Math.Min(image1.Width,image2.Width), Math.Min(image1.Height,image2.Height));
            for (int i = 0; i < image1.Width & i < image2.Width; i++)
            {
                for (int j = 0; j < image1.Height & j < image2.Height; j++)
                {
                    Color image1Pixel = image1.GetPixel(i, j), image2Pixel = image2.GetPixel(i, j);
                    Color newColor = Color.FromArgb( (image1Pixel.R * opacity + image2Pixel.R * (100 - opacity) ) / 100, (image1Pixel.G * opacity + image2Pixel.G * (100 - opacity) ) / 100, (image1Pixel.B * opacity + image2Pixel.B * (100 - opacity) ) / 100);
                    newBmp.SetPixel(i, j, newColor);
                }
            }
            return newBmp;
int trans = 30;

pictureBox1.Image = Fade(new Bitmap(imgOld), new Bitmap(imgNew), trans);
Kategorie: programmierung

    anzeigen   


Dienstag, 10. Dezember 2013

 jQuery.fn.centerFix = function () {
    this.css("position","absolute");
    this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
    this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");
    return this;
}
 
$('.div').centerFix();
Via der-webentwickler.net

Tags: jQuery, zentrieren
Kategorie: programmierung

    anzeigen   


Dienstag, 15. Oktober 2013

Was bedeutet dieser Fehler?
 ReferenceError: $ is not defined
	$(document).ready(function() {
Die Reihenfolge der abzuarbeitenden jQuery-Scripte sollte eingehalten werden. Der Verweis auf das jQuery-Script erfolgt an erster Stelle. Erst danach kann auf das eigene "nachfolgende" JavaScript-Script zugegriffen werden.
script type='text/javascript' src='jquery.min.js'
script type='text/javascript' src="meinscript.js'
Kategorie: programmierung

    anzeigen