## seo – Proper URL structure

I am trying to fix the URL structure of an e-commerce site that has about 90k pages of parts. The site does not have a URL directory structure. Therefore, all 90k pages are below the root as `example.com/part-page-one`.

I am not an SEO, but I know that this is incorrect and needs to be repaired for development and SEO purposes. Any changes you make should consider SEO first. There are 6 main sections of the site:

(comments later `#`)

``````1. example.com/parts #defines a basic parts landing page
2. example.com/car-parts #this displays links to cart part category pages
3. example.com/catalogsearch #this searches the product database
4. example.com/some-category-name #this page would display parts specific to the category
5. example.com/part-page #this is a page featuring a single part and it may be a car, truck, or motorcycle part.
6. example.com/vehicle-page #this page has not been added to the site yet, but this page will feature parts that go to a specific vehicle.
``````

Therefore, I am trying to discover what would be the best way to structure URLs in a hierarchy. The example.com/car-parts page is one of our pages with the highest ranking, which causes some difficulty to the structure below.

1. Put all pages related to parts below `example.com/parts`.

2. Put the pages related to the category below `example.com/parts/category-name`
It must be this `example.com/parts/categories/my-category-name`? What should be done with the `/parts/categories` page? We have several pages like `example.com/serpentine-belts` That ranks well, but that only follows the flat URL structure that is very difficult to scale.

3. Put search below `example.com/parts/search`. I would like to use our search facets to link to certain categories or pages of brands.

4. Put pages of vehicle parts below `example.com/parts/vehicles/ford-f150`
What should i do with `example.com/parts/vehicles`? Show a vehicle search list? Redirect to any homepage?

5. Put part pages below `example.com/parts/my-part-page`

These are just a few ideas that I had, but I'm not sure what the best approach will be. Any help would be appreciated.

## utility – Intuition for proper monotne functions

While reading documents about utility theory, I came across a definition of a suitable monotonous function, which is a function with $$u & # 39;> 0$$, $$u & # 39; & # 39; <0$$, $$u & # 39; & # 39; & # 39;> 0$$ and so.
The first conditions are clear: more is better than less and marginal utility decreases. I am not sure how to interpret the higher order conditions and, in general, what is "appropriate" about this function?

Any intuition is appreciated.

## Database design: proper way to store external passwords in 2020

For users to log in to an external application and manage a password during that process, what is currently considered the correct way to manage passwords in the latest Azure Azure database?

To be clear, this is independent of the management of the server administrator password and the individual logins of the database that have been configured for specific processes to access the data. (I thought if there is a scenario in which the user's password operation should only be allowed through a specific login / process for greater security; Would that be necessary too?)

`Design Solution`

What I have seen is creating several columns to handle the password process, such as creating a Encrypted text Y key columns and that external processes such as mobile devices / programs encrypt / decrypt the password in the place. In this way, the database acts only as a repository for the process and does not allow casual access to understand the external process.

If this is the path, if the columns are marked in a special way, how to specify a `sparse` column innuendo for future data management in that / those columns?

## linear algebra: algebraic multiplicity of a proper value greater than its depth

In the book, Linear Algebra done wrong, Sergey Treil says that one can notice that the algebraic multiplicity of a proper value $$lambda$$ is greater than its depth (minimum $$k$$ such that $$(A- lambda I) ^ k | E_ lambda = 0$$, where $$E_ lambda$$ it is the generalized own space of $$lambda$$) How exactly does one conclude this?

Note that we are building towards the canonical form of Jordan, so we cannot use that here.

Here is a screenshot:

## python: is this the proper use of if__name == & # 39; __ main __ & # 39;

Is this the correct use of if__name == & # 39;principal& # 39 ;? I am new to Python and I am not completely sure. In addition, any other suggestions will be very considered. I am calling an API, first using PUT and then GET.

``````import requests
import json
import time

#calling historical api, we must do a put request and then a get request.

def putRequest():

url = 'https://api.something.com/archive/job?time_interval=2019-09-01T00:00:00Z/2019-09-01T00:02:00Z&out_format=CSV'
api_token =  '9SFqoGYzQe5eqdMHOHjMtR0EQuR8uKmR'
headers = {'Content-Type': 'application/json','Authorization': 'Bearer {0}'.format(api_token)}

#getting job_id for current call using put request
putRes = response.content
job_id = data('job_id')
job_state = data('job_state')
print('API job id:', job_id)
return (job_state, job_id, api_token, headers)

def getRequest():

#using job_id from function above, and waiting until server resource sends back 'DONE'
dataget = putRequest()
data1 = dataget(0)
job_id = dataget(1)
wait_time = 0

while data1 != 'DONE':
wait_time += 15
time.sleep(wait_time)
url_get = 'https://api.something.com/archive/job?job_id=' + job_id
headers_get = {'Content-Type': 'application/json','Authorization': 'Bearer {0}'.format(dataget(2))}
response_get = requests.get(url_get, headers = dataget(3))
data1 = data('job_state')
print('Job State: ', data1)
#With the returned URL, send a GET request to download data
if data1 == 'DONE':
dl_url = dataurl(0)
print(dataurl)
print(dataurl(0))
#Get request to download data from URL and output it to a CSV file in current working directory.
r = requests.get(dl_url, allow_redirects=True)
open('datatest.csv', 'wb').write(r.content)

if __name__ == '__main__':
getRequest()
f = open('datatest.csv', 'r')
print(f)

``````

## Proper configuration of the Python project: code review stack exchange

They asked me to migrate this question from SO here.

I know there are already several questions about folder structures, relative imports, modules / scripts and `__init__.py` files, but even after reading about those topics, the proper configuration of the project remains what confuses me most about python.

For this purpose, I have created a sample project that should clarify all imports and different calls I can make and how to handle them, so I hope to use it as a template for all future projects. This is the structure of the project:

``````Sample
├── __init__.py
├── __main__.py
├── package1
│   ├── foo.py
│   └── __init__.py
├── package2
│   ├── bar.py
│   ├── __init__.py
│   └── subpackage
│       ├── baz.py
│       └── __init__.py
├── test.py
└── utils.py
``````

the `__init__` Currently, the files are left (intentionally) empty and (again) I avoided explicit relative imports. To avoid saturating this post with the content of each file, I have uploaded the entire project to GitHub.

I would like to fix the project configuration, if possible only by making the following changes:

• Change imports from absolute to relative or vice versa
• Add things to different `__init__.py` records

so that the following calls are resolved without `ImportError`s and `ModuleNotFoundError`s:

• `user@pc:/path/Sample\$ python .`
• `user@pc:/path\$ python Sample`
• `user@pc:/\$ python path/Sample`
• `user@pc:/path\$ python Sample/__main__.py`
• `user@pc:/path\$ python Sample/test.py`
• `user@pc:/path\$ python Sample/package2/subpackage/baz.py`

Bonus points if the following calls also run without errors (as long as the sample project is in the Python search path):

• `python -m Sample`
• `python -m Sample.test`
• `python -m Sample.package2.subpackage.baz`
• `python -m Sample.package2.baz`

The critical parts in my code that must be handled are:

• the various types of imports on lines 1-4 of `__main__.py`
• import on line 2 of `test.py`, which requires `baz` be available from `package2`, instead of his full path of `package2.subpackage` (This is what currently causes an error when executing `test.py`); This is similar to how, for example, one can do `from keras import Model`, instead of `from keras.models import Model`.
• the import on line 1 of `baz.py`, which imports a module at the top level from a subpackage (this is what currently causes an error when executing `__main__.py`

Can I fix the project only with the changes listed above? Is there any other change that I have to make in the configuration of my project to comply with Python standards?

## code quality: proper structuring of the program in Python

Many people have written volumes and volumes on the subject. Martin Fowler has some good advice. I strongly recommend looking through your work, also take a look at Kevlin Henney.

The problem is that you are writing a class of God. Which is not a bad first approach when you don't know how to solve a problem. It simply is not a great long term solution.

Sprouting It is a technique that searches for small fragments of coherent code in the class and extracts them in a function / method reasonably named (also in the same class).

The benefit of doing this is that it is easy to deduplicate small pieces of code distributed throughout the class, and it is also easier to make larger functions smaller by eliminating a couple of lines at a time.

The disadvantage is that your class goes from having ten functions, to having hundreds.

This is where terrible enters. You will probably notice as the methods emerge that the methods begin to form categories. These functions are about the input, those functions are about the X calculation, these are about error reports, etc. You will see that most of the variables themselves are only used by one or two of these categories of functions and, often, the data. The path will be linear. Created here, read there.

The trick is to create a new class with a category of functions. Move any shared state along with it, and perhaps add a constructor to configure that state. Now rewire the original class to call an instance of the new class when you want that service category.

The advantage here is that the program tells you what its structure really is. And it does it in a very mechanical way.

The disadvantage is that the structure revealed to you is not likely to be good. After all, you write a god class because you don't have a good structure in mind, and instead you have chosen to find something that works, rather than something that works well. You may have to take what you have learned and rewrite large portions of the architecture several times before it even begins to resemble a decent solution.

## How to get proper participation in Instagram posts.

I currently have a music website, where I review albums and metal shows, along with interviews with musicians. I also run an instagram page for the site, and I was wondering if there are any specific hashtags that I should use to get proper participation in the posts.

Your help would be much appreciated

## design – PHP – Proper way of applying a method signature with a different type according to the class implementer

I am implementing "command pattern" classes. Since they are very similar to each other in many ways (for example, functionally, their relationship in the domain problem, etc.), it is desirable to make them have a similar structure.

Let's use an anecdotal example `Merger`.

``````class Merger {
/* ... details are omitted ... */

public function execute (self \$rval): self
{
// ... merge \$rval to \$this
return \$this;
}

/* ... details are omitted ... */
}
``````

So we have another example `Filter`

``````class Filter {
/* ... details are omitted ... */

public function execute (self \$rval): self
{
// apply filters from \$rval to \$this
return \$this;
}

/* ... details are omitted ... */
}
``````

exist Many another class that implements `public function execute (self \$param): self`.

I try to extract `public function execute (self \$param): self` to their own structure, then they have another class that implements that function in some way derive of such structure.

the `self` part of the method signature is a bit problematic: I want `self` to refer to the class that implements the function `execute(self \$param)`.

## INTENTED SOLUTION

### (a) Interface

My attempt to use the interface did not work because `self` points to the interface, p.

``````interface IExecute {
public function execute (self \$param): self;
}

class Merger implements IExecute {
/* ... details are omitted ... */

public function execute (self \$param): self
{
// ... merge \$param to \$this
return \$this;
}

/* ... details are omitted ... */
}

\$merger = new Merger();
/**
* Output:
* Fatal error:  Declaration of Merger::execute(Merger \$param): Merger must
* be compatible with IExecute::execute(IExecute \$param): IExecute
* in (...)(...) on line 7
*
* PHP complains that Merger::execute signature is incorrect because \$param
* is of type IExecute + its return type is Merger instead of IExecute.
*
* I want \$param to be a Merger
*/
``````

### (b) Inheritance

The use of inheritance produces the same result as the use of the interface, that is, PHP burst error complaining about how the method signature is incompatible.

``````class Executor {
public function execute (self \$param): self
{}
}

class Merger extends Executor {
/* ... details are omitted ... */

public function execute (self \$param): self
{
// ... merge \$param to \$this
return \$this;
}

/* ... details are omitted ... */
}

\$merger = new Merger();

/**
* Output:
* Fatal error:  Declaration of Merger::execute(Merger \$param): Merger must
* be compatible with Executor::execute(Executor \$param): Executor
* in (...)(...) on line 18
*
* \$param in Merger::execute has type of Merger instead of Executor
*
* I want \$param in Merger::execute to be a Merger, not Executor
*/
``````

### (c) Trait

One approach that occurs to me (and works as intended) is to use `trait`.

``````trait Executor {
abstract public function execute (self \$self): self;
}
``````

Then have the classes to use that feature.

``````class Merger {
use Executor;

/* ... details are omitted ... */

public function execute (self \$rval): self
{
// ... merge \$rval to \$this
return \$this;
}

/* ... details are omitted ... */
}
``````

This works perfectly well since `self` point to the class that uses the feature `Executor`.

`trait` It does what I want, although having to use `use ` It is a slight mental overload, that is, the developer should know that they have to use `trait` to impose the class structure (instead of, for example, having a base class that is more intuitive for IMO).

This finally brings to my question: Is there a better approach than using `trait` to handle this problem? Preferably the one with the most emphasis on enforcing a structure intuitively

I am attracted to the solution provided by this SO publication (the solution is in the poster question), although it is in C #. It is a pity that one has to use an alternative solution to do generic typing in PHP

## Proper case conversion (performance)

I wrote a simple function that converts an array of words to uppercase and lowercase (using bit offset) and returns the array. I performed a simple test using `std::chrono` to see how fast you could convert. Using a vector of 1000 words the function could do it in an average of 27 microseconds.

My question is, if there is a faster way to do this or if there is something I have missed, it can be detrimental to the performance of the function. Also, if there is any syntactic problem or changes that I would recommend, it would be greatly appreciated.

``````std::vector ToProperCase(std::vector& array)
{
if (array.empty())
return array;

// Loop through each word
for (std::string& value : array)
{
// Loop through each character in the word
for (unsigned int i = 0; i < value.size(); ++i)
{
// Capitalise first character
value(0) &= (~(1 << 5));

// Convert character to lower case
if (i > 0)
value(i) |= (1 << 5);
}
}

return array;
}

``````