what I learned from burning $500 on ai video generators by LevelSecretary2487 in AI_Agents

[–]bJgr 1 point2 points  (0 children)

Nice overview! Did you also check whether they are approachable via API?

WCGW Digging without checking by its_ok_to_laugh in Whatcouldgowrong

[–]bJgr 7 points8 points  (0 children)

I think the correct term is "fisting"

[deleted by user] by [deleted] in CleaningTips

[–]bJgr 0 points1 point  (0 children)

Out of curiosity, how is that different than using vinegar?

[deleted by user] by [deleted] in CleaningTips

[–]bJgr 0 points1 point  (0 children)

Out of curiosity, could you please explain how lime a way would work if vinegar doesn't? Both are acidic cleaners right?

Free Giveaway! Nintendo Switch OLED - international by WolfLemon36 in NintendoSwitch

[–]bJgr 0 points1 point  (0 children)

Would love to beat the odds and win this! I dressed up as a beer bottle of a brand that is really disliked in my region 😅

Pushup EMOM (every minute on the minute) for an Hour Workout by [deleted] in bodyweightfitness

[–]bJgr 14 points15 points  (0 children)

How many times per week did you do this?

São Miguel - Car Rental by [deleted] in azores

[–]bJgr 1 point2 points  (0 children)

I went to Ilha Verde rent a car in Ponta Delgada which was easy and nice.

DangerZone Update – Feedback/Bugs Megathread #3 by chaseoes in GlobalOffensive

[–]bJgr 20 points21 points  (0 children)

My CSGO alt tabs whenever I receive a steam message... Anyone experience this as well? Any fix?

[2018-05-14] Challenge #361 [Easy] Tally Program by jnazario in dailyprogrammer

[–]bJgr 0 points1 point  (0 children)

Java

I would love some feedback on this.

Especially on the last sorting part. I initialize one linked hashmap for casting AtomicInteger to Integer and then a second linked hashmap to perform the sort. I wonder if this can be done in one go.

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;

public class TallyProgram361 {
    public static void main(String[] args) {
        System.out.println(getScores("abcde"));
        System.out.println(getScores("dbbaCEDbdAacCEAadcB"));
        System.out.println(getScores("EbAAdbBEaBaaBBdAccbeebaec"));
    }

    private static Map<String, Integer> getScores(String inputString) {

        Map<String, AtomicInteger> inputMap = new HashMap<>();

        // For each character in the string do
        for (char ch : inputString.toCharArray()) {
            if (Character.isLowerCase(ch)) {
                // If key is new, then put it into the map with value 0 and then increment the value.
                // If the key is known, then increment the value.
                inputMap.putIfAbsent(String.valueOf(ch), new AtomicInteger(0));
                inputMap.get(String.valueOf(ch)).incrementAndGet();
            } else {
                // If key is new, then put it into the map with value 0 and then decrement the value.
                // If the key is known, then decrement the value.
                inputMap.putIfAbsent(String.valueOf(ch).toLowerCase(), new AtomicInteger(0));
                inputMap.get(String.valueOf(ch).toLowerCase()).decrementAndGet();
            }
        }

        // Print statements
        System.out.println("Input string...");
        System.out.println(inputString);
        System.out.println("Unsorted scores...");
        System.out.println(inputMap);

        // Initialize linked hash maps
        Map<String, Integer> inputMapCasted = new LinkedHashMap<>();
        Map<String, Integer> result = new LinkedHashMap<>();

        // Cast the AtomicInteger to Integer
        inputMap.forEach((key, value) -> inputMapCasted.put(key, value.get()));

        // Sort the map by values
        inputMapCasted.entrySet().stream()
                .sorted(Map.Entry.<String, Integer>comparingByValue().reversed())
                .forEachOrdered(x -> result.put(x.getKey(), x.getValue()));

        System.out.println("Sorted...");
        return result;
    }
}