Borbin the 🐱

🔍 Suche...
🔍
Alle Begriffe müssen vorkommen (UND), "Phrase" für exakte Treffer, r"regex" für Muster (oder ').
  • Internationaler Katzentag 😺

    📅 8. August 2022 · ⏱️ 1 min

    My cat reminded me today of the International 😺 Day!
    Do not forget the extra treats today!
    🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈🐈

  • Katzentreppe 😺

    📅 3. August 2022 · ⏱️ 1 min

    My cat asked me for a staircase. After a long design discussion he finally said: "meow"! Project is on!


    All parts except the round material were cut from those boards.


    The boards were cut in length.


    And to thinner size.


    The staircase has an angle of 30°



    With a fixed vise all the holes in the treads were drilled.





    One of the wooden rounds broke and I had to cut one manually. Took longer than expected.


    The railing holes are cut with a 30° alignment using one of the cut offs as a guide.



    Two parts assembly.




    Construction finished. Painting!


    Customer is happy!


    It is his staircase.

  • Cafe Roussillon, Paris, France

    📅 26. Juli 2022 · Panorama · ⏱️ 1 min

    Typical french cafe in this neighborhood: Cafe Roussillon. Right in the center of Paris between the Eiffel tower and the Louvre.


    Interaktives Panorama Cafe Roussillon

  • Scan text with regex in PowerShell

    📅 24. April 2022 · Software · ⏱️ 1 min

    The named group capture (?exp) in a regex is an easy way to scan content. In this example, to get the text enclosed in quotes in a string. This is how it is done in PowerShell:

    # Get the text enclosed in quotes.
    [string]$text = 'This is an "example text".'
    [string]$textRegex = '\"(?<Text>.*?)\"'
    
    if ($text -match $textRegex) {
        $matches['Text']
    }

    This outputs
    example text


    Or split a formatted string into parts. For example the assignment structure 'id=value':

    # Parse the id and value of the text.
    [string]$text = '  id123 = abc  '
    [string]$idValueRegex = "^\s*(?<id>\w+?)\s*=\s*`"?(?<value>.+?)`"?\s*$"
    
    if ($text -match $idValueRegex) {
        "id=$($matches['id']), value=$($matches['value'])"
    }

    This outputs
    id=id123, value=abc


    Or parse a pattern, for example the content of each bracket in " abc { 123 } { def } 456 {xyz}"

    [string]$text = " abc { 123 } { def } 456 {xyz}"
    [string]$bracketRegex = "[{]\s*(?<Text>.*?)\s*[}]"
    
    ([regex]$bracketRegex).Matches($text) | % {
        [System.Text.RegularExpressions.Group]$match = $_
        [string]$value = $match.Groups["Text"].Value
    
        $value
    }

    This outputs
    123
    def
    xyz

  • Using List in PowerShell

    📅 24. April 2022 · Software · ⏱️ 1 min

    PowerShell has lots of array and lists support, but changing or creating a list with dynamic data recreate the list on each change which is inefficient for large lists.
    The most simple solution is to use the .NET List class:

        [System.Collections.Generic.List[string]]$content = [System.Collections.Generic.List[string]]::new()
    
        $content.Add("line1")
        $content.Add("line2")
← Neuere Beiträge Seite 35 von 56 Ältere Beiträge →
ÜBER

Jürgen E
Principal Engineer, Villager, and the creative mind behind lots of projects:
Windows Photo Explorer (cpicture-blog), Android apps AI code rpn calculator and Stockroom, vrlight, 3DRoundview, BitBlog and my github


Blog-Übersicht Chronologisch

KATEGORIEN

Auto • Electronics • Fotografie • Motorrad • Paintings • Panorama • Software • Querbeet


Erstellt mit BitBlog!