Magento2 removes index.php from the frontend URL

I have a Magento2-based website and try to remove the index.php from the URL. I have activated mod_rewrite on the server and also enabled it via the Magento admin panel.

In my virtual host file on the Apache2 server I have the following


    # The ServerName directive sets the request scheme, hostname and port that
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.
    ServerName testsite.islandtrinketz.com

    ServerAdmin ****@gmail.com
    DocumentRoot /var/www/i******.com

    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #LogLevel info ssl:warn

    
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    

    ErrorLog ${APACHE_LOG_DIR}/****_error.log
    CustomLog ${APACHE_LOG_DIR}/****_access.log combined

    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf

I also ran the following command in ssh and he says it is activated

sudo a2enmod rewrite

So I'm not sure why calling a website only loads a page when I manually paste index.php into the URL.

java – Removes a value from the set of objects

The title is not as descriptive as I hope. I will explain the problem in more detail here. If it helps, this question refers to a simple sudoku game.

Suppose we have a 2D array with one size size contain some objects.
The object contains a value and a set of possible values ​​that the value of this object can inherit.

For example, suppose the grid is already filled and meets the initial conditions of a sudoku game (for example, no two rows or two columns can contain the same value). Now we have to set the possible values ​​for each object.

Here I come across the problem. My approach is as follows:

  1. Scroll through the grid and determine the object value (row, column).
  2. Save this value in a variable. Let's call it value,
  3. Remove the value from each collection with the same column number and each collection with the same row number.

When I try to print the entire object set, an empty sentence is returned.
When trying to debug this code, I realized that, for some reason, values ​​are being removed from all objects, not just objects with the same row and column.

Below is the code.


public class Cell{
    public int value;
    public Set possible;

    public Cell(int value, Set possible){
        value = value;
        possible = new HashSet<>();
    }
}

// In main class.

int size = 4;
Cell()() grid = new Cell(size)(size);

// Assume loop is here and has filled with grid to pass the initial conditions of Sudoku.

// Loop to remove value from possible values of all object's with the same row and
// all the object's with the same column.

for(int row = 0; row < size; row++){
                for(int col = 0; col < size; col++){

                    value = grid(row)(col).value;

                    // This loop starts at the specified row or column and removes value from 
                    // all sets with the same row and all sets with the same column.
                    for(int index = 0; index < size; index++){
                        grid(row)(index).possible.remove(value);
                        grid(index)(col).possible.remove(value);
                    }

                }
            }

Magento 1.9 removes unused product images

I've tried to use this bash script to remove any unused product images, but unfortunately, the images used are also removed.

database=name
for path in `find . -type f $1`; do 
    extension="${path##*.}"
    if (( "$extension" != "jpg" )) && (( $extension != "jpeg" )) && (( $extension != "png" )) && (( $extension != "gif" )) && (( $extension != "bmp" )); then
        echo "extension: $extension $path"
        continue
    fi 
    delpath=${path:2}
    path=${path:1}
    query="SELECT value FROM catalog_product_entity_media_gallery WHERE value='$path';"
    sqlpath=`mysql --defaults-extra-file=mysqlconfig.cnf --database="$database" -s -N --execute="$query"`;
    if (( "$sqlpath" )); then
        echo  -n ""
    else
        name=$(basename -- "$path")
        find . -type f -name "$name" -delete -print
    fi
done   

The script recursively goes through the product images and deletes them if they are not in the catalog_product_entity_media_gallery table. If they are not there, they will not be used.
Is the query correct to find unused product images?

python – Removes words from an exclusion list on each line of a pandas.Series

You must currently go through all the keywords to see if they match the current word. If your exclude was a setYou could just do it if j in exclude, This change alone should greatly speed up your code (how much depends on how extensive your list of exclusion words actually is).

You can also simplify retrieving the exclusion words:

from collections import Counter
form itertools import takewhile
from operator import itemgetter

THRESHOLD = 25

words = Counter(whatever_generates_your_words())
exclude = set(t(0) for t in takewhile(lambda t: t(1) <= THRESHOLD,
                                      reversed(words.most_common())))

This takes advantage of the fact that collections.Counter.most_common Sorted by frequency, the inverse begins with the least common words. itertools.takewhile Stop taking it when the condition is no longer met, so you do not have to go through all the words in the list Counter,

For filtering, you should probably use some list comprehension. All three of the following functions do the same:

from itertools import filterfalse

def remove_nonfrequent(note):
    sentences = ()
    for sentence in note.split('. '):
        sentence_ = ()
        for word in sentence:
            if word not in exclude:
                sentence_.append(word)
        if sentence:
            sentences.append(" ".join(sentence))
    return ". ".join(sentences)

def remove_nonfrequent(note):
    return ". ".join(" ".join(filterfalse(exclude.__contains__, sentence.split(" ")))
                     for sentence in note.split('. '))
                     if sentence)

def remove_nonfrequent(note):        
    return ". ".join(" ".join(word for word in sentence.split(" ")
                              if word not in exclude)
                     for sentence in note.split('. ') if sentence)

Personally, I prefer the last one because it is best readable for me.

Note that Python has an official style guide, PEP8, which recommends the use of 4 spaces as indentation and surrounding operators with spaces.

Features – WordPress removes HTML

This is similar to the other questions, but the solutions I've seen include other plugins and things. The next point I have found for the "right" solution is

// STOP WORDPRESS REMOVING TAGS
function tags_tinymce_fix( $init )
{
  // html elements being stripped
  $init('extended_valid_elements') = 'div(*),article(*)';
  // don't remove line breaks
  $init('remove_linebreaks') = false;
  // convert newline characters to BR
  $init('convert_newlines_to_brs') = true;
  // don't remove redundant BR
  $init('remove_redundant_brs') = false;
  // pass back to wordpress
  return $init;
}
add_filter('tiny_mce_before_init', 'tags_tinymce_fix');

But that does not include the definition list markup, the list heads, and I'm sure I'll forget some.

Is there a way to make WordPress leave my HTML alone? There is no reason to clean up valid code … We are not all monkeys …

PHP – Updating user profile information removes image

I have a custom front-end user profile. If you update the profile without changing the profile picture, the picture is removed. You must re-upload the image every time you update your user profile.

This is the edit-profile.php

user_email == ""):
wp_redirect ("/ login");
endif;

$ posts = get_posts (array ()
& # 39; number posts & # 39; => -1,
& # 39; # 39 & post_type; => & # 39; member & # 39 ;,
& # 39; # 39 & meta_key; => & # 39; email_address & # 39 ;,
& # 39; # 39 & meta_value; => $ current_user-> user_email
));

if ($ posts):
$ pid = $ posts (0) -> ID ;;
endif;


get_header ();

?>

Contact information:

First name:
<input type = "text" name = "first_name" value = ""/>

Second first name:
<input type = "text" name = "middle_name" value = ""/>

Surname, Surname:
<input type = "text" name = "last_name" value = ""/>

Name of the company:
<input type = "text" name = "company name" value = ""/>

Address:
<input type = "text" name = "address" value = ""/>

Address:
<input type = "text" name = "address_2" value = ""/>

City:
<input type = "text" name = "city" value = ""/>

Status:
<input type = "text" name = "state" value = ""/>

Post Code:
<input type = "text" name = "zip" value = ""/>

Phone:
<input type = "text" name = "phone_number" value = ""/>

Fax number:
<input type = "text" name = "fax_number" value = ""/>

Website:
<input type = "text" name = "company website" value = ""/>

Bio:

User Profile Image:

To add your picture to your profile, select the picture and it will be added when you save the form.

<img src = "http://wordpress.stackexchange.com/width = 150"/>

Project pictures:

If you want to add a picture to your profile, select the picture to add when you save the form.

Current project pictures

To remove an image, click Delete. It will be removed when saving.

<? php // get acf gallery field $ images = get_field (& # 39; gallery & # 39 ;, $ pid); if ($ images): foreach ($ images as $ image): echo & # 39;
& # 39 ;; echo & # 39;& # 39 ;. $ image (& 39; caption & # 39;). & # 39; caption & # 39;
& # 39 ;; echo & # 39; Delete & # 39 ;; echo & # 39;
& # 39 ;; endforeach; endif; ?>

(<a target = "_ blank" href = ""> Show my profile)

<? php get_footer (); // Avoid closing the PHP tag to avoid problems with headers that have already been sent.

What do I miss?

Time Complexity Algorithm 1 Removes the node vk from the graph G represented as adjacency matrix A.

The function accepts an adjacency matrix A representing a graph G and an integer k, and returns the adjacency matrix A, which represents the graph G which is the result of removing the node of the k-th node vk from G.

Question: Provide an implementation of the NodeRemoval function in pseudocode. Indicate the time complexity of your implementation. Is it the best complexity that can be achieved for this task? Briefly describe your reasoning

Consider the following: Algorithm 1 Removes the node vk from the graph G, which is represented as adjacency matrix A.

Required: A ≤ {0, 1} (power) n × n, k ≤ N, k ≤ n

Make sure: A 0 ∈ {0, 1} (power) (n – 1) × (n – 1)

1: function NodeRemoval (A, k)

2 :. , ,

3: Return A

4: End function

c ++ – Removes random lines from a file

The user is asked for the file name and the number of lines to be removed. Then each line is stored in a vector. A dynamic array is used to hold the random number (random number) generated, and the corresponding element in the vector is deleted. This vector is then copied to a new file called temp.txt, where each element represents its own line.

Ask:

  • What can I improve to make this code more efficient? ie better methods to perform this task?
  • What should I not use and what should I change? (for example, any bad habits?)
  • What I have used is good and should be kept as a habit.
  • Are there any exceptions that I can use to ensure code?

Warnings I received:

  1. Warning C26495 The variable & # 39; LineEditor :: array & # 39; is not initialized. Always initialize a member variable (type 6). for LineEditor ().
  2. Avoid unnamed objects with custom constructions and destructions (es.84). for getFileName () in void removeLines ().
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

template
void writeTo(const std::string& filename, std::vector& v)
{
    std::ofstream fstream(filename);
    if (!fstream)
        exit(1);
    std::copy(v.begin(), v.end(), std::ostream_iterator(fstream, "n"));
    fstream.close();
}

class LineEditor
{
    std::vector buf;
    std::string fileName;
    int noOfLines{ 0 };
    int* array;
public:
    LineEditor()
    {
    }

    ~LineEditor()
    {
        std::cout << """ << fileName << """ << " " << noOfLines << " lines removed.n";
        delete() array;
    }

    void removeLines()
    {
        getFileName();
        TotalLinesToRemove();

        std::ifstream fileIn;
        std::string line;
        int lineCounter{ 0 };
        int* array = new int(noOfLines);

        fileIn.open(fileName);
        if (!fileIn)
        {
            std::cerr << fileName << " can not be opened." << std::endl;
            exit(1);
        }
        while (fileIn.is_open())
        {
            while (std::getline(fileIn, line))
            {
                lineCounter++;
                buf.push_back(line);
            }
            for (int i{ 0 }; i < noOfLines; ++i)
            {
                array(i) = getRandomNumber(0, lineCounter - 1);
                buf.erase(buf.begin() + (array(i)));
                --lineCounter;
            }
            writeTo("temp.txt", buf);
            fileIn.close();
        }
    }
private:
    std::string getFileName()
    {
        std::cout << "Enter name of text file: ";
        std::cin >> fileName;

        return fileName;
    }
    int TotalLinesToRemove()
    {
        std::cout << "Enter the number of lines to remove: ";
        std::cin >> noOfLines;

        return noOfLines;
    }
    int getRandomNumber(int min, int max)
    {
        std::mt19937 seed{ static_cast(std::time(nullptr)) };
        std::uniform_int_distribution<> rand(min, max);
        return rand(seed);
    }
};

int main()
{
    LineEditor file;
    file.removeLines();
    return 0;
}

I am quite a beginner to advanced in C ++ and would like to improve myself.