The Vulkan validation layer continues to throw an image design error in VkQueuePresentKHR ()

Obvious notice rookie. I have been learning Vulkan since yesterday, and as the title says, I still receive the previous error when sending to the present. I checked the tutorial code but I can't find any obvious errors. Here is my RenderPass creation code:

VkAttachmentDescription colorAttachmentDescription = {};
    colorAttachmentDescription.format = this->surfaceFormat.format;
    colorAttachmentDescription.samples = VK_SAMPLE_COUNT_1_BIT;
    colorAttachmentDescription.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
    colorAttachmentDescription.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
    colorAttachmentDescription.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
    colorAttachmentDescription.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
    colorAttachmentDescription.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
    colorAttachmentDescription.finalLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;

    VkAttachmentReference attachmentReference = {};
    attachmentReference.attachment = 0;
    attachmentReference.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;

    VkSubpassDescription subpassDescription = {};
    subpassDescription.colorAttachmentCount = 1;
    subpassDescription.pColorAttachments = &attachmentReference;
    subpassDescription.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;

    VkSubpassDependency subpassDependency = {};
    subpassDependency.srcSubpass = VK_SUBPASS_EXTERNAL;
    subpassDependency.dstSubpass = 0;
    subpassDependency.srcAccessMask = 0;

    VkRenderPassCreateInfo renderPassCreateInfo = {};
    renderPassCreateInfo.attachmentCount = 1;
    renderPassCreateInfo.pAttachments = &colorAttachmentDescription;
    renderPassCreateInfo.subpassCount = 1;
    renderPassCreateInfo.pSubpasses = &subpassDescription;
    renderPassCreateInfo.dependencyCount = 1;
    renderPassCreateInfo.pDependencies = &subpassDependency;

    vkCreateRenderPass(logicalDevice, &renderPassCreateInfo, nullptr, &renderPass);

Oh, and I've even tried changing the initial design to VK_IMAGE_LAYOUT_PRESENT_SRC_KHR but still I receive the error. This is the error of the validation layer that I get.

VALIDATION LAYER : Images passed to present must be in layout VK_IMAGE_LAYOUT_PRESENT_SRC_KHR or VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR but is in VK_IMAGE_LAYOUT_UNDEFINED. The Vulkan spec states: Each element of pImageIndices must be the index of a presentable image acquired from the swapchain specified by the corresponding element of the pSwapchains array, and the presented image subresource must be in the VK_IMAGE_LAYOUT_PRESENT_SRC_KHR layout at the time the operation is executed on a VkDevice (

map – Multiple colors in a geoserver layer

I have a geoserver layer and I am using it with open layers.
I want to put several colors on the same layer depending on their attributes.
How can I put several colors in a geoserver layer depending on the attributes of the layer?
The result I want would be something like this:enter image description here

software – Sketch error – Layer disabled – Too large

Working on Bohemian Sketch, I have a file that we have been using as our toolkit. It has about 1100 symbols, many nested. Due to our corporate policy, we are stuck in Sketch 52.3, we are using the Anima plugin to make stacking and filling work with our symbols.

The file used to work very well, but then I noticed that some symbols began to be empty, with the name of the symbol changed to DEACTIVATED LAYER – TOO BIG. The symbols have also resized, and are now approximately one million pixels wide. We have a fairly efficient version tracking, so I could track it so that it first happened with a symbol, then with a dozen and, over the course of two days, it expanded to approximately 500 symbols. And it is still there if the file is delivered to another person to open.

Has anyone seen anything like this?

Layer disabled: too large

switch – Layer 2 of VLAN broadcast filtering? (Access ports on Cisco SG-500-52MP)

This is the first time I set up VLAN on a Cisco, so I probably made some mistakes, I would appreciate some suggestions. Thanks in advance.

As I understand about switches, when a Layer 2 broadcast packet is received, the switch must send it to all other ports within the broadcast domain, except the source port.

Without VLANs, the broadcast domain must be all physical ports. If those ports are connected to switches, those switches in turn would also replicate it to all other ports.

In a VLAN configuration, the broadcast domain is all physical ports that are "configured" to use that VLAN.
Note: Technically "interfaces" … and "tagging" are correct terminology, but I am being careful not to use words that can mean different things with different providers.

So, if my understanding is correct, then something seems to be preventing transmission traffic from being sent to all other ports. I have used a packet sniffer on the router to determine this. There are no packets received on the specific interface with a destination mac address of ff: ff: ff: ff: ff: ff: ff: ff.

My physical configuration is this:

Cisco SG500-52MP switch. Three ports are configured for VLAN # 14.
In the Cisco language, these are configured as "Access ports." As I understand it, it means that all incoming traffic is labeled on VLAN 14. All outgoing traffic is not labeled. When I say "tagged," I mean that the VLAN ID is added to the package, and unlabeled means that it is stripped.

Of those three ports, one connects to a PC, one to a controller and one to the Mikrotik router. The interface on the router has no VLAN settings (the ports are not bridged) and it works like a real router.

On the Cisco switch, when I do "show vlan"show me:

Vlan Tagged Ports UnTagged Ports
---- ------------ --------------
1 gi1/23-35,gi1/30-47,gi1/49-52,po1-32
14 gi1/27-29
32 gi1/49 gi1/1-22,gi1/48
200 gi1/50 gi1/26

Interfaces 27-29 have the same switching port configuration.
show the interfaces switchport ge1 / 1/27

Added by: D-Default, S-Static, G-GVRP, R-Radius Assigned VLAN, T-Guest VLAN, V-Voice VLAN
Port : gi1/27
Port Mode: Access 
Gvrp Status: disabled
Ingress Filtering: true
Acceptable Frame Type: admitAll
Ingress UnTagged VLAN ( NATIVE ): 14

Port is member in: 

Vlan               Name               Egress rule     Added by     
---- -------------------------------- ----------- ---------------- 
 14                BMS                 Untagged          S         

Forbidden VLANS: 
Vlan               Name               
---- -------------------------------- 

Classification rules: 

Protocol based VLANs:                                 
  Group ID   Vlan ID 
------------ ------- 

Mac based VLANs: 
  Group ID   Vlan ID 
------------ -------

I realize that it says "Inbound filtering: true." I understand that packets should not be filtered without a VLAN identifier (VLan # 1 in Cisco language), as it is an access port.

Also, the version …
show version

SW version ( date  26-Sep-2019 time  20:01:21 )
Boot version ( date  21-Jul-2013 time  15:12:21 )
HW version    V03

When I use the router packet sniffer tool on the specific port for this VLAN, I can only see the multicast packets between the switch and the router … and a single router discovery packet. It shows very clearly that packets with a VLAN ID are not received, which is what I expect.
Passive results of the Sniff / Winbox package

When I listen to a packet while trying to ping the static IP of the controller host, I can see that ARP requests leave the correct router, but nothing is received.
Sniff / Winbox ARP results

Earlier I took another small Mikrotik and connected it to one of the three ports on Cisco and made a packet capture at the receiving end. ARP packets failed to pass.

So this tells me that Cisco is filtering them … but why? I must add that when I configured these switches, I performed a full factory reset and then copied / pasted the configuration commands I had saved. This is my way of discarding any type of typo or referring to the incorrect interface by accident. I know that these switches for small businesses have some nuances compared to catalysts, and something tells me that I am being bitten by one of them.

Add an LDAP layer to a website

Website A wants to obtain a read-only LDAP connection with website B, which is php / mysql / shared hosting.

I can see that PHP can make calls to LDAP systems, but can it pretend to be one and generate appropriate responses?

Object-oriented: when is it appropriate to introduce a new abstraction layer in a class hierarchy?

Suppose I am creating a game played on a 2D coordinate grid. The game has 3 types of enemies that move in different ways:

  • Drunkard: moves using type 1.
  • Mummy: moves using type 1 movement, except when it is close to the main character, in which you will use type 2 movement.
  • Ninja: moves using type 3 movement.

These are the ideas that came to mind when organizing the class hierarchy:

Proposal 1

A single base class from where each enemy derives from:

abstract class Enemy:
    public show()   // Called each game tick
    public update() // Called each game tick
    abstract move() // Called in update

class Drunkard extends Enemy:
    private move() // Type 1 movement

class Mummy extends Enemy:
    private move() // Type 1 + type 2 movement

class Ninja extends Enemy:
    private move() // Type 3 movement


  • Viola DRY since the code is not shared between Drunkard Y Mummy.

Proposal 2

Same as proposal 1 but Enemy does more:

abstract class Enemy:
    public show()            // Called each game tick
    public update()          // Called each game tick
    private move()           // Tries alternateMove, if unsuccessful, perform type 1 movement
    abstract alternateMove() // Returns a boolean

class Drunkard extends Enemy:
    private alternateMove(): return False

class Mummy extends Enemy:
    private alternateMove() // Type 2 movement if in range, otherwise return false

class Ninja extends Enemy:
    private alternateMove() // Type 3 movement and return true


  • Ninja It doesn't really just have one movement, so it doesn't really have an "alternative movement." So, Enemy It is a poor representation of all enemies.

Proposal 3

Expanding proposal 2 with a MovementPlanEnemy.

abstract class Enemy:
    public show()   // Called each game tick
    public update() // Called each game tick
    abstract move() // Called in update

class MovementPlanEnemy:
    private move() // Type 1 movement
    abstract alternateMove()

class Drunkard:
    private alternateMove() // Return false

class Mummy:
    private alternateMove() // Tries type 2 movement

class Ninja:
    private move() // Type 3 movement


  • Ugly and possibly oversized.


Proposition 1 is simple but has a lower level of abstraction. Proposition 3 is complex but has a higher level of abstraction.

I understand all about the "composition about inheritance" and how it can solve this whole disaster. However, I have to implement this for a school project that requires us to use inheritance. So, given this restriction, what would be the best way to organize this class hierarchy? Is this just an example of why inheritance is inherently bad?

I guess since my restriction is that I have to use inheritance, I'm really asking the broader question: In general, when is it appropriate to introduce a new abstraction layer at the expense of complicating the architecture of the program?

Edit: updated title.

exceptions: handling errors in the Nest service layer

I would like to create a REST API with NestJs. But I want to add GraphQL as another higher level layer later. So, for starters, I have the basic layer controller, the service and the TypeORM repository. Suppose you want to update a user's username by id. The controller path could be

PATCH /users/:id/username

Two problems may arise in the service or repository layer:

  • User ID may not exist
  • Username already exist

The basic flow of this operation would be

  • Get the user by id
  • Handle error if the user does not exist
  • Check if the username already exists
  • Handle error if username already exists
  • Update the user's username

I'm thinking about how I should handle those mistakes. I could throw exceptions immediately based on this concept

NestJs provides some ready-to-use exceptions that I can use

The problem is that I don't think I should throw HTTP exceptions in my service layer. They must be thrown into the logic of my controller. So what is a common approach to those mistakes?

  • I must return? undefined instead of an updated user? The controller would not know which part failed.
  • Should I create my own exceptions by extending Error and throw them away?
  • Due to the fact that exceptions come with poor performance if the return type of the function is something like ?

photoshop – PD: Why not solid color in my new layer?

I have approximately 20 layers in an .psd file. Suddenly, when I create a new layer, I can't get a solid color, which means I use 100% opacity, but still get a very light color.

The red color in the image is what I get when creating a new layer and adding a color, the only thing I do. I have tried all kinds of things but I have not succeeded.

After the tests I get the right color when I create a rectangle but still what appears in the image when I use the brush!

The result.

php: Does anyone know how to get data from 3 tables with the coffecode data layer?

Thank you for contributing to Stack Overflow in Portuguese!

  • Make sure answer the question. Enter details about your solution and share what you have discovered.

But avoid

  • Request clarification or details about other answers.
  • Make statements based only on your opinion; punctual references or previous experiences.

For more information, see our tips on how to write good answers.

Design patterns: on what layer should I do my validation and how to inform the user of meaningful messages?

I currently have several layers in my system. I have a container around the database that handles the basic interaction with the database. Then, I have a service at the top that handles business logic and then calls the database containers as needed.

For example:

class UsersDB():
    def create(self, user_data):
        # Create user here
        return insert_status

    def confirm_user(self, token):
        if token_date < today_start:
            # Token expired, return False
            return False

        if not self.collection.exists({'token':token}):
            # Token doesn't exist
            return False

        # Confirm user account
        self.collection.update_one({}, {})

class UserService():
    def __init__():
         self.users_db = UsersDb()

    def create(self, user_data):
        if self.users_db.exists(user_data('email')):
              self._set_error(status=409, error='This user already exists.')
              return False

        if self.users_db.create(user_data):
              AuditService().add_event('registration', ....)
              self._set_error(status=500, message='Unable to create user.'
              return False

Now, in UsersDB.confirm_user (), if this method fails, it is impossible to determine why the method call fails, either due to the non-existing token or the expired token. However, this is a validation that I do not necessarily want to mix with business logic. I prefer to keep the validation inside the UsersDB wrapper.

Similarly, if I wanted to do a more advanced validation on the user_data parameter passed to UserService.create (), then I would have to do it at the UserService level to get meaningful comments for the user.

Should I separate the validation of the UsersDB object and do the validation within the UserService methods before moving on to the UsersDB object, or is there a problem with the design that needs to be addressed?

Ideally, I would like to keep the validation out of UserService so that it only handles calls to other services, but I'm not sure if it's a good idea.