text:
Q: Wait for command line input to shell script from PHP I am looking for a solution that allows a PHP script to send multiple commands when prompted. When the following code is executed from the shell:
root@host [~]# /usr/local/bin/grads-2.0.2/bin/grads -b

This output results:
Grid Analysis and Display System (GrADS) Version 2.0.2
Copyright (c) 1988-2011 by Brian Doty and the
Institute for Global Environment and Society (IGES)
GrADS comes with ABSOLUTELY NO WARRANTY
See file COPYRIGHT for more information

Config: v2.0.2 little-endian readline printim grib2 netcdf hdf4-sds hdf5 opendap-grids,stn geotiff shapefile
Issue 'q config' command for more detailed configuration information
Landscape mode? ('n' for portrait):

As you can see, the script is waiting for y/n input. When y/n is typed, the following output results:
Landscape mode? ('n' for portrait):  y
GX Package Initialization: Size = 11 8.5
Running in Batch mode
ga->

The script then waits for any further commands until it can be quit with the 'quit' command. 'quit' results in the following output:
ga-> quit
No hardcopy metafile open
GX package terminated
root@host [~]#

My issue arises however when I try to do this through PHP. My code is as follows:
$descriptorspec = array(
   0 => array("pipe", "r"),  // stdin is a pipe that the child will read from
   1 => array("pipe", "w"),  // stdout is a pipe that the child will write to
   2 => array("file", "/tmp/error-output.txt", "a") // stderr is a file to write to
);
$cwd = '/';
$process = proc_open('/usr/local/bin/grads-2.0.2/bin/grads -b', $descriptorspec, $pipes, $cwd);
if (is_resource($process)) {
    // $pipes now looks like this:
    // 0 => writeable handle connected to child stdin
    // 1 => readable handle connected to child stdout
    // Any error output will be appended to /tmp/error-output.txt
    fwrite($pipes[0], 'y');
    fclose($pipes[0]);
    echo stream_get_contents($pipes[1]);
    fclose($pipes[1]);
    // It is important that you close any pipes before calling
    // proc_close in order to avoid a deadlock
    $return_value = proc_close($process);
}

However, this is the output all at once:
Grid Analysis and Display System (GrADS) Version 2.0.2
Copyright (c) 1988-2011 by Brian Doty and the
Institute for Global Environment and Society (IGES)
GrADS comes with ABSOLUTELY NO WARRANTY
See file COPYRIGHT for more information

Config: v2.0.2 little-endian readline printim grib2 netcdf hdf4-sds hdf5 opendap-grids,stn geotiff shapefile
Issue 'q config' command for more detailed configuration information
Landscape mode? ('n' for portrait):  GX Package Initialization: Size = 11 8.5
Running in Batch mode
ga-> [EOF]
No hardcopy metafile open
GX package terminated

As you can see, the script is racing along without waiting for input...what modifications do I need to make to the PHP code to fix this? Any help would be greatly appreciated...my commands work fine at the command line so this is the only thing holding my application back.

A: I can't help with the PHP, but if you invoke grads with "-blx" instead of "-b" then it will start in landscape mode automatically, and quit when your command is finished. The -l eliminates the need for the user input when GrADS asks about Landscape mode, and the -x tells it to quit when finished. You can add the 'c' followed by the name of a command or script. For example:
# /usr/local/bin/grads -blxc 'q config'

Will start grads in landscape mode, execute the command that prints out the configuration information, and then quit. The command 'q config' could be replaced by the name of a script. Documentation about command line options for GrADS is at http://iges.org/grads/gadoc/gradcomdgrads.html


text:
Q: How can I perform an operation only on elements of a 2D numpy array that meet a conditional within an index without iterating in Python? I am trying to implement a solving algorithm which will use one equation if an array element is negative, and another if it is positive. Here is my code for trying to differentiate the two cases:
    Xn = X.copy()
    X[X[2:-2, 2:-2]>=0] = #algorithm A, calls several upstream values from Xn
    X[X[2:-2, 2:-2]<0] = #algorithm B, calls several downstream values from Xn

I only want to assign values to X[2:-2, 2:-2]. The shape of X is (21,21) while the X[2:-2,2:-2] is (17,17). I get this error with the above code:
IndexError: boolean index did not match indexed array along dimension 0; dimension is 21 but corresponding boolean dimension is 17
How can I do this without iterating over every element?

A: Use Vectorization. That will solve all your problems.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Build OS-independent notepad with some code completion - appropriate platform? I want to build as simple notepad application with some code-completion.
It should be easy to compile to Linux, OS X and Windows.
I'm looking at wx-widgets or GTK. Others?? (as web-service as worst case.),
and without library dependencies.
Or does there exist any OS-independent FOSS editor with plug-in functionality.
(Eclipse way to heavy).
To be specific, what I want is a "helper" when coding XML towards an application-framework that use XML extensively. As libraries are loaded (through XML) new tags should be allowed and their existence should be prompted to user, both in toolbar (tags) and auto-complete (attributes).
Recommendations?
regards,
//t

A: *

*XML Copy Editor: I've used it and it's not the best editor, but it does do the autocompletion.

*Conglomerate: Looks quite promising but I never got it to work when I tried it out a year ago. Perhaps it's improved since then.

As for an OS-independent FOSS editor with plugin functionality that is more lightweight than Eclipse, try Gedit. It's not too difficult to write plugins for whatever functionality you may need. It's based on GTK.


text:
Q: How to establish a powershell session from a local machine to a Virtual Machine I want to connect to a Virtual Machine (Microsoft windows NT) which is MFA enabled, from my Local machine which are in different domains and run the PowerShell scripts on VM.
Also I log on to my VM using a different User and password.
At First, I tried to establish session between cross VM's which belong to the same domain which was successful using the below script and was able to do so
$Session = New-PSSession -ComputerName "VmName"
Invoke-Command -Session $Session -ScriptBlock {Get-ScheduledTask | Format-Table}

Then, I tried to establish a PowerShell Remote session between my local machine to the VM but it fails, using the same command and I also tried to use the credentials property but it still fails
I am not sure of what steps are to be followed to connect from my local to a VM in different domain.
Can somebody help me ?
Thanks in advance.


text:
Q: Modulus simplication for $x$ $||x-1|-2|=|x-3|$.
Find the value of $x$.
In my attempt I got the critical values of the expression as $1$ and $3$.
But I'm not sure is we can just not consider the $2$ in the LHS.
My steps are Case 1: when $x>3$, $x-1-2=x-3$, $0=0$
Case 2: $1<x<3$, $X-1-2=-x+3 \implies 2x=6 \implies x= 3$
Case 3: $x<1$, $-x+1-2=-x+3$. Not possible.

A: Just sketch the graphs $y=||x-1|-2|$ and $y=|x-3|$.
To draw $y=|x-3|$, first draw $y=x-3$ then reflect the negative $y$-region up over the $x$-axis. (In other words, fold the graph up over the $x$-axis.) Leave the positive $y$-region as it is.
To draw $y=||x-1|-2|$, first draw $y=x-1$, then fold it up over the $x$-axis, slide the whole thing down by 2, then fold it up over the $x$-axis.
It should be quite obvious that $x \ge 1$ solves $||x-1|-2|=|x-3|$.

A: You must do case work. If $$x\geq 1$$ then we get $$\vert{x-3\vert}=|x-3|$$ which is true.
If $$x<1$$ then we have $$|-x+1-2|=|x-3|$$, can you solve this equation?

A: Guide:
You have found the critical value to be $1$ and $3$, that's great, don't worry too much and work it out and see what needs to be done.
Consider $x<1$:
$$||x-1|-2|<|x-3|$$
$$|(1-x)-2|<3-x$$
$$|-1-x|<3-x$$
$$|x+1|<3-x$$
Now, as you see, you might need a new condition, just impose it and handle things as it comes by, now consider $x<-1$ and $x>-1$.
Move on to consider $1<x<3$, $x>3$, $x=1$, $x=3$ as well.


text:
Q: Replacing negative numbers with zero in a matrix So today I was coding up something where I wanted to replace all negative values in a matrix with 0. Call this matrix B. Well this was no problem, I just wrote
B[which(B<0)]=0

But then just because I was curious I was wondering, what if we got rid of the which and wrote
B[B<0]=0

and to my surprise this also gave the same answer. If I would have looked up this question on Stack Overflow the second answer is pretty standard (and there are even more complicated faster methods), but my question is: are the two methods above actually the same? B<0 returns a Boolean matrix. Which method is faster and why?

A: Yes, you can index with a logical vector. It's explained here: http://cran.r-project.org/doc/manuals/r-release/R-intro.html#Index-vectors

A: As to the issue of speed, there doesn't appear to be a big difference in tests I tried. For example,
B=.5-matrix(runif(10000),100,100)

start = Sys.time()
replicate(50000,B[B<0])
speed = Sys.time () - start

25.85 seconds
start = Sys.time()
replicate(50000,B[which(B<0)])
speed = Sys.time () - start

25.91 seconds


text:
Q: Running bookmarklet from a keyboard shortcut in Opera The Opera web browser makes it very easy for users to tie keyboard shortcuts to bookmarks by editing the keyboard.ini file, e.g.
F1 = http://google.com/

will allow a single keystroke F1 to Google.
I'd like to similarly tie a keyboard shortcut to a bookmarklet --- but the following doesn't work:
F1 = javascript:alert('Hello, World!')

Does anyone know how to achieve this, either using keyboard.ini or through some other means?
(The ultimate goal here is to build a TV-based browser that my grandparents can use.  This means a set of labelled hotkeys on the keyboard that instantly visit sites they like or perform other useful functions.  I'd like the whole package to be contained within Opera.)

A: What about
F1 = Go to page, "javascript:alert('Hello world')"

Would that work?

A: for chrome: right click on search bar -> edit search engines -> add new engine ->
three fields 1. name of the engine 2. d 3. javascript: alert("hellow");
final step press Ctr-L + d + Enter
Your bookmark in this case bookmarklet is opened


text:
Q: Search list item in the output python I need a help,
 list1 = [abc, xyz]

output:
123
143
153
abc!
abc
hhj
xyz--
xyz

I am using below code:
 for line in ouput.split("\n"):
    line = line.strip()

    if (re.search(list1, line)):
        print "abc and xyz present in output"

Above code does not work for my requirement
Note it should not macth for abc! and xyz-- meaning it must match only abc and xyz

A: Although your question is pretty unclear and lacks a mcve. If you want to check possession, if line is the same as something inside list1, you can just use the in operator.
if line in list1:
    print "abc or xyz present in output"

In your case, it should match twice, once for abc and once for xyz. Since you said:

Note it should not macth for abc! and xyz--

Note: regex is for searching patterns in a string. Not very appropriate for your task.

A: guesing you want to search each output line is in list1 or not!
check this out you don't need regex
list1 = ['abc', 'xyz']
output='''123
143
153
abc!
abc
hhj
xyz--
xyz'''

for line in output.split("\n"):
    line = line.strip()
    if line in list1:
        print line,"present in output"

output:

abc present in output
  xyz present in output

A: If you still want to use regex you can use this:
import re

output = """123
143
153
abc!
abc
hhj
xyz--
xyz"""

print(output)

for line in output.split("\n"):
    line = line.strip()
        if re.search(r"^\babc\b$", line) or re.search(r"^\bxyz\b$", line):
        print('line matched: {}'.format(line))

However, I would create a separate dictionary and look for the matches in there:
keywords = {'abc' : 0, 'xyz' :0, ...}

for line in output.split("\n"):
    if line in keywords:
        print('line matched: {}'.format(line))

Dictionary makes sense if you have a lot of keywords and they are all unique and your output file contains a lot of lines. The lookup time will be constant O(1).
If you use list of keywords the lookup will be O(n) which in total make your algorithm O(n^2).


text:
Q: how do I remove a class if an element has a class that I'm looking for using jQuery? video 1
video 2
video 3
video 4

In the above code, I have 4 possible menus that appear depending on which link tag I click. Whenever I click on a link that is not selected and doesn't have the 'selected' class, I want to remove the 'selected' class from the previously selected video link tag, and add that class to the link that is being clicked on.
I have no problem adding the class to the link that is being clicked on, but how do I remove the class 'selected' from the currently selected link tag when I click on a different link?
I tried the following and it did not work
$('a').hasClass('selected').removeClass('selected');

but apparently it is not a proper function and gives me an error message in the error log in firefox.

A: .hasClass() returns a boolean. Just use the selector API appropriately:
$('a.selected').removeClass('selected');

That said, this is logically equivalent:
$('a').removeClass('selected');

A: $("a.selected").removeClass("selected");

A: $('a').click(function(e){
  // current link
  var $link = $(this);

  // find all siblings (fellow links) and remove selected class
  $link.siblings('a.selected').removeClass('selected');

  // make sure this class has the elected class
  $link.addClass('selected');
});


text:
Q: Why doesn't this method call work from within a prototype? I'm trying to learn how to write better javascript but I'm not sure why this doesn't work. I have two method calls that write to a text field. The first one works fine, but the second one doesn't. Why is the text field variable undefined going thorough a nested call? Any help would be appreciated:
(function () {
    var TestObj = function (logEl) {
        this.log = logEl;
    };

    TestObj.prototype = function () {
        var log1 = function (text) {
            this.log.val(text);
        };

        var log2 = function (text) {
            log1(text);
        }

        return {
            log1: log1,
            log2: log2
        };
    }();

    $(function () {
        var logEl = $("#log");
        var test = new TestObj(logEl);
        test.log1("This Works");
        test.log2("This Dosen't"); //this.log is undefined
    });
})()

A: In the second case, log1 is being called without any context.  The value of this when being called from log2 will be the global object, not an instance of TestObj.
Try changing it to:
var log2 = function (text) {
    this.log1(text);
}

demo fiddle

A: I believe the issue is related to not using this in log2:
var log2 = function (text) {
    this.log1(text);
}

A fiddle example: http://jsfiddle.net/y66YT/

A: As dc5 and Hayes pointed out the value of this is the invoking object. It's the object that comes before the function:
somebutton.click();//this is somebutton
click();//nothing before click, window is assumed or throw exception in strict mode
myObject.doSomething();//this in doSomething is myObject

Since log1 is available through closures it doesn't throw an exception immediately (log1 is undefined) but this in log1 function is window since log2 didn't provide an invoking object.
To set the invoking object you could change code to:
 log1.call(this,text);

I'm not a big fan of throwing everything including the kitchen sink in IIFE as it creates unneeded closures for every method. You can wrap your application an an object literal instead and use IIFE where you actually need closures:
var app ={
  testObj:function(...

log1 won't be available through closures in log2 but you can call it using this
 this.log1(text);

More on prototype, constructor functions, inheritance and the value of this can be found here.


text:
Q: Updating parameters to JavaScript callback before it returns, without using globals I'm working on making a modification to a node.js module to improve error handling for one of my uses cases. The specifics of the module aren't really relevant, but one of the things I want to do is trigger a delayed retry when receiving a certain status code from the response to an API request. To do this I'm using the timeOut function to trigger a new call to the function after a period of time.
The structure of the code looks like this:
Outer function (parameters specified by client application)
 ——API request (using parameters)
   ——Callback from API request (response with status code)
     ——If error, set timeout to call outer function after delay

However, I also want to handle the case that the outer function is called again while waiting for the timeout. I don't want any calls to trigger a new API request while a timeout is pending, but I do want the parameters from the most recent call to be used when the timeout finishes.
I've been able to get this working using variables that are global to the module. Each time a new call comes in to the outer function it updates a global object with the new parameters then, if a timeout is pending, returns without calling the API request. The timeout function uses the parameters from the global object to call the outer function, rather than the parameters from when it was set. This way it always uses the most recent values that were passed into the outer function, but doesn't make duplicate API calls.
Here's a simplified example of how I've achieved this behavior with global variables: JSFiddle. Hit run a few times until you get a "failure response" which then triggers the timeout.
This works, but I would prefer not add these global variables into the module if there's a better way.
Is there any way to get this same behavior but have all of the state encapsulated in the outer function without using globals? I'm also open to completely rethinking the way I'm handling this if anyone has ideas.

A: You're not going to be able to do this without creating variables outside of your outer function, however it's still possible to create those variables without polluting your global scope.
To do so, wrap your outer function in another function that gets executed immediately, sometimes known as an IIFE:
mainFunction: (function() {
    var savedParam1;
    var savedParam2;
    var savedParam3;
    var pendingTimeout = false;

    return function(param1, param2, param3) {
        savedParam1 = param1;
        savedParam2 = param2;
        savedParam3 = param3;

        if (pendingTimeout) {
            log('pending timeout -- ignoring new call');
            return;
        }

        /* and so on */

    }
})(); // the () causes the outer function to run immediately,
      // which creates a scope for the savedParam / pendingTimeout variables,
      // and then returns the inner function (your old outer function)
      // to be used for mainFunction


text:
Q: Why am I getting no data from my Azure SignalR Service back to my KendoUI Grid? I'm using a KendoUI Grid in my ASP.NET Core 5 application.  The grid is SignalR enabled and my application is hosted in Azure.  I also use the Azure SignalR Service to handle the hubs which is what is recommended by the documentation.
I have 4 hubs powering my 4 different grids and yet, none of them are receiving data back from the SignalR Service in Azure it seems and I have no idea what is wrong.  The grids seem to load, missing data, I can see the negotiations in the console with signalR and they return 200 OK.  However, there is just no data being returned.
I'm not sure if it's a problem with the way I've set up my application or my Azure SignalR Service.
Here is how I have implemented the Azure SignalR Service in my application.
Startup.cs (ConfigureServices)
public IConfiguration Configuration { get; }

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{

    var mvcBuilder = services.AddControllersWithViews(options => {
        var policy = new AuthorizationPolicyBuilder()
          .RequireAuthenticatedUser()
          .Build();
        options.Filters.Add(new AuthorizeFilter(policy));
    });

    mvcBuilder.AddMicrosoftIdentityUI().AddJsonOptions(options =>
    {
        //Use the default property (Pascal) casing.
        options.JsonSerializerOptions.PropertyNamingPolicy = null;
    });

    services.AddRazorPages();

    services.AddSignalR(options => {
         //Debug only
         options.EnableDetailedErrors = true;
    }).AddAzureSignalR()
        .AddJsonProtocol(options =>
        {
            //Prevents signalr converting all text to lower case.
            options.PayloadSerializerOptions.PropertyNamingPolicy = null;
        });

    //Kendo
    services.AddKendo();
    services.AddHealthChecks();
}

Startup.cs (Configure)
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
    //Localization needed for date formats on datepickers
    var supportedCultures = new[] {
        new CultureInfo("en-GB")
    };

    //Localization set to En GB for datetime using the above supported cultures
    app.UseRequestLocalization(new RequestLocalizationOptions
    {
        DefaultRequestCulture = new RequestCulture("en-GB"),
        SupportedCultures = supportedCultures,
        SupportedUICultures = supportedCultures
    });
    app.UseHttpsRedirection();
    app.UseStaticFiles();
    app.UseRouting();
    app.UseAuthentication();
    app.UseAuthorization();

    app.UseEndpoints(endpoints =>
    {
        endpoints.MapHealthChecks("/healthcheck");
        endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}");
    });
    app.UseAzureSignalR(endpoints =>
    {
        endpoints.MapHub<RequirementHub>("/requirementHub");
        endpoints.MapHub<PositionHub>("/positionHub");
        endpoints.MapHub<FixtureHub>("/fixtureHub");
        endpoints.MapHub<NewswireHub>("/newswireHub");
    });
}

I am using SignalR installed in my client library in it's latest version.
libman.js
{
  "provider": "unpkg",
  "library": "@microsoft/signalr@latest",
  "destination": "wwwroot/vendor/signalr/",
  "files": [
    "dist/browser/signalr.js",
    "dist/browser/signalr.min.js"
  ]
},

I have hub controllers for each of my grids that uses SignalR.  I have shown the code for one of the hub controllers but they are all structured exactly the same, the only thing that changes is the name of the repository they are getting data from.
RequirementHub
using MyCompany.Data;
using MyCompany.Repo;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.SignalR;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace MyCompany.UI.Hubs
{
    public class RequirementHub : Hub
    {
        private readonly IRepository<Requirement> _requirement;

        public RequirementHub(IRepository<Requirement> requirement)
        {
            _requirement = requirement;
        }
        public override Task OnConnectedAsync()
        {
            Groups.AddToGroupAsync(Context.ConnectionId, GetGroupName());
            return base.OnConnectedAsync();
        }
        public override Task OnDisconnectedAsync(Exception e)
        {
            Groups.RemoveFromGroupAsync(Context.ConnectionId, GetGroupName());
            return base.OnDisconnectedAsync(e);
        }
        public IEnumerable<Requirement> Read()
        {
            var data = _requirement.GetAll();
            return data;
        }
        public async Task Update(Requirement model)
        {
            await _requirement.UpdateAsync(model);
            await Clients.OthersInGroup(GetGroupName()).SendAsync("update", model);

        }
        public string GetGroupName()
        {
            return GetRemoteIpAddress();
        }
        public string GetRemoteIpAddress()
        {
            return Context.GetHttpContext()?.Connection.RemoteIpAddress.ToString();
        }
    }
}

This now brings us to the grid itself.  Here is the code for the requirement grid, again, there are 4 grids and they are all structured the same but with different names and referencing their respective hubs.
Home.cshtml

You'll notice that the promise and hub are defined as requirement_hub_start and requirement_hub the code for those lives in its own JavaScript file as:
hubs.js
//Hub URL
var requirement_url = "/requirementHub";
var fixture_url = "/fixtureHub";
var position_url = "/positionHub";
var newswire_url = "/newswireHub";

//Connection Builder
var requirement_hub = new signalR.HubConnectionBuilder().withUrl(
    requirement_url, {
    transport: signalR.HttpTransportType.LongPolling
}).build();
var position_hub = new signalR.HubConnectionBuilder().withUrl(
    position_url, {
    transport: signalR.HttpTransportType.LongPolling
}).build();
var fixture_hub = new signalR.HubConnectionBuilder().withUrl(
    fixture_url, {
    transport: signalR.HttpTransportType.LongPolling
}).build();
var newswire_hub = new signalR.HubConnectionBuilder().withUrl(
    newswire_url, {
    transport: signalR.HttpTransportType.LongPolling
}).build();
//Hub Start
var position_hub_start = position_hub.start({
    json: true
});
var requirement_hub_start = requirement_hub.start({
    json: true
});
var fixture_hub_start = fixture_hub.start({
    json: true
});
var newswire_hub_start = newswire_hub.start({
    json: true
});

I looked at the documentation and have placed my SignalR Service connection string in my appsettings.json (until I can get this working):
appsettings.json
 "Azure": {
    "SignalR": {
      "ConnectionString": "Endpoint=https://mycompanysignalr.service.signalr.net;AccessKey=xxx=;Version=1.0;",
      "Enabled": "true"
    }
  }

Additionally, I have ensured that web sockets are switched ON in my Azure web app which was another recommendation of the documentation.  I'm a little confused at this point, I've been over my setup 100 times and I can't see anything obvious that could be preventing data coming back.
Is there another step I need to follow or have I done something wrong? Has anyone had this problem before?

A: Please check the Signalr ConnectionStrings in your appsettings.json. You can copy it from azure portal and replace it, then try.
The above suggestion is to consider whether you have used different Signalr ConnectionStrings from the Dev environment to the production environment, which caused this problem.
In addition, what pricing tier are you using? If you use Free tier, azure signalr service will limit your use.

That will happen, you have no problem at the beginning, the program is normal, and when the limit is exceeded, the program will be abnormal. At the beginning of the next day, it can be used for a while. This is a restriction given by the Free pricing tier.


text:
Q: MSWord: Change font and font-size Why does this VBA code not work?:
Sub AllToGeorgia12()

    Selection.Font.Size = 12
    Selection.WholeStory
    Selection.Font.Name = "Georgia"
End Sub

This code is meant to turn all the text into Georgia font of size 12

Edit 1:
(This edit is my answer to supporters Froeschli and Foole):
I am sorry: I didn't notice right away that the code with the first two lines swapped (just as you have suggested) works fine on its own. However, it doesn't change the font and size when I attach it to another piece of code:
Sub code()
'

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "jio"
        .Replacement.Text = ChrW(1105)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "zh"
        .Replacement.Text = ChrW(1078)
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "ja"
        .Replacement.Text = ChrW(1103)
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "ju"
        .Replacement.Text = ChrW(1102)
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "aj"
        .Replacement.Text = ChrW(1072) & ChrW(1081)
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "ej"
        .Replacement.Text = ChrW(1077) & ChrW(1081)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "ij"
        .Replacement.Text = ChrW(1080) & ChrW(1081)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "oj"
        .Replacement.Text = ChrW(1086) & ChrW(1081)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "uj"
        .Replacement.Text = ChrW(1091) & ChrW(1081)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "ey"
        .Replacement.Text = ChrW(1101)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "yj"
        .Replacement.Text = ChrW(1099) & ChrW(1081)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "ju"
        .Replacement.Text = ChrW(1102)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "ja"
        .Replacement.Text = ChrW(1103)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = ChrW(1105) & "j"
        .Replacement.Text = ChrW(1105) & ChrW(1081)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = ChrW(1101) & "j"
        .Replacement.Text = ChrW(1101) & ChrW(1081)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = ChrW(1102) & "j"
        .Replacement.Text = ChrW(1102) & ChrW(1081)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = ChrW(1103) & "j"
        .Replacement.Text = ChrW(1103) & ChrW(1081)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "jj"
        .Replacement.Text = ChrW(1098)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "q"
        .Replacement.Text = ChrW(1098)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = " j"
        .Replacement.Text = " " & ChrW(1081)
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "j"
        .Replacement.Text = ChrW(1100)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "b"
        .Replacement.Text = ChrW(1073)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "v"
        .Replacement.Text = ChrW(1074)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "g"
        .Replacement.Text = ChrW(1075)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "d"
        .Replacement.Text = ChrW(1076)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "z"
        .Replacement.Text = ChrW(1079)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "k"
        .Replacement.Text = ChrW(1082)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "l"
        .Replacement.Text = ChrW(1083)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "m"
        .Replacement.Text = ChrW(1084)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "n"
        .Replacement.Text = ChrW(1085)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "p"
        .Replacement.Text = ChrW(1087)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "r"
        .Replacement.Text = ChrW(1088)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "t"
        .Replacement.Text = ChrW(1090)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "f"
        .Replacement.Text = ChrW(1092)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "x"
        .Replacement.Text = ChrW(1093)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "ch"
        .Replacement.Text = ChrW(1095)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "sh"
        .Replacement.Text = ChrW(1096)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "s"
        .Replacement.Text = ChrW(1089)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "c"
        .Replacement.Text = ChrW(1094)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "w"
        .Replacement.Text = ChrW(1097)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "y"
        .Replacement.Text = ChrW(1099)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "e"
        .Replacement.Text = ChrW(1077)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "i"
        .Replacement.Text = ChrW(1080)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "u"
        .Replacement.Text = ChrW(1091)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = ChrW(1054) & ChrW(1049)
        .Replacement.Text = ChrW(1086) & ChrW(1081)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = " " & ChrW(1071)
        .Replacement.Text = " " & ChrW(1103)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

    ' AllToGeorgia12:
    Selection.WholeStory
    Selection.Font.Size = 12
    Selection.Font.Name = "Georgia"

End Sub

The code above is changing Latin letters to Cyrillic. The font-and-size-changing code is attached at the very end of it, right before the last End Sub line

Edit 2:
(This edit is my answer to Froeschli)
Here is what I have before running the code:

And here is what I get as a result:

As you can probably see here, only the third letter of text, letter "o", has been converted into font "Georgian".

A: You should change the order of the commands.
Selection.WholeStory
Selection.Font.Size = 12
Selection.Font.Name = "Georgia"

EDIT:
Sub code()

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "jio"
        .Replacement.Text = ChrW(1105)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "zh"
        .Replacement.Text = ChrW(1078)
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "ja"
        .Replacement.Text = ChrW(1103)
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "ju"
        .Replacement.Text = ChrW(1102)
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "aj"
        .Replacement.Text = ChrW(1072) & ChrW(1081)
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "ej"
        .Replacement.Text = ChrW(1077) & ChrW(1081)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "ij"
        .Replacement.Text = ChrW(1080) & ChrW(1081)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "oj"
        .Replacement.Text = ChrW(1086) & ChrW(1081)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "uj"
        .Replacement.Text = ChrW(1091) & ChrW(1081)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "ey"
        .Replacement.Text = ChrW(1101)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "yj"
        .Replacement.Text = ChrW(1099) & ChrW(1081)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "ju"
        .Replacement.Text = ChrW(1102)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "ja"
        .Replacement.Text = ChrW(1103)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = ChrW(1105) & "j"
        .Replacement.Text = ChrW(1105) & ChrW(1081)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = ChrW(1101) & "j"
        .Replacement.Text = ChrW(1101) & ChrW(1081)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = ChrW(1102) & "j"
        .Replacement.Text = ChrW(1102) & ChrW(1081)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = ChrW(1103) & "j"
        .Replacement.Text = ChrW(1103) & ChrW(1081)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "jj"
        .Replacement.Text = ChrW(1098)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "q"
        .Replacement.Text = ChrW(1098)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = " j"
        .Replacement.Text = " " & ChrW(1081)
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "j"
        .Replacement.Text = ChrW(1100)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "b"
        .Replacement.Text = ChrW(1073)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "v"
        .Replacement.Text = ChrW(1074)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "g"
        .Replacement.Text = ChrW(1075)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "d"
        .Replacement.Text = ChrW(1076)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "z"
        .Replacement.Text = ChrW(1079)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "k"
        .Replacement.Text = ChrW(1082)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "l"
        .Replacement.Text = ChrW(1083)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "m"
        .Replacement.Text = ChrW(1084)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "n"
        .Replacement.Text = ChrW(1085)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "p"
        .Replacement.Text = ChrW(1087)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "r"
        .Replacement.Text = ChrW(1088)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "t"
        .Replacement.Text = ChrW(1090)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "f"
        .Replacement.Text = ChrW(1092)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "x"
        .Replacement.Text = ChrW(1093)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "ch"
        .Replacement.Text = ChrW(1095)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "sh"
        .Replacement.Text = ChrW(1096)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "s"
        .Replacement.Text = ChrW(1089)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "c"
        .Replacement.Text = ChrW(1094)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "w"
        .Replacement.Text = ChrW(1097)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "y"
        .Replacement.Text = ChrW(1099)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "e"
        .Replacement.Text = ChrW(1077)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "i"
        .Replacement.Text = ChrW(1080)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "u"
        .Replacement.Text = ChrW(1091)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = ChrW(1054) & ChrW(1049)
        .Replacement.Text = ChrW(1086) & ChrW(1081)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = " " & ChrW(1071)
        .Replacement.Text = " " & ChrW(1103)
      .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

    Selection.WholeStory
    Selection.Font.Size = 12
    Selection.Font.Name = "Georgia"

End Sub

If I use the above code along with this sentence:
eyto budet russkij tekst

then everything gets converted to Cyrillic characters, font type "Georgia" font size 12.
этo будет русский текст

EDIT2:
An addition to the code has been mentioned on this question reguarding the same problem. The office version in use by the questioner is a chinese version. So the default language is chinese. This can be changed through adding the following line:

    Selection.WholeStory
    Selection.LanguageID = wdRussian
    Selection.Font.Size = 12
    Selection.Font.Name = "Georgia"


text: Q: Prove, for an open $\Omega \subset \mathbb{R}^n$ with $x\in \Omega$, that $u\in W^{1,p}(\Omega-\{x\})\implies u\in W^{1,p}(\Omega).$ Let $n\geq 2$, $\Omega\subset \mathbb{R}^n$ open, $x\in \Omega$ and $p\geq1$ I want to prove the above implication. We just need to show that the weak derivative of $u$ on the punctured domain remains the weak derivative on $\Omega$. I am unsure of how to do this though. I was thinking we could take a function $\phi \in C_0^{\infty}(\Omega)$ with $x\in supp(\phi)$ and define a new sequence of functions by smoothly cutting $\phi$ off in a ball of decreasing radius around $x$ and then pass to the limit in the definition. However we need $L^1$ convergence of the derivatives but I think this fails.


text:
Q: Enabling autologin in ubuntu 20.04.02 LTS server on raspi? I don't want theinitial screen that asks for username/password in beginning of Ubuntu Server 20.04 since I am using this OS on raspberry device which runs a code in background on startup. How do skip username/password screen or equivalently enable autologin?
I have followed tons of article over SO and web, but my version doesn't even seems to have folders where they want me to edit setting files. For example there is no 'init' folder once I get into /etc folder, lightdm, gdm3 folder, etc.

A: The program that's producing the prompt you're seeing is agetty. You can change the systemd config to automatically log you in as some user on every terminal, or on just one.
For every terminal
Use systemctl edit getty@.service to change the ExecStart=- line to /sbin/agetty -a $DESIRED_USERNAME --noclear %I $TERM
For just one terminal
Launch systemctl edit getty@tty1.service
Copy the contents of /lib/systemd/system/getty@.service into your text editor
Change the ExecStart=- line to /sbin/agetty -a $DESIRED_USERNAME --noclear %I $TERM
Solution stolen from this question and answer: https://unix.stackexchange.com/questions/253928/how-to-configure-agetty-to-autologon-on-only-one-terminal
Don't edit systemd service files directly (thanks kamilcuk).


text:
Q: Get Alfresco document nodeRef and versionNodeRef together I'm using Alfresco Community 5.0b.  I have a web application that uses Alfresco for its document store.  Each time I create a new document or update an existing version of a document, I want to store in my application database the document ID and the version ID.  The call to upload the document:
POST /alfresco/service/api/upload works great in that it returns the nodeRef of the newly created document, but it doesn't return the version nodeRef.  To get that, I need to then call: GET /alfresco/service/api/version?nodeRef={nodeRef}
Is there a way to get both pieces of information in a single call?


text:
Q: Boost score from schema I have a fieldType named double_score. The values here are all precomputed and can fit in a double format. I would like to use this score to boost the associated values s.t. solr returns values by this order. Moreover, I'd like to do this from just the schema. This last clause seems to be the one that is tripping up my searching / configuring fu.
Thanks.
EDIT: (dismax)
<requestHandler name="default" class="solr.SearchHandler" default="true">
  <lst name="defaults">
    <str name="defType">dismax</str>
    <str name="echoParams">explicit</str>
    <int name="rows">10</int>
    <str name="qf">name</str>
    <str name="bq">double_score</str>
    <str name="debug">true</str>
    <str name="q.alt">*:*</str>
  </lst>
</requestHandler>

A: Use sort order if you would like your results to be sorted acording to your double_score field.
You can see here how to use sort after your field: http://wiki.apache.org/solr/CommonQueryParameters#sort
If you want this to be set in your schema you just have to add the sort:double_score as a default parameter for each request:
<requestHandler name="default" class="solr.StandardRequestHandler" default="true">
    <lst name="defaults">
        <str name="sort">double_score</str>
    </lst>
</requestHandler>

A: "returns values by this order" if that means a simple sort, go with Dorin's answer.
But to boost results based on fields (you may take several fields into consideration) , see this: http://wiki.apache.org/solr/SolrRelevancyFAQ#How_can_I_make_.22superman.22_in_the_title_field_score_higher_than_in_the_subject_field


text:
Q: Appending strings to text files in C++ C++ beginner here,
I am trying to append some text to a pre-written .txt file where every line there is a word.
I have been using the method ofstream and ifstream as seen below, but everytime I try to write something, it erases the file. (I am not allowed to use ios:app or simillar)
int append_new_word() {
//First I read everything on the list and save it to a string called Words_in_List

    ifstream data_wordlist_in("woerterliste"); //Opens the txt file
    if (!data_wordlist_in) // checks if the file exists
    {
        cout << "File does not exist!" << endl;
        return 1;
    }

    string Word;
    int line = 0;
    string Vorhandene_Woerter;
    std::getline(data_wordlist_in, Wort);
    do { //line counter, goes through all lines and save it to a string
        line++;
        std::getline(data_wordlist_in, Word);
        Words_in_List = Words_in_List + "\n" + Word;

    } while (!data_wordlist_in.eof());

        cout << Words_in_List << endl;

        data_wordlist_in.close();

    //HEre it should save the string again in the list word per word with the neu appended word

    ofstream data_wordlist_out("woerterliste"); //opens ofstream
        if (!data_wordlist_out)
        {
            cout << "File does not exist!" << endl;
            return 1;
        }
        string new_word_in_list;
        cout << "\n Insert a Word to append: ";
        cin >> new_word_in_list;

        data_wordlist_out << Words_in_List << endl << new_word_in_list;

    data_wordlist_out.close(); //closes ofstream
}

Everytime I try I open my program it erases the list.

A: Your code has some minor problems, but nothing that matches your description of it.
It does line based input, which is strange because nothing in the problem description indicates that reading a line at a time is necessary.
It counts lines, again for no obvious reason.
It skips the first line (maybe this is deliberate, but if so you didn't mention that).
The loop termination is incorrect (see link in the comments).
The function is declared as returning an int but no return is made.
Here some code that addresses these problems. It reads characters not lines (using get()) which makes reading the input simpler, but essentially it's the same technique as your code.
void append_new_word()
{
    string existing_content;
    ifstream in("file.txt");
    char ch;
    while (in.get(ch))
        existing_content += ch;
    in.close();
    cout << "enter a new word ";
    string new_word;
    cin >> new_word;
    ofstream out("file.txt");
    out << existing_content << new_word << '\n';
}


text:
Q: sheet.cssRules throws error on inner pages but works fine on homepage I am using this function in my Wordpress site's custom javascript.
var addRule = (function (sheet) {
    if(!sheet) return;
    return function (selector, styles) {
        console.log(sheet.cssRules)
        if (sheet.insertRule) return sheet.insertRule(selector + " {" + styles + "}", sheet.cssRules.length);
        if (sheet.addRule) return sheet.addRule(selector, styles);
    }
}(document.styleSheets[document.styleSheets.length - 1]));

The problem here is the above function works fine on homepage but,
Throws Uncaught DOMException: Failed to read the 'cssRules' property from 'CSSStyleSheet': Cannot access rules on inner pages.
Here is the link to my site,
Homepage //here you will see no error in console
Inner Page //here you will see an error in console
as per my research, this error is caused by Cross-Origin Resource Sharing (CORS),
but why it is working on Homepage?

A: No doubt that the problem is caused by CORS. I suggest you to console.log(document.styleSheets) and see the href of the element to check which stylesheet is getting passed to your addrule() after doing this document.styleSheets.length - 1,  the stylesheet's href should be same as your domain.

A: It's not going to work without you including "../" before the sheet.cssRule. Just go ahead and count the depth of your internal file and add "../" to be exactly equal to that value.
Writing something like "../../../../sheet.cssRule" instead of "sheet.cssRule" should get the problem solved.

A: I understand you code is absolutely fine when we compare both pages and also try close console.log with (;) semi colon in your script.
console.log(sheet.cssRules);


text:
Q: exclude inactive users when sending push notifications Does apns or gcm notify clients (us) when certain device ids are inactive?
Or should we try to guess who is inactive and active?
I guess there are many user accounts who actually deleted our app. I want to remove those devices from our server so that we don't have to send push notifications to them..
(or should we not care?)

A: Yes, Apple provides a Feedback service for this:
https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/CommunicatingWIthAPS.html
For GCM, it is built-in in the response of the GCM HTTP connection server:
https://developer.android.com/google/gcm/http.html


text:
Q: BSD Packet Filter Redirect Internal traffic I'm using OSX Yosemite with Packet Filter (BSD). Is there a way to redirect internal originating traffic (let's say from en1) to lo0 on a specific port for specific destinations? rdr from what I understood is used only for incoming packets.
Thx


text:
Q: Error while creating/updating Maven project in STS eclipse
I have installed STS recently on Ubuntu system but i appears an error while create/update any maven project.
Can't understand what it says!

A: Got the solution by deleting .m2 directory :D


text:
Q: TYPO3 and RealUrl don't use translated page titles in url I use TYPO3 7.1 and RealUrl 1.13.3.
Auto configuration is not using the page title from translated pages and it is not changing ?L=1 to fx /en/
It is just using the default Danish page titles and adding ?L=1 to English pages and ?L=2 to German pages.
The content is shown in the right languages.
What could be the problem?

A: First switch to manual config, then add config for L param in preVars section according to your languages like described in doc
     array(
         'GETvar' => 'L',
         'valueMap' => array(
             'dk' => '1',
             'en' => '2',
             // etc...
         ),
         'noMatch' => 'bypass',
     ),

also add the languageGetVar (also described in doc) param to pagePath section
'pagePath' => array(
    'type' => 'user',
    'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
    'rootpage_id' => 1,
    'languageGetVar' => 'L', // <- here
),


text:
Q: Sum lines in linux with different numbers but with the same pattern I would like to know if is possible to sum in linux directly the following lines contained in one file.
34 cars
13 cars
11 drivers
42 drivers

The output I would like to be
47 cars
53 drivers

Thank you!
I've searched the website but I didn't find something similar with my request.

A: You can use awk for that:
awk '{a[$2]+=$1}END{for(i in a){print a[i], i}}' file

UPD. If the pattern consists of several words, then try
awk '{n=$1;$1="";a[$0]+=n}END{for(i in a){print a[i], i}}' file

However, there are still issues with non-normalized white space, e.g. a space and a  space are the same pattern.


text:
Q: Accessing a public Facebook profile in UIWebView (with access_token) Problem: Viewing a public Facebook profile without being authenticated into Facebook shows a bare-bones profile. I have the users access_token. Is there any way to use the access_token to show the user a profile as if they were authenticated, or authenticate them behind the scenes before sending them to the profile page in order to see the full profile?
Specifically, I'm loading a Facebook profile in a UiWebView, which does not have access to the cookie pool of Safari, and so the user is not able to see the full profile. The user has already authenticated with my app, and so I have their access token, which I'm hoping I can use without forcing them to re-authenticate.
I know this is somehow possible because the Foursquare iPhone app accomplishes it. If you look at another users Facebook profile, you are able to see the full profile as if you were logged in. Next step is to sniff the traffic to try to figure it out, but wanted to see if there was an obvious solution I was missing first.

A: Turns out this is only possible if you had logged into FB in a UIWebView of that particular application at some point in the past. Once you do that, it caches your credentials across all future sessions.

A: Play around with the Graph API Explorer since you already have the token.  https://developers.facebook.com/tools/explorer  There you can learn what you can and cant do with the API. Once you get used to that, then you can learn the iOS stuff via http://developers.facebook.com/docs/reference/iossdk/