Applying replacement rules to products doesn’t work as expected

I have the following issue: I’d like to apply some replacement rules, for example

rules:={f[x]/t :> ff[x], g[x]/t :> gg[x]} 

to an expression, e.g. like this:

(f[x]*g[x]/(t^2))/. rules 

Surprisingly, this doesn’t give the expected result

ff[x]*gg[x] 

How do I fix this? Sorry if it’s an easy question, I’m still a beginner with Mathematica.

Fragment shader not working as expected

I am porting the following shader into Godot. The results seem not correct though. Apart from the wrong colours there seems to be no change with time. What is the problem with it?

shader_type canvas_item;  const float DELTA = 0.00001; const float TAU = 6.28318530718; const float NOISE_TEXTURE_SIZE = 256.0; const float NOISE_TEXTURE_PIXEL_COUNT = (NOISE_TEXTURE_SIZE * NOISE_TEXTURE_SIZE);  uniform vec4 vColor: color;  // MAIN CONTROLLER UNIFORMS uniform float intensity = 1.;       // overall effect intensity, 0-1 (no upper limit) uniform float rngSeed = .0;         // seed offset (changes configuration around) uniform sampler2D noiseTexture;     // noise texture sampler  //TUNING uniform float lineSpeed = .01;          // line speed uniform float lineDrift = .1;           // horizontal line drifting uniform float lineResolution = 1.;      // line resolution uniform float lineVertShift = .0;       // wave phase offset of horizontal lines uniform float lineShift = .004;         // horizontal shift uniform float jumbleness = .2;          // amount of "block" glitchiness uniform float jumbleResolution = .2;    // resolution of blocks uniform float jumbleShift = .15;        // texture shift by blocks   uniform float jumbleSpeed = 1.;         // speed of block variation uniform float dispersion = .0025;       // color channel horizontal dispersion uniform float channelShift = .004;      // horizontal RGB shift uniform float noiseLevel = .5;          // level of noise uniform float shakiness = .5;           // horizontal shakiness //  float rand(vec2 co){     return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); }  vec4 extractRed(vec4 col){     return vec4(col.r, 0., 0., col.a); }  vec4 extractGreen(vec4 col){     return vec4(0., col.g, 0., col.a); }  vec4 extractBlue(vec4 col){     return vec4(0., 0., col.b, col.a); }  // Replacement for the mirror address mode, hopefully nobody needs filtering. vec2 mirror(vec2 v) {     return abs((fract((v * 0.5) + 0.5) * 2.0) - 1.0); }  vec2 downsample(vec2 v, vec2 res) {         // Division by zero protected by uniform getters.     return floor(v * res) / res; }  // Fetches four random values from an RGBA noise texture vec4 whiteNoise(vec2 coord, vec2 texelOffset, vec2 resolution) {     vec2 offset = downsample(vec2(rngSeed * NOISE_TEXTURE_SIZE, rngSeed) + texelOffset, vec2(NOISE_TEXTURE_SIZE));     vec2 ratio = resolution / vec2(NOISE_TEXTURE_SIZE);     return texture(noiseTexture, (coord * ratio) + offset);  }  // Fetch noise texture texel based on single offset in the [0-1] range vec4 random(float dataOffset) {     vec2 halfTexelSize = vec2((0.5 / NOISE_TEXTURE_SIZE));     float offset = rngSeed + dataOffset;         return texture(noiseTexture, vec2(offset * NOISE_TEXTURE_SIZE, offset) + halfTexelSize);  }  // Jumble coord generation vec2 jumble(vec2 coord, float time, vec2 resolution){     // Static branch.     if ((jumbleShift * jumbleness * jumbleResolution) < DELTA) {         return vec2(0.0);     }              vec2 gridCoords = (coord * jumbleResolution) / (NOISE_TEXTURE_SIZE * 0.0245);     float jumbleTime = mod(floor(time * 0.02 * jumbleSpeed), NOISE_TEXTURE_PIXEL_COUNT);     vec2 offset = random(jumbleTime / NOISE_TEXTURE_PIXEL_COUNT).ga * jumbleResolution;     vec4 cellRandomValues = whiteNoise(gridCoords, vec2(jumbleResolution * -10.0) + offset, resolution);     return (cellRandomValues.ra - 0.5) * jumbleShift * floor(min(0.99999, cellRandomValues.b) + jumbleness); }  // Horizontal line offset generation float lineOffset(vec2 coord, vec2 uv, float time, vec2 resolution) {     // Static branch.     if (lineShift < DELTA) {         return 0.0;     }          // Wave offsets     vec2 waveHeights = vec2(50.0 * lineResolution, 25.0 * lineResolution);         vec4 lineRandom = whiteNoise(downsample(uv.yy, waveHeights), vec2(0.0), resolution);     float driftTime = uv.y * resolution.y * 2.778;          // XY: big waves, ZW: drift waves     vec4 waveTimes = (vec4(downsample(lineRandom.ra * TAU, waveHeights) * 80.0, driftTime + 2.0, (driftTime * 0.1) + 1.0) + (time * lineSpeed)) + (lineVertShift * TAU);     vec4 waveLineOffsets = vec4(sin(waveTimes.x), cos(waveTimes.y), sin(waveTimes.z), cos(waveTimes.w));     waveLineOffsets.xy *= ((whiteNoise(waveTimes.xy, vec2(0.0), resolution).gb - 0.5) * shakiness) + 1.0;     waveLineOffsets.zw *= lineDrift;     return dot(waveLineOffsets, vec4(1.0)); }  void fragment() {     vec3 randomValues = vec3(rand(vec2(TIME, 0.0)), rand(vec2(TIME, 0.0)), rand(vec2(TIME, 0.0)));     vec2 resolution = 1.0 / SCREEN_PIXEL_SIZE;     vec2 uv = FRAGCOORD.xy / (1.0 / SCREEN_PIXEL_SIZE).xy;          // Sample random high-frequency noise     vec4 randomHiFreq = whiteNoise(uv, randomValues.xy, resolution);          // Apply line offsets     vec2 offsetCoords = uv;     offsetCoords.x += ((((2.0 * randomValues.z) - 1.0) * shakiness * lineSpeed) + lineOffset(offsetCoords, uv, TIME, resolution)) * lineShift * intensity;          // Apply jumbles     offsetCoords += jumble(offsetCoords, TIME, resolution) * intensity * intensity * 0.25;              // Channel split     vec2 shiftFactors = (channelShift + (randomHiFreq.rg * dispersion)) * intensity;     vec4 outColour;          // Static branch.     if (((channelShift + dispersion) * intensity) < DELTA) {         outColour = texture(SCREEN_TEXTURE, mirror(offsetCoords));     } else {         outColour = extractRed(texture(SCREEN_TEXTURE, mirror(offsetCoords + vec2(shiftFactors.r, 0.0)))) + extractBlue(texture(SCREEN_TEXTURE, mirror(offsetCoords + vec2(-shiftFactors.g, 0.0)))) + extractGreen(texture(SCREEN_TEXTURE, mirror(offsetCoords)));     }          // Add noise         outColour.rgb *= (vec3(.55, .5, .4) * randomHiFreq.gab * intensity * noiseLevel) + 1.0;              // COLOR = vColor * outColour;     COLOR = outColour; } 

enter image description here

How to avoid alienation by expected but slow mood shift, and still keep players out of spoilers?

I run an MLP campaign. By design, at the start of the campaign what the citizens (PCs) know about the world is true, but it’s not the whole and complete truth, and many issues of the past are either not widely known or just reframed to appear less severe than they are. The campaign revolves around them figuring out How Things Really Are, and becoming ones who keep the surface level of the Utopia running.

And here’s the question. MLP makes people think that they know how things really are. So, over time a player may decide that it’s too dark, or by other means too conflicting with their own vision.

Be it other campaign, we could compare our visions for compatibility beforehand, to make sure that it works.

But this campaign is meant to include perspective shifts; I have a few players that are prone to ‘bleeding’ (and know that!) and/or prefer to stay out of spoilers. The ‘actual state of the world’ has/will have a ‘darker past’; this Utopia is based on a few questionable decisions, and is not as stable as it appears at first. I am afraid of alienating these players, or being met by a reaction of "You asked us to play in the Utopia, and then the mood became totally different". Basically, "I was creating my character for another sort of game, one that you initially described to me; and now it’s a different game, one that I don’t actually like".

How to reduce this risk of alienation, yet still keep the mood of mystery and (classical urban-fantasy) ‘this is deeper than you have thought’, without spoilers?

SQL 2012 patching failure – The language of SQL Server instance MSSQLSERVER does not match the language expected by the SQL Server update

I’ve picked up the support for a SQL 2012 instance on a server at our German site and need to apply SQLServer2012SP4-KB4018073-x64-ENU.

The patching is failing with the installer showing error "The language of SQL Server instance MSSQLSERVER does not match the language expected by the SQL Server update. The installed SQL Server product language is German (Germany) and the expected SQL Server language is English (United States)."

The server properties general tab (in SSMS) shows Language German (Germany), but the SERVERPOPERTY(‘LCID’) shows 1033 (US_English). The registry entry shows 1031 (German) as the install language (https://www.sqlserverscience.com/basics/localization/language-used-sql-server-binaries/#comment-191) enter image description here

Trying to use the German patch file SQLServer2012SP4-KB4018073-x64-DEU results in “This SQL Server setup media does not support the language of the OS, or does not have the SQL Server English-language version installation files. Use the matching language-specific SQL Server media; or install both the language specific MUI and change the format and system locales through the regional settings in the control panel”.

Any pointers as to a way forward so I can apply the patch?

ORA-00932: inconsistent datatypes: expected CHAR got NUMBER

I am trying to SUBSTR the first 3 character in use this query -> CASE WHEN (RMSTMP_PNG.ota_activity_lotinfo.KEY = ‘TestProgram’) THEN TO_CHAR(SUBSTR(RMSTMP_PNG.ota_activity_lotinfo.VALUE,1,3)) ELSE 0 END AS Test1 But it return me this ORA-00932: inconsistent datatypes: expected CHAR got NUMBER 00932. 00000 – "inconsistent datatypes: expected %s got %s". May i know what wrong in my query? I tried to use To_NUMBER or To CHAR, it also return me same error. Appreciate if someone could help on this issue. Below is my query:

SELECT RMSTMP_PNG.ota_activity.EQP_ID, SUM(CASE WHEN (RMSTMP_PNG.ota_activity.MESSAGE='Load lot success.' AND RMSTMP_PNG.ota_activity_lotinfo.KEY = 'Quantity') THEN 1 ELSE 0 END) AS LOT_ID, SUM(CASE WHEN (RMSTMP_PNG.ota_activity.MESSAGE='Load lot success.' AND RMSTMP_PNG.ota_activity_lotinfo.KEY = 'Quantity') THEN TO_NUMBER(RMSTMP_PNG.ota_activity_lotinfo.VALUE) ELSE 0 END) AS QUANTITY, CASE WHEN (RMSTMP_PNG.ota_activity_lotinfo.KEY = 'TestProgram') THEN TO_CHAR(SUBSTR(RMSTMP_PNG.ota_activity_lotinfo.VALUE,1,3)) ELSE 0 END AS Test1 FROM RMSTMP_PNG.ota_activity  FULL OUTER JOIN RMSTMP_PNG.ota_activity_lotinfo ON RMSTMP_PNG.ota_activity.ID = RMSTMP_PNG.ota_activity_lotinfo.ID  WHERE RMSTMP_PNG.ota_activity.MODIFIED_DATE >= to_date('27-Sep-2020') AND RMSTMP_PNG.ota_activity.MODIFIED_DATE < to_date('27-Sep-2020') + 1  group by RMSTMP_PNG.ota_activity.EQP_ID,RMSTMP_PNG.ota_activity_lotinfo.VALUE, RMSTMP_PNG.ota_activity_lotinfo.KEY order by RMSTMP_PNG.ota_activity.EQP_ID 

If has action not working as expected

I’m using ACF Blocks in a theme I’m building.

Here’s my block template file within /my-plugin/template-parts/blocks/page-intro/page-intro.php:

<?php /**  * Page Intro Block Template.  *  * @param   array $  block The block settings and attributes.  * @param   string $  content The block inner HTML (empty).  * @param   bool $  is_preview True during AJAX preview.  * @param   (int|string) $  post_id The post ID this block is saved to.  */ ?> <?php do_action('acf_add_class'); ?> <div class="page-intro-wrapper" style="background: url(<?php esc_url( the_field('background_image') ); ?> )">     <div class="page-intro">         <h2><?= esc_html( get_field('title') ); ?></h2>         <?= get_field('text'); ?>     </div> </div> 

You’ll see that I’ve added <?php do_action('acf_add_class'); ?> at the top.

I then have the following via my plugin:

/**  * Add custom classes to body  */ function body_classes( $  classes ) {          if ( has_action('acf_add_class') ) {         $  classes[] = 'page-intro';     }          return $  classes; } add_filter( 'body_class', 'body_classes' ); 

I was hoping that if ( has_action('acf_add_class') ) { would trigger the condition and add the class, but this hasn’t worked.

I’ve also tried this within the body_class filter:

if ( has_action('acf_add_class', get_queried_object_id() ) ) {     $  classes[] = 'page-intro'; } 

This question may be off-topic if the issue is ACF related.

Any ideas?

I am not getting output for the below batch file as expected [closed]

I wrote the below mentioned test batch file… But while executing it, when I give input as "How are you" then the file automatically gets terminated.

@echo off echo Hi! echo Happy to be at your service 🙂 :start set /a A = How are you set /p help="How may I help you? " if /i %help% EQU excel (start excel) else (if /i %help% EQU %A% (echo I am good! Thanks for asking)) goto start

But, if I write…

@echo off echo Hi Sir! echo Happy to be at your service 🙂 :start set /a A = How set /p help="How may I help you? " if /i %help% EQU excel (start excel) else (if /i %help% EQU How (echo I am good Sir! Thanks for asking)) goto start

and when I give input as "How"… I get the output as expected.

The output that I get at this case is…

Hi! Happy to be at your service 🙂 How may I help you? how I am good! Thanks for asking How may I help you?

Kindly help me in solving this issue.

Setuid on rcp not working as expected

While pentesting in a lab, came across an rcp binary with setuid bit which looked like a potential privilege escalation vector.

bash-3.1$   ls -l /usr/bin/rcp -rwsr-xr-x 1 root root 18544 May 18  2007 /usr/bin/rcp 

Following the explanation at https://securiteam.com/exploits/6b00l1p0bc/ , I tried the following:

bash-3.1$   /usr/bin/rcp 'bob bobalina;/usr/bin/id;' 127.0.0.1 uid=48(apache) gid=48(apache) groups=48(apache) bash: 127.0.0.1: command not found 

My understanding is that since rcp is setuid as root, any command executed by it must be run as root. Why am I then seeing the output of /usr/bin/id as apache, which is the user I am running as?

I’m not a great Linux guy so if I’m missing something obvious, please let me know.

I’ve also tried the command injection with backticks, got the same result:

bash-3.1$   /usr/bin/rcp ``bob bobalina;/usr/bin/id;`` 127.0.0.1 uid=48(apache) gid=48(apache) groups=48(apache) bash: 127.0.0.1: command not found