c # – The type of entity requires the definition of a primary key – even if it is not used / defined in DbContext

I receive the following error:

The entity type 'ConditionField' requires a primary key to be defined

Whenever I try to instantiate my context called: OnlineApplicationsDbContext – EfCore throws a strop on the fact that the above entity does not have a PK.

Now, here is where it gets a little strange – I do not use or refer to this entity in my new context. None of my tables / entities defined in my new context have business with the ConditionField entity.

N, B: my context OnlineApplicationsDbContext has been copied and pasta's context wider than I wrote long ago: ApplicationsDbContext who defined and referenced the entity ConditionField.

Interactive folder file organizer (alphanumeric and type) for macOS / Linux in Python

A simple interactive Python script to organize messy folders on the computer, supports macOS and linux but not windows. The mini-program has the following features:

  • Create alphanumeric folders (A-Z / 0-9) based on the available set of letters in the folder specified in the path and move the folders / files to the newly created folders.
  • Creation of folders specific to the type (Audio, Video …) and moving files in the appropriate type folders.
  • Run directly from shell or from a Python interpreter.
  • Interactive.

It is planned to add more features to the code and to possibly perform other optimizations / updates, here is my implementation in Python, I hope it suits you, suggestions for improvements / features to add / problems encountered when using the code are more than welcome. The program works fine, no bug has been found so far, however, you may want to test it before using it on a folder containing test files to get you used to it.

#!/usr/bin/env python
import os
import string
import shutil
import random


def thank_user():
    """Print a thank you message and end program."""
    print(5 * ' ' + 10 * '=')
    print('Thank you for using file organizer.')
    print(5 * ' ' + 10 * '=')
    exit()


def get_folder_contents(path):
    """Return folder contents."""
    while not os.path.exists(path):
        path = input('Invalid path, please enter a valid path or q to exit: ').rstrip()
        if path == 'q':
            thank_user()
    os.chdir(path)
    return (file for file in os.listdir(path) if file != '.DS_Store')


def welcome_user():
    """Print a welcome message."""
    print(5 * ' ' + 10 * '=')
    print('Welcome to file organizer.')
    print(5 * ' ' + 10 * '=')
    action = input('Do you wish to continue? y/n: ')
    while action != 'y' and action != 'n':
        print(f'Invalid command {action}')
        action = input('Do you wish to continue? y/n: ')
    if action == 'n':
        thank_user()
    if action == 'y':
        pass


def create_alpha_num_folders(path):
    """Create alpha-numeric folders for first characters present in files of the given path ."""
    folder_contents = get_folder_contents(path)
    if not folder_contents:
        print(f"0 files found in {str(path).split('/')(-1)}")
        print(105 * '=')
        thank_user()
    chars_to_produce = set((item(0).upper() for item in folder_contents))
    invalid_folders = (folder for folder in folder_contents if folder in string.ascii_uppercase
                       or folder in string.digits)
    if invalid_folders:
        print(f'Found the following {len(invalid_folders)} folders named from A - Z/ 1 - n:')
        for invalid_folder in invalid_folders:
            print(invalid_folder)
        while invalid_folders:
            action = input(f'Enter q to exit. Do you want to to rename the {len(invalid_folders)}'
                           f' invalid folder(s)? y/n/q: ')
            if action == 'q' or action == 'n':
                print('Creating A - Z / 1 - n folders unsuccessful.')
                thank_user()
            if action == 'y':
                confirm = input(f'Are you sure, do you want to rename {len(invalid_folders)} invalid folders? y/n: ')
                while not confirm == 'y' or confirm == 'n':
                    print(f'Invalid command {confirm}')
                    confirm = input(f'Are you sure, do you want to rename {len(invalid_folders)} '
                                    f'invalid folders? y/n: ')
                if confirm == 'y':
                    count = random.randint(10 ** 6, 10 ** 7)
                    for filename in invalid_folders:
                        new_name = filename + '_' + str(count)
                        os.rename(filename, new_name)
                    print(f'Changed {len(invalid_folders)} folder name(s) successful.')
                    break
                if confirm == 'n':
                    thank_user()
            else:
                print(f'Invalid command {action}')
    for char in sorted(chars_to_produce):
        os.mkdir(char)
        print(f'Creation of folder {char} successful.')
    print(105 * '=')


def get_supported_formats():
    """Return supported formats."""
    formats = {
        'AUDIO': ('aif', 'cda', 'mid', 'midi', 'mp3', 'mpa', 'ogg', 'wav', 'wma', 'wpl'),
        'COMPRESSED': ('7z', 'arj', 'deb', 'pkg', 'rar', 'rpm', 'tar.gz', 'z', 'zip'),
        'DISC': ('bin', 'dmg', 'iso', 'toast', 'vcd'),
        'DATA': ('csv', 'dat', 'db', 'dbf', 'log', 'mdb', 'sav', 'sql', 'tar', 'xml'),
        'EXECUTABLE': ('apk', 'bat', 'bin', 'cgi', 'pl', 'com', 'exe', 'gadget', 'jar', 'wsf'),
        'FONT': ('fnt', 'fon', 'otf', 'ttf'),
        'IMAGE': ('ai', 'bmp', 'gif', 'ico', 'jpeg', 'jpg', 'png', 'ps', 'psd', 'svg', 'tif', 'tiff'),
        'INTERNET': ('asp', 'aspx', 'cer', 'cfm', 'css', 'htm', 'html', 'js', 'jsp',
                     'part', 'php', 'rss', 'xhtml'),
        'PRESENTATION': ('key', 'odp', 'pps', 'ppt', 'pptx'),
        'PROGRAMMING': ('c', 'class', 'cpp', 'cs', 'h', 'java', 'sh', 'swift', 'vb', 'py'),
        'SPREADSHEET': ('ods', 'xlr', 'xls', 'xlsx'),
        'SYSTEM': ('bak', 'cab', 'cfg', 'cpl', 'cur', 'dll', 'dmp', 'drv', 'icns', 'ini',
                   'lnk', 'msi', 'sys', 'tmp'),
        'VIDEO': ('3g2', '3gp', 'avi', 'flv', 'h264', 'm4v', 'mkv', 'mov', 'mp4', 'mpg', 'mpeg',
                  'rm', 'swf', 'vob', 'wmv', 'webm'),
        'WORD_PROCESSOR': ('doc', 'docx', 'odt', 'pdf', 'rtf', 'tex', 'txt', 'wks', 'wps', 'wpd'),
        'SUBTITLES': ('srt', 'sub', 'sbv')
    }
    return formats


def get_extension_type(extension):
    """Return extension type ex: mp3 --> AUDIO."""
    formats = get_supported_formats()
    possible_extensions = tuple(ext for ext, exts in formats.items() if extension.lower() in exts)
    if not possible_extensions:
        return ('UNCLASSIFIED',)
    return possible_extensions


def get_file_extension(filename):
    """Return file extension"""
    return filename.split('.')(-1).lower()


def get_folder_extensions(path):
    """Return all folder extensions."""
    folder_contents = get_folder_contents(path)
    return set((get_file_extension(filename) for filename in folder_contents))


def create_folders(path):
    """Create alpha-numeric folders or type specific folders in the given path."""
    folder_contents = get_folder_contents(path)
    print(f"Current folder: {str(path).split('/')(-1)}")
    print(f'Folder contents ({len(folder_contents)}) items:')
    print(105 * '=')
    if not folder_contents:
        print(f"0 files found in {str(path).split('/')(-1)}")
        print(105 * '=')
        thank_user()
    for number, filename in enumerate(sorted(folder_contents), 1):
        if os.path.isdir(filename):
            print(f'{number}. Folder: {filename}')
        if os.path.isfile(filename):
            print(f'{number}. File: {filename}')
    print(105 * '=')
    action1 = input(f'Enter q to exit. Do you want to group the {len(folder_contents)}'
                    f' items above Alpha-numerically (A-Z / 0-9) or by type? a/t/q: ')
    while action1 != 'a' and action1 != 't' and action1 != 'q':
        print(f'Invalid command {action1}')
        action1 = input(f'Enter q to exit. Do you want to group the {len(folder_contents)}'
                        f' items above Alpha-numerically (A-Z / 0-9) or by type? a/t/q: ')
    if action1 == 'a':
        action2 = input(f"Enter q to exit. Are you sure, do you want to create Alpha-numeric (A-Z / 0-9) folders in "
                        f"{str(path).split('/')(-1)}? y/n/q: ")
        while action2 != 'y' and action2 != 'n' and action2 != 'q':
            print(f'Invalid command {action2}')
            action2 = input(
                f"Enter q to exit. Are you sure, do you want to create Alpha-numeric (A-Z / 0-9) folders in "
                f"{str(path).split('/')(-1)}? y/n/q: ")
        if action2 == 'n' or action2 == 'q':
            print('Creation of new Alpha-numeric (A-Z / 0-9) folders unsuccessful.')
            thank_user()
        if action2 == 'y':
            create_alpha_num_folders(path)
            return 'alpha'
    if action1 == 't':
        folder_extensions = get_folder_extensions(path)
        new_folders = set((get_extension_type(extension) for extension in folder_extensions))
        new_folder_names = (folder_name for folder_names in new_folders for folder_name in folder_names)
        print('New type folders to create: ')
        for number, name in enumerate(sorted(new_folder_names), 1):
            print(number, name)
        action2 = input(f"Enter q to exit. Are you sure do you want to create the {len(new_folder_names)} folders"
                        f" above in {str(path).split('/')(-1)}? y/n/q: ")
        while action2 != 'y' and action2 != 'n' and action2 != 'q':
            print(f'Invalid command {action2}')
            action2 = input(f"Enter q to exit. Are you sure do you want to create the {len(new_folder_names)} folders"
                            f" above in {str(path).split('/')(-1)}? y/n/q: ")
        if action2 == 'y':
            for folder in sorted(new_folder_names):
                try:
                    os.mkdir(folder)
                    print(f'Creation of {folder} folder successful.')
                except FileExistsError:
                    print(f'Filename {folder} already exists.')
                    print(f'Creation of {folder} folder unsuccessful.')
            return 'type'
        if action2 == 'n' or action2 == 'q':
            print(f'Creation of {len(new_folder_names)} folders unsuccessful.')
            thank_user()
    if action1 == 'q':
        print('Creation of new folders unsuccessful.')
        thank_user()


def organize_files(path):
    """Move files and folders into new organized relevant folders."""
    folder_types = create_folders(path)
    if folder_types == 'alpha':
        new_folder_contents = get_folder_contents(path)
        files_to_move = (folder for folder in new_folder_contents if folder not in string.ascii_uppercase
                         and folder not in string.digits)
        new_alpha_folders = (folder for folder in new_folder_contents if folder in string.ascii_uppercase
                             or folder in string.digits)
        print(f"Current folder: {str(path).split('/')(-1)}")
        print(f'Folder contents to be moved ({len(files_to_move)}) items:')
        print(105 * '=')
        for number, filename in enumerate(sorted(files_to_move), 1):
            if os.path.isdir(filename):
                print(f'{number}. Folder: {filename}')
            if os.path.isfile(filename):
                print(f'{number}. File: {filename}')
        print(105 * '=')
        action = input(f'Enter q to exit. Are you sure, do you want to organize the {len(files_to_move)} files above'
                       f' to Alpha-numeric (A-Z / 0-9) folders? y/n/q: ')
        while action != 'q' and action != 'y' and action != 'n':
            print(f'Invalid command {action}')
            action = input(
                f'Enter q to exit. Are you sure, do you want to organize the {len(files_to_move)} files above'
                f' to Alpha-numeric (A-Z / 0-9) folders? y/n/q: ')
        if action == 'q' or action == 'n':
            print(f'Organization of {len(files_to_move)} Alpha-numerically (A-Z / 0-9) unsuccessful.')
            thank_user()
        if action == 'y':
            for filename in files_to_move:
                for folder_name in new_alpha_folders:
                    if filename.startswith(folder_name.lower()) or filename.startswith(folder_name):
                        shutil.move(filename, folder_name)
                        print(f'Moving successful ... {filename} to {folder_name}')
    if folder_types == 'type':
        new_folder_contents = get_folder_contents(path)
        files_to_move = (folder for folder in new_folder_contents if folder not in get_supported_formats())
        new_type_folders = (folder for folder in new_folder_contents if folder in get_supported_formats())
        print(f"Current folder: {str(path).split('/')(-1)}")
        print(f'Folder contents to be moved ({len(files_to_move)}) items:')
        print(105 * '=')
        for number, filename in enumerate(sorted(files_to_move, key=get_file_extension), 1):
            if os.path.isdir(filename):
                print(f'{number}. Folder: {filename}')
            if os.path.isfile(filename):
                print(f'{number}. File: {filename}')
        print(105 * '=')
        action = input(f'Enter q to exit. Are you sure, do you want to organize the {len(files_to_move)} files above'
                       f' into type specific folders? y/n/q: ')
        while action != 'y' and action != 'n' and action != 'q':
            print(f'Invalid command {action}')
            action = input(
                f'Enter q to exit. Are you sure, do you want to organize the {len(files_to_move)} files above'
                f' into type specific folders? y/n/q: ')
        if action == 'n' or action == 'q':
            print(f'Organization of {len(files_to_move)} by type unsuccessful.')
            thank_user()
        if action == 'y':
            for filename in files_to_move:
                file_type = get_extension_type(get_file_extension(filename))
                for folder_name in new_type_folders:
                    if file_type(0) == folder_name:
                        shutil.move(filename, folder_name)
                        print(f'Moving successful ... {filename} to {folder_name}')
    thank_user()


if __name__ == '__main__':
    welcome_user()
    path_to_folder = input('Please enter a valid path or q to exit: ').rstrip()
    if path_to_folder == 'q':
        thank_user()
    organize_files(path_to_folder)

Add a pagination on a custom message type archive

I've moved custom publications on what would normally be an archive template to a dedicated page template. I followed this article:
https://jasonyingling.me/use-page-custom-post-type-archive-url-rewrites/.

But I am confused as to how I would add pagination. If I inspect the $ paginated code, it's always 0. When I call the code I have here (, nothing makes.

function pagination() {
    global $wp_query;

    $total_pages = $wp_query->max_num_pages;

    if ($total_pages > 1){
        $current_page = max(1, get_query_var('paged'));

        echo paginate_links(array(
            'base' => get_pagenum_link(1) . '%_%',
            'format' => '/page/%#%',
            'current' => $current_page,
            'total' => $total_pages,
        ));
    }
}

Ideas that I'm doing wrong?

javascript – The footer goes up when I type something in the entry

* {
  font-family: Arial;
}

body {
  margin: 0;
  padding: 0;
}

.topo {
  height: 50px;
  background-color: #353535;
}

.topointerior {
  width: 1000px;
  margin: auto;
}

.logomarca {
  float: left;
  font-size: 24px;
  color: white;
  line-height: 50px;
}

#miniatura {
  font-size: 10px;
}

.menu {
  float: right;
  color: white;
}

.menu ul,
.menu li,
.menu a {
  margin: 0;
  padding: 0;
  color: white;
  list-style: none;
  text-decoration: none;
}

.menu li {
  float: left;
  padding-left: 10px;
  padding-right: 10px;
  line-height: 50px;
  font-size: 14px;
  cursor: pointer;
}

.menu li:hover {
  background-color: #FF0000;
}

#xxx{
  background-color: #FF0000;
}

.outrosprodutos {
  color: white;
  height: 50px;
  font-size: 20px;
  text-align: center;
  line-height: 50px;
  margin-bottom: 10px;
}

.divsubmenu {
  position: absolute;
}

.submenu {
  background-color: #353535;
  position: absolute;
  display: none;
}

.banner {
  background-image: url(azule.jpg);
  background-position: center;
  background-size: 100%;
  height: 300px;
  background-color: #000066;
}

.bannerinterior {
  width: 1000px;
  margin: auto;
}

.banneresquerda {
  float: left;
}

.bannerdireita {
  float: right;
}

.bannerdireita img {
  margin-right: 55px;
  margin-top: 20px;
  width: 300px;
}

.frase1 {
  font-size: 70px;
  color: #CC0000;
  margin-top: 100px;
}

.frase2 {
  font-size: 30px;
  color: #CC0000;
}


}
.conteudointerno {
  margin: auto;
  width: 1000px;
}
.conteudo {
  background-color: #353535;
  height: 50px;
}
.outrosprodutos {
  color: #CC0000;
  height: 40px;
  font-size: 20px;
  text-align: center;
  line-height: 50px;
}
#tabela {
  width: 800px;
  text-align: center;
  border-collapse: collapse;
  margin: auto;
  background-position: center;
}
#tabela thead {
  color: black;
  font-size: 20px;
}
#tabela tbody tr {
  border: solid 1px;
  height: 30px;
  cursor: pointer;
  color: #990000;
}
#tabela tbody td {
  font-family: System;
}
#tabela input {
  width: 210px;
  color: black;
  border-radius: 3px;
  border-color: #999999;
  background-color: white;
  text-align: center;
  margin-bottom: 10px;
}
#txtColuna1 {
  margin-top: 10px;
}
.rodape {
  background-color: #353535;
  height: 50px;
  line-height: 50px;
  text-align: center;
  color: #FFFFFF;
  font-size: 10px;
  position: absolute;
  width: 100%;
  margin-top: 10%;
}



  
      xxx xxxx 
  
  
  

  



  







  





  
DONE / REFERRED
AUDIOMETRIC
CONVENTIONAL CARIOTYPE WITH BADES
CONVENTIONAL CARIOTYPE WITH EDGES
karyotype
FLOW CURVE
defecography
ECG
ERGOMETRY
SPIROMETRY
ELECTROPHYSIOLOGICAL STUDY
electroneuromyography
ELECTROCARDIOGRAM
ELETROENCEPHALOGRAMME
electrocoagulation
FLOWOMETRY
PHYSIOTHERAPY
PHOTO LASER COAGULATION
PHOTO THERAPY
General practitioner
Geriatra
HOLTER 24H
HYDROTHERAPY
IMPEDANCIOMETRY (IMMITANCIOMETRY)
manometry
MAP
NEUROLOGIST
NUTRITIONIST
PILATES
lung specialist
POLYSONOGRAPHIE
PH METRIA
HEARING PROSTHESIS
rheumatologist
ERGOMETRIC TEST
VIDEO FLUROSCOPY OF GLUTITION
VECTORELETRONISTAGMOGRAPHY
VECTORÉLETROVISTOMOGRAPHIE
(xxxx - xxxxxx - xxxxx)

Server-side script – If the content is retrieved by wget, could there be a problem if I do not specify the correct content type in the HTTP response?

It's a question about wget. I have a simple file uuid.html in the root of the document that contains a single line 54da5638-099d-4cf3-9319-c436fcb81334. I get the line in a shell script with content=$(wget localhost/uuid.txt -O -). My server, Apache, automatically assigns the type of content. text/html the output document in the response returned to wget. Is it safe to assume that wget completely ignores the content type contained in the response header to determine what is returned and assigned to $content? I know that Apache would define the type of content on text/plain in the response header if I used a different extension for the file. This is not the question. Also, is it necessary to specify the type of content in the http response header? is a similar question, but the context is different: they consider that the request is made by a browser. Also, of course, I checked that it works on my server. The question is whether this is reliable regardless of the environment.

windows 10 – Unknown type name & # 39; RAWINPUTDEVICE & # 39;

I have a small piece of code c running in a Windows 10 environment that continues to go wrong with error: unknown type name 'RAWINPUTDEVICE'.

Here is my code:
#include
int main() {
RAWINPUTDEVICE HIDs(2);
}

Has anyone ever met this error before?

Statistical inference – A basic question about a randomized test involving Type I error.

I have a fundamental question in the context of the verification of statistical assumptions, specifically randomized tests. Suposse that I have two actions (alternatives) on a certain unknown parameter $ theta in Theta $: the null ($ H_0 $) and alternative hypotheses ($ H_1 $).

In this case, the sample space is $ (0,15) subset mathbb {R} $. We know that the critical function is given by
$$ phi (x) = P (reject , , H_0 , , | , , x , , observed) $$

I do not know exactly if this definition really implies a conditional probability. Suposse I have the following critical function

$$
phi (x) =
begin {cases}
0, quad x in (0,2) \
p, quad x in (2,10) \
1, quad x in (10,15) \
end {cases}
$$

I can understand why

$$ P (reject , , H_0 , , , , H_0 , , is , , true) , = 0 times P (x in (0,2)) + p times P (x in (2,10)) + 1 times P (x in (10,15)) $$

The right side looks a lot like a wait. But I can not understand.

web design – Web UX – Serve two versions of the site depending on the type of customer selected

The conventional feature that immediately comes to mind to support the functions you describe is: user profile. Conventionality means recognition and familiarity.

Presumably, an accounting application has security features that require secure login and authentication, as well as security latency, and so on. Business and individual consumer user profiles during this mandatory initial configuration, that is, during the "Create a user ID" steps at the first visit. Integrate the profile choice into this configuration. I do not recommend hiding the profile choice in a pop-up window – the modal route (a "pop-up" dialog box) is useless and annoying if your user still needs to provide configuration information, such as the user name and the identification information.

Does the configuration information that you ask your users to provide differ between Business and individual users? If one configuration requires many more data points than the other – no more checkboxes, fields to fill out, drop-down selections to make – you'll want to set the Business against individual & # 39; roadfork & # 39; at the beginning of the initial workflow of registration, because the downstream content following a route will be more elaborate than the other.

The same constraint applies when switching from one type of profile to the other while you are logged on. If the difference is trivial, flip it easily, but if a professional user profile is a very different beast from a particular one, create a more "protected" user interface stream according to which your user converts one profile to the other.

To stay true to the classic UX (and thus the benefits of repetition and recognition of other sites), most people familiar with anything that requires a login / logout will recognize a user avatar. located on the header of your site, right, as their user's location. profile (much like StackExchange), and expect simple actions such as settings and Connect – Out when we click on this avatar.

If the profile changes from Business at individual or vice versa is easy and does not require any important additional information, this is where you might want to locate it. If this change is more complex and more demanding, I hope to find the option to change profile under settings (or "My profile").

This model is easily transferred to a mobile environment; only the layout and presentation of an otherwise identical information architecture may be different. The exact structure of this configuration depends – again – on the participation of your specific configuration steps. If your profile configuration is complex and full of dependencies (the content of step 2 depends on step 1), a wizard-style step-wise disclosure may be required – and no wizard with a modern user interface need not necessarily be Windows 95. watch more dialogue these days!

Regarding the level of visibility of the site version for your users, how do you plan to market the site? If your Business the user version is higher (and possibly paying or paying) than the individual consumer You may want to reflect this version in the naming convention that you apply to your site. Reward your paid customer or subscriber segment by offering a significantly richer offer while encouraging your freebie users to consider upgrading. However, if your site does not adopt a too odious sales position, constant incentives for "in-app purchases" can have the opposite effect. to reduce your offer.

However, if the distinction between Business and individual Site profiles are unimportant, and the nature and complexity of the required profile generation data entry are about the same, I would like to make an easy switchover and perhaps add a descriptive label to the I & # 39; User avatar (see above), under the user name.

It can be interesting to explore the Business and individual User segments of your site planned via a customization study, even if you already collaborate with a marketing expert. Do you know how different the expectations and priority needs of each segment are? Are there differences in each segment? Are there overlaps (for example, for self-employed workers where aspects of personal and business finance may be confused)? To what extent are the accounting requirements of your business sector consistent?

A final reflection on the differences between desktops and mobile devices: the two user segments can engage in one or the other environment for very different reasons. Mobile bookkeeping on the go is extremely convenient, for example, for tracking travel expenses (eg Concur), because you can download invoice images. But it is probably less useful for more complex workflows such as tax and other accounting. Remember to differentiate exactly what features you offer by environment rather than creating uniform desktop and mobile offerings – but keep in mind that this type of sophistication needs to be documented by a thorough user search. Good luck!

Construct a type of function

Let $ f (a, b) $ to be a continuous function that is only an integer when $ a $ and $ b $ are the two integers. What is such a definition of $ f (a, b) $?

sharepoint online – Publish PnP content type Powershell

Battery Exchange Network

The Stack Exchange network includes 175 question-and-answer communities, including Stack Overflow, the largest and most reliable online community on which developers can learn, share knowledge and build their careers.

Visit Stack Exchange