mysql – Match tag names with form titles

I am trying to match tag names with form titles to fetch the correct form into the current post, to subscribe to new posts tagged with the current posts tag.
I only have 1 tag assigned per post.

The code for categories works well, and I tried to transcribe it for tags, but I am afraid there are syntax errors in the code, because it does not work.

How do I write the correct code?

add_shortcode( 'subscribe-to-tag', function() {
   global $wpdb, $post;
 
$the_tag = get_the_tags( $post->ID );
$tag_name = $the_tag(0)->tag_name;
   $id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM wptq_forms WHERE name = '{$tag_name}';"));
   if (is_null($id)) { return ''; }
   return do_shortcode( '(newsletter_form id="' . intval( $id ) . '")' );
} ); 

Logic: changing quantified variable names and moving quantifiers

Let’s say I have

$$exists x (x-2=0) lor exists x (x-3=0) tag{1}$$

in the set of real numbers.

I have recently learned that I can rename one of the two $x$:

$$exists x (x-2=0) lor exists y (y-3=0) tag{2}$$

But I also know that I can start from $(1)$ and use only one $exists$:

$$exists x (x-2=0 lor x-3=0) tag{3}$$

And I also know that I can start from $(2)$ and move both $exists$ at the beginning:

$$exists x exists y (x-2=0 lor y-3=0) tag{4}$$

Based on what I know, $(1)$, $(2)$, $(3)$ and $(4)$ are alla equivalent each other. And that confuses me. For example $(2)$ is true when

  • $x=2$ and $y$ is a real number such that $y-3=0$ is false (i.e. $y ne 3$);
  • $y=3$ and $x$ is a real number such that $x-2=0$ is false (i.e. $x ne 2$);
  • $x=2$ and $y=3$.

While $(3)$ is true only in two ways:

  • with $x=2$ that makes $x-2=0$ true and $x-3=0$ false
  • with $x=3$ that makes $x-2=0$ false and $x-3=0$ true

so I miss the case where both $x-2=0$ and $x-3=0$ are true!

Also $(1)$ is true in three cases:

  • when the first $x$ is equal to $2$ and the second $x$ is not equal to $3$
  • when the first $x$ is not equal to $2$ and the second $x$ is equal to $3$
  • when the first $x$ is equal to $2$ and the second $x$ is equal to $3$

while I know for sure that $(1)$ and $(3)$ are equivalent because of the "distributive property" of $exists$ over $lor$, so how is it possible that $(1)$ is true in three cases and $(3)$ is true only in two cases? How can $(1)$ and $(3)$ be equivalent if they are not true in the same cases?

So it seems clear to me that I’m missing something, that I don’t understand something. What am I doing wrong? What formulas are equivalent and what are not equivalent? And why?

Thanks

mysql – Storing sports teams with multiple alternative names

I am designing a MySQL database to store some football match results and statistics in.

The data for pupulating the DB will be scraped from multiple sources and the names of the teams will be slightly different on each website (some have old names used before the team was rebranded and changed it’s name completely, some will have abbreviations such as United, Utd, some will have FC in the name, some won’t, othe sources will have the names in a language different than English.

I’m wondering what would be the best way to store that data.

My thinking is to use the TeamID in the main table and have an extra table as a dictionary for translating multiple variants of the team name into the ID. Ofc it would be quite a hassle to populate such a “dictionary” haha.

Example

TeamID | TeamName
-----------------------------
1      | Manchester United
1      | Man Utd
1      | MUFC
2      | PSG
2      | Paris Saint-Germain

This is actually a big problem with south american clubs, where one club can have 5 completely different names in various sources and it’s not as easy as shortening United to Utd or abbreviating the name.

So I’ll have script scrape the name of a team, find it in the “dictionary” table, then write all the statistics and info into the main table using just the TeamID, that should also save some memory.

Please let me know if that’s a good solution and if have some different approaches for me =)

sharepoint online – How to change the column names of a hashtable before it gets exported to Excel?

You can add aliases to your PSObject.

For example, if you want to rename OLDName to NewName, you can use the following code:

$hashTable | Add-Member -MemberType AliasProperty -Name NewName -Value OLDName -PassThru | Select-Object Title2

If you need to select multiple columns or aliases:

... | Select-Object ColumnA, ColumnB, Alias2

Demo

enter image description here

Update

Based on your comments, this is the code you want to use right before you export your array of custom objects to Excel:

$hashTable = $hashTable | Add-Member -MemberType AliasProperty -Name "00:00" -Value Before -PassThru `
| Add-Member -MemberType AliasProperty -Name "06:30" -Value "between" -PassThru `
| Add-Member -MemberType AliasProperty -Name "14:30" -Value "after" -PassThru `
| Select-Object "Datum","00:00", "06:30",  "14:30","Opmerkingen"

$hashtable | Export-XLSX $outputFilePath -Table -Autofit -Force

will brainstorm brand names business names domains and product names for $10

will brainstorm brand names business names domains and product names

Do you want to create an SEO-friendly unique brand name for your business and skyrocket sales?

Then You’ve come to the right place.

Naming your startup businesses can be challenging and time-consuming. that’s where I come in as a professional creative business name designer.

WHY THIS SERVICE???????

Here, I will deliver only the names available with the exact domain you choose at your preference.

Not just a domain & trademark availability search as in other servics

My Names Wil Be

  • Brandable
  • Linguistically Clean
  • Easy to Remember
  • 3-5 Syllables.
  • Easy to Pronounce
  • Unique
  • Legally Safe
  • The exact domain will be available

Why me?

  • 2100+ local & International projects completed
  • Experience of more than 10 years.
  • A better understanding of the market and competitors.

Please check gig extras for logos, slogans & other additional services

NOTE: All of my ideas are 100% original and brainstormed. it’s a time-consuming process. So I am unable to deliver even in 5-6 hours. I will be needing 24 hours minimum.

Feel free to contact me before ordering for custom offers!

I will do proper research and create something totally unique so I assure you that it will be worth it.

.

How to rename multiple uniquely name directories on a mapped drive with unique names in a batch file

I have a mapped drive with multiple uniquely named folders containing files. I want to rename each folder with a batch file.

V:MediaElton JohnSingles>dir
 Volume in drive V is DATA3
 Volume Serial Number is 50CF-6A6E

 Directory of V:MediaElton JohnSingles

2021-04-17  05:16 AM    <DIR>          .
2020-09-22  10:14 AM    <DIR>          ..
2021-04-09  06:47 AM    <DIR>          1969-01 Lady Samantha - All Across The Heavens (7'', Philips BF 1739)
2021-04-09  07:36 AM    <DIR>          1970-07 Border Song - Bad Side Of The Moon (7'', UNI 55246)
2021-04-09  06:50 AM    <DIR>          1970-08 Rock And Roll Madonna - Grey Seal (7'', Supreme S. 147)
.
.
.

I want to rename each uniquely named directory with a unique name – examples:

1969-01 Lady Samantha - All Across The Heavens (7'', Philips BF 1739)"
1970-07 Border Song - Bad Side Of The Moon (7'', UNI 55246)
1970-08 Rock And Roll Madonna - Grey Seal (7'', Supreme S. 147)

I created a batch file – the pauses are so I can abort the batch file if there are problems:

ren "1969 - Lady Samantha. All Across The Heavens (7'', Philips BF1739)" "1969-01 Lady Samantha - All Across The Heavens (7'', Philips BF 1739)"
PAUSE
ren "1971 - Border Song. Bad Side Of The Moon (7'', UNI 55246)" "1970-07 Border Song - Bad Side Of The Moon (7'', UNI 55246)"
PAUSE
ren "1970 - Rock'n'Roll Madonna. Grey Seal (7'', Supreme DJS 222)" "1970-08 Rock And Roll Madonna - Grey Seal (7'', Supreme S. 147)"

I ran it and got:

C:WINDOWSsystem32>cd V:MediaElton JohnSingles

C:WINDOWSsystem32>V:

V:MediaElton JohnSingles>C:UsersMarcDesktopEJSingles.bat

V:MediaElton JohnSingles>ren "1969 - Lady Samantha. All Across The Heavens (7'', Philips BF1739)" "1969-01 Lady Samantha - All Across The Heavens (7'', Philips BF 1739)"
The system cannot find the file specified.

V:MediaElton JohnSingles>PAUSE
Press any key to continue . . .

V:MediaElton JohnSingles>ren "1971 - Border Song. Bad Side Of The Moon (7'', UNI 55246)" "1970-07 Border Song - Bad Side Of The Moon (7'', UNI 55246)"
The system cannot find the file specified.

V:MediaElton JohnSingles>PAUSE
Press any key to continue . . .

V:MediaElton JohnSingles>ren "1970 - Rock'n'Roll Madonna. Grey Seal (7'', Supreme DJS 222)" "1970-08 Rock And Roll Madonna - Grey Seal (7'', Supreme S. 147)"
The system cannot find the file specified.

V:MediaElton JohnSingles>

I stripped out the quotes and got:

V:MediaElton JohnSingles>C:UsersMarcDesktopEJSingles.bat

V:MediaElton JohnSingles>ren 1969 - Lady Samantha. All Across The Heavens (7'', Philips BF1739) 1969-01 Lady Samantha - All Across The Heavens (7'', Philips BF 1739)
The syntax of the command is incorrect.

V:MediaElton JohnSingles>PAUSE
Press any key to continue . . .

V:MediaElton JohnSingles>ren 1971 - Border Song. Bad Side Of The Moon (7'', UNI 55246) 1970-07 Border Song - Bad Side Of The Moon (7'', UNI 55246)
The syntax of the command is incorrect.

V:MediaElton JohnSingles>PAUSE
Press any key to continue . . .

V:MediaElton JohnSingles>ren 1970 - Rock'n'Roll Madonna. Grey Seal (7'', Supreme DJS 222) 1970-08 Rock And Roll Madonna - Grey Seal (7'', Supreme S. 147)
The syntax of the command is incorrect.

V:MediaElton JohnSingles>

I added the complete path to the batch file:

ren "V:MediaElton JohnSingles1969 - Lady Samantha. All Across The Heavens (7'', Philips BF1739)" "V:MediaElton JohnSingles1969-01 Lady Samantha - All Across The Heavens (7'', Philips BF 1739)"
PAUSE
ren "V:MediaElton JohnSingles1970 - Take Me To The Pilot. Your Song (7'', UNI 55265)" "V:MediaElton JohnSingles1970-10 Take Me To The Pilot - Your Song (7'', UNI 55265)"
PAUSE
ren "V:MediaElton JohnSingles1970 - Rock'n'Roll Madonna. Grey Seal (7'', Supreme DJS 222)" "V:MediaElton JohnSingles1970-08 Rock And Roll Madonna - Grey Seal (7'', Supreme S. 147)"

I got:

V:MediaElton JohnSingles>C:UsersMarcDesktopEJSingles.bat

V:MediaElton JohnSingles>ren "V:MediaElton JohnSingles1969 - Lady Samantha. All Across The Heavens (7'', Philips BF1739)" "V:MediaElton JohnSingles1969-01 Lady Samantha - All Across The Heavens (7'', Philips BF 1739)"
The system cannot find the file specified.

V:MediaElton JohnSingles>PAUSE
Press any key to continue . . .

V:MediaElton JohnSingles>ren "V:MediaElton JohnSingles1970 - Take Me To The Pilot. Your Song (7'', UNI 55265)" "V:MediaElton JohnSingles1970-10 Take Me To The Pilot - Your Song (7'', UNI 55265)"
The system cannot find the file specified.

V:MediaElton JohnSingles>PAUSE
Press any key to continue . . .

V:MediaElton JohnSingles>ren "V:MediaElton JohnSingles1970 - Rock'n'Roll Madonna. Grey Seal (7'', Supreme DJS 222)" "V:MediaElton JohnSingles1970-08 Rock And Roll Madonna - Grey Seal (7'', Supreme S. 147)"
The system cannot find the file specified.

V:MediaElton JohnSingles>

Lastly I tried using the complete path without quotes:

V:MediaElton JohnSingles>C:UsersMarcDesktopEJSingles.bat

V:MediaElton JohnSingles>ren V:MediaElton JohnSingles1969 - Lady Samantha. All Across The Heavens (7'', Philips BF1739) V:MediaElton JohnSingles1969-01 Lady Samantha - All Across The Heavens (7'', Philips BF 1739)
The syntax of the command is incorrect.

V:MediaElton JohnSingles>PAUSE
Press any key to continue . . .

V:MediaElton JohnSingles>ren V:MediaElton JohnSingles1970 - Take Me To The Pilot. Your Song (7'', UNI 55265) V:MediaElton JohnSingles1970-10 Take Me To The Pilot - Your Song (7'', UNI 55265)
The syntax of the command is incorrect.

V:MediaElton JohnSingles>PAUSE
Press any key to continue . . .

V:MediaElton JohnSingles>ren V:MediaElton JohnSingles1970 - Rock'n'Roll Madonna. Grey Seal (7'', Supreme DJS 222) V:MediaElton JohnSingles1970-08 Rock And Roll Madonna - Grey Seal (7'', Supreme S. 147)
The syntax of the command is incorrect.

V:MediaElton JohnSingles>

I’m using Notepad to write the batch file – Word Wrap IS NOT on.

I’m probably forgetting something simple. Any help is appreciated.

Have user type file they want to have read C++ & appending file names

Disclosure: I am a student right now, so if you see any bad habits in my code, feel free to point them out. I have questions about both the ofstream and ifstream portions of my code.

In the ofstream, the user can create their own shopping list and name it (which will end up being the file name). Once their list is created, the file will save with the data.

Here my question: How do I let the user determine the file type of a file they name? Here is my current code for it:

void createList(double price(100), double quantity(100), string item(100), double tax, int list_size) {
    ofstream saved_list;
    string listname;
    string fileApplicator = ".txt";

    cout << "What would you like to save this list as?: ";
    getline(cin, listname.append(fileApplicator));
    saved_list.open(listname.c_str());

As for the ofstream part of my code, I want the user to be able to select which file they want read based on the name of the file.

Here’s my question: When I run the code, the file fails to open every time. I have a current file saved as safeway.txt but it will not open when I attempt it. Here is the code for it:

void reviewList(void) {
    ifstream saved_list;
    string listname;
    string fileApplicator = ".txt";
    char viewAnother = 'Y';
    do {
        cout << "Which list would like to open: ";
        getline(cin, listname.append(fileApplicator));
        saved_list.open(listname.c_str());
        if (saved_list.is_open()) {

......//other code
            }
            cout << "Would you like to view a different list (Y/N): ";
            cin >> viewAnother;
            viewAnother = toupper(viewAnother);
            if (viewAnother == 'N')
                break;
        }
        else {
            cout << "List not found. Please try again.n";

        }
    } while (viewAnother == 'Y');
}

I appreciate any and all help! This is my first question on this forum so hopefully I don’t get banned from asking already.

python – What’s the future for abbreviations names in libraries?

When writing a library, we encounter a dilemma in naming functions, the function names need to follow naming conventions. Recently, I encountered python panda library (released 2008), and I needed to use iloc() and loc() functions. However, those two functions made me look up for their documentations unnecessarily. In fact, I wouldn’t have looked it up if they were named properly, location() and indexLocation() for examples. Panda library is not as old as c standard library, I can’t find excuse for it to be honest. Are name abbreviations going to continue?