Generalized solution for project euler #1 in haskell with recursion

I decided to do euler1 before looking at your solution and this is what I came up with:
euler1 :: [Int] -> Int -> Int
euler1 ns limit =
  sum .
  filter (\x -> any (\n -> x `mod` n == 0) ns) .
  take limit $
  [0..]

So my answers to your questions are:

Yes, composition helps cut down on the things you have to name, and thus on the things you have to pass along to intermediate functions.
Haskell loves lists, and [0..] is often a nice starting point for a composition chain.
Your checkIfMultiple recursion is good, but you will often find a very short synonym for this type of thing (common operations on a list) in base (eg all).
Types are awesome.
List comprehensions are amazing but they can sometimes interrupt a good compositional chain, compared with the equivalent filters and/or fmaps.


Multiple SELECT with LEFT JOIN to order results

First of all you don't need so many subqueries. all of your code can be done in given way

SELECT DISTINCT t1.id, t1.name, t2.open
FROM table1 t1
LEFT JOIN table2 t2 ON t1.id = t2.name_id AND t2.open = 1 AND type = 2
ORDER BY t1.date DESC, t1.name ASC LIMIT 3

Works exactly the way you want it, plus is almost 3 times faster on my machine. (0.0012 seconds vs 0.0034)

for additional reading on subqueries and joins https://stackoverflow.com/questions/3856164/sql-joins-vs-sql-subqueries-performance
https://stackoverflow.com/questions/2577174/join-vs-sub-query

Second point is that I think you should not be storing name value in table2. i don't know your project requirements or specifics but one of the major point of relational databases is to diversify data and avoid copies of the same data in different places.

table2 is connected with table1 with name_id which means it indirectly provides name value and i would suggest removing that column from table2 if it's not absolutely neccessery for your project, or it would mean u should rewrite  big portion of your code.


Printing facility for std::chrono::time_point

Global singleton format looks a bit peculiar. Unfortunatelly, iostreams do not support user-defined stream properties like time format, but you can do something similar:

struct format
{
    std::string format;
    time_point time;
};

ostream & operator << (ostream & os, format const & f)
{
    // output f.time using f.format
    // ...
}

Which can be used like

std::cout << format{"%Y %b %d %H:%M:%S %a", now()} << std::endl;

Alongside with operator<<(ostream &, time_point const &) (which just uses some default predefined format) this can be used in a lot cleaner way.

(obviously, all this should be put to appropriate namespaces)


As mentioned in my comment, the structure you are dealing with is more commonly called a circular buffer. The Wikipedia link has several examples on how to efficiently provide thread safe read/write access (a producer/consumer queue), but what's more important is the idea that you can abstract the access to your circular buffer to an interface, so that callers deal with it like it's an ordinary list.

The interface might look something like this (sorry for my poor Java skills):

public interface IReadonlyList<T>
{
    // gets the item at the specified index
    T getItem(int index);

    // gets the length
    int length();
}

And the circular buffer implementation would simply offset the internal index before returning the requested value:

// note that _headOffset and _actualArray aren't
// assigned anywhere, it's just a concept

public class CircularBuffer<T> : IReadonlyList<T>
{
    private final int _headOffset;
    private final T[] _actualArray;

    public T getItem(int index)
    {
        var actualIndex = (index + _headOffset) % Length;
        return _actualArray[actualIndex];
    }

    public int length()
    {
        return _actualArray.Length;
    }
}

Wrapping the class in an interface like this allows you to use a general binary search algorithm you would use for a standard sorted list (and any other algorithm which would work on a non-circular buffer).


Here's an alternative way to write count().  It's shorter and uses expressions instead of statements.  You can't do as much in an expression, so I use them instead of statements when possible because there's a lower chance of things going wrong.  Readability is more important than those things, though, so I recommend using what is most readable to you.

private int count()
{
    return 1 +
        (_leftChild != null ? _leftChild.count() : 0) +
        (_rightChild != null ? _rightChild.count() : 0);
}

Or if you want to use C# 6 null checking:

private int count()
{
    return 1 + (_leftChild?.count() ?? 0) + (_rightChild?.count() ?? 0);
}

Method names should be UpperCamelCase, so count() should be Count().  I'm guessing you want to access a child's Count property instead of the method because the method is private.


Notification script | from RSS to Email | Bash

I see a number of things that may help you improve your code.

Use "shebang" line

The shebang is the line at the beginning of a shell script that tells which program to use.  In this case, you probably want this:

#! /usr/bin/env bash

See this question for details.

Consider using cron instead of sleep

If this is something you want to run automatically, consider running it as a cron tab instead of using sleep within the script.

Include some comments

The program requires rsstail, mutt and sleep which is a requirement that should be documented in a comment.

Be cautious about handing variables to programs

The mutt program, like many Linux programs, has a -- option which specifies that no further options are on the command line.  This prevents the contents of $TO_EMAIL in a line like the following from being misinterpreted as a command line option.

mutt -s $TITLE -- $TO_EMAIL < $BODYTEXT

Combine strings

The echo is used twice with an identical string.  An alternative approach is

TITLE="Nuovo Articolo BDO"
BODYTEXT="New article published on the site. TITLE: $TITLE_ARTICLE - LINK: $LINK_ARTICLE"
mutt -s $TITLE -- $TO_EMAIL < $BODYTEXT
echo $BODYTEXT

Avoid creating extraneous variables

Instead of creating SENDER_EMAIL, you could just specify EMAIL and then the reassignment of the latter variable before mutt is called would not be necessary.

Consider writing a portable script

By sticking closely with Posix and avoiding bashisms your code could run on many different kinds of systems, including recent versions of Ubuntu which don't use bash.


import javax.swing.*;
import javax.sound.midi.*;
import java.awt.*;
import java.awt.event.*;

Most style guides will frown upon the wildcard import -- is it so much extra work to list the classes you actually depend on?  This will also help you to avoid conflicts, where you want List to mean java.util.List rather than java.awt.List

public static ArrayList<String> note = new ArrayList<String>();
public static ArrayList<String> extendedNote = new ArrayList<String>();

ArrayList is an implementation detail, that consumers generally don't need to know about.  The more usual declaration would look like:

public static List<String> note = new ArrayList<String>();
public static List<String> extendedNote = new ArrayList<String>();

Furthermore, by specifying that these are lists, you are claiming that they support insert.  Is it really a good idea to allow other code to start inserting new notes into your lists?

An alternative would be to expose the notes as Iterable, rather than List, which helps disguise the fact that the underlying container supports inserts.  Better would be to make that data private, and provide methods that give access to the notes.

(Note: the spelling change of the variable name; this thing isn't a note, it's a collection of notes).

private static List<String> notes = new ArrayList<String>();

public static List<String> getNotes() {
    return Collections.unmodifiableList(notes);
}

The best answer isn't clear, as your example doesn't include any external consumers.

As a rule, you should try to keep variable declarations near their use -- it makes the code clearer to read, and helps with refactoring the code later.

public static void main (String[] args) {

    String[] preNote = {"C","D","E","F","G","A","B"};
    for (int i = 0; i < 7; i++) {
        note.add(preNote[i]);
    }

    String[] preExtendedNote = {"C","C#","D","D#","E","F","F#","G","G#","A","A#","B"};
    for (int i = 0; i < 12; i++) {
        extendedNote.add(preExtendedNote[i]);
    }

    VirtualKeyboard gui = new VirtualKeyboard();
    gui.setGUI();
}

Magic numbers are poor form; you should avoid them where possible.

    String[] preNote = {"C","D","E","F","G","A","B"};
    for (int i = 0; i < preNote.length; i++) {
        note.add(preNote[i]);
    }

You should also avoid writing code that has already been written for you.

    String[] preNote = {"C","D","E","F","G","A","B"};
    List<String> notes = Arrays.asList(preNote);

Or more directly

    List<String> note = Arrays.asList("C","D","E","F","G","A","B");

As an aside - it may make more sense to treat the notes as Enumerations, rather than Strings.

    JButton[] key = new JButton[7];

    for (int i = 0; i < 7; i++) {
        key[i] = new JButton(note.get(i));
        key[i].addActionListener(this);
        keyPanel.add(key[i]);
    }

Two problems here -- you're repeating your magic number again; and also you are creating an array that you never use.

    for (int i = 0; i < note.size(); i++) {
        JButton key = new JButton(note.get(i));
        key.addActionListener(this);
        keyPanel.add(key);
    }

But this is silly -- you put notes in a List, you should use it

    for (String currentNote : note) {
        JButton key = new JButton(currentNote);
        key.addActionListener(this);
        keyPanel.add(key);
    }

OK, let's get some real meat...

public void setGUI() {
    JFrame frame = new JFrame("Rhysy's Virtual Keyboard!!!");
    JPanel keyPanel = new JPanel();
    JPanel controlPanel = new JPanel();

    for (String currentNote : note) {
        JButton key = new JButton(currentNote);
        key.addActionListener(this);
        keyPanel.add(key);
    }

    JLabel instrumentChoiceLabel = new JLabel("Instrument Choice: ");
    instrumentChoice = new JTextField(1);

    JLabel octaveChoiceLabel = new JLabel("Octave: ");
    octaveChoice = new JTextField(1);

    controlPanel.add(instrumentChoiceLabel);
    controlPanel.add(instrumentChoice);
    controlPanel.add(octaveChoiceLabel);
    controlPanel.add(octaveChoice);

    frame.getContentPane().add(BorderLayout.NORTH, keyPanel);
    frame.getContentPane().add(BorderLayout.SOUTH, controlPanel);
    frame.setSize(500,200);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
}

OK, what you are doing here is building an object graph -- creating instances of objects and establishing the relationships between them.  That shouldn't happen in an object that also does anything else (separation of concerns).

The VirtualKeyboard is an ActionListener that plays sounds.  So it shouldn't also be doing the job of building it's own object graph.  Building things is the domain of Factory objects, so you should implement the creation of the object graph elsewhere.

But - it's not easy here.  The action listener holds two of the objects that are needed to build the UI, but all the others are created somewhere else.  The riddle is solved by passing the JTextFields to the VirtualKeyboard, rather than the other way around....

private final JTextField octaveChoice;
private final JTextField instrumentChoice;

public VirtualKeyboard(JTextField octaveChoice, JTextField instrumentChoice) {
    this.octaveChoice = octaveChoice;
    this.instrumentChoice = instrumentChoice;
}

So we need the JTextField before we create VirtualKeyboard, which means that we need to create those objects in main().  This is actually pretty common -- main is a good place to put the object assembly you need when bootstrapping your application.

public static void main (String[] args) {
    JTextField instrumentChoice = new JTextField(1);
    JTextField octaveChoice = new JTextField(1);

    VirtualKeyboard gui = new VirtualKeyboard(octaveChoice, instrumentChoice);

    JFrame frame = new JFrame("Rhysy's Virtual Keyboard!!!");
    JPanel keyPanel = new JPanel();
    JPanel controlPanel = new JPanel();

    for (String currentNote : note) {
        JButton key = new JButton(currentNote);
        key.addActionListener(gui);
        keyPanel.add(key);
    }

    JLabel instrumentChoiceLabel = new JLabel("Instrument Choice: ");

    JLabel octaveChoiceLabel = new JLabel("Octave: ");

    controlPanel.add(instrumentChoiceLabel);
    controlPanel.add(instrumentChoice);
    controlPanel.add(octaveChoiceLabel);
    controlPanel.add(octaveChoice);

    frame.getContentPane().add(BorderLayout.NORTH, keyPanel);
    frame.getContentPane().add(BorderLayout.SOUTH, controlPanel);
    frame.setSize(500,200);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);

The code should be re-organized so that you can see how the parts relate....

public static void main (String[] args) {

    JFrame frame = new JFrame("Rhysy's Virtual Keyboard!!!");

    JPanel controlPanel = new JPanel();

    JLabel instrumentChoiceLabel = new JLabel("Instrument Choice: ");
    controlPanel.add(instrumentChoiceLabel);

    JLabel octaveChoiceLabel = new JLabel("Octave: ");
    controlPanel.add(octaveChoiceLabel);

    JTextField instrumentChoice = new JTextField(1);
    controlPanel.add(instrumentChoice);

    JTextField octaveChoice = new JTextField(1);
    controlPanel.add(octaveChoice);

    VirtualKeyboard gui = new VirtualKeyboard(octaveChoice, instrumentChoice);

    frame.getContentPane().add(BorderLayout.SOUTH, controlPanel);

    JPanel keyPanel = new JPanel();

    for (String currentNote : note) {
        JButton key = new JButton(currentNote);
        key.addActionListener(gui);
        keyPanel.add(key);
    }
    frame.getContentPane().add(BorderLayout.NORTH, keyPanel);

    frame.setSize(500,200);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);

It's common to create classes that do all this work -- done well, it tends to improve both testability and re-use.

Let's look at the action code again

public void actionPerformed(ActionEvent e) {
    int finalNote = 0;
    Object source = e.getSource();
    if (source instanceof JButton) {
        JButton but = (JButton) source;
        System.out.print(but.getText());

        finalNote = (Integer.parseInt(octaveChoice.getText()) * 12) + extendedNote.indexOf(but.getText());

        System.out.print(" (" + finalNote + ")\n");

        playNote(finalNote, Integer.parseInt(instrumentChoice.getText()));
    }
}

There are at least three things going on here...

public void actionPerformed(ActionEvent e) {
    Object source = e.getSource();
    if (source instanceof JButton) {
        JButton but = (JButton) source;

        String note = but.getText();
        String octave = octaveChoice.getText();
        String instrument = instrumentChoice.getText();

        int finalNote = (Integer.parseInt(octave) * 12) + extendedNote.indexOf(note);
        int finalInstrument = Integer.parseInt(instrument);

        playNote(finalNote, finalInstrument);
    }
}

You've got the ActionListener, which is reading Strings out of awt, you've got a Parser, which knows how to turn those strings into notes and instruments, and you've got a Player that knows how to turn notes and instruments into sounds.

This separation is important, because you should be able to do test that the parser does the right thing without assembling the entire UI for it.  You should be able to replace this player with another one that uses a different set of magic numbers to generate ShortMessages.


Ensure that all `h2` tags have a `span` inserted

I would agree with discussion in comments that this should be looked at as a stop-gap solution only, as the real answer here is to change the HTML source, or better yet, the CSS styling for the desired h2's such that you don't need these span's at all.

If you truly want to wrap every h2 like this, why is this not just:

$('h2').wrapInner('<span />');

Note here that I also skip the unnecessary call to each(), as wrapInner() will already be applied against every element in the jQuery collection.

Your other function against .bottomLine also seems odd in that you are just moving one set of items in DOM to different positions, something that would unnecessarily cause document reflow. Again, this is something that should probably be fixed in source.


Program to print all evironment variables

There's always a question of what 'improve' might mean.  I don't see anything here that is 'wrong,' so mostly I'm commenting on 'style.'  That said, if I were doing a code review, these are some of the things I'd mention:

You have lots of very clear comments.  That's a good thing, especially in assembler.  I can't count the number of times I've read code and thought "What the heck was this guy THINKING?"  This can be especially important when the code is wrong: He thinks it's doing x, but the code actually does y, so I am probably safe fixing it.
You don't have a comment that describes what the program does.  While your SE post has a (misspelled) description, the code does not.
While it is not an issue for such a short program, you might want to start thinking in terms of 'routines.'  Having a chunk of code that counts the length of a string (or that prints a string) that you can copy into your next program can be useful.
While it works, I wouldn't get into the habit of using repne.  It's not the best performing way to do this kind of loop (see https://stackoverflow.com/a/34141835/2189500).  BTW, this is one of the reasons to use a high level language (like C).  Compilers already know all this stuff and (try to) use the best possible construct.
I expect that with a bit of fiddling (by using an offset on the mov) you can remove the dec edi/inc edx.
I might consider changing the jb ExitFailure.  jb can only jump over a certain amount of code, so your existing construct will work even if PopEnv was far away.  But since your code is small, you could do:

a

jnb PopEnv              ; get another env

ExitFailure:
mov eax,1               ; sys_exit
mov ebx,-1              ; EXIT_FAILURE
int 80h                 ; make the call

Exit:
mov eax,1               ; sys_exit
mov ebx,0               ; EXIT_SUCCESS
int 80h                 ; make the call

In summary, my comments are mostly just piddly 'style' stuff.


What you're doing with RewriteCond %{HTTP:HTTPS} !1 is checking whether the HTTPS header is present in the request and if it is, then the value is not 1.

  %{HTTP:header}, where header can be any HTTP MIME-header name,
  can always be used to obtain the value of a header sent in the HTTP
  request. Example: %{HTTP:Proxy-Connection} is the value of the HTTP
  header Proxy-Connection:.

Though, I think it'd be easier to use %{HTTPS} instead.

  %{HTTPS}

  Will contain the text "on" if the connection is using SSL/TLS, or
  "off" otherwise. (This variable can be safely used regardless of
  whether or not mod_ssl is loaded).

RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L,QSA]

Also, you are not using QSA flag. This might cause in undesired behaviour.


Improving the first solution

I like the first solution better, because I find it easier to understand how it works, and it's shorter.

It can be a bit simpler. The condition if i <= curr_far: is unnecessary and can be safely dropped.

Instead of iterating over a range of indexes, I nice trick is to use enumerate, like this:

for index, value in enumerate(nums):

This way, instead of nums[index] in the loop body, you can use value directly.

Another code smell is the condition if i == curr_far and curr_far != 0 executed in every iteration of the loop, even though curr_far != 0 will only be false for the first iteration, otherwise always true.

I didn't like most of the variable names...

Instead of step, I would find jumps more natural
Instead of curr_far and next_far, I would find reach and next_reach more intuitive

All in all, I would write like this instead:

class Solution(object):
    def jump(self, nums):
        end = len(nums) - 1
        if not end:
            return 0

        reach = 0
        next_reach = 0
        jumps = 0
        for pos, value in enumerate(nums):
            if next_reach < pos + value:
                next_reach = pos + value
                if next_reach >= end:
                    return jumps + 1

            if pos == reach:
                reach = next_reach
                jumps += 1

Issues with the second solution

Looks more complex than the first, and I think unnecessarily so
The __init__ method is completely unnecessary
The outer parentheses are unnecessary in while(curr < len(nums)):
The convention for the naming style of variables in Python is snake_case instead of camelCase


The program's data structures aren't necessarily complicated enough for OOP - you'll almost never need to create multiple instances of any of the potential objects. So don't worry about it too much.

The only big problem I can see is that you always calculate both the Korean-English and English-Korean dictionaries even though only one is used each game, which could be a big waste of memory if the dictionaries get larger. I'd suggest waiting until after the user has chosen their direction and THEN invert the hash if you need to, and ideally throw away the uninverted version (unfortunately Ruby doesn't have an invert! method on hashes). If you're reading from a file, you can invert the data yourself as it is read in.

The one OOP improvement I'd recommend is to wrap the dictionary in an abstract data type. Rather than counting on it being a hash, write methods that return a word to use as a question and the translation of input word, and call those. That way, when you want to make the dictionary bigger or read it from a file, you can just modify those methods. For example, when the dictionary gets really big you might want to read it from disk by random access rather than reading the whole thing into memory. Or you could even write a version that makes requests to a web service.


Simplifying an AngularJs directive that counts the number of characters entered in a textarea

Massive overkill indeed,

<span>{{name.length}}</span>

will do the trick.

On the whole, I am not sure why you would use Angular to write an editor if you are not an expert in Angular. It adds a layer of complexity and eats into performance.


edge += 0; doesn't do anything You can just remove it and the else branches where you do it.

The number of decks handling can be done with an array:

int[] deckEdge = new int[]{0, 0.01, -0.32, 0, -0.49, 0, -0.54, 0, -0.57};//insert 0 in invalid places;

edge += deckEdge[decks];

(there is a trick you can use here by dividing the number of decks by 2 to remove the inserted 0s but that is less readable and understandable)

The switch solution is perhaps the most straightforward setup for this though:

switch(decks){
    case 1:
        edge += 0.01;
        break;
    case 2:
        edge -= 0.32;
        break;
    case 4:
        edge -= 0.49;
        break;
    case 6:
        edge -= 0.54;
        break;
    case 8:
        edge -= 0.57;
        break;
    default:
        System.out.println("You made a mistake.  Start over.");
        return;//stop program;
}

You also just continue on when a wrong number of decks is specified. You can either use return to stop immediately (like in the above switch) or use a do...while loop while reading it:

do{
    System.out.println("How many decks? (1, 2, 4, 6, 8)");
    int decks = sc.nextInt();
}while(decks!=1 && decks!=2 && decks!=4 && decks!=6 && decks!=8);


jQuery click handlers to show one of four containers

Here you can write a simple logic to identify container div on the basis of anchor id.

Please see below code:

put class="container" for all container div, like below :

home

about

projects

contact

And jQuery is :

$(document).ready(function () {
    $("li a").click(function(){
        event.preventDefault();
        // hide all container div
        $(".container").hide();

        // get id of clicked anchor and create its corresponding container id
        var anchorId = $(this).attr('id');
        var containerId = anchorId+"BodyContainer";
        $("#"+containerId).fadeIn(1500);
    });

});

Note : It would be better idea to assign same class to anchor, so that if you have some other anchor available in your HTML then also you can easily bind click event to all desired anchor.

Example:

Assign class="anchorToClick" to all desired anchor tags

and jQuery will be like

$(document).ready(function () {
        $(".anchorToClick").click(function(){
            // your stuff here
          });

    });


First things first, you need to fix your indentation. It'll make it much easier to follow what's happening. Here's your code properly formatted:

using System;

namespace zaliczenie6test
{
    class Program
    {
        static void Main(string[] args)
        {
            Counter gate = new Counter();
            char wybor;

            Console.WriteLine("If you want to enter the building(through the gate) press 'p', if you want to leave the building press 'd', if you want check how many people is inside press 'c': ");
            do
            {
                Console.Write("Enter your choice: ");
                wybor = char.Parse(Console.ReadLine());
                if (wybor == 'p')
                {
                    Counter gate2 = new Counter();
                    gate2.IncNr(wybor);
                    gate.Count(wybor);
                }
                else if (wybor == 'd')
                {
                    Counter gate3 = new Counter();
                    gate3.DecNr(wybor);
                    gate.Count(wybor);
                }
            } while (wybor != 'c');
            if (wybor == 'c')
            {
                gate.CheckNr(wybor);
            }
            Console.ReadKey();
        }
    }

    class Counter
    {
        private int _licznik;
        private int quantity;
        public int Licznik
        {
            get { return _licznik; }
            set { _licznik = value; }
        }

        public Counter()
        {
            _licznik = 0;
        }

        public void IncNr(char wybor)
        {
            if (wybor == 'p')
            {
                Licznik += 1;
                Console.WriteLine("The amount of people that just entered the building through the gate: { 0}\n", Licznik);
            }
        }
        public void CheckNr(char wybor)
        {
            if (wybor == 'c')
            {
                Console.WriteLine("The current amount of people: {0}", quantity);
            }
        }

        public void Count(char wybor)
        {
            if (wybor == 'p')
            {
                quantity += 1;
            }
            else if (wybor == 'd')
            {
                quantity -= 1;
            }
        }

        public void DecNr(char wybor)
        {
            if (wybor == 'd')
            {
                Licznik += 1;
                Console.WriteLine("The amount of people that just passed the gate toward the exit is: { 0}\n", Licznik);
            }
        }
    }
}

You're also mixing English and Polish - try to stick to one language (Licznik vs quantity).

  The class should contain a methods that will singly increase amount of people or singly decreases amount of them, the third method should show how many is inside already. Last but not least, the constructor for counter should be set as 0.

This is worded a bit ambiguously, but I'll put that down to the translation. From my understanding, it wants you to make three functions

Increment the counter
Decrement the counter
Return the count

It also mentions the difference between the number of entries and the current amount of people in the building, so you might need an additional method to return the total number of entries (ignoring the exits).

You've got those methods, but they're being passed an argument (the choice made). Those methods don't need any argument - they do one thing only. It's the responsibility of the caller to determine which to call (increment, decrement, or show the count). Also, the methods aren't very clear. What is IncNr? What's the Nr represent here? I suspect this may be 'Increment Number', but that's not very clear. Use descriptive method names.

Your Counter class should have the skeleton like so:

class Counter
{
    private int _totalEntrances;
    private int _currentCount;

    public Counter()
    {
        // ...
    }

    public void Increment()
    {
        // ...
    }

    public void Decrement()
    {
        // ...
    }

    public int GetCurrentCount()
    {
        // ...
    }

    public int GetTotalEntries()
    {
        // ...
    }

}

I'll leave it up to you to implement those, but it should be pretty straight forward. Now, for your main method:

if (wybor == 'p')
{
    Counter gate2 = new Counter();
    gate2.IncNr(wybor);
    gate.Count(wybor);
}

Here, you're creating a new counter, increment the count, and then throwing away the counter. This doesn't actually do anything. The only work being done here is gate.Count(wybor). Also be aware that a function named Count() changing a value is very confusing. Judging by the name, it should be returning the count, not changing the count. Also, as we already know it's an entrance, so the code should be:

if (wybor == 'p')
{
    gate.Increment();
}

The same applies to the decrement call.

Currently, your code will exit if the user asks for the count. I'm not sure if this is expected behaviour. I'd expect something like 'q' to quit the program, but 'c' to simply return the count and continue.


As far as I can tell, you have 4 options:

Use the current code as-is (and, as you say, risk stepping on an existing method_missing).
You can use RSpec's config.extend to at least limit the inclusion.
You can skip method_missing in favor of creating a module explicit method declarations for anything you want to forward to @browser. This is no doubt the safest, but also the most laborious, solution. Still, I'd consider it
You can do something like below, which, admittedly, is somewhat hacky.

module Session_FF

  # Alias existing method_missing implementation when being included
  def Session_FF.append_features(target)
    if target.instance_methods.include?(:method_missing)
      target.send(:alias_method, :overriden_method_missing, :method_missing)
    end
    super
  end

  # Define your own method_missing which forwards to @browser
  # or to the previous method_missing (if any)
  def method_missing(name, *args, &block)
    if @browser.respond_to?(name)
      @browser.send(name, *args, &block)
    elsif respond_to?(:overriden_method_missing)
      overriden_method_missing(name, *args, &block)
    end
  end

  def element(*args)
    # ...
  end

end

Should work, although if @browser also relies on method_missing without a reliable respond_to?, you might have better luck simply trying to call a method @browser and rescue a NoMethodError. Not very pretty, though.

On a side-note, I think it's perhaps a little strange that the module is named _FF when the @browser could be something other than Firefox. WatirSession might be  a more inclusive name.


Algorithm

You're using a O(n log(n)) algorithm here, which could be O(n²) for difficult cases since contains() is O(n) and is called in a loop. Instead, use the property of HashSet: access is O(1), which means you can achieve this in O(n) time. My algorithm below simply keeps track of what it can add to the result. I can add everything that exists in the first list, but I should not add an item I already added.

See my tested code for my implementation:

public static List<Integer> intersection(List<Integer> a, List<Integer> b){
    Set<Integer> canAdd = new HashSet<Integer>(a);
    List<Integer> result = new ArrayList<Integer>();

    for (int n: b) {
        if(first.contains(n)) {
            result.add(n);
            // we wish to add only one n
            canAdd.remove(n);
        }
    }

    return result;
}

Comments on your code

You should return a List, not an ArrayList since it's an implementation detail. Using an ArrayList is OK here since adding at the end of it has O(1) amortized complexity. Otherwise, lists should be LinkedList (when adding to the beginning, not to the end, as @Landei points out).
Be careful about the names you choose. findIt doesn't seem to be appropriate, but removeDuplicates or intersection describes what the code does.


Avoid magic symbols

The character literals 'x', 'o', ' ' appear many times throughout the code.
It would be better to put these in constants, for example:

static final char EMPTY = ' ';
static final char PLAYER_X = 'x';
static final char PLAYER_O = 'o';

Simplify changePlayer

In changePlayer, the newTurn variable is pointless.
The player is either 'o' or 'x', so you can simplify to:

public char changePlayer(char player) {
    return player == 'o' ? 'x' : 'o';
}

Simplify checkIfLegal

The parentheses are unnecessary in the boundary check condition.

And instead of checking if a cell is 'x' or 'o',
it would be simpler to check if it's ' '.

Like this:

public boolean checkIfLegal(int row, int column) {
    if (row > 2 || column > 2 || row < 0 || column < 0) {
        return true;
    } else if (table[row][column] != ' ') {
        return true;
    }

    return false;
}

Not intuitive checkIfLegal

The return value of checkIfLegal is kind of counter-intuitive.
Judging by the name,
my first thought is to return true if legal.
But that's not the case.
A more natural name would be isIllegal.

Formatting

Your code, nicely formatted, would look below.
I simply used my IDE to auto-reformat. You can do this too, next time.

public class Game {

    char[][] table = new char[3][3];

    public void initializeGame() {
        for (int i = 0; i < 3; i++) {
            for (int p = 0; p < 3; p++) {
                table[i][p] = ' ';
            }
        }
    }

    public boolean checkIfLegal(int row, int column) {
        if ((row > 2 || column > 2) || (row < 0 || column < 0)) {
            return true;
        } else if (table[row][column] == 'x' || table[row][column] == 'o') {
            return true;
        }

        return false;
    }

    public void changeBoard(char player, int row, int column) {
        table[row][column] = player;

    }

    public void displayBoard() {

        System.out.println("  0  " + table[0][0] + "|" + table[0][1] + "|" + table[0][2]);
        System.out.println("    --+-+--");
        System.out.println("  1  " + table[1][0] + "|" + table[1][1] + "|" + table[1][2]);
        System.out.println("    --+-+--");
        System.out.println("  2  " + table[2][0] + "|" + table[2][1] + "|" + table[2][2]);
        System.out.println("     0 1 2 ");
    }

    public char changePlayer(char player) {
        char newTurn = 'e';
        if (player == 'o') {
            newTurn = 'x';
        }
        if (player == 'x') {
            newTurn = 'o';
        }
        return newTurn;
    }

    public boolean checkIfWinner() {
        if (table[0][0] == table[1][0] && table[1][0] == table[2][0] && (table[0][0] == 'x' || table[0][0] == 'o')) {
            return true;
        } else if (table[0][1] == table[1][1] && table[1][1] == table[2][1] && (table[0][1] == 'x' || table[0][1] == 'o')) {
            return true;
        } else if (table[0][2] == table[1][2] && table[1][2] == table[2][2] && (table[0][2] == 'x' || table[0][2] == 'o')) {
            return true;
        } else if (table[0][0] == table[0][1] && table[0][1] == table[0][2] && (table[0][0] == 'x' || table[0][0] == 'o')) {
            return true;
        } else if (table[1][0] == table[1][1] && table[1][1] == table[1][2] && (table[1][0] == 'x' || table[1][0] == 'o')) {
            return true;
        } else if (table[2][0] == table[2][1] && table[2][1] == table[2][2] && (table[2][0] == 'x' || table[2][0] == 'o')) {
            return true;
        } else if (table[0][0] == table[1][1] && table[1][1] == table[2][2] && (table[0][0] == 'x' || table[0][0] == 'o')) {
            return true;
        } else if (table[2][0] == table[1][1] && table[1][1] == table[0][2] && (table[2][0] == 'x' || table[2][0] == 'o')) {
            return true;
        } else {
            return false;
        }
    }

    public boolean checkIfTie() {
        for (int i = 0; i < 3; i++) {
            for (int p = 0; p < 3; p++) {
                if (table[i][p] == ' ') {
                    return false;
                }
            }
        }

        return true;
    }

}

public class Main {

    public static void main(String[] args) {
        char player = 'o';
        int row, column;
        Scanner k = new Scanner(System.in);
        Game g = new Game();

        g.initializeGame();
        System.out.println("Game ready !\n");

        while (true) {
            player = g.changePlayer(player);
            System.out.print("\n" + player + " ,choose your location (row, column):");
            row = k.nextInt();
            column = k.nextInt();

            while (g.checkIfLegal(row, column)) {
                System.out.println("That slot is already taken or out of bounds, please try again (row, column).");
                g.displayBoard();
                row = k.nextInt();
                column = k.nextInt();
            }
            g.changeBoard(player, row, column);
            g.displayBoard();

            if (g.checkIfWinner()) {
                System.out.println("\nThe winner is " + player + " !");
                break;

            }
            if (g.checkIfTie()) {
                System.out.println("\nThe game is a tie !");
                break;
            }
        }

    }

}


Group inner properties from an array of objects to a map

Too complex
Don't make code more complicated than needed.
The getValue function for each data item is entirely unnecessary. You can move the function out and reduce the data input complexity a great deal. See 1st rewrite.
For each data item property you call getValue (once for country and once for city) which creates a new object each time it is called. This is a huge overhead, the items should be created only once (When code is parsed) and to process you should not need to make copies just to read properties.
If you need the data items to be functions, don't write the function for each item, write the function once and return it using a second function. See 2nd rewrite.
Template_literals can sometimes add a lot of noise to the construction of a string. Maybe ${key} = ${value} can be better as key + " = " + value.  Template literals do not make for better code just by using them.
Names
The naming is very poor. You should never get lazy with naming, even if its example code.

key and value should be country and city
myMap Yes we know its a map, but what does it represent. citesByCountry

Code should never stand alone. Always write code as a named function, even when its just example code. See rewrite.
General points
Always code in Strict_mode.
Prefer for...of loops over Array iterators when possible.
You do two map look-ups with Map.has and Map.get if an index exists. You can avoid one of the look-ups and use only Map.get. Check the result to determine if the map has the index you are looking for. See rewrite.
Learn to use the Conditional Operator ?, Nullish coalescing operator ?? and / or Optional chaining ?. to simplify statement combinations.
Rewrites
First without the overhead of the getValue call per item.
"use strict";
function dataTest() {
    const addCountry = (country, city) => ({country, city});
    const data = [
        addCountry("France", "Toulouse"),
        addCountry("England", "London"),
        addCountry("France", "Paris"),
    ];
    function joinByCountry(data) {
        const countries = new Map();
        for (const {country, city} of data) {
            countries.get(country)?.push(city) ?? countries.set(country, [city]);
        }
        return countries;
    }

    for (const [country, cites] of joinByCountry(data)) {
         console.log(country + " = " + cites);
    }
}

If getValue is required then write the getValue function once rather than for each item.
This rewrite uses Conditional Operator ? to replace the if else statements.
"use strict";
function dataTest() {
    const addCountry = (country) => ({ getValue() { return country} });
    const data = [
        addCountry({country: "France", city: "Toulouse"}),
        addCountry({country: "England", city: "London"}),
        addCountry({country: "France", city: "Paris"}),
    ];
    function joinByCountry(data) {
        const countries = new Map();
        for (const location of data) {
            const {country, city} = location.getValue();
            const cites = countries.get(country);
            cites ? cites.push(city) : countries.set(country, [city]);
        }
        return countries;
    }

    for (const [country, cites] of joinByCountry(data)) {
         console.log(country + " = " + cites);
    }
}


Java executing rSync shell command with progress display

Process.waitFor will terminate the current thread until the process is terminated. Thus, at the place where you commented it out, it does not make any sense at all. You might consider putting a p.waitFor() after the loop, as to continue with your program only when the process has terminated.

Apart from that, sorry to say so, your code is a mess. You use a very outdated method to start the process, you do not read stderr (which may lead to blocking conditions on stdout), code format is all over the place, p is declared outside the try block without any reason, exception handling is not present.

To at least cover the basic necessities of reading both stdin and stderr, you should go for process builder and redirect stderr to stdout:

    ProcessBuilder builder = new ProcessBuilder(Arrays.asList("rsync", "--progress", "-va", src, dest));
    builder.redirectErrorStream(true);
    builder.redirectOutput(ProcessBuilder.Redirect.PIPE);
    Process p = builder.start();


Comparing strings case insensitively is done by using the proper overload:

string.Compare(str1, str2, StringComparison.OrdinalIgnoreCase)

By calling .ToLower() for each string to compare (4 times for each iteration), you create 4 new strings each time. If you have a lot of (long) strings, this will create a lot of garbage for no reason.

In your case you use .Contains() so you can mimic this by using .IndexOf():

str4.IndexOf("dyt2", StringComparison.OrdinalIgnoreCase) >= 0

It's prettier to use bool instead of Boolean, partly because it also keeps your code consistent.

Write your variable names in full: objectCount, previousResultName, etc.

Constants are PascalCase, not WHATEVER_THIS_IS as in Java.

The addResult variable seems a little wonky. Instead of this:

Boolean addResult = true;
if (thisSearch.FilterDescription)
{
    if (!name.ToLower().Contains(thisSearch.Value.ToLower()))
    {
        addResult = false;
    }
}
if (addResult)
{
    SearchItem oSearch = new SearchItem(name, code);
    SearchResults.Add(oSearch);
    prevResultName = name;
}

Why not this:

if (!(thisSearch.FilterDescription && !name.ToLower().Contains(thisSearch.Value.ToLower()))
{
    SearchItem oSearch = new SearchItem(name, code);
    SearchResults.Add(oSearch);
    prevResultName = name;
}

You can clean this up a bit more but I'm not in a boolean algebra mood.


A big danger.

When the len parameter happens to be a muliple of 8 and all of the full qwords have been processed, there will be no remaining bytes to process.
Your code calculates the number of remaining bytes using

mov 16(%ebp),%edx     # length
...
and $7,%edx           # loop tail

but forgets to exit if this produces zero. The loop that follows is started anyway and at the bottom where it reads

inc %edx
jnz 0b

the increment of %edx will keep producing NZ for a very long time!

Resolve this by exiting if the and instruction sets ZF=1.

mov 16(%ebp), %edx    # length
...
and $7, %edx          # loop tail
jz  1f

A small optimization

and $~7,%edx        # only process full qwords
test %edx,%edx
jz 1f

Because the and instruction defines the zero flag (ZF), there's no need to write test %edx, %edx.

Allow me

mov $'A'+26-1,%ah

This struck me as being a bit too much of a complication. Why not simply write

mov $'Z', %ah

Now if it was your intent to come close to the comment that follows in the next line
# ah: threshold ('A' - 1 - (key - 26))
then writing

lea -26(%ecx), %eax   # al: key - 26
mov $'A'-1, %ah
sub %al, %ah          # ah: threshold ('A' - 1 - (key - 26))

would have nailed it.


Filtering vector of maps based on a blacklist

We want to exclude from the vector (more generally a sequence) the maps of which any map in the blacklist is a sub-map. Let's define a function that tests whether its first argument is a sub-map of its second argument:

(defn submap? [a b]
  (every? (fn [[k v]] (= v (b k)))  a))

For instance,

=> (map #(submap? {1 2} %) [{} {1 1} {1 2}])
(false false true)

So far, so good. Let's use submap? to define function clean that takes a blacklist and a sequence of maps as arguments, excluding any supermaps of any map in the blacklist from the sequence:

(defn clean [blacklist ms]
  (filter
    (fn [m] (not-any? #(submap? % m) blacklist))
    ms))

For example,

=> (clean blacklist my-list)
({:a 1, :b 5, :c 6} {:a 7, :b 8, :c 12})

submap? could be careful about absent keys. If you have nil values, you need to fix this.


Use Standard Constants When You Can

The stdio.h header file contains a definition of BUFSIZ. This is a good constant to use for input and output buffers.

In the stdlib.h header file are 2 constants that are useful when calling exit or returning from main, these are EXIT_FAILURE and EXIT_SUCCESS. These constants are universal, even if the underlying operating system expects different numbers for success or failure this constants will provide the correct value.

DRY Code
There is a programming principle called the Don't Repeat Yourself principle. The principle is this, if you find yourself repeating code, it might be better to create a function or sub-program and call that function where the code is repeated. This reduces the amount of code in a module and makes it easier to read. What is more beneficial than the readability is the fact that you only have to write and debug that code once. Another benefit of puting repeating code into a function is that if the code needs to be changed, there is only one place to change it.
.

Code that repeats a lot in this program:

    printf("     %d  %s", index, buffer);
    index++;

While this is only one line of code, making a function out of it reduces the possibility of errors such as missing spaces or too many spaces.

All of the output could be in their own functions:

void formattedLineOut(int *index, char buffer[])
{
    printf("     %d  %s", *index, buffer);
    *index++;
}

The function formattedLineOut is receiving a reference to index rather than
the value. This way the function doesn't have to have a return value for
index.

void bprint(int *index, char buffer[])
{
    if (strcmp(s, "\n") == 0) {
        printf(" %s", s);
    }
    else {
        formattedLineOut(index, s);
    }
}

void outputLine(int *index, char buffer[], int nflag, int bflag)
{
    if (nflag)
    {
        formattedLineOut(index, buffer);
    }
    else if (bflag)
    {
        bprint(index, buffer);
    }
    else
    {
        printf("%s", buffer);
    }
}

int readFile(char* filename, FILE* fp, int index, int bflag, int nflag) {
    char ch;
    char s[BUF_SIZE];
    if (fp == NULL) { //in case the file doesn't exist
        printf("%s: No such file or directory\n", filename);
        exit(1);
    }

    while ((fgets(s, BUF_SIZE, fp))) {
        outputLine(&index, s, bflag, nflag)
    }

    return index;
}

Match fclose() With fopen()

The function readFile has multiple calls to fclose(). This can lead to bugs,
it might be better to call fclose() after readFile returns in the calling
function. This will also allow readFile to handle stdin, since stdin is a file pointer.


Applying scalar multiplication to matrix

Braces aren't required as initialization will proceed by row.
However it is much easier to read if you initialized your
two-dimensional array like this:

int sampleMatrix[3][5] = {
    {7,16,55,13,12},
    {12,10,52,0,7},
    {-2,1,2,4,9}
}

Also note, it is not required that the entire array be initialized.
If you use inner pairs of braces you can force initialization to
whatever you want. Unspecified values are set to zero by default.

int sampleMatrix[3][5] = {
    {7,16,55,13},  //Last element in each row is zero ; test it yourself
    {12,10,52,0},
    {-2,1,2,4}
}

Use variables to represent the number of rows and columns for the
matrices. Magic numbers are bad. This will also allow you to pass
matrices of different dimensions.

void scalarMultiply(int nRows, int nCols, int matrix[nRows][nCols], int scalar);
void displayMatrix (int nRows, int nCols, int matrix[nRows][nCols]);

It is best practice to keep your function prototypes outside of
main(). Keeping it in main() makes it harder to find.
The outout layout looks a bit messy. Change your printf statement
to include a field width specifier.

     printf ("%5i", matrix[row][column]);

%5i tells printf to display integers and their sign that take up 5 columns.
Use proper spacing:

    scalarMultiply (sampleMatrix, 2);

    printf ("\nMultiplied by 2:\n");
    displayMatrix (sampleMatrix);

    scalarMultiply (sampleMatrix, -1);

    printf ("\nThen multiplied by -1:\n");  //Keep related functions together
    displayMatrix (sampleMatrix);


$sql = <<<'EOSQL'
SELECT g.name, g.year, GROUP_CONCAT(m.name SEPARATOR ', ') AS members
FROM groups g INNER JOIN members m on g.id = m.idGroup
GROUP BY m.idGroup
EOSQL;

The key insight here is that GROUP_CONCAT and GROUP are what you need to combine multiple rows of the result into one.  Note that GROUP is a SQL name.  It is just coincidence that you also have a table named groups.

I also used a Nowdoc because the SQL string is using multiple lines.  I picked Nowdoc because we aren't doing any interpolation or other escaping in the string.

It's obsolete now (assuming you use the INNER JOIN version), but in

  while($member =   $ergebnis->fetch_assoc())
  {
    if(!empty($members)) $members .= ", ";
    $members .= htmlspecialchars($member["name"]);
  }

It looks like you forgot to change a variable name.  I think that $ergebnis should be $memberResult.  But the main point I wanted to make is that at the expense of some mildly duplicate code, you don't need to check every iteration to see if it is the first.

  if ($member = $memberResult->fetch_assoc())
  {
    $members = htmlspecialchars($member['name']);

    while ($member = $memberResult->fetch_assoc())
    {
      $members .= ', ' . htmlspecialchars($member['name']);
    }
  }

On the first row, you just set the variable.  On subsequent rows, you append the separator and the new value to the variable.  This produces the same result without all the checks to see if you are on the first iteration.

I find it more readable to put a space between while and the opening parenthesis.  That makes it easier to see that we are not making a function call.  The additional whitespace also breaks up the line and makes it easier for a human to parse (the compiler doesn't care either way).

In PHP, a double-quoted string allows variable interpolation.  So if I'm not using variable interpolation, I use a single-quoted string.  There's a slight performance benefit.  But the real advantage is that when I see a single-quoted string, I know that I don't have to look for variables being interpolated.

  ?>

I find it more readable to always put the ?> at the far left (no indent) when the PHP block spans multiple lines.  Perhaps that is just me, but I find it easier to scan for ?> if they are always in the same place.


Convert HTML input string to JavaScript Array literal

The answer

What you're actually trying to do is only converting objects from Javascript notation to actual javascript objects. Now what if there was a well-specified data interchange format that was named "Javascript object notation"? Oh there is?

parsed = JSON.parse(inputField.value);

You're even using JSON.stringify already...

Other general advice

Don't use classes to identify unique elements. That's exactly not what classes are intended for. Instead use IDs.
Make use of the strict evaluation mode for javascript... "use strict";
You could avoid the e.preventDefault if you didn't use a submit button, but a normal button instead or listened to 'onblur'. I personally would prefer the last method the most, possibly combined with an 'onchange' listener with a timeout.
Always put braces around your stuffs, in this case around the throw new Error. This helps avoid bugs when changing the code later.


Mainly performance improvements?

There doesn't seem to be much oppurtunity for performance improvements. This class basically consists of (1) loading and parsing the configuration and (2) accessing data. For loading, parse_ini_file and json_decode are builtin methods so unless you write your own parser from scratch, you won't make this any faster. And accessing data is basically a single condition checking and an array lookup, not much to improve there either.

However, here is a different kind of suggestion. You probably want to make sure that $filepath in the constructor is restricted to specific directories, for example your web root or better, a subfolder of that. That also means checking for attempts to escape from the restricted directory, e.g. $filepath does not have components like ../. I can easily imagine an attack where a malicious user gets to place a custom php script in /tmp and then (if you have some other vulnerability in your other code) manages to call new Config('/tmp/attack.php'). Then you have an arbitrary maclicous script executing with the priviliges of your website. Ouch.


As Jason Tyler said in a comment, this has a problem that [Flags] enumerations won't be properly handled.

I ran this in C# interactive, and it threw an exception (as expected, but not desired) for a valid [Flags] value:

> public static T ToEnum<T>(this int value)
. {
.     Type type = typeof(T);
.
.     if (!type.IsEnum)
.     {
.         throw new ArgumentException($"{type} is not an enum.");
.
.     }
.
.     if (!type.IsEnumDefined(value))
.     {
.         throw new ArgumentException($"{value} is not a valid ordinal of type {type}.");
.     }
.
.     return (T)Enum.ToObject(type, value);
. }
> [Flags] public enum Test { Flag1 = 0x01, Flag2 = 0x02 }
> ToEnum<Test>(3);
3 is not a valid ordinal of type Submission#1+Test.
  + Submission#0.ToEnum<T>(int)

So, we might have to look at a different way of going about this.

There's an answer on Stack Overflow, but I don't like it. They use string comparison and validation, and it just feels like a hack.

So what can we do?

Well, we have Enum.GetValues, I bet we can come up with a solution there, assuming we interpret all the values as a numeric type.

The hard part is picking the type. Enums can be any numeric type, so we have to decide on one.

Fun fact: every numeric type can be cast to the others in C#, there just might be overflow issues. So if we look at all the numeric types, we can find that we should always be able to cast them to a long or ulong, depending on whether they're signed or not.

OK, so how do we figure out what number type it is?

There's another magic function in Enum: Enum.GetUnderlyingType, I think that'll do.

Of course, this also means we can no longer take an int input, because we want to support any number. We could take in an object, but then we have to deal with boxing/unboxing, and that can get prohibitively expensive with frequent use, but we'll work that out-of-the-way later.

We can use some bit-fiddling to find out if a value is only composed of valid Enum values. Basically, we'll do the following:

Loop through the valid flags options:

If providedValue ∧ enumValue > 0, then providedValue = providedValue ⊕ enumValue

If providedValue > 0 then it is not composed strictly of the valid enum options

For those unfamiliar with boolean algebra:

∧ = "AND", take all bits of both values and compare them such that the result value only contains those that are 1 in each value, this is & in C#;
⊕ = "XOR", take all bits of both values and compare them such that the result value only contains those that are 1 in one value, and 0 in another, this is ^ in C#;

So, if we rewrite this, it gets a bit ugly, but we'll clean some of that up:

public static TEnum ToEnum<TEnum>(this object value)
{
    Type type = typeof(TEnum);

    if (!type.IsEnum)
    {
        throw new ArgumentException($"{type} is not an enum.");
    }

    if (type.GetCustomAttributes(typeof(FlagsAttribute), true).Length > 0)
    {
        var values = Enum.GetValues(type);
        switch (Enum.GetUnderlyingType(type).FullName)
        {
            case "System.Byte":
                {
                    var myVal = (byte)value;
                    foreach (byte val in values)
                    {
                        if ((myVal & val) > (byte)0)
                        {
                            myVal ^= val;
                        }
                    }
                    if (myVal > (byte)0)
                    {
                        throw new ArgumentException($"{value} is not a valid ordinal of type {type}.");
                    }
                }
                break;
            case "System.SByte":
                {
                    var myVal = (sbyte)value;
                    foreach (sbyte val in values)
                    {
                        if ((myVal & val) > (sbyte)0)
                        {
                            myVal ^= val;
                        }
                    }
                    if (myVal > (sbyte)0)
                    {
                        throw new ArgumentException($"{value} is not a valid ordinal of type {type}.");
                    }
                }
                break;
            case "System.UInt16":
                {
                    var myVal = (ushort)value;
                    foreach (ushort val in values)
                    {
                        if ((myVal & val) > (ushort)0)
                        {
                            myVal ^= val;
                        }
                    }
                    if (myVal > (ushort)0)
                    {
                        throw new ArgumentException($"{value} is not a valid ordinal of type {type}.");
                    }
                }
                break;
            case "System.Int16":
                {
                    var myVal = (short)value;
                    foreach (short val in values)
                    {
                        if ((myVal & val) > (short)0)
                        {
                            myVal ^= val;
                        }
                    }
                    if (myVal > (short)0)
                    {
                        throw new ArgumentException($"{value} is not a valid ordinal of type {type}.");
                    }
                }
                break;
            case "System.UInt32":
                {
                    var myVal = (uint)value;
                    foreach (uint val in values)
                    {
                        if ((myVal & val) > (uint)0)
                        {
                            myVal ^= val;
                        }
                    }
                    if (myVal > (uint)0)
                    {
                        throw new ArgumentException($"{value} is not a valid ordinal of type {type}.");
                    }
                }
                break;
            case "System.Int32":
                {
                    var myVal = (int)value;
                    foreach (int val in values)
                    {
                        if ((myVal & val) > (int)0)
                        {
                            myVal ^= val;
                        }
                    }
                    if (myVal > (int)0)
                    {
                        throw new ArgumentException($"{value} is not a valid ordinal of type {type}.");
                    }
                }
                break;
            case "System.UInt64":
                {
                    var myVal = (ulong)value;
                    foreach (ulong val in values)
                    {
                        if ((myVal & val) > (ulong)0)
                        {
                            myVal ^= val;
                        }
                    }
                    if (myVal > (ulong)0)
                    {
                        throw new ArgumentException($"{value} is not a valid ordinal of type {type}.");
                    }
                }
                break;
            case "System.Int64":
                {
                    var myVal = (long)value;
                    foreach (long val in values)
                    {
                        if ((myVal & val) > (long)0)
                        {
                            myVal ^= val;
                        }
                    }
                    if (myVal > (long)0)
                    {
                        throw new ArgumentException($"{value} is not a valid ordinal of type {type}.");
                    }
                }
                break;
            default:
                throw new ArgumentException($"{type} does not have a valid backing type ({underlyingType}).");
                break;
        }
    }
    else
    {
        if (!type.IsEnumDefined(value))
        {
            throw new ArgumentException($"{value} is not a valid ordinal of type {type}.");
        }
    }

    return (TEnum)Enum.ToObject(type, value);
}

This will work as expected on [Flags] enumerations, which is great! But, there's some improvement to be made.

First and foremost: how do we get rid of that object parameter?

Well, we have a few options, but the easiest is to redefine our ToEnum on each numeric type, and create a version that takes a dynamic. It's ugly, but works:

public static TEnum ToEnum<TEnum>(this byte value) => DynamicToEnum<TEnum>(value);
public static TEnum ToEnum<TEnum>(this sbyte value) => DynamicToEnum<TEnum>(value);
public static TEnum ToEnum<TEnum>(this ushort value) => DynamicToEnum<TEnum>(value);
public static TEnum ToEnum<TEnum>(this short value) => DynamicToEnum<TEnum>(value);
public static TEnum ToEnum<TEnum>(this uint value) => DynamicToEnum<TEnum>(value);
public static TEnum ToEnum<TEnum>(this int value) => DynamicToEnum<TEnum>(value);
public static TEnum ToEnum<TEnum>(this ulong value) => DynamicToEnum<TEnum>(value);
public static TEnum ToEnum<TEnum>(this long value) => DynamicToEnum<TEnum>(value);

private static TEnum DynamicToEnum<TEnum>(dynamic value)
{
    ...

For each repeated case body, there's no good way to do this. With the use dynamic, we lose all safety of our types. There's no way to constrain it generically, because we can't say "it can be any number."

The best we could do would be a local function something like the following:

void testEnum<T>(T myVal, Func<T, bool> aboveZero, Func<T, T, T> and, Func<T, T, T> xor)
{
    foreach (T val in values)
    {
        if (aboveZero(and(myVal, val)))
        {
            myVal = xor(myVal, val);
        }
    }
    if (aboveZero(myVal))
    {
        throw new ArgumentException($"{value} is not a valid ordinal of type {type}.");
    }
}

Which means, we can use it to create a more readable version of our function:

public static TEnum ToEnum<TEnum>(this byte value) => DynamicToEnum<TEnum>(value);
public static TEnum ToEnum<TEnum>(this sbyte value) => DynamicToEnum<TEnum>(value);
public static TEnum ToEnum<TEnum>(this ushort value) => DynamicToEnum<TEnum>(value);
public static TEnum ToEnum<TEnum>(this short value) => DynamicToEnum<TEnum>(value);
public static TEnum ToEnum<TEnum>(this uint value) => DynamicToEnum<TEnum>(value);
public static TEnum ToEnum<TEnum>(this int value) => DynamicToEnum<TEnum>(value);
public static TEnum ToEnum<TEnum>(this ulong value) => DynamicToEnum<TEnum>(value);
public static TEnum ToEnum<TEnum>(this long value) => DynamicToEnum<TEnum>(value);

private static TEnum DynamicToEnum<TEnum>(dynamic value)
{
    Type type = typeof(TEnum);

    if (!type.IsEnum)
    {
        throw new ArgumentException($"{type} is not an enum.");
    }

    if (type.GetCustomAttributes(typeof(FlagsAttribute), true).Length > 0)
    {
        var values = Enum.GetValues(type);

        void testEnum<T>(T myVal, Func<T, bool> aboveZero, Func<T, T, T> and, Func<T, T, T> xor)
        {
            foreach (T val in values)
            {
                if (aboveZero(and(myVal, val)))
                {
                    myVal = xor(myVal, val);
                }
            }
            if (aboveZero(myVal))
            {
                throw new ArgumentException($"{value} is not a valid ordinal of type {type}.");
            }
        }

        var underlyingType = Enum.GetUnderlyingType(type).FullName;
        switch (underlyingType)
        {
            case "System.Byte":
                testEnum((Byte)value, (v) => v > (Byte)0, (v1, v2) => (Byte)(v1 & v2), (v1, v2) => (Byte)(v1 ^ v2));
                break;
            case "System.SByte":
                testEnum((SByte)value, (v) => v > (SByte)0, (v1, v2) => (SByte)(v1 & v2), (v1, v2) => (SByte)(v1 ^ v2));
                break;
            case "System.UInt16":
                testEnum((UInt16)value, (v) => v > (UInt16)0, (v1, v2) => (UInt16)(v1 & v2), (v1, v2) => (UInt16)(v1 ^ v2));
                break;
            case "System.Int16":
                testEnum((Int16)value, (v) => v > (Int16)0, (v1, v2) => (Int16)(v1 & v2), (v1, v2) => (Int16)(v1 ^ v2));
                break;
            case "System.UInt32":
                testEnum((UInt32)value, (v) => v > (UInt32)0, (v1, v2) => (UInt32)(v1 & v2), (v1, v2) => (UInt32)(v1 ^ v2));
                break;
            case "System.Int32":
                testEnum((Int32)value, (v) => v > (Int32)0, (v1, v2) => (Int32)(v1 & v2), (v1, v2) => (Int32)(v1 ^ v2));
                break;
            case "System.UInt64":
                testEnum((UInt64)value, (v) => v > (UInt64)0, (v1, v2) => (UInt64)(v1 & v2), (v1, v2) => (UInt64)(v1 ^ v2));
                break;
            case "System.Int64":
                testEnum((Int64)value, (v) => v > (Int64)0, (v1, v2) => (Int64)(v1 & v2), (v1, v2) => (Int64)(v1 ^ v2));
                break;
            default:
                throw new ArgumentException($"{type} does not have a valid backing type ({underlyingType}).");
                break;
        }
    }
    else
    {
        if (!type.IsEnumDefined(value))
        {
            throw new ArgumentException($"{value} is not a valid ordinal of type {type}.");
        }
    }

    return (TEnum)Enum.ToObject(type, value);
}

Overboard? Probably. But does it work? Oh yeah.

Additionally, as Peter Taylor mentions, you can use where TEnum : struct to help reduce some of the run-time issues, and bring them to the compile-type.


Boolean enums: improved clarity or just overkill?

I think the enum is a very nice solution here. And in a way I disagree with Johannes, even for single-use the enum improves readability and discoverability of the API, and writing it is a negligible effort; and I’d be wary of using comments as in his example, they scream “hack”.


For the first function you could use set operations and the built-in string module:

import string

ALPHABET = set(string.ascii_lowercase)

def get_available_letters(letters_guessed):
    '''
    letters_guessed: iterable, what letters have been guessed so far
    returns: string, comprised of letters that represents what letters have not
      yet been guessed.
    '''
    return "".join(sorted(ALPHABET - set(letters_guessed)))

Note that I renamed your function/variables to adhere to Python's official style-guide, PEP8.

If you don't care that the return value is sorted, or a string, you can just return the set right away:

def get_available_letters(letters_guessed):
    '''
    letters_guessed: iterable, what letters have been guessed so far
    returns: set, letters that have not yet been guessed.
    '''
    return ALPHABET - set(letters_guessed)

In your actual game function, here are a few nitpicks:

Use str.format for an easier way to put some value somewhere in a text. This changes print ('I am thinking of a word that is ') + intro + (' letters
long.') to print 'I am thinking of a word that is {} letters
long.'.format(len(secretWord)) and print ('You have ') + str(mistakesMade) + (' guesses left.') to print ('You have {} guesses left.'.format(mistakesMade))
while mistakesMade > 0 and mistakesMade <= 8 and wordGuessed is False: could be while 0 < mistakesMade <= 8 and not wordGuessed
Use a set also for lettersGuessed, then if guess in lettersGuessed: becomes \$\mathcal{O}(1)\$, instead of \$\mathcal{O}(n)\$
if wordGuessed == True: can just be if wordGuessed:


I'd say give your "output" elements a data-* attribute that matches the name of the form value it should contain. For instance:

Then, you can do something like:

$('#save').click(function() {
  var values = $('form').serializeArray(),
      output = $('#values');

  $.each(values, function() {
    output.children("[data-key='" + this.name + "']").text(this.value);
  });
});

Here's a demo


Add items to a list, or update the quantity if already in the list

I am not really sure about the needs but when you see something like this it should make you question if there is a better data structure.  If you stored the parts in an Object for example keyed by partNumber the code is more algorithmically efficient (O(1) vs O(N)) and a bit cleaner.

var newPartNumber = partToAdd.partNumber,
    existingPart = parts[newPartNumber];

if(!existingPart) {
    parts[newPartNumber] = partToAdd;
}
else {
    existingPart.quantity = ...;
}

Now if there are other reasons for using an array or using an object keyed by part number wouldn't be useful anywhere else I would use the some
method.

 var partExistsOnTransfer = transferList[0].parts.some(function (part, indx) {
    if (part.partNumber === partToAdd.partNumber) {
        // if part already exists, add to existing quantity, do not push new part onto list
        part.quantity = (Number(part.quantity) + Number(partToAdd.quantity)).toString();
        return true;
    }
});

Also remember returning false on an Array forEach doesn't make it stop iterating.


Module that warns (a chatbot) about high rate of messages

is_flooding is apparently triggered by the particular user's action. However, it calls update_timer, which affects much wider community. This seems wrong. I recommend keeping each user's activity along with the user's instance, and test only her, along the lines of

def on_message_received(user):
    user.update_tally()
    if user.flooding():
        user.warn_and_ignore_message()
    else:
        user.proceed_normally()

The (anti)-idiom

    if self.dict[user] > limit:
        return True
    else:
        return False

is a long way to say

    return self.dict[user] > limit

The significance of 2 in dictionary updates is very unclear.


Searching the number with the biggest amount of odd divisors in an interval

Bug

Your code isn't always correct:

>>> amountOddDivisorsOf(15)
3

Should be 4.

Coding style

The Python style guide recommends snake_case over camelCase. Also, many of your names are just WAY too long. You're taking up too much space without providing new information.

There's also a lot of repetitiveness. askLowerLimit() and askUpperLimit() shouldn't be separate functions. You should have one function prompting for a value, and then separately assert 0 < lower < upper.

Finding the most divisors

numberWithMostOddDivisors is extremely verbose. We can do much better. The max function takes a keyword argument named key that gives you a function. So as a first go, it's as easy as:

def most_odd_divisors(lo, hi):
    return max(range(lo, hi+1), key=num_odd_divisors)

But this is unsatisfactory, as then you have to recalculate how many odd divisors it has. So instead, we can use:

def most_odd_divisors(lo, hi):
    with_divs = ((i, num_odd_divisors(i)) for i in range(lo, hi+1))
    return max(with_divs, key=operator.itemgetter(1))

And that'll give you both the most odd divisors and the value:

lo = ask_limit()
hi = ask_limit()
assert hi > lo > 0
num, divisors = most_odd_divisors(lo, hi)

Better way of counting

Rather than manually counting each divisor, remember the number of factors formula. If \$n = \prod_p p^i\$, then the sum of the factors is \$\prod_p (i+1)\$, so the number of odd factors if \$\prod_{p \neq 2} (i+1)\$.

So let's find the prime factorization first. We'll just yield pairs of prime numbers and their exponents:

def prime_factors(n):
    for i in itertools.count(2):
        if i*i > n:
            break

        exp = 0
        while n%i == 0:
            n //= i
            exp += 1

        if exp > 0:
            yield i, exp

    if n > 1:
        yield n, 1

The advantage here is that we're not repeating a lot of work. Once you know that a number is divisible by 3 and 5, you know it'll be divisible by 15 too. This way, doing the bare minimum amount of divisibility checking - which isn't cheap!

We can use that to:

def num_odd_divisors(n):
    prod = 1
    for p, e in prime_factors(n):
        if p != 2:
            prod *= e+1
    return prod

Counting from 5,000 to 10,000, this is roughly 11x faster than your implementation. So I suspect your professor did something along these lines.


Obtaining weather station data from a MySQL database

You SQL commands seem rather overelaborated. Let me first rewrite it in a more readable way:

SELECT DATE_FORMAT(date,'%H:%i'), dht22_temp
FROM weather
INNER JOIN
  (SELECT max(dht22_temp) as ts
  FROM weather
  WHERE date(date) = curdate())
AS ds ON weather.dht22_temp = ds.ts
ORDER BY date DESC
LIMIT 1

If I understand it correctly it seems you want to know at what time today the maximum temperate was reached and what that temperature was. You use the table weather with date and dht22_temp columns. In contrast to what you might think, I would start by splitting this command in two parts:

SELECT idweather, dht22_temp
FROM weather
WHERE date(date) = curdate()
ORDER BY dht22_temp DESC
LIMIT 1

This will execute quite fast and return the maximum temperature today, and the row where that maximum occured. Please make sure dht22_temp is properly indexed. Also note that this assumes that there's only 1 maximum. This might not be correct, and you can check that by reading more rows (increase LIMIT). Now you can check all kind of stuff that happened when the temperature was at its maximum:

SELECT *
FROM weather
WHERE idweather = <id of max temp>

This is very simple, but it gives you all the weather parameters when the temperature was at its maximum, including the time at which it occured. A lot of data in two simple steps.

Don't overcomplicate your SQL. But the main point is: Use your auto increment index!

I am, of course, making a point here. Once you've seen that we can rewrite the two SQL commands into a single one, reducing it to what was needed:

SELECT DATE_FORMAT(date,'%H:%i') as time, dht22_temp
FROM weather
WHERE date(date) = curdate()
ORDER BY dht22_temp DESC
LIMIT 1

And doesn't that look much simpler? In your case however I would just grab the data for one whole day:

SELECT *
FROM weather
WHERE date(date) = curdate()

and read it in an array. Then do the manipulation, like sorting, in memory. You could even make a histogram this way, without having to access the database again.


Program efficiency vs user experience. Python Ancestor app

Pathlib
AncestoryDir = os.getenv("APPDATA") + "\Ancestry"
ConfigFile = AncestoryDir + "\CONFIG.ini"

# Make Ancestory Directory
if not os.path.exists(AncestoryDir):
    os.makedirs(AncestoryDir)

can reduce to
ancestry_dir = Path(os.getenv('APPDATA')) / 'Ancestry'
config_file = ancestry_dir / 'CONFIG.ini'

ancestry_dir.mkdir(exist_ok=True)

Note:

pathlib grants you a cleaner, object-oriented method for path manipulation
it's spelled "ancestry"
with pathlib there's no need for a separate existence check
even if you kept your approach, you have an invalid escape \A that either needs to be double-escaped or exist in a raw string

pathlib applies to your other code, too. Also it's spelled "Trees", not "Tree's".
PEP8
Protest thou may, but this actually matters. Coding is a form of communication, and the less we successfully communicate with other coders, the less they're able to help and work with us.


Don't use floating point numbers for representing money.
Don't using namespace std, it's a bad habit that will bite you down the line.
You've "double-spaced" pretty much all your code. That's too much vertical whitespace.
Try to declare your variables as late as possible, ideally only when you can initialize them. This avoids bugs linked to using uninitialized variables, and keeps their scope as small as possible which makes the code simpler to follow - less state to keep in mind. Don't declare variables  then initialize them one line after, just do both at once.

Example for this last point:

double incomeB;

incomeB = bSeats * SECT_B_TICKPRICE;

return incomeB;

Should be:

double incomeB = bSeats * SECT_B_TICKPRICE;
return incomeB;

Or better simply:

return bSeats * SECT_B_TICKPRICE;

Also:

double aSeats;
double bSeats;
double cSeats;

aSeats = getSeatsA();

bSeats = getSeatsB();

cSeats = getSeatsC();

Should be:

double aSeats = getSeatsA();
double bSeats = getSeatsB();
double cSeats = getSeatsC();

For the first point about money, simplest way out is to use int and compute all prices in cents. You can split out dollars and cents (or euros, whatever) on display. I'll use that for the rest of this review.
Also I doubt that buying 0.42 seats makes much sense, so the number of seats purchased/booked should use integers too.

Then look at your repeated functions, and look at what differences they have. Then try to make a more generic function, often by passing additional parameters.

Your getSeatsX functions only depend on a section name, and a number of available seats for that section. So put those in parameters.

int getSeatsForSection(std::string const& name, int maxSeats)
{
    std::cout << "How many tickets were sold in Section "
              << name << "?" << std::endl;

    int seats;
    std::cin >> seats;

    while (seats < 0 && seats > maxSeats)
    {
        std::cout << "Enter a value between 0 and "
                  << maxSeats << std::endl;
        std::cin >> seats;
    }

    return seats;
}

Your calcIncomeX functions only depend on the price of the seats in that section, so move that to a parameter too.

int calcIncome(int seats, int centsPerSeat)
{
    return seats * centsPerSeat;
}

So your main becomes:

const int SECT_A_TICKPRICE = 2000; // price in cents
// ...
int main()
{
  int seatsA = getSeatsForSection("A", 300);
  // ...
  int incomeA = calcIncome(seatsA, SECT_A_TICKPRICE);
  // ...
}

With a little helper to display dollar amounts, you can update your showIncome function easily:

void displayIncome(int cents)
{
  std::cout << (cents / 100) << " dollars and "
            << (cents % 100) << " cents" << std::endl;
}

(Or use a string stream and return the formatted number, either like above or in xxx.yy format.)

But that's still not very good. If you need to add a new section, you need to add a bunch of code in several different places.

I'd suggest the following:

Create a struct that represents sections. It should contain the section name, total number of seats and seat price.
Build a std::vector of all your sections.
Use that to loop over all sections for input and display.

Rough sketch of what main would look like with that:

int main()
{
  std::vector<section> sections = { /* ... */ };
  int totalIncome = 0;

  for (auto const& sect : sections) {
    int seats = getSeatsForSection(sect.name, sect.maxSeats);
    int income = calcIncome(seats, sect.seatPrice);
    displayIncomeForSection(sect.name, income);
    totalIncome += income;
  }
  displayTotalIncome(totalIncome);
}

There are lots of other options possible, depending on exactly what you need to do. This is just a suggestion.


Ensuring non-expired token before every request

You could introduce a delegate instead passing another block in loadCategories method.

First, the protocol:

@protocol ASMyApiCategoriesDelegate <NSObject>

    @required
    - (void) ASMyApiCategoriesDidLoad:(NSArray *)categories;
    - (void) ASMyApiCategoriesDidFailToLoadWithError:(NSError *)error

@end

You change the signature of + [ASMyApi loadCategories:completionBlock:] to accept a delegate:

+ (void) loadCategoriesToken:(id)token delegate:(id <ASMyApiCategoriesDelegate>)delegate
{
    NSArray *categories;
    // code that loads categories

    if (categories)
    {
        [delegate ASMyApiCategoriesDidLoad:categories];
    }
    else
    {
        [delegate ASMyApiCategoriesDidFailToLoadWithError:nil];
    }
}

In your view controller you'll have to implement the required methods from ASMyApiCategoriesDelegate protocol and update loadCategories method.

- (void) ASMyApiCategoriesDelegateDidLoad:(NSArray *)categories
{
    [self.refreshControl endRefreshing];
    self.categories = categories;
    [self updateUI];
}

- (void) ASMyApiCategoriesDelegateDidFailToLoadWithError:(NSError *)error
{
    [self.refreshControl endRefreshing];
    [self monitorNetworkReachability];
}

- (IBAction) loadCategories
{
    [self.refreshControl beginRefreshing];
    [((AppDelegate *)[UIApplication sharedApplication].delegate) fetchTokenWithCompletionBlock:^(ASToken *token, NSError *error) {
        if (token)
        {
            [ASMyApi loadCategories:token.token delegate:self];
        }
        else
        {
            [self ASMyApiCategoriesDidFailToLoadWithError:nil];
        }
    }];
}


Prefer to use iterators to iterate through data structures

Look how nice your ReverseWord function becomes when you use the provided rbegin() and rend():

std::string ReverseWord(const std::string& word) {
  return std::string(word.rbegin(), word.rend());
}

Use algorithms when possible

Similarly, your finding of the spaces can be done with a simple string::find() instead.

Apart from that, the code looks reasonable. However...

High level

This is an algorithm that's traditionally implemented as an in-place transformation on a string_view (or array of chars, pre-c++17)

You definitely would want to revisit this and tackle the problem from that angle instead.

It's a bit of a "trick" question, as there is a very simple algorithm to do it, but it's not exactly obvious at first glance. That's why the question asks to reverse a word first. Once you figured out how to reverse a word in-place, the solution to "reverse the words of a phrase" becomes a bit more clear.


Here's how I'd probably do it (basically, it's the same as in the answer I linked to in the comments, I'm just adding it here for clarity)

var handlers = {
  save_data:   function (event, content, wrap) {
    // save code
  },

  cancel_data: function (event, content, wrap) {
    // cancel code
  },

  edit_data:   function (event, content, wrap) {
    // edit code
  },

  delete_date: function (event, content, wrap) {
    // delete code
  }
};

$('#container a').on('click', function (event) {
  var klass = this.className,
      content,
      wrap;

  if(typeof handlers[klass] === "function") {
    content = $(this).closest("div.Content"),
    wrap    = $(this).closest("div.content_wrap");
    handlers[klass].call(this, event, content, wrap);
  }

  // you want to always "absorb" the click event, you can
  // do so here or in the if-block above
  //   event.preventDefault();
});

You can write the handler functions just like you'd write them in your orginal code (i.e. this will refer to the right element, etc.). However, the click event handler will pass along the the content and wrap arguments, so you don't have to have code to select those elements in every handler function.

Of course, if your links have multiple classes, the className trick won't work. That's why I'd advocate (as I do in the answer I linked to) using a data-* attribute if possible.


Implementing Binary Tree using Queue in C#

As a first step, TreeImplementation can create the tree in the constructor and only keep a reference to the root node. Also the queue is only used in LevelOrder and should be moved there.

public class TreeImplementation
{
    Tree _rootNodeF;

    public TreeImplementation()
    {
        _rootNodeF = new Tree {
            Data = 'F',
            LChild = new Tree {
                Data = 'D',
                LChild = new Tree { Data = 'B' },
                RChild = new Tree { Data = 'E' }
            },
            RChild = new Tree { Data = 'J' }
        };
    }

    public void LevelOrder()
    {
        //Initialize an empty queue to use for tree traversal.
        Queue<Tree> _treeQueue = new Queue<Tree>();
        .
        .
        .
    }
}

To make sure future tree manipulations doesn't cause a bug in LevelOrder(), I'd just remove the mini-optimization of the continue statement. Also, checking if the queue has Any() elements is semantically better than checking if Count() != 0. tempNode isn't used outside the while loop and is initialized with an object that is never used. Move the declaration inside the loop instead.

LevelOrder() is actually a tree walker method. I'd rename it to ForEach() instead and pass in an Action<char> it could call instead of the hard coded method VisitedTreeNode(). The walker could then be reused easier.

Now LevelOrder() has been replaced with:

    public void ForEach(Action<char> action)
    {
        Queue<Tree> _treeQueue = new Queue<Tree>();
        _treeQueue.Enqueue(_rootNodeF);

        while (_treeQueue.Any())
        {
            var tempNode = _treeQueue.Dequeue();

            action(tempNode.Data);

            if (tempNode.LChild != null)
            {
                _treeQueue.Enqueue(tempNode.LChild);
            }

            if (tempNode.RChild != null)
            {
                _treeQueue.Enqueue(tempNode.RChild);
            }
        }
    }

.. and can be called with treeImplementation.ForEach((queueData) => Console.WriteLine(queueData));

Implementing the IEnumerable interface

It could probably be userful to manipulate Tree structures with the built in methods of C#, such as foreach() or any Linq calls. To do this, you need to implement the IEnumerable interface in Tree:

public class Tree : IEnumerable<char>
{
    public char Data { get; set; }
    public Tree LChild { get; set; }
    public Tree RChild { get; set; }

    IEnumerator IEnumerable.GetEnumerator()
    {
        return this.GetEnumerator();
    }

    public IEnumerator<char> GetEnumerator()
    {
        yield return Data;
        if (LChild != null)
        {
            foreach (var data in LChild)
            {
                yield return data;
            }
        }
        if (RChild != null)
        {
            foreach (var data in RChild)
            {
                yield return data;
            }
        }
    }
}

Of course this implementation totally makes ForEach above redundant, as it now can be replaced with:

    public void ForEach(Action<char> action)
    {
        foreach (var data in _rootNodeF)
            action(data);
    }

Generics

As a final thought, Tree is a pretty generic construct and would be a lot more useful as:

public class Tree<T> : IEnumerable<T>
{
    public T Data { get; set; }
    public Tree<T> LChild { get; set; }
    public Tree<T> RChild { get; set; }

    IEnumerator IEnumerable.GetEnumerator()
    {
        return this.GetEnumerator();
    }

    public IEnumerator<T> GetEnumerator()
    {
        yield return Data;
        if (LChild != null)
        {
            foreach (var data in LChild)
            {
                yield return data;
            }
        }
        if (RChild != null)
        {
            foreach (var data in RChild)
            {
                yield return data;
            }
        }
    }
}

Creating your specific tree is the done with

var myTree = new Tree<char>
{
    Data = 'F',
    LChild = new Tree<char>
    {
        Data = 'D',
        LChild = new Tree<char> { Data = 'B' },
        RChild = new Tree<char> { Data = 'E' }
    },
    RChild = new Tree<char> { Data = 'J' }
};

foreach(var data in myTree)
{
    Console.WriteLine(data);
}


1. Review

Normally, a class is used to implement a collection of objects with similar behaviour, and an object is used to implement some kind of persistent thing or data structure. But what kind of thing is an instance of the IsGsm class? It doesn't look as though it corresponds to any kind of thing.

What you really have here is a function (IsGsm.is_gsm) that determines if text can be encoded in GSM 03.38. It's clear that this is a function rather than a method, because it does not use its cls argument. So it would be clearer and simpler if this were a function. In Python, not everything needs to be part of a class!

See Jack Diederich's talk "Stop Writing Classes" for more about this problem.
A new ascii_gsm data structure gets built each time you call IsGsm.is_gsm, but each time the data structure is the same. It would be simpler if this were a global variable. Then it would only have to be constructed once.
The ascii_gsm data structure is poorly named: it is a mapping whose keys are Unicode code points for characters that can be encoded.
The values of the ascii_gsm data structure are always True. This is a waste of space: if you just need the keys, then Python has a set datatype.
The code in the post thinks that FORM FEED cannot be encoded:

>>> IsGSM.is_gsm('\N{FORM FEED}')
False

but according to the "Basic Character Set Extension" table in Wikipedia, FORM FEED can be encoded as the two bytes 1B 0A.
I think it would be clearer and less risky to use Python's Unicode named escapes, and write \N{ESCAPE} instead of \x1b. The former is easier to read, easier to check, and Python will raise an error if you make a typo:

>>> '\N{ESACPE}'
  File "<stdin>", line 1
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 0-9: unknown Unicode character name

With hexadecimal escapes, Python won't help you if you write \x1c by mistake for \x1b.
But can ESCAPE really be encoded as 7-bit GSM? It looks to me as though it cannot — Wikipedia says:

  Note that the second part of the table is only accessible if the GSM device supports the 7-bit extension mechanism, using the ESC character prefix. Otherwise, the ESC code itself is interpreted as a space, and the following character will be treated as if there was no leading ESC code.

So whether the device supports the extension mechanism or not, ESCAPE cannot be encoded.
It's not clear why you want to normalize \xc2. This is LATIN CAPITAL LETTER A WITH CIRCUMFLEX, and when normalized as NFKD this becomes LATIN CAPITAL LETTER A followed by COMBINING CIRCUMFLEX ACCENT. But COMBINING CIRCUMFLEX ACCENT can't be encoded as 7-bit GSM, so the normalization doesn't help. I think this needs explanation, or perhaps just removing.

2. Revised code

I think that it would make more sense here to build a codec. The idea is to write an encode function that encodes Unicode text as 7-bit GSM, using the same interface as Python's own codecs.encode. Then callers will be able to write code like this to detect text that can't be encoded, using the "strict" error handler:

try:
    gsm_encoded_bytes = encode(text, 'strict')
except UnicodeEncodeError:
    # Can't encode text as GSM

This interface also supports more graceful handling of errors, for example if the "replace" error handler is used, then the output will have 3F when a character can't be encoded:

>>> encode('abcω', 'replace')
b'abc?'

Here's a start on an implementation:

import codecs

# Name of the codec.
_NAME = 'gsm03.38'

# GSM 03.38 Basic Character Set
_BASIC_CHARACTERS = (
    "@£$¥èéùìòÇ\nØø\rÅåΔ_ΦΓΛΩΠΨΣΘΞ\N{ESCAPE}ÆæßÉ"
    " !\"#¤%&'()*+,-./0123456789:;<=>?"
    "¡ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÑÜ§"
    "¿abcdefghijklmnopqrstuvwxyzäöñüà")

# GSM 03.38 Basic Character Set Extension. Note that CR2 and SS2 are
# not Unicode characters, so don't appear in this table.
_EXTENSION_CHARACTERS = {
    '\N{FORM FEED}': 0x0A,
    '^': 0x14,
    '{': 0x28,
    '}': 0x29,
    '\\': 0x2F,
    '[': 0x3C,
    '~': 0x3D,
    ']': 0x3E,
    '|': 0x40,
    '€': 0x65,
}

# These are not in the GSM 03.38 specification but we provide them for
# convenience.
_ADDITIONAL_CHARACTERS = {
    '\N{NO-BREAK SPACE}': 0x20,
}

# Build mapping from Unicode character to GSM 03.38 encoding
_CHARMAP = {c: bytes([i]) for i, c in enumerate(_BASIC_CHARACTERS)}
del _CHARMAP['\N{ESCAPE}']
for char, encoding in _EXTENSION_CHARACTERS.items():
    _CHARMAP[char] = bytes([0x1B, encoding])
for char, encoding in _ADDITIONAL_CHARACTERS.items():
    _CHARMAP[char] = bytes([encoding])

def encode(input, errors='strict'):
    error_handler = codecs.lookup_error(errors)
    result = bytearray()
    i = 0
    while i < len(input):
        c = input[i]
        if c in _CHARMAP:
            result.extend(_CHARMAP[c])
            i += 1
        else:
            exc = UnicodeEncodeError(_NAME, input, i, i + 1, "no encoding")
            replace, i = error_handler(exc)
            for c in replace:
                result.extend(_CHARMAP[c])
    return bytes(result)

With some more work we could add a decode function that decodes 7-bit GSM as Unicode, using the same interface as Python's own codecs.decode function. Then we will be able to register our functions with the codec registry, allowing users to write code like:

try:
    gsm_encoded_bytes = text.encode('gsm03.38', 'strict')
except UnicodeEncodeError:
    # Can't encode text as GSM

But in fact there's already a GSM 03.38 codec on the Python Package Index, and it probably makes sense to use that instead of writing your own.


Simplify complex hash-table manipulations in Common Lisp

First of all, I suggest that you use a structure instead of a hash table when you know that the table will only have 3 elements; this improves both readability and performance:

(defstruct triplestore-graph
  (spo (make-hash-table))
  (pos (make-hash-table))
  (osp (make-hash-table)))
(defvar *triplestore-graph* (make-triplestore-graph))

Next, there is no puthash in Common Lisp, use (setf gethash) instead.

Finally, I would modify the code like this:

(defun triplestore-add (s p o)
  (triplestore-add-to-index (triplestore-graph-spo *triplestore-graph*) s p o)
  (triplestore-add-to-index (triplestore-graph-pos *triplestore-graph*) p o s)
  (triplestore-add-to-index (triplestore-graph-osp *triplestore-graph*) o p s)) ; o s p?!

(defun triplestore-add-to-index (index a b c)
  (let ((at (gethash a index)))
    (if at
        (pushnew c (gethash b at))
        (setf (gethash a index)
              (let ((tmp (make-hash-table)))
                (setf (gethash b tmp) (list c))
                tmp)))))


Bugs

You have several race conditions:

There is no guarantee that a worker stays joinable between these two calls.

        if (worker.joinable()) {
            worker.join();

This is a multi-threaded environment you can not assume run_task is being called from only one thread. You must assume that it can be called from any number of threads.

    {
        std::lock_guard<std::mutex> task_lock{ task_mu };
        // There is no guarantee that `current_task` stays the same
        // between here and when you create a new worker thread.
        // As soon as the scope is exited another thread can enter
        // and overwrite `current_task` before the first thread
        // pushes `work` onto the thread queue or an existing worker
        // picks it up
        current_task = std::move(task);
    }

Design

Usually thread pools are created with a fixed number of threads. Jobs are added to a queue. When a thread becomes available it pulls a job from the queue or waits on a condition variable until a job is available.

I dislike the design of adding threads. As this could spawn lots of threads when there is a sudden high workload that are never released. Threads are expensive resources to create. Also creating many threads does not mean more parallelism (it just means more swapping). A machine usually has an upper bound of available parallelism allocating more threads than this is usually counter productive).


Comparator classes supporting operations on sets

I don't know if something can be too DRY.  Too abstract perhaps.

    public function rightComplement($args = null)  {
        $complement = self::$setB

        if ($args === null)  {
            $this->iterate(self::$setA, __FUNCTION__);
        }  else  {
            unset ($complement[$args['k']][$args['k2']][$args['k3']]);
        }

PHP has closures.  You don't need this pattern.  Consider

    public function rightComplement()  {
        $complement = self::$setB;

        $this->iterate(self::$setA, function($i, $j, $k, $element) use ($complement) {
            unset($complement[$i][$j][$k]);
        });

Now rather than having two ways to call the function, one of which indirectly calls the other, there is one way.  We use the closure to provide the single element behavior instead.

I like this better than either of your choices, as it is more direct about what it does than the second.  And it is DRYer than the first version.  We call iterate with a closure that handles each element.

You don't complete the implementation for the other function, so I didn't try to duplicate it.