Translate

Donnerstag, 31. August 2017

Die deutschen Diesel sind schlecht? Die Statistik zeigt ein anderes Bild...

Die deutschen Diesel sind schlecht? Die Statistik zeigt ein anderes Bild...

C# IEnumerable to ObservableCollection as extension method

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DBLayer.Extensions
{
    public static class IEnumerableExtensions
    {
        public static ObservableCollection<T> ToCollection<T>(this IEnumerable<T> list)
        {
            var collection = new ObservableCollection<T>();
            foreach (var item in list)
                collection.Add(item);
            return collection;
        }
    }
}

C# IEnumerable to ObservableCollection as extension method

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DBLayer.Extensions
{
    public static class IEnumerableExtensions
    {
        public static ObservableCollection<T> ToCollection<T>(this IEnumerable<T> list)
        {
            var collection = new ObservableCollection<T>();
            foreach (var item in list)
                collection.Add(item);
            return collection;
        }
    }
}

C# string contains only values from a given sequence

C# Visual Studio Unit testing

Arduino/ NodeMCU Telegram bot library

NodeMCU wrong pin mapping...

https://github.com/esp8266/Arduino/issues/584

static const uint8_t D0   = 16;
static const uint8_t D1   = 5;
static const uint8_t D2   = 4;
static const uint8_t D3   = 0;
static const uint8_t D4   = 2;
static const uint8_t D5   = 14;
static const uint8_t D6   = 12;
static const uint8_t D7   = 13;
static const uint8_t D8   = 15;
static const uint8_t D9   = 3;
static const uint8_t D10  = 1;

Git checkout and stash in one step

C# Access AccessViolationException

C# dotnetsnippets Exception handling

C# SEHExceptions/ Corrupted state exceptions abfangen

LaTeX Name referencing for chapters/ headings

Dienstag, 22. August 2017

Arduino Nodemcu-Get bot to send to group chat/ Bot an Gruppe senden lassen

Arduino Nodemcu Wifi

Arduino Nodemcu Wifi connect

Nodemcu Arduino Telegram Bot library

C# Barcode reader example

ZXing.Net example code not working

C# Bitmap to byte array

Montag, 21. August 2017

C# Read barcode from image

Arduino deep sleep mode

Access truncate tables

Install Tor on a Raspberry

Tor ist tot-Was nun?

Telefonspammer nerven dich? - Telefonpaul.de hilft :D

Telefonüberwachung für Smartphones

Arduino Phone Dialer

Cryptocat sicher chatten

Die wahren Dieselautos mit den höchsten Ausstößen

Donnerstag, 10. August 2017

Nuget-Wie erstellt man ein Paket


1. Downloaden
2. Datei "nuget.exe" in Solutionordner kopieren
3. nuget.exe spec (bzw. ./nuget.exe spec) in Shell ausführen. (In GitGui sowie Powershell ist das 2. notwendig).
4. Paketdatei wie

<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
    <metadata>
    <!-- The identifier that must be unique within the hosting gallery -->
    <id>Contoso.Utility.UsefulStuff</id>

    <!-- The package version number that is used when resolving dependencies -->
    <version>1.8.3.331</version>

    <!-- Authors contain text that appears directly on the gallery -->
    <authors>Dejana Tesic, Rajeev Dey</authors>

    <!-- Owners are typically nuget.org identities that allow gallery
            users to easily find other packages by the same owners.  -->
    <owners>dejanatc, rjdey</owners>

    <!-- License and project URLs provide links for the gallery -->
    <licenseUrl>http://opensource.org/licenses/MS-PL</licenseUrl>
    <projectUrl>http://github.com/contoso/UsefulStuff</projectUrl>

    <!-- The icon is used in Visual Studio's package manager UI -->
    <iconUrl>http://github.com/contoso/UsefulStuff/nuget_icon.png</iconUrl>

    <!-- If true, this value prompts the user to accept the license when
            installing the package. -->
    <requireLicenseAcceptance>false</requireLicenseAcceptance>

    <!-- Any details about this particular release -->
    <releaseNotes>Bug fixes and performance improvements</releaseNotes>

    <!-- The description can be used in package manager UI. Note that the
            nuget.org gallery uses information you add in the portal. -->
    <description>Core utility functions for web applications</description>

    <!-- Copyright information -->
    <copyright>Copyright ©2016 Contoso Corporation</copyright>

    <!-- Tags appear in the gallery and can be used for tag searches -->
    <tags>web utility http json url parsing</tags>

    <!-- Dependencies are automatically installed when the package is installed -->
    <dependencies>
        <dependency id="Newtonsoft.Json" version="9.0" />
    </dependencies>
    </metadata>

    <!-- A readme.txt is be displayed when the package is installed -->
    <files>
    <file src="readme.txt" target="" />
    </files>
</package>
 
in https://docs.microsoft.com/en-us/nuget/create-packages/creating-a-package erstellen.
 
5. nuget.exe pack (bzw. ./nuget.exe pack) ausführen.
In GitGui oder Powershell ist das 2. nötig.

Geile Icons für Github

Nuget installieren Visual Studio 2017

Install-Package NuGet.CommandLine

PS4 Pro 1TB

How to publish on nuget.org for Visual Studio packages

C#-Resize images

public Bitmap ResizeImage(Image image, int width, int height)
        {
            var destinationRectangle = new Rectangle(0, 0, width, height);
            var destinationImage = new Bitmap(width, height);
            destinationImage.SetResolution(image.HorizontalResolution, image.VerticalResolution);
            using (var graphics = Graphics.FromImage(destinationImage))
            {
                SetGraphicsOptions(graphics);
                using (var wrapMode = new ImageAttributes())
                {
                    wrapMode.SetWrapMode(WrapMode.TileFlipXY);
                    graphics.DrawImage(image, destinationRectangle, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, wrapMode);
                }
            }
            return destinationImage;
        }

        private void SetGraphicsOptions(Graphics graphics)
        {
            graphics.CompositingMode = CompositingMode.SourceCopy;
            graphics.CompositingQuality = CompositingQuality.HighQuality;
            graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
            graphics.SmoothingMode = SmoothingMode.HighQuality;
            graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
        }

Outlook PST-Datei Passwort setzen

Mittwoch, 9. August 2017

C# Autosize columns

ContactsDataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;

Excel VBA Refresh column filters.

Sub Button_RefreshFilter()
    If Me.FilterMode = True Then
        With Application
            .EnableEvents = False
            .ScreenUpdating = False
        End With
        
        With ActiveWorkbook
            .CustomViews.Add ViewName:="Mine", RowColSettings:=True
            Me.AutoFilterMode = False
            .CustomViews("Mine").Show
            .CustomViews("Mine").Delete
        End With
        
        With Application
            .EnableEvents = True
            .ScreenUpdating = True
        End With
    End If
End Sub

Dienstag, 8. August 2017

Seagate Barracuda LP 2TB 5900 RPM

Western Digital Red 2TB 5400 RPM

Arduino-Deep sleep mode

C# Embedded resources for "installer" like behaviour-Example


http://stackoverflow.com/questions/859699/how-to-add-resources-in-separate-folders


Einfach die Ordner (Und Dateien --> Bilder, SQL-Skripte, ...) in Ordner einfügen, zum Projekt hinzufügen.

Dann bei allen auf "Embedded resource" stellen:




Für SQL:

public MainWindow()
        {
            InitializeComponent();
            string commandText;
            Assembly thisAssembly = Assembly.GetExecutingAssembly();
            using (Stream s = thisAssembly.GetManifestResourceStream("TestAppInstaller.Resource.Test.Test.sql"))
            {
                using (StreamReader sr = new StreamReader(s))
                {
                    commandText = sr.ReadToEnd();
                }
            }
            Debug.Print($"SQL commando: {commandText}");
        }

Für Bilder:

using(Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("<root namespace for the assembly>.<folder name>.<image file name>"))
{
   pictureBox1.Image = Image.FromStream(stream);
}

Für Bilder:
private void SetRedImage()
        {
            this.UiThreadInvoke(() => { PictureBox_Online.Image = GetImage("SchichtbuchPlaner2.Images.Red.ico"); });
        }

        private Image GetImage(string path)
        {
            using (Stream stream = GetStream(path))
            {
                return new Icon(stream).ToBitmap();
            }
        }

        private Stream GetStream(string path)
        {
            return Assembly.GetExecutingAssembly().GetManifestResourceStream(path);
        } 

Guter Bohrer

C# error with Scrollbars on DataGridViews

C# List to string

string.Join("; ", list)));

C# Generic database access