database design – Best practice to work around the problem of implementing a Java type field

We have a course in the main library of our company as follows:

public class User {
    private long id;
    private UserType type;
    // Getters, setters, constructors, etc.

and have several options to implement UserType. Whose one is a enum:

public enum UserType {
    DEFAULT (10),
    TYPE_A  (20);

    private int type;

    UserType(int type) {
        this.type = type;

    public int getType() {
        return type;

    public static UserType valueOf(int value){

        for(UserType type : values()){
            if(type.getType() == value){
                return type;
        throw new IllegalArgumentException(String.format("Couldn't convert value : %d into a valid %s object", value, UserType.class));

Our USERS table:

| id | type |
|  1 |   10 |
|  2 |   20 |

We have an RowMapper again, in our library which is as follows:

public class UserRowMapper implements RowMapper {
    public IRuleContainer mapRow(ResultSet rs, int i) throws SQLException {
        return new User(rs.getLong("id"), UserType.valueOf(rs.getInt("type"));

However, a project that takes the master library as a dependency may need to be extended UserType. Conversion UserType in an interface, again does not work, because of RowMapper (again in the library) will have to instantiate a UserType.

Here is what I come with:

public class UserType {
    private int id;
    private String name;
    // Getters, setters and constructors

and the database becomes:


| id | type |
|  1 |   10 |
|  2 |   20 |


| id |  name   |
| 10 | DEFAULT |
| 20 | TYPE_A  |

and in RowMapper we create a user as follows:

return new User(rs.getLong("id"), new UserType(rs.getInt("type_id"), rs.getString("type_name")));

and for the sake of us, we could have a UserTypeContainer:

public class UserTypeContainer {
    public static final UserType DEFAULT = new UserType(10, "DEFAULT");
    public static final UserType TYPE_A = new UserType(10, "TYPE_A");

so that we can use it:


and projects that have this library as an addiction will have to:

1) Have extended types in their database
2) expand UserTypeContainer have their extended types (if they want to use the line above)

Is this an optimal solution? Is it a good programming practice or do you see flaws? What other options do I have?

usability – Problem of location filter location

The context

I am working on a SAAS product. Several products are listed in our product and the user may choose to specify the location of an asset or leave the location unspecified.


We can create reports for assets with placements. Currently, we can filter the report based on certain indicators. For example, we can specify that if we want to see asset reports with locations, the value of the filter will be "ALL LOCATIONS". The user can also select a specific location for the specific report.

But the problem is with setting the default filter. By default, the "All placements" filter is selected and assets without a location tend not to display because we selected the "All placements" filter. The user must specifically select the "No Location" filter to see assets without a location mentioned.

Can we somehow improve the usability of this filter widget?

Here's what the filter widget looks like:

enter the description of the image here

SharePoint 2013 authorization problem – (on-site)

Recently, I added all users to the SharePoint user group. After giving permission (Edit) to one of the group members, even after giving individual permission (Edit) to the document library, no user can see the folder. When I check the particular user / group permission, it shows the details below.

Limited access given directly

Edit, limited access assigned through the "Administrative Personnel" group.

Can any one solve this problem?

Thank you

seo – Problem on the Google Console

I'm trying to change the address of my site on the search console and I can not …

The console returned an error: "301-redirect from home page: can not extract page"

  • The verification for both sites is OK!
  • I've implemented 301 redirect on my old website and works for ALL pages …

What is the problem?
Thanks for your help.enter the description of the image here

Possible security problem with tsoHost servers?

According to publicwww, aprox. The same hack concerns 400 sites (post_content injected with a malicious Javascript code).

And it seems that all are hosted by tsoHost.…eid%3D2826294/

My client contacted them, but they claim that this is not a server problem.

However, POST logging is enabled and no malicious data comes from site files.

They had similar problems in the past, not sure that the same thing is going on right now.

How is it possible to have exactly the same malware injection as for tsoHost hosted sites? Any entry is appreciated, thank you!

Problem related to Vanity Name Checker.

Hello members,

Faced with 2 problems, mentioned below:

1. I'm getting good results for Tumblr but not for Weebly. When I try to check them in Vanity Name Checker, it shows no connection data. What is the problem, can someone help you please?

2. When I try to check some custom URLs like Tumblr, Weebly & WordPress, URLs are used as keywords. For example, In addition, there is no URL zone to check by doing the thing.

Another gcd problem

My friend gave me another challenge.

CA watch $ sum_ {a = 1} ^ {n} { gcd (n, a)} leq 2n ^ {3/2}. $

I do not know where to start.

javascript – I have a problem with the reporter when I try to run the test cases in the Microsoft browser. I receive an error

Thank you for contributing an answer to Stack Overflow!

  • Please make sure to respond to the question. Provide details and share your research!

But to avoid

  • Ask for help, clarification, or answer other answers.
  • Make statements based on the opinion; save them with references or personal experience.

To learn more, read our tips for writing good answers.

WP + gulp + browserSync + WAMP CORS problem

I need help solving the CORS gulp + browserSync problem when working with a customizer or any front page builder (Elementor, Beaver ect). I continue to get Uncaught DOMException: Blocked a frame with origin "" from...

I have tried a lot of combos but I can not make it work properly. This configuration works correctly as long as you do not need to reload live a page with an iframe or a front-end editor:

        proxy: 'localhost/WP/wp-admin/post.php?post=2&action=elementor',
        open: 'external',
        middleware: (
            function (req, res, next) {
                res.setHeader("Access-Control-Allow-Origin", "*");

Also verified httpd.config and virtual host config in WAMP and Access-Control-Allow-Origin is set to "*" everywhere and header_module it's active.
Any help is appreciated.

Ubuntu 18.04 old ipod editing problem

I've found my old iPod for years. If you connect it with a USB cable, this output comes from dmesg. Is there another way to mount it? The model of iPod is A1099.

[50.482808] USB 3-4: new high speed USB device number 3 using xhci_hcd
[50.610692] usb 3-4: device descriptor read / 64, error -71
[50.846689] usb 3-4: device descriptor read / 64, error -71
[51.082601] USB 3-4: new high speed USB device number 4 using xhci_hcd
[51.210607] usb 3-4: device descriptor read / 64, error -71
[51.446536] usb 3-4: device descriptor read / 64, error -71
[51.554553] usb usb3-port4: restart attempt
[52.206269] USB 3-4: new high speed USB device number 5 using xhci_hcd
[52.334264] usb 3-4: device descriptor read / 64, error -71
[52.570170] usb 3-4: device descriptor read / 64, error -71
[52.806117] USB 3-4: new high speed USB device number 6 using xhci_hcd
[52.934035] usb 3-4: device descriptor read / 64, error -71
[53.170046] usb 3-4: device descriptor read / 64, error -71
[53.278061] usb usb3-port4: can not enumerate a USB device