LWJGL: Not understanding how indices and texturePositions are mapped to vertices

I’ve been following a tutorial on opengl and lwjgl (lwjglgamedev.gitbooks.io/3d-game-development-with-lwjgl) and at some point three different lists are introduced without really explaining how they interact with each other. Can someone explain how it works?

    float[] positions = new float[] {     -0.5f,  0.5f,  0.5f, // V0     -0.5f, -0.5f,  0.5f, // V1      0.5f, -0.5f,  0.5f, // V2      0.5f,  0.5f,  0.5f, // V3     -0.5f,  0.5f, -0.5f, // V4      0.5f,  0.5f, -0.5f, // V5     -0.5f, -0.5f, -0.5f, // V6      0.5f, -0.5f, -0.5f, // V7          // For text coords in top face     -0.5f, 0.5f, -0.5f, // V8: V4 repeated      0.5f, 0.5f, -0.5f, // V9: V5 repeated     -0.5f, 0.5f,  0.5f, // V10: V0 repeated      0.5f, 0.5f,  0.5f, // V11: V3 repeated      // For text coords in right face     0.5f,  0.5f, 0.5f, // V12: V3 repeated     0.5f, -0.5f, 0.5f, // V13: V2 repeated      // For text coords in left face     -0.5f,  0.5f, 0.5f, // V14: V0 repeated     -0.5f, -0.5f, 0.5f, // V15: V1 repeated      // For text coords in bottom face     -0.5f, -0.5f, -0.5f, // V16: V6 repeated      0.5f, -0.5f, -0.5f, // V17: V7 repeated     -0.5f, -0.5f,  0.5f, // V18: V1 repeated      0.5f, -0.5f,  0.5f, // V19: V2 repeated };  float[] texturePos = new float[]{     // Front Face     0.0f, 0.0f,     0.0f, 0.5f,     0.5f, 0.5f,     0.5f, 0.0f,          // Behind Face     0.0f, 0.0f,     0.5f, 0.0f,     0.0f, 0.5f,     0.5f, 0.5f,          // Top Face     0.0f, 0.5f,     0.5f, 0.5f,     0.0f, 1.0f,     0.5f, 1.0f,      // Right Face     0.0f, 0.0f,     0.0f, 0.5f,      // Left Face     0.5f, 0.0f,     0.5f, 0.5f,      // Bottom Face     0.5f, 0.0f,     1.0f, 0.0f,     0.5f, 0.5f,     1.0f, 0.5f, };  int[] indexes = new int[]{     0,  1,  3,  3,  1,  2,  // Front face     8,  10, 11, 9,  8,  11, // Top Face     12, 13, 7,  5,  12, 7,  // Right face     14, 15, 6,  4,  14, 6,  // Left face     16, 18, 19, 17, 16, 19, // Bottom face     4,  6,  7,  5,  4,  7   // Back face }; 

For example, why are there only 2 vertices in the Right and Left face of the texture coords? Also, I’ve noticed that the texture I’m drawing on a cube is insideout on those faces. Could that be the reason?

Thanks in advance.

Understanding CPU time to measure workload

I want to understand the workload of my stored procedures, which run on an instance with many other databases. Among other things I would like to know if I had my own server how many CPU core would I need and how much memory will be enough.

Say I have a server with one core. If I turn on "statistics time" and get 1000 •60•60 = 3600000 ms as CPU time does that mean that the core was occupied 100% for one hour. Is this a valid way to measure e.g. how many cores I need?

How can I measure how much memory is needed for my workload?

Understanding postgres query planner behaviour on gin index

need your expert opinion on index usage and query planner behaviour.

\d orders                                          Partitioned table "public.orders"            Column            |           Type           | Collation | Nullable |                   Default -----------------------------+--------------------------+-----------+----------+----------------------------------------------  oid                         | character varying        |           | not null |  user_id                     | character varying        |           | not null |  tags                        | text[]                   |           | not null |  category                    | character varying        |           |          |  description                 | character varying        |           |          |  order_timestamp             | timestamp with time zone |           | not null |  ..... Partition key: RANGE (order_timestamp) Indexes:     "orders_uid_country_ot_idx" btree (user_id, country, order_timestamp)     "orders_uid_country_cat_ot_idx" btree (user_id, country, category, order_timestamp desc)     "orders_uid_country_tag_gin_idx" gin (user_id, country, tags) WITH (fastupdate=off)     "orders_uid_oid_ot_key" UNIQUE CONSTRAINT, btree (user_id, oid, order_timestamp) 

I have observed the following behaviour based on query param when I run the following query, select * from orders where user_id = 'u1' and country = 'c1' and tags && '{t1}' and order_timestamp >= '2021-01-01 00:00:00+00' and order_timestamp < '2021-03-25 05:45:47+00' order by order_timestamp desc limit 10 offset 0

case 1: for records with t1 tags where t1 tags occupies 99% of the records for user u1, 1st index orders_uid_country_ot_idx is picked up.

Limit  (cost=0.70..88.97 rows=21 width=712) (actual time=1.967..12.608 rows=21 loops=1)    ->  Index Scan Backward using orders_y2021_jan_to_uid_country_ot_idx on orders_y2021_jan_to_jun orders  (cost=0.70..1232.35 rows=293 width=712) (actual time=1.966..12.604 rows=21 loops=1)          Index Cond: (((user_id)::text = 'u1'::text) AND ((country)::text = 'c1'::text) AND (order_timestamp >= '2021-01-01 00:00:00+00'::timestamp with time zone) AND (order_timestamp < '2021-03-25 05:45:47+00'::timestamp with time zone))          Filter: (tags && '{t1}'::text[])  Planning Time: 0.194 ms  Execution Time: 12.628 ms 

case 2: But when I query for tags value t2 with something like tags && '{t2}' and it is present in 0 to <3% of records for a user, gin index is picked up.

Limit  (cost=108.36..108.38 rows=7 width=712) (actual time=37.822..37.824 rows=0 loops=1)    ->  Sort  (cost=108.36..108.38 rows=7 width=712) (actual time=37.820..37.821 rows=0 loops=1)          Sort Key: orders.order_timestamp DESC          Sort Method: quicksort  Memory: 25kB          ->  Bitmap Heap Scan on orders_y2021_jan_to_jun orders  (cost=76.10..108.26 rows=7 width=712) (actual time=37.815..37.816 rows=0 loops=1)                Recheck Cond: (((user_id)::text = 'u1'::text) AND ((country)::text = 'ID'::text) AND (tags && '{t2}'::text[]))                Filter: ((order_timestamp >= '2021-01-01 00:00:00+00'::timestamp with time zone) AND (order_timestamp < '2021-03-25 05:45:47+00'::timestamp with time zone))                ->  Bitmap Index Scan on orders_y2021_jan_to_uid_country_tag_gin_idx  (cost=0.00..76.10 rows=8 width=0) (actual time=37.812..37.812 rows=0 loops=1)                      Index Cond: (((user_id)::text = 'u1'::text) AND ((country)::text = 'c1'::text) AND (tags && '{t2}'::text[]))  Planning Time: 0.190 ms  Execution Time: 37.935 ms 
  1. Is this because the query planner identifies that since 99% of the records is covered in case 1, it skips the gin index and directly uses the 1st index? If so, does postgres identifies it based on the stats?

  2. Before gin index creation, when 1st index is picked for case 2, performance was very bad since index access range is high. i.e number of records that satisfies the condition of user id, country and time column is very high. gin index improved it but i’m curious to understand how postgres chooses it selectively.

  3. orders_uid_country_cat_ot_idx was added to support filter by category since when gin index was used when filtered by just category or by both category and tags, the performance was bad compared to when the btree index of user_id, country, category, order_timestamp is picked up . I expected gin index to work well for all the combination of category and tags filter. What could be the reason? The table contains millions of rows

understanding how google adwords headlines / descriptions work

It says I need five headlines. If I try to add less I get a "Too few elements in the collection" error. Does Google switch out between the headlines? What if I’d rather it just use one headline for all ads? I tried to copy / paste the same headline 5x and got an error about duplicates existing.

I looked at another existant campaign on my website and that campaign appears to have 3x duplicate headlines (not 5x). Is that campaign just kinda being grandfathered in?

And what if I wanted certain headlines to go with certain descriptions? From the UI there doesn’t appear to be a way to link the two.

Finally, does the order of the headlines / descriptions matter?

Any ideas?

Understanding Connection To Proxy Ratio

I am watching looplines video on safely scraping google in 2020 and am having a fundamental misunderstanding on the terminology.

It says that there should be one connection for every 5 proxies, or that the connection ratio can vary.

How can more than 1 IP address make a single connection? When a page loads does it not load from a single IP?

How would it be possible for 50 IP addresses to load one connection?

What does “connection” mean in this case?

D&D 3.5e understanding attacks of opportunity

I am currently assisting in the dming of the game as far as understanding rules. in the last game session we played i experianced a AoO for the first time as did the actual dm. A pc(1) was engaged in combat with an enemy another pc(2) standing next to him moved away from that fight does that provoke an attack of opportunity from the enemy. also i understand an AoO to be a free attack so does that mean it doesnt have to roll hit? then one last question in the aforementioned situation if an enemy is engaged with pc(1) and pc(2) attacks enemy does the enemy shift target to pc(2) and does the pc(2) take any negatives for attacking the enemy via melee like a ranged attack would.

thank you for any feed back

Understanding mod_expires apache module [closed]

Working with htaccess is a new capitol for me. I have already read about mod_expires here https://httpd.apache.org/docs/current/mod/mod_expires.htm, but I’m stil confused.

I have the next code from stack overflow:

ExpiresActive On ExpiresByType image/jpg "access 1 year" ExpiresByType image/jpeg "access 1 year" ExpiresByType image/gif "access 1 year" ExpiresByType image/png "access 1 year" ExpiresByType text/css "access 1 month" ExpiresByType text/html "access 1 month" ExpiresByType application/pdf "access 1 month" ExpiresByType text/x-javascript "access 1 month" ExpiresByType image/x-icon "access 1 year" ExpiresDefault "access plus 2 months" 

My questions are:

  1. I suppose the line ExpiresByType image/jpg "access 1 year" tells the client (browser) to download the file and keep it for one year. And when the client accesses the same page from my website, the jpg image won’t be downloaded from my website. It will be read from his computer (where the browser saved first time). After one year, the browser automatically deletes the file and, once the client access my website, it will download again, for another year. If the client cleans his browser history after 2 months, then the browser will download it again even if a year hasn’t passed. Do I miss something ?

  2. What cache availability should I set for each file type ? It depends on the file ? What should I consider when set the expiration time ?

  3. What’s the difference between "access 1 year" and "access plus 1 year" ?

  4. Does ExpiresDefault rule works for php files too ? I mean, if I have a contact.php file with some content and I modify the content of contact.php, because of ExpiresDefault rule, the content won’t change to the user ?

  5. Do search engine spiders listen for this cache rules or they download the files each time they crawling my website ?

  6. Is it true that ExpiresDefault is for the files I don’t set using ExpiresByType ? If the answer is yes, what are the other types ? What types of files are included here ?

  7. Do I understand correct that Header set Cache-Control "max-age=290304000, public" is the maximum time allowed for a file to be cached ? If the answer is yes, then means that "access 999 years" will take no effect as long 290304000 is the limit. True or false ?

Understanding the mechanics of a satyr’s mirthful leap

I apologize if this question has been asked in this form or another, but I am still having an issue calculating how to utilize a satyr’s mirthful leap, and how it would affect the character moving forward, focusing on the math and stats. For this question, I’ll use the DndBeyond stat block’s 12 Strength as a fair basis and perfect rolls for maximum distance.

The satyr’s mirthful leap is stated as follows:

Whenever you make a long or high jump, you can roll a d8 and add the number rolled to the number of feet you cover, even when making a standing jump. This extra distance costs movement as normal.

while the calculation for long jump states:

When you make a long jump, you cover a number of feet up to your Strength score if you move at least 10 feet on foot immediately before the jump. When you make a standing long jump, you can leap only half that distance. Either way, each foot you clear on the jump costs a foot of movement.

So adding everything together as I understand it, a satyr can either clear a 20ft chasm with a 10 ft leap (12ft for strength and 8 for their ability), leaving them 5 ft extra in case something goes wrong, OR can clear a 13ft chasm ([12/2]+8) without a running start. This means the satyr has the ability to use nearly all his movement in one long jump, correct?

If that is the case, then:

  1. If your satyr had to cross a terrain during 1 round by leaping from platform to platform (say to cross a river, or avoid the many pit traps in a sealed hallway), how would the mirthful leap be applied? Without a running start, would each leap be up to 13ft? Would that only apply to the first jump? Or would the mirthful leap of the prior jump be considered a running start for the next, allowing them to jump to the next platform up to 20ft away?
  2. Would this not make modifiers like Boots of Striding (tripling jumping distance up to character speed) useless?

Understanding the importance of Gunicorn and Nginx for Django web development

I’m entirely uninitiated to the world of web development, and only have a tentative grasp on Django and web development through the test server it works through.

From the guide I’m reading, the author turns to using Nginx once he starts working on site deployment, because Django is "not designed for real-life workloads." What does that mean, and why doesn’t it? In terms of justification for using Gunicorn, the author remarks:

Do you know why the Django mascot is a pony? The story is that Django comes with so many things you want: an ORM, all sorts of middleware, the admin site…​ "What else do you want, a pony?" Well, Gunicorn stands for "Green Unicorn", which I guess is what you’d want next if you already had a pony…​

Well and good, but I don’t really know what the two are doing for the server. I know for web developers this is like asking what multiplication is to a maths professor, so please excuse the naivety. In your please keep in mind I have almost no knowledge of web development other than what I’ve thus far learned from this guide, doing my best to understand as much as I can for the previously entirely uninitiated (I’m from a computational programming background).

Understanding Logging Priority & Options in Oracle DB

From my understanding once we switch on database logging, the entire DB goes into logging mode and generates redo logs.

I want to categorically exclude/include some tables/tablespaces from this logging as they are not required for recovery incase of failures.

Is there any priority on the logging options and to exclude certain tables/tablespaces from logging so as to reduce some of the traffic going to redo logs.