Fourier coefficient of $\frac{1}{5 + 4\cos(x)}$ wrong

I’ve been trying to use Mathematica to compute the Fourier coefficient of

$ $ f(x) = \frac{1}{5 + 4\cos(x)}, $ $ which is a $ 2\pi$ periodic function. Inputting

FullSimplify[  FourierCoefficient[1/(5 + 4 Cos[x]), x, n,    FourierParameters -> {1, 1},    Assumptions -> {x \[Element] Reals, n \[Element] Integers}]] 

I get as an output

-(1/3) (-2)^Abs[n]

This is clearly wrong as the Fourier coefficient $ f$ , it being continuous and periodic, should decay with $ n$ , which the output from Mathematica does not give.

Any insight into why this is happening would be appreciated.

Any ideas on why when I put a list of category links in a dropdown list using tags the links are going to the wrong url?

Desktop version is providing the correct url for example: http://test.local/test/category/featured/ but the mobile version is not providing the correct url: http://test.local/test/featured/ it’s dropping the /category/

Here is my desktop version of code:

<div class="category-filter full">         <span class="filter-text"><i class="far fa-filter"></i> <?php esc_html_e( 'Filter by:', 'test-wp' ); ?></span>         <ul class="category-list">             <?php              // only display "Featured" if a Featured post is present in the blog                 $  query = new WP_Query(array(                     'post_type' => 'post',                     'field' => 'slug',                     'category_name' => 'featured',                     'ignore_sticky_posts'    => 1,                 ));                 if( $  query->have_posts() ){                     echo '<li><a href="'. get_site_url() .'/category/featured/">Featured</a></li>';                 }             wp_reset_postdata(); // Restore original Post Data             ?>             <?php                  foreach ( $  terms as $  term ) {                     printf( '<li><a href="%1$  s">%2$  s</a></li>',                         esc_url( get_category_link( $  term->term_id ) ),                         esc_html( $  term->name )                     );                 }             ?>         </ul>     </div> 

And here is my mobile version of code:

<div class="category-filter mobile">         <select id="custom-select" onchange="location = this.value;" style="outline:none;border:1px solid #777;font-size:20px;height:30px;color:#777;">             <?php                  foreach ( $  terms as $  term ) {                     printf( '<option><a href="%1$  s">%2$  s</a></option>',                         esc_url( get_category_link( $  term->term_id ) ),                         esc_html( $  term->name )                     );                 }             ?>         </select>     </div> 

Configuration error: Error: Could not alloc node id at 172.xx.xx.2 port 1186: Connection done from wrong host ip 172.xx.x.4

Im running in datanode 2 ndb_restorebut it get me error.

[root@a5aabaf20dc3 /]# ndb_restore --ndb-connectstring=172.xx.xx.2:1186 \ >                    --nodeid=2 --backupid=1 \ >                    --backup_path=/var/lib/mysql-cluster/BACKUP/BACKUP-1 \ >                    --restore_data --disable-indexes Nodeid = 2 Backup Id = 1 backup path = /var/lib/mysql-cluster/BACKUP/BACKUP-1 Configuration error: Error: Could not alloc node id at 172.xx.xx.2 port 1186: Connection done from wrong host ip 172.xx.x.4. 

also tried --ndb-connectstring "nodeid=2,172.xx.xx.2:1186" and with out port as well as with out --ndb-connectstring at all. nothing made it better

Cluster Configuration --------------------- [ndbd(NDB)] 4 node(s) id=2    @172.xx.xx.4  (mysql-8.0.21 ndb-8.0.21, Nodegroup: 0, *) id=3    @172.xx.xx.3  (mysql-8.0.21 ndb-8.0.21, Nodegroup: 0) id=4    @172.xx.xx.8  (mysql-8.0.21 ndb-8.0.21, Nodegroup: 1) id=5    @172.xx.x.9  (mysql-8.0.21 ndb-8.0.21, Nodegroup: 1)  [ndb_mgmd(MGM)] 1 node(s) id=1    @172.xx.xx.2  (mysql-8.0.21 ndb-8.0.21)  [mysqld(API)]   2 node(s) id=101  @172.xx.xx.5  (mysql-8.0.21 ndb-8.0.21) id=102 (@172.xx.xx.6  (mysql-8.0.21 ndb-8.0.21) 

anyone have idea whats wrong?

SQL Server 2017 – CU25 – sp_pkeys – Wrong order

After our customers have installed CU25 there is a problem with the stored procedure sp_pkeys. It may now return the wrong order if a primary key has multiple columns.

It can be tracked down in the code itself. This is the 2017 CU25 variant:

create procedure sys.sp_pkeys (     @table_name      sysname,     @table_owner     sysname = null,     @table_qualifier sysname = null ) as     declare @table_id           int     -- quotename() returns up to 258 chars     declare @full_table_name    nvarchar(517) -- 258 + 1 + 258          if @table_qualifier is not null     begin         if db_name() <> @table_qualifier         begin   -- If qualifier doesn't match current database             raiserror (15250, -1,-1)             return         end     end          if @table_owner is null     begin   -- If unqualified table name         select @full_table_name = quotename(@table_name)     end     else     begin   -- Qualified table name         if @table_owner = ''         begin   -- If empty owner name             select @full_table_name = quotename(@table_owner)         end         else         begin             select @full_table_name = quotename(@table_owner) + '.' + quotename(@table_name)         end     end          select @table_id = object_id(@full_table_name)          select         TABLE_QUALIFIER = convert(sysname,db_name()),         TABLE_OWNER = convert(sysname,schema_name(o.schema_id)),         TABLE_NAME = convert(sysname,o.name),         COLUMN_NAME = convert(sysname,c.name),         KEY_SEQ = (SELECT convert(smallint, index_column_id)                              FROM sys.index_columns                               WHERE object_id = @table_id AND index_id = i.index_id and column_id = c.column_id),         PK_NAME = convert(sysname,k.name)     from         sys.indexes i,         sys.all_columns c,         sys.all_objects o,         sys.key_constraints k     where         o.object_id = @table_id and         o.object_id = c.object_id and         o.object_id = i.object_id and         k.parent_object_id = o.object_id and          k.unique_index_id = i.index_id and          i.is_primary_key = 1 and               c.column_id IN                (SELECT column_id                FROM sys.index_columns                WHERE object_id = @table_id AND index_id = i.index_id)     order by 1, 2, 3, 5 

And this is the SQL Server 2017 CU24 and SQL Server 2019 variant:

create procedure sys.sp_pkeys   (       @table_name      sysname,       @table_owner     sysname = null,       @table_qualifier sysname = null   )   as       declare @table_id           int       -- quotename() returns up to 258 chars       declare @full_table_name    nvarchar(517) -- 258 + 1 + 258          if @table_qualifier is not null       begin           if db_name() <> @table_qualifier           begin   -- If qualifier doesn't match current database               raiserror (15250, -1,-1)               return           end       end          if @table_owner is null       begin   -- If unqualified table name           select @full_table_name = quotename(@table_name)       end       else       begin   -- Qualified table name           if @table_owner = ''           begin   -- If empty owner name               select @full_table_name = quotename(@table_owner)           end           else           begin               select @full_table_name = quotename(@table_owner) + '.' + quotename(@table_name)           end       end          select @table_id = object_id(@full_table_name)          select           TABLE_QUALIFIER = convert(sysname,db_name()),           TABLE_OWNER = convert(sysname,schema_name(o.schema_id)),           TABLE_NAME = convert(sysname,o.name),           COLUMN_NAME = convert(sysname,c.name),           KEY_SEQ = convert (smallint,               case                   when c.name = index_col(@full_table_name, i.index_id,  1) then 1                   when c.name = index_col(@full_table_name, i.index_id,  2) then 2                   when c.name = index_col(@full_table_name, i.index_id,  3) then 3                   when c.name = index_col(@full_table_name, i.index_id,  4) then 4                   when c.name = index_col(@full_table_name, i.index_id,  5) then 5                   when c.name = index_col(@full_table_name, i.index_id,  6) then 6                   when c.name = index_col(@full_table_name, i.index_id,  7) then 7                   when c.name = index_col(@full_table_name, i.index_id,  8) then 8                   when c.name = index_col(@full_table_name, i.index_id,  9) then 9                   when c.name = index_col(@full_table_name, i.index_id, 10) then 10                   when c.name = index_col(@full_table_name, i.index_id, 11) then 11                   when c.name = index_col(@full_table_name, i.index_id, 12) then 12                   when c.name = index_col(@full_table_name, i.index_id, 13) then 13                   when c.name = index_col(@full_table_name, i.index_id, 14) then 14                   when c.name = index_col(@full_table_name, i.index_id, 15) then 15                   when c.name = index_col(@full_table_name, i.index_id, 16) then 16               end),           PK_NAME = convert(sysname,k.name)       from           sys.indexes i,           sys.all_columns c,           sys.all_objects o,           sys.key_constraints k       where           o.object_id = @table_id and           o.object_id = c.object_id and           o.object_id = i.object_id and           k.parent_object_id = o.object_id and            k.unique_index_id = i.index_id and            i.is_primary_key = 1 and           (c.name = index_col (@full_table_name, i.index_id,  1) or            c.name = index_col (@full_table_name, i.index_id,  2) or            c.name = index_col (@full_table_name, i.index_id,  3) or            c.name = index_col (@full_table_name, i.index_id,  4) or            c.name = index_col (@full_table_name, i.index_id,  5) or            c.name = index_col (@full_table_name, i.index_id,  6) or            c.name = index_col (@full_table_name, i.index_id,  7) or            c.name = index_col (@full_table_name, i.index_id,  8) or            c.name = index_col (@full_table_name, i.index_id,  9) or            c.name = index_col (@full_table_name, i.index_id, 10) or            c.name = index_col (@full_table_name, i.index_id, 11) or            c.name = index_col (@full_table_name, i.index_id, 12) or            c.name = index_col (@full_table_name, i.index_id, 13) or            c.name = index_col (@full_table_name, i.index_id, 14) or            c.name = index_col (@full_table_name, i.index_id, 15) or            c.name = index_col (@full_table_name, i.index_id, 16))                   order by 1, 2, 3, 5 

The crucial part is how KEY_SEQ is determined. It would work correctly if the second variant would be used.

Alternatively even the first variant would work if the sub-select would be done like this:

SELECT convert(smallint, key_ordinal) FROM sys.index_columns  WHERE object_id = @table_id AND index_id = i.index_id and column_id = c.column_id 

So key_ordinal instead index_column_id needs to be used.

However as it is a system stored procedure it seemingly is not possible to change it. At least not without very critical and unadvised steps.

Are there any alternatives than downgrading or waiting for a fix from Microsoft (workarounds)? What would be the best way to contact Microsoft to receive a fix as quickly as possible?

Edit: Forgot to mention. They even have written about a change to sp_pkeys in their release notes. See https://support.microsoft.com/en-us/topic/kb5003830-cumulative-update-25-for-sql-server-2017-357b80dc-43b5-447c-b544-7503eee189e9#bkmk_13975159.

Edit2: There is no difference with CU26 which was just released.

What’s wrong with the following dynamic TSQL?

The following generated dynamic TSQL has operation type clash which I am unable to find the problem.

exec sp_executesql  N'INSERT INTO EmployeePassword VALUES(@EmployeeCode, @Password, @EmployeeId, @EntryDate)', N'@EmployeeCode nvarchar(4000), @Password nvarchar(4000), @EmployeeId uniqueidentifier, @EntryDate datetime',  @EmployeeCode=N'SC0001', @Password=N'xxxxxx', @EmployeeId=N'B84EC880-BD58-4A64-8AA3-C86ADA108731', @EntryDate=N'2021-09-08 09:51:36.350' 

Error message I got after the execution of the above TSQL.

Msg 206, Level 16, State 2, Line 1 Operand type clash: uniqueidentifier is incompatible with datetime 

Any Idea on what the cause is?

Why do my bullets always go the wrong way when my player turns around?

So I tried to make a shooting mechanism for my game. My player can shoot in the direction pointed by the mouse. My player can also turn around, facing the other way as he walks. The firing mechanism is fine when my player is facing right, but when my player is facing left (I used transform.localscale and set my x scale to a negative value so my player sprite is flipped) the gun is also reversed, i solved the problem on the gun, but when i shoot the bullet, the first bullet fired after i turn around will go in the wrong direction. I set my weapon as child of an empty game object named gunHolder like this:

enter image description here

When it play, it looks like this, when i trun around and shots my first bullet, the bullet go in mirror direction:

how it looks like when it play

My shooting code look like this:

void FixedUpdate()     {                  Vector3 difference=Camera.main.ScreenToWorldPoint(Input.mousePosition)-transform.position;         float rotZ=Mathf.Atan2(difference.y,difference.x)*Mathf.Rad2Deg;                  if(player.transform.localScale.x==1)turnOffset=0;         else turnOffset=180;          transform.rotation=Quaternion.Euler(0f,0f,rotZ+offset+turnOffset);         if(timeBtwShots<=0){             if(Input.GetMouseButtonDown(0)){              Instantiate(projectile,shotPoint.position,transform.rotation);              float transX= (float)(player.transform.localScale.x*0.3);             projectile.transform.localScale= new Vector3(transX,projectile.transform.localScale.y,projectile.transform.localScale.z);              BulletBehaviour bulletBehaviour=projectile.GetComponent<BulletBehaviour>();             if(player.transform.localScale.x==1){                 bulletBehaviour.flip=false;             }             else{                 bulletBehaviour.flip=true;                 Debug.Log("flip");             }             timeBtwShots=startTimeBtwShots;         }         }else{             timeBtwShots-=Time.deltaTime;         }              } 

So I flip my weapon based on where my player is facing. I handle my player animation when facing another direction by changing transform.localscale.x:

scale=transform.localScale; if (Input.GetKey(KeyCode.A))      {           isMoving=true;           Vector2 movement = transform.right.normalized * -moveSpeed;           rb.AddForce(movement);           scale.x=-1;      }      else if (Input.GetKey(KeyCode.D))      {           isMoving=true;           Vector2 movement = transform.right.normalized * moveSpeed;           rb.AddForce(movement);           scale.x=1;      } 

And my bullet script look like this:

void Update()     {         if(!flip){             transform.Translate(Vector2.right*speed*Time.deltaTime);                          }         else {             transform.Translate(Vector2.left*speed*Time.deltaTime);             }     } 

Based on where my player facing, i change my bullet direction(I did this because before, my bullet went in the wrong direction if my player was facing left). Now my bullets are facing the right direction, it’s just that the first bullet that is fired after my player turns around always goes in the wrong direction (the opposite direction to the direction it should be, even the sprites are reversed). Anyone know why this happening and how to solve this?

I’m having trouble making a paint trail effect in ShaderGraph. What am I doing wrong? Are there other ways of doing this?

Link to what I have so far: https://i.imgur.com/UzFUtrT.gif

Link to ShaderGraph of the original render texture: https://i.imgur.com/orlufI0.png Link to ShaderGraph of the output render texture: https://i.imgur.com/nUfYFu2.png

I’m trying to make the quad on the right leave a trail of cyan when the circle moves. Both squares use different materials.

I’ve tried using Graphics.Blit to draw the current texture onto a new one but it doesn’t create any painting effect (code: https://hatebin.com/rlmjuzilmn).

The only progress I’ve gotten is from creating a RenderTexture and using SetPixel in a C# script but its very inefficient and slows down my computer too much: https://i.imgur.com/9617OYQ.gif

I’ve been going about this for weeks. What am I doing wrong? What are the other options I have?

I would like to avoid writing shader code if possible. I’m looking for relatively simple and easy to understand solutions.

I’m trying to use sp_ineachdb, please can anyone see where I’m getting it wrong?

Can anyone help please? I can’t seem to find where I’m missing it. I’m trying to loop through the user databases in my SQL Server instance to delete all the existing users. I’m using the stored proc dbo.sp_ineachdb. For each database, I get an error that the cursor already exists. My code is pasted below. Thank you.

DECLARE @sql AS VARCHAR(4000) SET @sql =

‘USE [‘ + DB_NAME() +’] DECLARE @UserName nvarchar(256) DECLARE csrUser CURSOR FOR SELECT [name] FROM sys.database_principals WHERE principal_id > 4 AND is_fixed_role < 1 ORDER BY [name]

OPEN csrUser FETCH NEXT FROM csrUser INTO @UserName WHILE @@FETCH_STATUS <> -1 BEGIN BEGIN TRY EXEC sp_revokedbaccess @UserName END TRY BEGIN CATCH ROLLBACK END CATCH FETCH NEXT FROM csrUser INTO @UserName END

CLOSE csrUser DEALLOCATE csrUser’

EXEC dbo.sp_ineachdb @command = @sql

the_modified_time showing wrong date

I have an wordpress self-hosted installation that is over 10 years old. I was updating the template files to show the last modified date instead of the published date for my posts.

Old snippet: <time datetime="<?php the_time('c');?>"> <?php the_time('j F Y'); ?></time>

New snippet: <time datetime="<?php the_modified_time('c');?>"><?php the_modified_time('j F Y'); ?>

Here’s where it got weird. Every post that was modified before 6 februari 2021 shows the date 6 februari 2021. Every post that got updated after 6 februari 2021 shows the correct date.

I double checked this. There are posts that haven’t been updated since 2014 or 2011, yet they show 6 februari 2021. I even went into phpMyAdmin and the post_modified field shows the correct date (not 6 februari 2021).

Does anyone have an idea what it causing this or how to fix this? I have some suspects:

  • I’m using older php version: 7.2.34
  • I’m using an old sql server (WP site diagnose says so)
  • I vagely remember doing a sort of database update. Yoast SEO promted me to do something for indexing purposes.

Google uses wrong image to display product in Google Image Search

I have a problem with Google associating the wrong image with our products when they are display in Image Search.

For some reason, the main image of our products, which has more desirable data (alt tags, higher resolution, placed first as product image, not tampered with), is discarded.Instead, Google chooses the last loaded image for a product, which has no alt data, worse resolution, watermark dynamically added (it’s not even .jpg), or just blank white image with the watermark.

I have Schema.org microdata set up dynamically for each product. I’ve removed the "additional_image" tag, using only "image", still no success.