A
A
AlexanderBulat2014-02-14 09:49:53
Search Engine Optimization
AlexanderBulat, 2014-02-14 09:49:53

Link with an anchor in Russian and translation into English in the title attribute: are there any negative consequences?

I would like to hear if there are any negative consequences of using a link of this kind:

<a href="#" title="Marvel Universe">Вселенная Марвел</a>

I find this makes product links and sections more understandable to users due to the nature of the content.
Does this solution reduce the weight of the link and does it not "confuse" search engines due to the difference between the anchor and the title attribute?
Everything I've found so far is contradictory. Up to the fact that the title attribute is generally ignored by search engines.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dyuran, 2014-02-24
@Dyuran

Does this solution reduce link weight?

Doesn't reduce.
Doesn't "confuse".
If necessary - use, there are no negative consequences.

M
monah_tuk, 2015-04-19
@Blunker

At a minimum, you pass the same input stream to all threads. There is a place to be not only a race, but generally a mess with access. The thread then locks the mutex while continuing ALL of its work. Your variant with the same success could work in one flow, tk. until a thread finishes reading, others will wait on the mutex. Block only on vector access.
Alternatively, code like this:

#include <iostream>
#include <string>
#include <fstream>
#include <sstream>
#include <vector>
#include <deque>
#include <map>
#include <thread>
#include <mutex>

std::mutex lock;

void pipeline(const std::string&, std::vector<std::string>&);


std::string files[4] =
        {
                "file1.txt",
                "file2.txt",
                "file3.txt",
                "file4.txt"
        };

int main()
{
    std::string string;
    std::vector<std::string> str;
    std::map<std::string, std::size_t> freq;
    std::deque<std::thread> pool;
    std::ofstream out("out.txt");

    for (std::size_t i = 0; i < 3; i++)
    {
        pool.push_back(std::thread(pipeline, std::ref(files[i]), std::ref(str)));
    }

    while (pool.size())
    {
        pool.front().join();
        pool.pop_front();
    }

    std::cout << str.size();

    return 0;
}

void pipeline(const std::string &infile, std::vector<std::string> &str)
{
    std::ifstream in(infile.c_str());

    while (!in.eof())
    {
        std::string temp;

        std::getline(in, temp);

        {
            std::unique_lock<std::mutex> guard(lock);
            str.push_back(temp);
        }
    }
}

Changes:
- the stream is created in a stream, the file name is passed to the stream
- blocking access only on vector modifications
- use of a guard class to block and release the verctor.
- close on the stream can be omitted in this case - it will close upon exiting the scope

M
mamkaololosha, 2015-04-19
@mamkaololosha

Here is the corrected version.
You passed one in to all of them and got into a race/deadlock.

#include <iostream>
#include <string>
#include <fstream>
#include <sstream>
#include <vector>
#include <deque>
#include <map>
#include <thread>
#include <mutex>

std::mutex mutex;

std::string files[4] =
        {
                "file1.txt",
                "file2.txt",
                "file3.txt",
                "file4.txt"
        };

void pipeline(std::string &in, std::vector<std::string> &str)
{
  std::lock_guard<std::mutex> lock(mutex);

  std::ifstream file;
  file.open(in);

    while (!file.eof())
    {
        std::string temp;
        std::getline(file, temp);
        str.push_back(temp);
    }

  std::cout << in << " finished" << std::endl;
  file.close();
}

int main()
{
    std::string string;
    std::vector<std::string> str;
    std::map<std::string, std::size_t> freq;
    std::deque<std::thread> pool;
    std::ofstream out("out.txt");

    for (std::size_t i = 0; i < 4; i++)
    {
        pool.push_back(std::thread(pipeline, std::ref(files[i]), std::ref(str)));
    }

    while (pool.size())
    {
        pool.front().join();
        pool.pop_front();
    }

  out << str.size();
  std::cout << str.size();

  std::cin.get();

    return 0;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question