2.5D z-buffering doesn’t work properly

I’m currently making a 2.5D FPS game in Java. And because I want to make more diverse maps I made taller walls but I have no idea how to change z-buffer code to handle walls with different heights. The taller blocks are using the same renderwall method as the smaller ones.

Weird z-buffering bug

As you can see my problem is that the smaller walls are covering the taller walls.

public void renderWall1(double x0, double y0, double x1, double y1, int tex, double xt0, double xt1, double height1) {

double xc0 = ((x0 - 0.5) - xCam) * 2; double yc0 = ((y0 - 0.5) - yCam) * 2; double xx0 = xc0 * rCos - yc0 * rSin; double u0 = ((-height1 - 0.5) - zCam1) * 2; double l0 = ((+0.5 - height1) - zCam1) * 2; double zz0 = yc0 * rCos + xc0 * rSin; double xc1 = ((x1 - 0.5) - xCam) * 2; double yc1 = ((y1 - 0.5) - yCam) * 2; double xx1 = xc1 * rCos - yc1 * rSin; double u1 = ((-height1 - 0.5) - zCam1) * 2; double l1 = ((+0.5 - height1) - zCam1) * 2; double zz1 = yc1 * rCos + xc1 * rSin;  xt0 *= size * 2; xt1 *= size * 2;  double zClip = 0.2;  if (zz0 < zClip && zz1 < zClip)     return;  if (zz0 < zClip) {     double p = (zClip - zz0) / (zz1 - zz0);     zz0 = zz0 + (zz1 - zz0) * p;     xx0 = xx0 + (xx1 - xx0) * p;     xt0 = xt0 + (xt1 - xt0) * p; }  if (zz1 < zClip) {     double p = (zClip - zz0) / (zz1 - zz0);     zz1 = zz0 + (zz1 - zz0) * p;     xx1 = xx0 + (xx1 - xx0) * p;     xt1 = xt0 + (xt1 - xt0) * p; }  double xPixel0 = xCenter - (xx0 / zz0 * fov); double xPixel1 = xCenter - (xx1 / zz1 * fov);  if (xPixel0 >= xPixel1)     return; int xp0 = (int) Math.ceil(xPixel0); int xp1 = (int) Math.ceil(xPixel1); if (xp0 < 0)     xp0 = 0; if (xp1 > width)     xp1 = width;  double yPixel00 = (u0 / zz0 * fov + yCenter); double yPixel01 = (l0 / zz0 * fov + yCenter); double yPixel10 = (u1 / zz1 * fov + yCenter); double yPixel11 = (l1 / zz1 * fov + yCenter);  double iz0 = 1 / zz0; double iz1 = 1 / zz1;  double iza = iz1 - iz0;  double ixt0 = xt0 * iz0; double ixta = xt1 * iz1 - ixt0; double iw = 1 / (xPixel1 - xPixel0);  for (int x = xp0; x < xp1; x++) {     double pr = (x - xPixel0) * iw;     double iz = iz0 + iza * pr;      int xTex = (int) ((ixt0 + ixta * pr) / iz);      double yPixel0 = yPixel00 + (yPixel10 - yPixel00) * pr - 0.5;     double yPixel1 = yPixel01 + (yPixel11 - yPixel01) * pr;      int yp0 = (int) Math.ceil(yPixel0);     int yp1 = (int) Math.ceil(yPixel1);     if (yp0 < 0)         yp0 = 0;     if (yp1 > height)         yp1 = height;      double ih = 1 / (yPixel1 - yPixel0);     for (int y = yp0; y < yp1; y++) {         double pry = (y - yPixel0) * ih;         int yTex = (int) (size * 2 * pry);          if (zBufferWall[x] > iz)             continue;          zBufferWall[x] = iz;          int color = Art.walls.pixels[((xTex) + (tex % size) * size * 2)                 + (yTex + tex / size * size * 2) * sheetSize];          if (color != 0xffff00ff) {             pixels[x + y * width] = color;             zBuffer[x + y * width] = 1 / iz * 4;         }     } } 

}

Why doesn’t my code fill in the augmented matrix properly?

I’m trying to input data from a training file. It is skipping the first row entirely.

    double** augmentMatrix(double** matrix, int dim) {   double** identityMatrix = CreateIdentityMatrix(dim, dim); //creates identity matrix    double** augmentedMatrix = (double**)malloc(sizeof(double*) * dim);      for (int row = 0; row < dim; row++) {         augmentedMatrix[row] = (double*)malloc(sizeof(double) * dim * 2);      } // attributes space    for(int row = 0; row < dim; row++) {     for(int col = 0; col < dim; col++) {       augmentedMatrix[row][col] = matrix[row][col]; // sets first part of augmented matrix to the matrix parameter's points     }     for(int col = dim; col < 2 * dim; col++) {       augmentedMatrix[row][col] = identityMatrix[row][col - dim]; //separates the identity matrix       }     }   printMatrix(augmentedMatrix, dim, dim * 2);   return augmentedMatrix; } 

Here is what it is outputting:

    0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0,  26.2, 84.8, 61.9, 58900.0, 51789.8, 0.0, 1.0, 0.0, 0.0, 0.0,  6493.8, 19487.8, 12220.3, 9864262.5, 12861241.2, 0.0, 0.0, 1.0, 0.0, 0.0,  21384.0, 70762.0, 55533.2, 57206075.0, 42298973.0, 0.0, 0.0, 0.0, 1.0, 0.0,  19713.0, 61172.0, 41552.0, 39621035.0, 38865313.0, 0.0, 0.0, 0.0, 0.0, 1.0, 

Here is the training data file:

    18.0, 55.0, 37.0, 33025.0, 35598.0,  26.2, 84.8, 61.9, 58900.0, 51789.8,  6493.8, 19487.8, 12220.3, 9864262.5, 12861241.2,  21384.0, 70762.0, 55533.2, 57206075.0, 42298973.0,  19713.0, 61172.0, 41552.0, 39621035.0, 38865313.0,  

18.04 Ubuntu does not shutdown properly on laptop

I have a Gigabyte p25x-v2 laptop which I have only upgraded SSD from 250 * 2 GB RAID to 1TB + 500GB.

Here are some more detailed specifications

  • CPU: i7-4810MQ
  • GPU: GTX 880M
  • RAM: 8 * 2 GB
  • SSD 1: Evo 860 mSATA 1TB
  • SSD 2: Evo 860 mSATA 500GB
  • HDD: 1TB

SSD 1 is used for Windows OS and SSD 2 is separately used for Ubuntu OS while HDD is used for data storage only.

Firmware for both SSDs and BIOS are up-to-date, secure boot option is off and I have tested on a complete mint condition of Ubuntu 18.04, but it still does not shut down and stays as shown below screenshot.

Screenshot

I have seen many laptop users with Windows + Ubuntu dual booting system having similar issue as mine, but the difference is that:

  1. I have two different OS installed on two different SSD as I mentioned earlier
  2. I have no re-boot issue, but shut down issue only.

This is really, really and really driving me crazy and I am eager to fix this issue…

It would have been easier if I got any sort of error message, but I am not getting any…

How to properly inject PriceResolverInterface to my module class

I am trying to inject via the constructor a \Magento\ConfigurableProduct\Pricing\Price\PriceResolverInterface

So that I can properly resolve configurable product prices, however whenever I add it, dependency injection fails unlike other classes.

e.g.

    public function __construct(         ProductRepositoryInterface $  productRepository,         CategoryRepositoryInterface $  categoryRepository,         LoggerInterface $  logger,         SearchCriteriaBuilderFactory $  searchCriteriaBuilderFactory,         CollectionFactory $  collectionFactory,         Product $  productModel,         Data $  helper,         \Magento\Framework\Filesystem\DirectoryList $  directoryList,         StoreManagerInterface $  storeManager,         \Magento\ConfigurableProduct\Model\Product\Type\Configurable $  configurableType,         State $  state,         PriceResolverInterface $  configurableRegularPrice     ) 

yields

PHP Fatal error:  Uncaught Error: Cannot instantiate interface Magento\ConfigurableProduct\Pricing\Price\PriceResolverInterface in /private/magento/2x/default/httpdocs/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:50 Stack trace: #0 /private/magento/2x/default/httpdocs/vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\Configu...') #1 /private/magento/2x/default/httpdocs/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(160): Magento\Framework\ObjectManager\ObjectManager->get('Magento\Configu...') #2 /private/magento/2x/default/httpdocs/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(246): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(Array, 'Magento\Configu...', NULL, 'configurableReg...', 'Vendor\Module...') #3 /private/magento/2x/default/httpdocs/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(34): Magento\Framework\ObjectManage in /private/magento/2x/default/httpdocs/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php on line 50 

I’ve tried injecting various different stuff from configurableproduct module and it keeps failing.

other things I’ve tried

\Magento\ConfigurableProduct\Pricing\Price\RegularPriceResolver

\Magento\ConfigurableProduct\Pricing\Price\FinalPriceResolver

Could someone explain to me why those classes won’t work with the normal constructor dependency injection system and what I need to do to get them to work?

THanks in advance

how to properly install and configure stubby on a ubuntu server 18.04

This is what I have done, according to this instructive, but it does not work in my localnet. What am I missing?

Install stubby on ubuntu server 18.04

sudo apt -y install stubby sudo systemctl status stubby active (running) 

Verify services:

sudo netstat -lnptu | grep stubby 

enter image description here

enter image description here

Edit stubby.yml and add IP server to listen and add only one DNS resolvers (rest comments):

sudo nano /etc/stubby/stubby.yml  listen_addresses:  - 127.0.0.1  - 0::1  - 192.168.0.10   #CloudFlare DNS over TLS servers  - address_data: 1.1.1.1    tls_auth_name: "cloudflare-dns.com"  - address_data: 1.0.0.1    tls_auth_name: "cloudflare-dns.com" 

Restart stubby:

 sudo systemctl restart stubby 

Aditional config:

a. netplan:

 nano /etc/netplan/config.yaml  network: version: 2  renderer: NetworkManager  ethernets:    eno0:     dhcp4: yes     dhcp6: no   eno1:     dhcp4: no     addresses: [192.168.0.10/24]   sudo netplan apply        sudo systemctl restart NetworkManager 

b. Internal isc-DHCP-Server and netcard eno1:

 DNS 127.0.0.1 192.168.0.10 

c. Open dns 53 and 853 to ip server firewall iptables

 dns="127.0.0.1 192.168.0.10"  for ip in $  dns; do    iptables -A INPUT -s $  ip -i eno1 -p udp -m multiport --sports 53,853 -m state --state ESTABLISHED -j ACCEPT    iptables -A OUTPUT -d $  ip -o eno1 -p udp -m multiport --dports 53,853 -m state --state ESTABLISHED,RELATED,NEW -j ACCEPT    iptables -A FORWARD -s 192.168.0.0/24 -i eno1 -p udp -m multiport --dports 53,853 -d $  ip -o eno0 -m state --state ESTABLISHED,RELATED,NEW -j ACCEPT  done 

Flowtype: How to properly use $ObjMap for making all functions chainable?

I’m working on some JS package and I want to provide separated flow type definitions as index.js.flow because internal behavior is slightly different.

I have this function for create component definition

function defineComponent(name, createFunc); 

createFunc is function which grabs elements and returns object containing particular user defined actions upon that component

so you can call defineComponent in this manner:

const loginForm = defineComponent("login form", () => {   ...   ...   return {     fillUsername: () => { ...doesn't matter what is return type... },     fillPassword: () => { ...doesn't matter what is return type... }   }; }); 

and those actions should be chainable, but I don’t want to burden user with always mentioning return type within each user defined action. So final chain should look like this:

loginForm   .fillUsername()   .fillPassword(). 

So internally defineComponent will wrap each user defined action like this:

function defineComponent(..., createFunc) {   const actions = createFunc(...);    return actions.map(action => {     return (...args) => {       action(...args);       return actions;     }   }) } 

I already tried this (my whole testing code):

type ComponentType<T> = $  ObjMap<T, <V>((V) => any) => V => ComponentType<T>>;  declare function defineComponent<T>(   name: string,   createFunc: () => T ): ComponentType<T>;  const Component = defineComponent("foo", () => {   return {     fooAction: () => {},     barAction: () => {}   }; });  Component.fooAction().barAction() 

I proceeds with flow’s No errors! but flow is showing no errors also when I do something like

Component.fooAction.barAction() 

And also VS Code provides no autocompletion above that :/

Thanks!

Css files not loading properly in sharepoint server 2019, only in sharepoint online

I have some custom html e js files that i am using in PDPs, (pages) of sharepoint, but the css its not being loaded.

I importing the files like this:

<link rel="stylesheet" type="text/css" href="../SiteAssets/js/SlickGrid/Css/slick.grid.css"/> <link rel="stylesheet" type="text/css" href="../SiteAssets/js/SlickGrid/Css/slick.pager.css"/> <link rel="stylesheet" type="text/css" href="../SiteAssets/js/SlickGrid/css/jquery-ui.min.css"/> <link rel="stylesheet" type="text/css" href="../SiteAssets/js/SlickGrid/Css/examples.css"/> <link rel="stylesheet" type="text/css" href="../SiteAssets/js/SlickGrid/Css/slick.columnpicker.css"/> <link rel="stylesheet" type="text/css" href="../SiteAssets/js/PDP/vendor/bootstrap/css/bootstrap.min.css"/> <link rel="stylesheet"type="text/css" href="../SiteAssets/Js/Bootstrap/startbootstrap/vendor/font-awesome/css/font-awesome.min.css"/> 

The css files are loaded but not “executed”. However when a put some css code from a external address (cdn) the style works properly.

I used this files in sharepoint online and always works fine. What am my missing when doing this in sharepoint server 2019?

Ubuntu not working properly after install dual boot

I downloaded ubuntu 18.04 LTS and installed it “alongside windows 10”. The installation works fine. I remove the installation media, restart and choose Ubuntu in GRUB.

Once I get in to ubuntu my resolution is 1024 x 576 or something windows popping up are not visible at first. I have to drag my mouse over windows to reveal parts of them. I can’t change resolution in display settings etc. On top of this it is really slow.

What could be the problem?

New Ubuntu Install on flashdrive not booting properly

Due to various reason, I have been in need to install Ubuntu on a thumb drive. I have been trying for the last few days or so to install Ubuntu (Not the “LIVE CD” ) on a flashdrive. Everytime I try to boot, I get either a) an error from my computer’s bios saying that it is not a bootable drive; b) a frozen purple or black screen; c) I get to the GRUB menu and when I try to get to login, it freezes midway; or d) I login and the entire thing freezes for what feels like an eternity only to eventually get up and come back after a minute and find the thing is back at the login screen.

I have reinstalled Ubuntu various ways; I have attempted repairing the installs; I have looked high and low. I don’t know what is happening. Can someone please help me! I am very new to Linux, and I am completely lost as to what is going on. Here are some technical specs of what I use:

  • 64GB flashdrive (USB 2.0)
  • Dell Optiplex 990
    • i7 2600
    • 8GB RAM
    • AMD RADEON HD 6***(No idea what it is after that)

Please help. I’m begging.