Borbin the 🐱

  • Dragonfly landed safely

    📅 6. Juli 2019 · Fotografie

    A dragonfly made it safely to our garden, fresh from its latest airshow performance.

    Panasonic DMC-GM1 1/160s f/5,6 ISO 200/24° f=32mm/64mm


    Panasonic DMC-GM1 1/160s f/6,3 ISO 200/24° f=32mm/64mm


    Captains view

    Panasonic DMC-GM1 1/160s f/6,3 ISO 200/24° f=32mm/64mm



    Update: Anisoptera at Rest — A Moment on the Leaf

    Nikon Z30 1/125s f/6,3 ISO 900 16-50mm f/3,5-6,3 VR f=50mm/75mm


    Nikon Z30 1/50s f/6,3 ISO 400/27° 105mm f/2,8 VR


    Nikon Z30 1/60s f/7,1 ISO 400/27° 105mm f/2,8 VR


    Nikon Z30 1/60s f/7,1 ISO 400/27° 105mm f/2,8 VR


    Nikon Z30 1/60s f/7,1 ISO 400/27° 105mm f/2,8 VR


    Nikon Z30 1/80s f/10 ISO 1250 105mm f/2,8 VR

  • Overflow valve for CJ750 / M72 final drive

    📅 15. Mai 2019 · Motorrad

    The amount of oil in final drive of the CJ750 / M72 motorcycle needs to be very precise, otherwise the oil is pushed out through the main seal. The reason for this is the small volume of the final drive gear. Even the slightest overfilling push out oil when the final drive gets warm during driving.
    To solve the problem, I had installed a small cylindric chamber (1) to collect the oil. But there was still some oil splashed out of the breathing hole so I added another chamber on top of it (2).

    With the recommended 0.15l oil, there was still some splashing. Especially driving uphill.
    To get around this problem once and for all, I have made an even larger chamber (3) holding a fair amount of oil that allows a slight overfilling to ensure I have always enough oil.
    The thread size is M14x1.5.

  • Neutral switch for CJ750 / M72

    📅 27. April 2019 · Motorrad

    The CJ750 / M72 motorcycle does not have a neutral indicator. With a simple switch extension to the gearbox lever you can add a neutral indicator.

    It starts with the switch plate that gets attached to the gearbox lever cut out from stainless steel.

    Now with the parts fabricated, the switch holder gets attached to the gearbox.

    You can use any ball switch for automotive purpose.

    The neutral lamp is added to a simple mini dashboard, that also contains the high beam and oil lamp.

  • Replace substring in substrings with Regular expressions (regex)

    📅 21. April 2019 · Software

    A regular expression defines a search pattern for strings. Replace is possible for text matches, but repeated substring replace in substrings is difficult. Especially if the text you want to replace is also outside of the initial substrings. Using cascaded match evaluators, this replacements gets very easy. For example to replace quoted text withing square brackets.
    Please note the middle text "text" in this example which must not be replaced.

    ["text1"] "text" ["text2"]
    Begin[Pre"1txet"Post]End "text" Begin[Pre"2txet"Post]End

    First the text is splitted by the primary substrings defined by square brackets.
    Then these substrings are recomposed according to the business logic. In this example the string gets enclosed in a "Pre" / "Post" and then reverted. The primary substrings gets enclosed in "Begin" / "End".

    string inputText = "[\"text1\"] "text" [\"text2\"]";
    
    string replacedText = Regex.Replace(
        inputText,
        $"(\\[)(.*?)(\\])",
        arrayMatch =>
        {
            return 
            $"Begin" +
            arrayMatch.Groups[1].Value +
            Regex.Replace(
                arrayMatch.Groups[2].Value,
                $"(\".*?\")+",
                contentMatch =>
                {
                    return $"Pre" + new string(contentMatch.Groups[1].Value.Reverse().ToArray()) + "Post";
                }) +
    
            arrayMatch.Groups[3].Value +
            $"End";
        });


    Or modify a text section to add a link from a markdown link to the following picture:

    from:
      [Interactive Panorama title](link.htm)
      ![](bild.jpg)

    to:
      [Interactive Panorama title](link.htm)
      ![](bild.jpg)


    Using PowerShell:

        [string]$content = [System.IO.File]::ReadAllText($FileName)
    
        # using '(?s)', the dot '.' matches the newline and allows for multiline replace 
        [string]$StringsRegex = "(?s)(?<section>\[Interactive Panorama.*?\]\((?<link>.*?)\).*?)(?<bild>\!\[\]\(.*?\))"
    
        $updatedContent = $content -replace $StringsRegex, {
            $match = $_
            $section = $match.Groups["section"].Value
            $link = $match.Groups["link"].Value
            $bild = $match.Groups["bild"].Value
    
            # already replaced?
            if(-not $section.Contains("<"))
            {    
                # insert link
                # '$section$bild' -> 'section<a href="$link">$bild</a>'
                "$section<a href=""$link"">$bild</a>
            }
        }
    
        if($updated)
        {
            [string]$outFile = FileName + ".updated"
            [IO.File]::WriteAllText($outFile, $updatedContent)
        }
  • Math126, Taylor series

    📅 17. März 2019

    For Math126 we were talking about the Taylor series for

    It looks difficult at first glance, but it is actually quite simple. Let me explain:

    Using this as a base:

    The derivative of this term is:

    Which gets to:

    Now move the nominator in the sum to get the solution:

    Time for a small PowerShell script for the Taylor series:

    function f([double]$x)
    {
        [Math]::Pow($x/(1-$x), 2)
    }
    
    function T([double]$x, [int]$k)
    {
        0..$k | % { $sum = 0 } { $sum += $_ * [Math]::Pow($x, $_ + 1) } { $sum }
    }
    
    
    [int]$K = 16
    
    for([int]$xi = -5; $xi -le 5; $xi += 1)
    {
        [double]$x = $xi / 10
    
        [PSCustomObject]@{
            'x' = $x
            'f(x)' = f $x
            'T(x)' = T $x $K
        }
    }
    
       x                f(x)                T(x)
       -                ----                ----
    -0,5   0,111111111111111   0,111068725585938
    -0,4  0,0816326530612245  0,0816318326348185
    -0,3  0,0532544378698225  0,0532544328723274
    -0,2  0,0277777777777778  0,0277777777741005
    -0,1 0,00826446280991736 0,00826446280991734
       0                   0                   0
     0,1  0,0123456790123457  0,0123456790123457
     0,2              0,0625  0,0624999999943475
     0,3   0,183673469387755   0,183673459741776
     0,4   0,444444444444445   0,444442421037629
     0,5                   1   0,999862670898438

    The convergence is | x | < 1
    T15 is used for this test.

     k             Tk(x)
     -             -----
     0                 0
     1              0,25
     2               0,5
     3            0,6875
     4            0,8125
     5          0,890625
     6            0,9375
     7        0,96484375
     8        0,98046875
     9      0,9892578125
    10       0,994140625
    11    0,996826171875
    12    0,998291015625
    13  0,99908447265625
    14     0,99951171875
    15 0,999740600585938
← Neuere Beiträge Seite 41 von 50 Ä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 and my github


Blog-Übersicht Chronologisch

KATEGORIEN

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


Erstellt mit BitBlog!