What is the recommended way of sending dynamic content depending on form contents?

The task of my client is this: He has a wordpress site and wants to offer a service where he can send custom legal texts per mail. Depending on which single-choice the users select at a form, it should send them slightly modified texts. And afterwards it should save the emails in some sort of newsletter/funnel system to contact them.

So my idea was to

  • User fills in form
  • Save form data in database
  • Send form data or only email to mailchimp
  • User confirms email subscription
  • User gets text depended on his selection

How would you approach this? I’ve never done an email subscription with goodie thing and maybe there are some good solutions or best practices for this?

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?

Are there pitfalls to implementing a hybrid site with both responsive layouts and dynamic serving layouts?

I have a 20 year old site that I want to upgrade to a responsive layout. Originally it was a desktop-only layout but when a significant portion of my user base went mobile I implemented dynamic serving layouts where I sniff the user agent and serve different HTML based on whether the user agent is for a mobile device or not.

I started to implement the responsive layouts, but I found that about 5% of my user base is on older browsers that don’t have all the CSS and JavaScript I would like to use. For example, only 95.42% of users fully support CSS grid layouts: https://caniuse.com/css-grid While I wouldn’t want to take the time to develop a site just 5% of my users, I already have a site that works for those users and I don’t want to lose that much of my traffic when I move to responsive.

My current plan is to still do server side tests based on the user agent like this pseudo code:

use responsive-layout if (bot)  use desktop-layout if (msie or firefox < 54 or chrome < 58  or edge < 16) use mobile-layout if (opera-mini or android-browser or samsung-internet < 5 or safari-mobile < 10.3) use responsive-layout otherwise 

Most of my users and search engine crawlers would get the responsive layout. Only specific non-capable and older browsers would get my existing static layouts.

I know that Google supports either responsive layouts or dynamic serving layouts but I haven’t been able to find any information about a hybrid approach like this. Are there any pitfalls (especially with regards to SEO) of mostly using responsive but falling back to dynamic serving for some browsers?

My dynamic button evaluates as soon as it’s created. How do I stop this behavior?

I think I finally hit on the holy grail of buttons. I coded a dynamic autosave button whose duration and frequency can be set all the while showing very useful dynamic real time information directly in the label (button name, countdown in seconds, "saved" and beep alert when saved) without freezing the frontend or tying up the kernel. And get this, it even works when the button scrolls off screen. I have no idea how I got it to do that.

There is just one little snag. They autosave starts as soon as the button is created. No need to click or hover over it. Please help me fix this odd behavior.

There is just one more little teeny tiny thing if you don’t mind. I would like to anchor the code to a function like this dynaSave[s_,n_]:= DynamicModule[...]but it produces syntax errors.

(* dynaSave button works but oddly evaluates when created *)  Quiet@Remove["Global`*"];  DynamicModule[{   s = 10, n = Infinity, col1 = Black, col2 = RGBColor[.2, .65, .2],    bg = RGBColor[.775, .85, 1]   },  ops := Sequence[AutoAction -> True, ImageSize -> {80, 30},     Appearance -> "Palette",     BaseStyle -> {14, col1, Bold, FontFamily -> "Arial"},     Background -> bg];  actions := (NotebookSave[];Beep[];Style["SAVED", Bold, col2]);   actionclock[f_, g_] :=    Dynamic[t = f - Clock[{0, f, 1}, f, g]; If[t == 0, actions, t]];  Button[Dynamic[x, (#) &,     Initialization :> (x := "DynaSave")], (x := actionclock[s, n]) &,    ops]   ] 

What is a natural way of rendering dynamic (partially view dependent) GUI elements?

My question is really about low-level rendering techniques, but I’m going to illustrate it with a high-level GUI example. I’m not so much interested in GUI design, but rather in some basic concepts involving coordinate systems and trasformations in a rendering pipeline. I’m sure that this is a well understood problem, but I can’t seem to come up with the right keywords to find the answers I need, so let me try to explain it in simple terms.

Say we have some sort of strategy game, Crusader Kings is a good illustration. CK3

There are essentially three different types of objects that are being rendered:

  1. World objects: terrain, cities, units, etc. The game keeps track of the world coordinates of these objects. They are submitted to the rendering pipeline which applies all necessary transformations so that they end up in the right place on the screen. As the player zooms in/out or pans around, the view transformation is updated so the map moves as expected.
  2. "Static" GUI elements: sidebars, topbars, windows, event icons, etc. The positions of these are computed directly in screen coordinates (or possibly some other very close coordinates, in any case unrelated to the world coordinates). As the player moves the map, their position and size remain unchanged.
  3. "Dynamic" GUI elements: city name banners, army banners etc. These are odd ones out in that their positions depend on world coordinates (as they are attached to specific world objects), but their size in screen coordinates is fixed. As the player pans around, they move along with their coresponding world object. But as the player zooms in/out, their size remains unchanged. (Note that in the screenshot above the county names are written directly "on terrain" and they scale with the map, so they belong to type 1.)

If I was trying to recreate this in OpenGL, I would have a program for rendering the world objects and I would transform them with standard projection-view-model transformations. I would have a separate program for the static GUI elements. But I can’t quite envision a clean way of handling the dynamic GUI elements.

  • I could send them through the world-rendering program, but then I would have to manually adjust their size depending on the current view transformation so that their size in screen coordinates remains constant.
  • I could send them throuth the GUI-rendering program, but then I have to manually compute their screen coordinates based on world coordinates of the world objects they are attached to (thus duplicating the work already done by the world-rendering program).

Both these feel like ad hoc work arounds. What is a more natural approach?

WordPress change title with custom dynamic

I have created a custom php template file, which I use to filter results, based on user choice. I get the user’s choice with the following code

$  bla=$  wp_query->query_vars['something']; 

So I want to change the wordpress title, instead of the template name inside of wordpress panel, to something like "My template name dynamic- Website name"

I’ve found this

add_filter('pre_get_document_title', 'custom_title'); function custom_title($  title) {      return 'Test New Title'; } 

And it changes the title, however it doesn’t show the contents of the $ bla. If you echo it few lines down the code it works. I believe that is because I have to place this filter before the get_header() of the template file. Any advice?

MariaDB: Create dynamic PrepareStatement inside a Procedure

I am trying to make a stored procedure which returns me the records of a table that match filters that can be applied in layers.

The procedure receives certain variables as parameters and I want to construct a PrepareStatement that adds the non-null variables as filters. I am using MariaDB 10.6.2

The table I am working on (removing the foreign keys) looks like:


The goal itself is to create it this way

DELIMITER // CREATE OR REPLACE PROCEDURE UThesis.searchThesisByFilters(     IN year_in SMALLINT,     IN title_in VARCHAR(255),     IN limit_in TINYINT,     IN offset_in TINYINT ) BEGIN     DECLARE first BIT DEFAULT 0;      SET @sql = 'SELECT TD.title AS title,' ||                'TD.year AS year,' ||                'TD.file AS path,' ||                'TD.abstract AS abstract,' ||                'TD.thesis_id AS thesis_id ' ||                'FROM Thesis_Detail TD ';      IF NOT ISNULL(title_in) THEN         SET first = 1;         SET @sql = @sql + ' WHERE MATCH(title) AGAINST(? IN NATURAL LANGUAGE MODE)';     END IF;      IF NOT ISNULL(year_in) THEN         IF first THEN             SET @sql = @sql + ' WHERE';         ELSE             SET @sql = @sql + ' AND';         END IF;         SET @sql = @sql + ' TD.year = ?';     END IF;      SET @sql = @sql + ' LIMIT ?  OFFSET  ?';      PREPARE stmt FROM @sql;     EXECUTE stmt using title_in, year_in, limit_in, offset_in;     DEALLOCATE PREPARE stmt;  END //  DELIMITER ; 

The problem is that the following line would be dynamic, that is, it may or may not have the title_in or year_in

EXECUTE stmt using title_in, year_in, limit_in, offset_in; EXECUTE stmt using year_in, limit_in, offset_in; EXECUTE stmt using title_in, limit_in, offset_in; EXECUTE stmt using limit_in, offset_in; 

This example can be solved with combinations of whether one or two are null, but the problem is that I have to apply more filters. In total there are 5 filters but doing the case of each combination ends up being terrible. Any ideas how I can achieve this?

In the first link they make use of CONCAT, but I don’t know if that makes the procedure vulnerable to SQL injections.

CREATE OR REPLACE PROCEDURE UThesis.searchThesisByFilters(     IN year_in SMALLINT,     IN title_in VARCHAR(255),     IN limit_in TINYINT,     IN offset_in TINYINT ) BEGIN     DECLARE first BIT DEFAULT 0;      SET @sql = 'SELECT TD.title AS title,' ||                'TD.year AS year,' ||                'TD.file AS path,' ||                'TD.abstract AS abstract,' ||                'TD.thesis_id AS thesis_id ' ||                'FROM Thesis_Detail TD ';      IF NOT ISNULL(title_in) THEN         SET first = 1;         SET @sql = @sql + ' WHERE MATCH(title) AGAINST(? IN NATURAL LANGUAGE MODE)';     END IF;      IF NOT ISNULL(title_in) THEN         IF first THEN             SET @sql = @sql + ' WHERE';         ELSE             SET @sql = @sql + ' AND';         END IF;         SET @sql = @sql + CONCAT(' TD.year = ', year_in);     END IF;      SET @sql = @sql + CONCAT(' LIMIT', limit_in, ' OFFSET ', offset_in);      PREPARE stmt FROM @sql;     EXECUTE stmt;     DEALLOCATE PREPARE stmt;  END // 

SQL Dynamic Query based on user input in PowerBI

I am pulling data from inSQL using the SQL Query below:

SET QUOTED_IDENTIFIER OFF  SELECT * FROM OPENQUERY(INSQL, "SELECT DateTime, [X],[Y], [Z], [A]  FROM WideHistory  WHERE wwRetrievalMode = 'Cyclic'  AND wwResolution = 1000  AND wwVersion = 'Latest'  AND DateTime >= '20210601 20:02:33.000'  AND DateTime <= '20210607 20:02:34.000'") 

I’m using this table in PowerBI and want [X],[Y], [Z], [A] & the DateTime values to dynamically change based on user input.

Any advice on this would be greatly appreciated. I am new to PowerBI and SQL.

Dynamic bridge via joints

When a new object is added to the bridge, the bridge shakes violently, and when objects are added even faster, it breaks.

I’ve tried changing mass and changing time step, but that doesn’t solve the problem.

enter image description here

Code for adding a new object:

[SerializeField] Rigidbody _last;  [SerializeField] GameObject _prefab;  void Update() {     if (Input.GetMouseButtonDown(0))     {         var go = Instantiate(_prefab);         var fj = go.GetComponent<FixedJoint>();         fj.autoConfigureConnectedAnchor = false;         fj.connectedAnchor = new Vector3(0f, 0f, -2f);         fj.connectedBody = _last;         _last = go.GetComponent<Rigidbody>();     } } 

The first cube is kinematic. prefab:

enter image description here

How can you solve this? Thanks for help

Dynamic media query

In WordPress how can I modify the media query screen size? Say if I have a customizer option for mobile size : 600px and the in CSS this value should change.

For javascript, there is wp_localize and similar functionality for CSS?

Please help