Math Genius: Set Theory and Monotonicity | Proof Explanation

Original Source Link

I’ve been having a bit of trouble on the last exercise found in Enderton’s Element’s of Set Theory about the section on functions. Even after examining a proof I found online, I don’t fully understand the proof, and I feel utterly lost in how I would construct the proof myself. As such, I would greatly appreciate any help in allowing me to understand this problem.

The exercise states:

Assume that $F: mathscr{P} A rightarrow mathscr{P} A$ and that $F$ has the monotonicity property: $$X subseteq Y subseteq A Leftrightarrow F(X) subseteq F(Y).$$ Define $$B = bigcap {X subseteq A mid F(X) subseteq X }$$ $$C = bigcup { X subseteq A mid X subseteq F(X) }$$

(a) Show that $F(B) = B$ and $F(C) = C$.

(b) Show that if $F(X) = X$, then $B subseteq X subseteq C$.

In the proof I found online, it stated that for $X subseteq A$, $$F(B) = F left( bigcaplimits_{F(x) subseteq X } Xright) subseteq bigcaplimits_{F(x) subseteq X } F(X) subseteq bigcaplimits_{F(x) subseteq X } X = B.$$ This step makes sense to me because it fits with a theorem found earlier in the book. It is the next step that confuses me. The author continues by saying that because $F(B) subseteq B$, by the monotonicity property, $F(F(B)) subseteq F(B)$ and $B subseteq F(B)$. It is primarily this very last step that confuses me. Why is it that $F(F(B)) subseteq F(B)$ implies $B subseteq F(B)$?

For showing $F(C) = C$, the author uses a very similar argument with indexed sets, but with unions and with concluding that $C subseteq F(C)$ The problem is that she makes the same conclusion that $F(C) subseteq C$ follows from $F(C) subseteq F(F(C))$.

This is my main problem that I need to solve. Why is this the case? How might I prove it? I also would like some advice on how to improve my proof-writing skills. I am able to do almost all the exercises and proofs in the book on my own, but these more tricky and nuanced proofs still seem difficult and impossible without help. My proofs are also a bit messy and convoluted. If you have any more general advice about that, I would also greatly appreciate it. I’m self-studying this material as my first advanced mathematics course, and so I’m still a novice.Please forgive me if my questions are trivial.

If you would like to see the full proof, the problem is exercise 3.30 in this solution’s manual.

By definition, $B$ is the intersection of all subsets $X$ such that $F(X)subseteq X$. The intersection of a collection of sets is contained in each member of that collection, namely is the largest set which is contained in each member of the collection. Since $F(B)$ is in the collection, because $F(F(B))subseteq F(B)$, then $B$ must be a subset of $F(B)$.

Similarly for the union. The union of a collection of sets contains each element of the collection, namely is the smallest set with that property. If the collection is given by all sets with the property that their image under $F$ contains them, then $F(C)$ enjoys that property, hence $F(C)$ must be contained in the union of all sets enjoying that property, and that union is defined to be $C$.

Tagged : /

Code Bug Fix: Override the WooCommerce function to extend category list design

Original Source Link

I have done a change in the class-wc-product-cat-list-walker.php file and following is the changes in the code

public function start_el( &$output, $cat, $depth = 0, $args = array(), $current_object_id = 0 ) {
    $cat_id = intval( $cat->term_id );

    $output .= '<li class="cat-item cat-item-' . $cat_id;

    if ( $args['current_category'] === $cat_id ) {
        $output .= ' current-cat';

    if ( $args['has_children'] && $args['hierarchical'] && ( empty( $args['max_depth'] ) || $args['max_depth'] > $depth + 1 ) ) {
        $output .= ' cat-parent';

    if ( $args['current_category_ancestors'] && $args['current_category'] && in_array( $cat_id, $args['current_category_ancestors'], true ) ) {
        $output .= ' current-cat-parent';
    $pageurl = wp_get_referer(); 
    $template = basename($pageurl);
    $post_id = get_the_ID();
    $catpage = get_field( 'catelog_page', $post_id );
    $catalogpage = 'no';
    if (isset($_GET['catalog'])) {
        $catalogpage = 'yes';
    if (  $catpage == TRUE || $catalogpage=='yes' ) {
        $output .= '"><a href="' . get_term_link( $cat_id, $this->tree_type ) . '?catalog=true">' . apply_filters( 'list_product_cats', $cat->name, $cat ) . '</a>';
    else {
        $output .= '"><a href="' . get_term_link( $cat_id, $this->tree_type ) . '">' . apply_filters( 'list_product_cats', $cat->name, $cat ) . '</a>';

    if ( $args['show_count'] ) {
        $output .= ' <span class="count">(' . $cat->count . ')</span>';

I want to keep it in the child theme and make it functional. Is there any way? I have tried to copy the file and paste it in the child theme WooCommerce folder. but it is not working.

please help me to know the way to change it. Thanks in advance.

Tagged : / / / /

Server Bug Fix: How do I crack a double encrypted Hash

Original Source Link

I created a hash which is encrypted like this: $What_i_made=BCrypt(MD5(Plain Text Password)) and I wonder if it can be cracked. Currently, I thought of two ways:

  1. Brute force $What_i_made to get the MD5 Hash then do a dictionary attack on the MD5 Hash. However, this will take ages as Bcrypt is so slow and a MD5 is 32 characters long.
  2. $result=Bcrypt(MD5(random combination)) and compare $resultto $What_i_madeuntil they match. This will be much faster, but I am not really sure how to do this. I tried John and Hashcat but I am not really sure how you can do this with them, so I am turning to the community for help. Thanks. 🙂

BTW, any other tools that work will also do and I would prefer a method which allows for trying every single combinations instead of dictionary attaks.

As a password cracker, I encourage all of my targets to use this technique. 😉

It seems like a good idea, but it turns out that against real-world attacks, wrapping an unsalted hash with bcrypt is demonstrably weaker than simply using bcrypt.

This is because attackers can do this:

  1. Acquire existing MD5 passwords – even ones that haven’t been cracked yet
  2. Run these MD5s as a wordlist against your bcrypt(md5($pass)) corpus, to identify bcrypts with known MD5s
  3. crack the MD5s outside of bcrypt at much higher speed

In other words, in many cases you can simply crack the inner hash first. And for a fast hash like MD5, that means that for any password that can be cracked first, bcrypt’s resistance to brute-force attack is dramatically weakened.

(I can’t take credit for the technique, but it’s very effective – especially when users reuse passwords across multiple sites, and the attacker has access to leaked password data.)

Here’s a more specific, single-user scenario:

  • User [email protected] has an account on Site B that uses bcrypt(md5($pass))
  • Site B is compromised, and its password-hash lists is leaked online
  • Attacker acquires the Site B leak
  • Attacker does a fast run against the Site B dump and determines from testing that the site is using bcrypt(md5($pass))
  • Attacker first checks to see if any other known leaks in their collection contain [email protected]
  • If so, and any of those other leaks use MD5, Attacker simply tries [email protected]’s other MD5s to see if Jo was reusing her password, and it’s the one “inside” the bcrypt
  • If Jo’s MD5 is inside that bcrypt, Attacker can now attack that MD5 at massive speeds until they find a crack. Attacker now knows [email protected]’s original password on Site B

Now, imagine that Attacker wants to attack all 100,000 bcrypt hashes on Site B … but Attacker also has access to thousands of other leaks:

  • Attacker writes a script to check all MD5 leaks for email addresses that match Site B
  • Attacker first tries the user-specific MD5s against each specific user’s bcrypt from Site B. (This is a “correlation attack”). Attacker quickly cracks about 20% (which also removes their salts from the overall attack, increasing attack speed for the remaining hashes)
  • Attacker next tries other known MD5s from common passwords, and similarly removes those bcrypts from the attack
  • Attacker then tries other unknown MD5s from those leaks. If they find one, they can then attack those MD5 as direct MD5s (without involving bcrypt at all)

And yes, the attack can also be done directly – either by MD5’ing the candidate passwords yourself, or using a tool that natively supports bcrypt(md5($pass)), such as MDXfind:

$ echo "password" | tee bcrypt-md5.dict 

$ echo -n 'password' | md5sum | awk '{print $1}'

$ htpasswd -bnBC 10 "" 5f4dcc3b5aa765d61d8327deb882cf99 | tr -d ':n' | tee bcrypt-md5.hash; echo 

$ mdxfind -h '^BCRYPTMD5$' -f bcrypt-md5.hash bcrypt-md5.dict 
Working on hash types: BCRYPTMD5 
Took 0.00 seconds to read hashes
Searching through 0 unique hashes from bcrypt-md5.hash
Searching through 1 unique BCRYPT hashes
Maximum hash chain depth is 0
Minimum hash length is 512 characters
Using 4 cores
BCRYPTMD5 $2y$10$JUbSRB0GQv.yKorqYdBaqeVYLtbZ/sRXdbPWt6u/6R3tqbaWTlQyW:password

Done - 1 threads caught
1 lines processed in 0 seconds
1.00 lines per second
0.07 seconds hashing, 2 total hash calculations
0.00M hashes per second (approx)
1 total files
1 BCRYPTMD5x01 hashes found
1 Total hashes found

Unfortunately (for the attacker 😉 ), it looks like John the Ripper “jumbo” edition doesn’t support this algorithm using its dynamic syntax:

$ john --format=dynamic='bcrypt(md5($pass))' --test
Error: dynamic hash must start with md4/md5/sha1 and NOT a *_raw version. This expression one does not

But for a focused attacker, it’s much more efficient to simply dig out those MD5s from your hashes, and then attack those MD5s at speeds of billions of candidates per second on GPU.

If you want to do something like this – for example, to work around bcrypt’s 72-character maximum – use a per-plain salt, a site-wide pepper, or true encryption in the MD5 step.

This composite hash has no benefit over plain bcrypt. It could be marginally weaker due to MD5 collisions, but I don’t think one could actually exploit it to make this attack faster. Anyway, there’s no reason to pre-hash passwords with MD5. Now, to the actual answer.

You approach #2 won’t work because bcrypt uses integrated random salts. Hashing the same input twice will produce two different hashes because different salts will be generated.

The result of bcrypt is actually a data structure containing actual hash and salt. To verify if a password is correct, you have to extract original salt from original hash structure and use it to hash the password to be verified. If the resulting hash matches the original, the password is valid. This feature is usually provided by bcrypt implementations.

If you’re going to perform a dictionary attack, simply pre-hash all entries in your dictionary with MD5 and then run a bcrypt dictionary attack with the dictionary of MD5s. Reversing MD5s for successfully cracked passwords will be very easy and I’m leaving it for you to figure out.

A basic brute-force attack where all combinations are tested is impractical against bcrypt and MD5 is irrelevant.

Tagged : / / / /

Making Game: Trying to access a router inside a WAN

Original Source Link

I am running a clinic inside another office building.
It is a very small clinic and we have our own LAN for just 2 people, but approx. 10 devices.
The router is a NightHawk 10, where I have all ports open to a mac mini running macos server.
I have a NAS connected through the mac mini and also directly to our LAN’s router.
I can access the NAS remotely but only through the app for the NAS and only on the port the NAS used, not the mac mini, which is what we want (the mac mini using macos to control priveledges and directories).
I can access the router remotely but only through its app.
I cannot access the mac mini macos server no matter what I try.
The building is using a WAN that we connect to through a ethernet port and the IT say they have opened all ports for us.
The router is configured using DMZ to the mac mini and also the NAS; but I cannot connect to either.
The mac mini shows a green light for that it can be reached, but for some reason I cannot come into it.
The IT here works for the building and although they assure me that the ports are all open to my LAN, they also act like they could care less that I cannot seem to access it from the internet (on a train or even at home). I am not permitted to bring in another IT person, as the building is ultra protective of their network and that is fine enough, but I need to figure out how to do this.
I would appreciate any help or suggestions as this is a HUGE problem for me.

Tagged : / / /

Math Genius: Is bounded finite set theory equivalent to bounded arithmetic?

Original Source Link

Bounded finite set theory is:

Extensionality + $Delta_0$-Separation + Adjunction?

Where Adjunction is: $forall x forall y (x cup {y} text { exists})$

Would this theory be equivalent to bounded arithmetic?

Tagged : / / /

Server Bug Fix: How can I indicate time passing?

Original Source Link

There is a scene in which my main character is hiding from the villain while they are both in the same room. I want this to be a suspenseful and agonizing stretch of time, but I’m not sure how to show how long it feels for the character without it becoming boring or using cliche phrases like “every second felt like an hour.”

What does the time spend hiding do to your character? Pick things that start off easy to manage, but becomes hard to maintain (especially under stress or pressure), and talk about those. For example, if they are squeezed into a wardrobe, staying as still as possible:

As the villain paced the room, she shivered in her hiding spot. Every time he walked out of view of the thin gap between the doors, her heart jumped with the fear that he would approach the wardrobe, fling it wide open, and catch her. The effort to keep her breathing slow and quiet began to feel like Sisyphus pushing a boulder uphill, straining to keep it from rolling back down, picking up speed and sound on its way to the bottom in a crushing defeat.

Her arms and legs started to tremble, the exertion of staying in one place for so long gradually building up in a slow burn, the urge to move, to scratch, to do anything but stay safely hidden growing with every passing moment. The beating of the blood in her veins seemed to boom out, and she was sure he would hear it, the agonising torment of “what if”s playing through her mind in an unending saga of paranoia.

And then, mercifully, he left. At first, she remained frozen – almost expecting him to burst back in the moment she moved. Gradually, she let out a long, deep breath, tension draining from her frame as she slid down the wall and sank to the floor with a faint scrawp of cloth on wood. That was close.

One possibility is to just say that time has passed. “The two men sat staring at each other, neither saying a word, for fifteen minutes.”

Another possibility is to fill the time with action. If the point is that it was a tense standoff, “action” here probably doesn’t mean people running and fighting, but events appropriate to the situation. “Bob locked the door behind him. He leaned against the wall and breathed heavily, trying to catch his breath. He listened carefully for signs of pursuit. He strained to hear any sound coming from outside. All he could hear were the noises of traffic in the street. At one point he heard a voice. He was afraid that it was THEM in the hall, but as he strained to make out the words he realized it was just two people talking about being late for some social event.” Etc.

My favorite way to pass time to to make the characters get lost in their thoughts.

What was that? A floorboard creeking? It must just be a mouse. At least Jim hoped it was. It wasn’t supposed to end this way… ever since he sold the doughnuts to Sally, she had begun to suspect that they were running an underground operation.


How could he have known that such a simple action would end up betraying them? But it was too late to be filled with regret now.

Continue along these lines for several paragraphs.

Think about what your characters are doing during the long periods of hiding. Are they thinking? Playing cards? Planning their escape?

Show the reader how slow time is passing.

Another way is to make the characters confused about the passing of time.

Everything was quiet. Was it safe to come out? Jim cracked the door open. Light from the opposing window flooded the closet.

How could it still be daylight?

Jim closed the door again and continued to wait for night to fall.

There are some great answers to this question already. I could see many scenarios where one could use a mix of the suggestions in the answers.

Another idea is to use visual cues, such as sunlight, to suggest that time has passed;

Tom pulled the door from inside the cabinet, leaving it just open
enough to see the table in the room across the hall, where the
sunlight beamed in and bathed the wooden tabletop in a deep amber

[Insert character’s thoughts here like in the other answers]

Tom took his hand from his mouth and drew what felt like the first
natural breath in hours. He peeked through the opening and once again
saw the wooden table in the room across the hall. He could tell that
the room was still lit from the daylight, but the sunlight no longer
hit any part of the table directly.

How long had he been hiding in the closet?

A similar observation could be made about the sun going down or no longer shining into the cabinet, the streets falling quiet post-rush-hour, the construction worker’s radio no longer playing, his watch beeping to remind him of taking his insulin, the battery of ___ running out, etc.

Use the knowledge of your character(s) to find something that makes sense for that character to notice and experience.

Is your villain searching for the main character? Or is it a standoff? You could perhaps briefly elaborate on what the villain is doing in the room and how the main character (if hidden) can see the villain’s every move. Possibly explain what the main character is going through at that moment(elevated heart rate, sweaty palms, fast breaths, and so on) or what the main character is doing if the villain is close to discovering the main character’s hideout. This should, in my opinion, give a sense of extended time to the reader while keeping them occupied in the storyline.

1: “Every second was one second too much.”
2: “Every second was passed in agony.”

The MC glanced at his watch/mobile phone. A whole hour had passed already and he was beginning to get …

Tagged : / /

Server Bug Fix: IP Route: Prioritize one default route over the other by default

Original Source Link

I’m doing a lot of spooky networking shenanigans at work lately, and it’s really messing with the routing on my laptop. Sometimes, it’ll just decide that my default route now leads into the dev box and will flat out refuse to use my wireless connection to search google.

Naturally, I figured this was a routing issue, and popped off an ip route show which gave back this:

default via dev eth0 proto static metric 20100 
default via dev wlp1s1 proto dhcp metric 20600 

The .9net is the one connected to the internet. As you can see, that one is not at the top of the list. How can I tell my machine to use that route over the other one, connected to my dev box?

Tagged : / / / /

Math Genius: Proof of Fundamental Theorem for line integrals

Original Source Link


I’ve been looking into the proof of Fundamental Theorem for line integrals in Multivariable Calculus course officially provided by MIT(18.02sc).
And the question is that at the final step, I could not follow how the transition in the proof below happening at the part below
$$int^{t_1}_{t_0} frac{d}{dt} f(x(t), y(t)) dt = f(x(t), y(t)) rvert^{t_1}_{t_0}

Theorem Fundamental Theorem for line integrals

If $mathbf{F} = mathbf{nabla} f$ is a gradient field of $f$ and $C$ is any curve with endpoints
$P_0 = (x_0, y_0)$ and $P_1 = (x_1, y_1)$ then
int_C mathbf{F} cdot d mathbf{r} = f(x, y) rvert^{P_1}_{P_0} = f(x_1, y_1) – f(x_0, y_0)

Proof: Theorem Fundamental Theorem for line integrals

int_C mathbf{F} cdot d mathbf{r} = int_C f_x dx + f_y dy = int^{t_1}_{t_0} Big[ f_x(x(t), y(t)) frac{dx}{dt} + f_y(x(t), y(t)) frac{dy}{dt} Big] dt = int^{t_1}_{t_0} Big[ frac{d}{dx} f(x(t), y(t)) frac{dx}{dt} + frac{d}{dy} f(x(t), y(t)) frac{dy}{dt} Big] dt = int^{t_1}_{t_0} frac{d}{dt} f(x(t), y(t)) dt = f(x(t), y(t)) rvert^{t_1}_{t_0} = f(P_1) – f(P_0)

Let $F(t):= f(x(t), y(t)),$ then

$$int^{t_1}_{t_0} frac{d}{dt} f(x(t), y(t)) dt= int^{t_1}_{t_0}F'(t) dt = F(t_1)-F(t_0).$$

Tagged : /

Code Bug Fix: Search for users that haven’t been fetch yet

Original Source Link

I have a quick question, I build a block of code that fetches all the users in the database for searching purposes. Preparing for thousands of users in the future, I programmed the method in a pagination way fetching a certain amount of users at a time. That is where the problem lies when I search for a user if the user hasn’t been retrieve from the database yet through scrolling I can’t search there profile. Does anyone have a suggestion on how I can tackle this?

Here is the code I use to fetch the users:

//create a method that will fetch a certain mount of users

    func fetchUsers() {

        if userCurrentKey == nil {
            USER_REF.queryLimited(toLast: 21).observeSingleEvent(of: .value) { (snapshot) in
                guard let first = snapshot.children.allObjects.first as? DataSnapshot else { return }
                guard let allObjects = snapshot.children.allObjects as? [DataSnapshot] else { return }

                allObjects.forEach({ (snapshot) in
                    let uid = snapshot.key
                    Database.fetchUser(with: uid, completion: { (user) in
                self.userCurrentKey = first.key
        } else {
            USER_REF.queryOrderedByKey().queryEnding(atValue: userCurrentKey).queryLimited(toLast: 22).observeSingleEvent(of: .value, with: { (snapshot) in

                guard let first = snapshot.children.allObjects.first as? DataSnapshot else { return }
                guard let allObjects = snapshot.children.allObjects as? [DataSnapshot] else { return }

                allObjects.forEach({ (snapshot) in
                    let uid = snapshot.key
                    if uid != self.userCurrentKey {
                        Database.fetchUser(with: uid, completion: { (user) in
                self.userCurrentKey = first.key

Here is the code I used to paginate the users:
//once the users pass a certain amount of cells paginate to fetch the next set of users

override func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
   if users.count > 20 {
        if indexPath.item == users.count - 1 {

Lastly here is the code I used to filter through the users:

func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {
        if searchText.isEmpty{
            //if search text is empty fetch the users but display nothing
            inSearchMode = false
            filteredUsers = users
            self.collectionView?.refreshControl = refreshController
        } else {
            //if search text is not empty search for the users
            inSearchMode = true
            self.collectionView?.refreshControl = nil
            filteredUsers = self.users.filter { (user) -> Bool in
                return user.username.lowercased().contains(searchText.lowercased())
        //reload the table view data to update the displayed user

Thank you in advance!

The up front issue is you should not be in a situation where you have to load all users to search through them.

If you have a lot of data in the users node, loading that much data can overwhelm the device and secondly it’s going to get very laggy for the user as the loaded data is iterated over.

Your best move is to denormalize your data and let the server do the heavy lifting by performing those queries and delivering only the data you need. Way faster and much easier to maintain. You can also add additional nodes to get to the data you want.

Looking at the code (I don’t know your structure) it appears your goal is to have a searchfield where the users can type a username and the goal is to query for that username and return it lowercased.

A solution is to update your Firebase structure. Suppose it’s like this

      userName: "MyCrazyUserNAME"

if you want to search, lowercased, add another node to your structure that’s a lowercased version of the name

      userName: "MyCrazyUserNAME"
      lowerCased: "mycrazyusername"

Then, perform a partial string query on the lowerCased node as the user types

func searchFor(thisPartialString: String) {
   let userRef = self.ref.child("users")
   let startString = thePartialString
   let endString = thisPartialString + "\uf8ff"
   let query = ref.queryOrdered(byChild: "lowerCased")
                        .queryStarting(atValue: startString)
                        .queryEnding(atValue: endString")

The “uf8ff” is a character at a very high code level in Unicode – because of that it encompasses all of the preceeding characters.

Tagged : / / /