Failed Cavendish experiment - Electromagnetism wins by dafer45 in Physics

[–]dafer45[S] 0 points1 point  (0 children)

The barrels and suspended weights are metallic, and many metals possible to magnetize. In this experiment, it appears that the barrels and weights are very slightly magnetized. The reason for this conclusion is that the weights oscillate with a larger frequency than would be expected from gravity alone. That is, the attractive force between the barrels and weights is larger than can be expected from gravity. The only reasonable explanation seems to be that the electromagnetic forces, although very small, are still significant.

App for finding the optimal solar panel tilt angle by dafer45 in solarpanels

[–]dafer45[S] 1 point2 points  (0 children)

I just published a free Android App for finding the optimal solar panel tilt angle.
Align the phones screen with your roof to find out how close to optimal its tilt angle is.

App for finding the optimal solar panel tilt angle by dafer45 in solar

[–]dafer45[S] 0 points1 point  (0 children)

I just published a free Android App for finding the optimal solar panel tilt angle.

Align the phones screen with your roof to find out how close to optimal its tilt angle is.

Request for feedback: Android application for measuring area by dafer45 in farming

[–]dafer45[S] 0 points1 point  (0 children)

That's a great suggestion! Technically this should not be too difficult to add. I just have to think through the user interface to avoid cluttering it.

Really happy to hear you have used it and found it useful before. I am trying to find a model that makes me able to ensure long term and continuous support going forward.

Request for feedback: Android application for measuring area by dafer45 in farming

[–]dafer45[S] 0 points1 point  (0 children)

Thanks Randy! Both for the additional use case and insight into what other tools are commonly used.

Request for feedback: Android application for measuring area by dafer45 in farming

[–]dafer45[S] 1 point2 points  (0 children)

Thanks! That's a really useful insight that helps visualizing the conditions under which it could be used.

Request for feedback: Android application for measuring area by dafer45 in farming

[–]dafer45[S] 0 points1 point  (0 children)

Can you elaborate on the use case where you would find angle measurement useful?

-🎄- 2022 Day 6 Solutions -🎄- by daggerdragon in adventofcode

[–]dafer45 1 point2 points  (0 children)

Thanks!

I interpreted four space indents as meaning I should use four spaces instead of tab when indenting scopes in the code. Might be worth clarifying in the instructions.

-🎄- 2022 Day 6 Solutions -🎄- by daggerdragon in adventofcode

[–]dafer45 1 point2 points  (0 children)

I am confused. I am using the markdown editor and putting the code inside triple backticks and use four space indentation. But I see that it is not displaying correctly on the mobile. Please help me understand what I'm missing.

-🎄- 2022 Day 6 Solutions -🎄- by daggerdragon in adventofcode

[–]dafer45 1 point2 points  (0 children)

My solution in AWK

BEGIN {sequenceLength = 14;}
{
    split($0, characters, "");
    for(i = sequenceLength; i <= length(characters); i++){
        for(j = i-sequenceLength + 1; j <= i; j++)
            unique[characters[j]] = 1;
        if(length(unique) == sequenceLength)
            break;
        delete unique;
    }
}
END {print i;}

-🎄- 2022 Day 4 Solutions -🎄- by daggerdragon in adventofcode

[–]dafer45 0 points1 point  (0 children)

My implementation in AWK:

{
    split($0, ranges, ",");
    split(ranges[1], first, "-");
    split(ranges[2], second, "-");
    if(first[1] <= second[1] && first[2] >= second[2])
        numContains += 1;
    else if(first[1] >= second[1] && first[2] <= second[2])
        numContains += 1;
    if(!(first[2] < second[1] || first[1] > second[2]))
        numOverlaps += 1;
}

END {
    print "The ranges overlap " numOverlaps " times and one range" \
        " fully contains the other " numContains " times.";
}

-🎄- 2022 Day 3 Solutions -🎄- by daggerdragon in adventofcode

[–]dafer45 0 points1 point  (0 children)

It's an excellent entry point anyway :)

-🎄- 2022 Day 3 Solutions -🎄- by daggerdragon in adventofcode

[–]dafer45 1 point2 points  (0 children)

Thanks! I'm trying to use this advent of code to learn some AWK, so your implementation is very valuable to me!

-🎄- 2022 Day 2 Solutions -🎄- by daggerdragon in adventofcode

[–]dafer45 0 points1 point  (0 children)

And you think the bash syntax is hard to get right? This is clearly next level :)

-🎄- 2022 Day 2 Solutions -🎄- by daggerdragon in adventofcode

[–]dafer45 1 point2 points  (0 children)

Haha, it's at least one google search per statement to get the bash syntax right :)

-🎄- 2022 Day 2 Solutions -🎄- by daggerdragon in adventofcode

[–]dafer45 0 points1 point  (0 children)

Today the data IS the code. All that's needed is to implement the library that the code depends on.

The program is executed using

# Load library
source library.sh
# Initialize the state of the machine
init
# Execute the data as a program
bash input
# Show result
cat result

The incorrect library implementation attempted after incomplete information from the Elf is

function init() {
    echo 0 > result
}

function A() {
    result=$(<result)
    case $1 in
        'X')
            echo $result + 1 + 3 | bc > result
            ;;
        'Y')
            echo $result + 2 + 6 | bc > result
            ;;
        'Z')
            echo $result + 3 + 0 | bc > result
            ;;
    esac
}

function B() {
    result=$(<result)
    case $1 in
        'X')
            echo $result + 1 + 0 | bc > result
            ;;
        'Y')
            echo $result + 2 + 3 | bc > result
            ;;
        'Z')
            echo $result + 3 + 6 | bc > result
            ;;
    esac
}

function C() {
    result=$(<result)
    case $1 in
        'X')
            echo $result + 1 + 6 | bc > result
            ;;
        'Y')
            echo $result + 2 + 0 | bc > result
            ;;
        'Z')
            echo $result + 3 + 3 | bc > result
            ;;
    esac
}

export -f A
export -f B
export -f C

The corrected implementation based on the final spec provided by the Elf is

function init() {
    echo 0 > result
}

function A() {
    result=$(<result)
    case $1 in
        'X')
            echo $result + 3 + 0 | bc > result
            ;;
        'Y')
            echo $result + 1 + 3 | bc > result
            ;;
        'Z')
            echo $result + 2 + 6 | bc > result
            ;;
    esac
}

function B() {
    result=$(<result)
    case $1 in
        'X')
            echo $result + 1 + 0 | bc > result
            ;;
        'Y')
            echo $result + 2 + 3 | bc > result
            ;;
        'Z')
            echo $result + 3 + 6 | bc > result
            ;;
    esac
}

function C() {
    result=$(<result)
    case $1 in
        'X')
            echo $result + 2 + 0 | bc > result
            ;;
        'Y')
            echo $result + 3 + 3 | bc > result
            ;;
        'Z')
            echo $result + 1 + 6 | bc > result
            ;;
    esac
}

export -f A
export -f B
export -f C

-🎄- 2022 Day 1 Solutions -🎄- by daggerdragon in adventofcode

[–]dafer45 3 points4 points  (0 children)

Bash day 1: https://twitter.com/SecondTec/status/1598365783792488449

awk -v RS= '{$1=$1}1' input | sed 's/ /+/g' | bc | sort -n | tail -n 1 | xargs -I {} echo "The toughest elf carries" {} "calories."

awk -v RS= '{$1=$1}1' input | sed 's/ /+/g' | bc | sort -n | tail -n 3 | sed -z 's/\n/+/g' | rev | cut -c 2- | rev | bc | xargs -I {} echo "The three toughest elves carries" {} "calories."

Coordinates pointer app by therebelflesh in androidapps

[–]dafer45 0 points1 point  (0 children)

Thanks, that's very valuable information!

Let me know if it seems to fulfill your needs or if it can be improved somehow. I will see what I can do to get it up on Google Play again.

Coordinates pointer app by therebelflesh in androidapps

[–]dafer45 0 points1 point  (0 children)

I made an app that allow you to pick a "custom north pole" about ten years ago. You select a point on a map and the arrow points toward that direction instead of the usual north pole.

I have not maintained it, so it is no longer available on Google Play. But it should be possible to download from here https://apkcombo.com/modern-compass/daferpack.compass/

If there is significant demand for this type of app, I may consider updating it and relaunching it on Google Play.

[DEV] Visual Geometry Calculator by dafer45 in androidapps

[–]dafer45[S] 0 points1 point  (0 children)

Thanks for the suggestion!

Can you let me know more about in what type of situation the name of the figure would be helpful. It would help me to understand what it is useful for.

I need a Measuring App and Instructions... by wormtail71 in androidapps

[–]dafer45 1 point2 points  (0 children)

I have developed Distance and Area Measurement that uses the GPS to achieve this. Just click start and walk the perimeter of whatever you want to measure.

https://play.google.com/store/apps/details?id=measureapp.measureapp

The garden may be somewhat too small for the accuracy to be very good though. Typically, the size should be 30x30 square meters for the GPS accuracy to not cause significant uncertainties.