How to store the chi-square values in a text file?

I am new to Mathematica. I have a 3×3 textfile 3.txt of numerical values. Each column corresponds to a,b,c respectively. I have a function f(d,e,f). I found the bestfit values for d, e, and f using Chimin, performing a chi-square analysis contrasting with data in my 3×3 textfile 3.txt. The code i created for the same is as follows

<< NumericalCalculus`  SetDirectory["C:/Users/vmsha/Downloads"];  data = ReadList["3.txt", {Number, Number, Number}]  ndata = 3;  Do[a[i] = data[[i, 1]], {i, 1, ndata}]  Do[b[i] = data[[i, 2]], {i, 1, ndata}]  Do[c[i] = data[[i, 3]], {i, 1, ndata}]  Chi[d, e, f] := Sum[((c[i]) - (d*e*f*a[i]))^2/b[i]^2, {i, 1, ndata}]  Chimin = FindMinimum[{Chi[d, e, f], -10 < d < 10, -10 < e < 10, -10 < f < 10}, {d, e, f}]  {0.0177074, {d -> 3.36069, e -> 0.929241, f -> 0.929241}} 

Now, I am interested in getting the whole 3 chi-square values evaluated using chi(d,e,f) in a single text file. Could anybody help?

Can I split a gravity forms postcode field by the space so just the first half of the postcode is entered automatically into a text field

reaching out on this one. I’m using gravityforms address field and need a simple text field to display just the first half of the postcode.


Postcode Field: E14 4RD Text Field: E14

No idea where to start I’ve Googled and asked on gravityforms forum but no luck.

Any pointers would be great

Why the UI text value is changing take affect only when returning back to the visual studio window and than back to the editor?

My guess is because I’m using OnValidate but is there another way to try to accomplish what I’m trying ?

The goal is use the drawn circle in one script information and use this information in another script.

For example the GameObject the draw circle script is attached to I want to get the Y position of that GameObject and assign the value to the other script specific variable in both Editor and Runtime modes.

This script draw a circle in this case around my player and I attached this script to a empty GameObject child of my player so I can change the circle height by changing the GameObject Y position :

using UnityEngine; using System.Collections; using System;  [ExecuteAlways] [RequireComponent(typeof(LineRenderer))] public class DrawRadiusAroundObject : MonoBehaviour {     [Range(1, 50)] public int segments = 50;     [Range(1, 5)] public float xRadius = 5;     [Range(1, 5)] public float yRadius = 5;     [Range(0.1f, 5f)] public float width = 0.1f;     public bool controlBothXradiusYradius = false;     public bool draw = true;      [SerializeField] private LineRenderer line;      private void Start()     {         if (!line) line = GetComponent<LineRenderer>();          CreatePoints();     }      //private void Update()     //{     //         //}      public void CreatePoints()     {         line.enabled = true;         line.widthMultiplier = width;         line.useWorldSpace = false;         line.widthMultiplier = width;         line.positionCount = segments + 1;          float x;         float y;          var angle = 20f;         var points = new Vector3[segments + 1];         for (int i = 0; i < segments + 1; i++)         {             x = Mathf.Sin(Mathf.Deg2Rad * angle) * xRadius;             y = Mathf.Cos(Mathf.Deg2Rad * angle) * yRadius;              points[i] = new Vector3(x, 0f, y);              angle += (380f / segments);         }          // it's way more efficient to do this in one go!         line.SetPositions(points);     }  #if UNITY_EDITOR     private float prevXRadius, prevYRadius;     private int prevSegments;     private float prevWidth;      private void OnValidate()     {         // Can't set up our line if the user hasn't connected it yet.         if (!line) line = GetComponent<LineRenderer>();         if (!line) return;          if (!draw)         {             // instead simply disable the component             line.enabled = false;         }         else         {             // Otherwise re-enable the component             // This will simply re-use the previously created points             line.enabled = true;              if (xRadius != prevXRadius || yRadius != prevYRadius || segments != prevSegments || width != prevWidth)             {                 CreatePoints();                  // Cache our most recently used values.                 prevXRadius = xRadius;                 prevYRadius = yRadius;                 prevSegments = segments;                 prevWidth = width;             }              if (controlBothXradiusYradius)             {                 yRadius = xRadius;             }         }     } #endif } 

The object with the drawn circle :

Drawn circle around the player

And this script is making an object the Target child to rotate around my player. I want by using the drawn circle information to set the rotating variables.

using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine;  [ExecuteAlways] public class SimpleRotate : MonoBehaviour {     public List<TextMeshProUGUI> uiText = new List<TextMeshProUGUI>();      public DrawRadiusAroundObject drawAround;      // Add this script to Cube(2)     [Header("Add your turret")]     public GameObject Turret;//to get the position in worldspace to which this gameObject will rotate around.      [Header("The axis by which it will rotate around")]     public Vector3 axis;//by which axis it will rotate. x,y or z.      [Header("Angle covered per update")]     public float angle; //or the speed of rotation.      public float upperLimit, lowerLimit, delay;// upperLimit & lowerLimit: heighest & lowest height;      private float height, prevHeight, time;//height:height it is trying to reach(randomly generated); prevHeight:stores last value of height;delay in radomness;       // Update is called once per frame     void Update()     {         //Gets the position of your 'Turret' and rotates this gameObject around it by the 'axis' provided at speed 'angle' in degrees per update          transform.RotateAround(Turret.transform.position, axis.normalized, angle);         time += Time.deltaTime;         //Sets value of 'height' randomly within 'upperLimit' & 'lowerLimit' after delay          if (time > delay)         {             prevHeight = height;             height = Random.Range(lowerLimit, upperLimit);             time = 0;         }         //Mathf.Lerp changes height from 'prevHeight' to 'height' gradually (smooth transition)           transform.position = new Vector3(transform.position.x, Mathf.Lerp(prevHeight, height, time), transform.position.z);          uiText[0].text = angle.ToString();         uiText[1].text = upperLimit.ToString();         uiText[2].text = lowerLimit.ToString();         uiText[3].text = delay.ToString();          upperLimit = drawAround.transform.position.y;     } } 

The object with the script that make Target object child to rotate around my player

Target is the basketball.

The basketball rotating around my player.

For example I tried to set the object Y position value on the Upper Limit variable in the SimpleRotate script.

Everything is getting update find in editor mode and runtime mode except the ui text.

First of all I’m not sure using [ExecuteAlways] in both scripts is the right way and second because I’m using OnValidate in the script that draw the circle the affecting on the variable upper limit is taking affect only when I validate by changing windows in the editor mode.

How to insert text at the current cursor position in Gutenberg?

I am trying to insert text into Gutenberg at the current position for a speech to text solution.

I am aware how to insert new blocks.

const newBlock = wp.blocks.createBlock( "core/paragraph", {     content: 'This is the content', }); "core/editor" ).insertBlocks( newBlock ); 

But I can’t figure out how to add a string at the current cursor position. Could somebody please give me a hint. Any help appreciated.

I need a bit of help with understanding how I should start making a text engine

I was trying to make a textbox engine for my RPG using Gamemaker Studio 2 as my game engine, and so far I have managed to make a pretty good-looking animation for when the textbox comes in and out. I think it looks really nice…

…However, I’ve come across some complications when it comes to the actual text itself… I have NO IDEA on where I should start with that…

You see, a basic rundown of what I wanted to do was keep the main lines of dialog on separate scripts (labeled as TEXT_EN and TEXT_JP, for the potential different languages), and have the dialog box object print the specific line from the TEXT scripts depending on which one I call, basically how UNDERTALE and DELTARUNE handled it (from what I could tell, they relied on arrays but that’s all I know, I’m not sure on how to utilize them to my advantage).

I’m not sure on how I should start doing that… And I tried following along with some guys on Youtube who were better at it, but it didn’t really feel right to me… I was planning on having different languages with my game, and these tutorials didn’t have that in mind… If any of you guys could point me in the right direction, I would GLADLY appreciate it. Thank you for your time.

i am trying to run the powershell script to get disk report for servers from text file but getting error

$  DiskSizeReport = @() $  servers = get-content "D:\Testing\Serverlist.txt" foreach ($  server in $  servers) { write-host "Executing query against server: " $  server $  Disks = Get-WmiObject win32_logicaldisk -computername $  server -Filter "Drivetype=3" -ErrorAction SilentlyContinue | Select-Object @{Label = "Server Name";Expression = {$  _.SystemName}}, @{Label = "Drive Letter";Expression = {$  _.DeviceID}},@{Label = "Total Capacity (GB)";Expression = {"{0:N1}" -f( $  _.Size / 1GB)}}, @{Label = "Used Space (GB)";Expression = {(Round($  _.Size /1GB,2)) - (Round($  _.FreeSpace /1GB,2))}}, @{Label = "Free Space (GB)";Expression = {"{0:N1}" -f( $  _.Freespace / 1GB ) }},@{Label = "Free Space (%)"; Expression = {"{0:P0}" -f ($  _.freespace/$  _.size) }} $  DiskSizeReport += $  Disks }    # Output to CSV   write-host "Saving Query Results in CSV format..." $  results | export-csv  "D:\Testing\Diskreport.csv"   -NoTypeInformation 

The below error I am getting

Get-WmiObject : Cannot validate argument on parameter ‘ComputerName’. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
At line:6 char:56

Rotated text does not show up when exported to pdf

My version: 12.2 Student Edition. I was trying to add a rotated label into a plot.

temp = Graphics[Text[Style["some text information", "Label", FontSize -> 14,  FontColor -> Black, FontFamily -> "Times"], {0.5, 1}, Center, {3, -1}]] Export["temp.pdf", temp, "AllowRasterization" -> True,  ImageSize -> 600, ImageResolution -> 600] 

The code above produces

enter image description here