I am learning how to properly use Java parameters and arguments

I am learning to use parameters and arguments in Java to make my coding efficient. I am open to suggestion if I’ve done something wrong with this code of mine.

import java.util.Scanner;

public class paramsAndArgs {

    static String name, feeling;

    public static void main(String() args) {
        doesSomething(name, feeling);
    }

    private static void doesSomething(String name, String feeling) {
        Scanner scan = new Scanner(System.in);

        System.out.println("What is your name?");
        name = scan.nextLine();
        System.out.println("How are you today?");
        feeling = scan.nextLine();

        System.out.println("Hello, " + name + ". I am feeling " + feeling + " too.");
    }
}
```

DiscretizeRegion is not working properly with Graphics3D

I have a 3D object and I would like to remove everywhere except a part with a circle shape. Here is the 3D object

ax := 0; az := 2; ay := 0; rs = 0.1; rl = 0.01;
unitCell3D(x_, y_, z_) := {Black, Sphere({x + ax, y + ay, az}, rs), 
   Black, Sphere({x + ax, y + ay + 2/3 Sin(120 Degree), az}, rs), 
   Black, Cylinder({{x + ax, y + ay, az}, {x + ax, 
      y + ay + 2/3 Sin(120 Degree), az}}, rl), Black, 
   Cylinder({{x + ax, y + ay, az}, {x + ax + Cos(30 Degree)/2, 
      y + ay - Sin(30 Degree)/2, az}}, rl), Black, 
   Cylinder({{x + ax, y + ay, az}, {x + ax - Cos(30 Degree)/2, 
      y + ay - Sin(30 Degree)/2, az}}, rl)};
xUns(j_) = j Sin((Pi)/3) + 0.1;
f2 = Graphics3D(
  Block({unitVectA = {Cos(120 Degree), Sin(120 Degree), 0}, 
    unitVectB = {1, 0, 0}}, 
   Table(unitCell3D @@ (unitVectA j + unitVectB k), {k, -10, 
     10}, {j, -10, 10})), Boxed -> False, Axes -> False, 
  Method -> {"EdgeDepthOffset" -> False}, ImageSize -> 300, 
  PlotRange -> {{-5.6, 5.6}, {xUns(-6) - Sin((Pi)/6), 
     xUns(6)}, {-0.3, 2.3}})   

and here is how I remove the desired part

hole = Cylinder({{0, 0, -3}, {0, 0, 2}}, Sqrt(10));
dhole = DiscretizeRegion@hole; g2 =
 f2 /. Sphere -> Ball /. 
  r_?(RegionQ@# && ! RegionWithin(hole, #) &) :> 
   If(RegionDisjoint(hole, r), Nothing, {EdgeForm@None,
     BoundaryMesh(RegionDifference(DiscretizeRegion@r, dhole))});

Show(g2, Graphics3D(hole), Boxed -> False, ViewPoint -> Top, 
 ImageSize -> 450)    

but some dangling lines and dots exist in the removed region, see below. How can I make it perfectly removed outside the circle?

enter image description here

unity – GameObject LookAt not aligning properly

I have a celestial sphere with a plane in the centre and spheres (stars) aligned around the centre with a fixed radius.

Celestial Sphere Screenshot

In order to show the stars visible from a certain latitude and longitude from Earth, I need to rotate the plane accordingly.

To rotate the plane properly, I converted the latitude and longitude into 3D vectors, then utilised the LookAt() method to point the plane at this vector.

The following is the code which calculated the vectors from the coordinates, and utilises the LookAt() Method:

public void positionLand(double latitude, double longitude)
{
    Vector3 markerPositioning = new Vector3();
    markerPositioning.x = (float)-((math.cos(latitude)) * (math.cos(longitude)));
    markerPositioning.y = (float)((math.cos(latitude)) * (math.sin(longitude)));
    markerPositioning.z = (float)((math.sin(latitude)));

    groundPlane.transform.LookAt(markerPositioning);
}

To test if this would work, I used the coordinates of London, UK, latitude: 51.509865 and longitude: -0.118092. And this was the result:

London coordinates LookAt

As you can see, the plane is not properly rotating. Initially, I thought maybe the LookAt() method is using the incorrect forward vector of the plane gameobject, but this isn’t the case as there is no connection between the way the plane rotated and the coordinates of London.

What am I doing wrong and how can I fix this?

web server – How properly manage several webapps on one domain nginx

as in title I’m trying to setup several webapps (nextcloud, roundcube) on one domain, let’s say example.com, without using cname subdomains. I installed webapps in default location /usr/share/webapps/ and I want this directory to be also my webroot server. How can I achieve effect like this:

example.com -> /usr/share/webapps/index.html
example.com/nextcloud -> /usr/share/webapps/nextcloud/
example.com/roundcube -> /usr/share/webapps/roundcube/

using (if possible) several nginx configurations file? For example, nginx config for nextcloud contains few server blocks while roundcube config from archwiki (server is running Arch Linux) is all written in one location block. How should look nginx configuration to make all this working and with option to easily add new webapps?

server setup – How do I properly debug the root cause of 503 errors produced by Varnish?

I’m using Magento 2.3.5 with Apache 2.4 and Varnish 6 and seeing constant 503 errors (“Backend Fetch Failed” or sometimes “Service Unavailable”) in the browser’s network panel when page assets are loading.

The 503 errors don’t affect all requests; on a typical page load in developer mode, when a Magento page might require about 200 external assets (JS/CSS/template files etc.) about 80-90% of requests are successful but 10-20% are not.

The errors do not always affect the same files; it is quite random although anecdotally I would say that larger files are affected moreso than tiny files.

If I manually request the problem URL in the browser, or click Resend in the browser’s network panel to retry the request, the request almost always succeeds with a 200 OK response straight away.

In this way, I am usually able to load a page fully without any 503 errors by a process of refreshing the page 4, 5, or 6 times until all the 503 are “exhausted” and “turn into” 200 OK responses.

Obviously this is not OK, and something is wrong; pages should load first time every time.

Debugging

I have debugged extensively trying to find the root cause of this. Things I have tried:

  1. varnishlog output is not particularly helpful. It simply states that the backend fetch failed without saying why (e.g. did it time out? etc.)
    > -   VCL_return     pass
    > -   VCL_call       HASH
    > -   VCL_return     lookup
    > -   VCL_call       PASS
    > -   VCL_return     fetch
    > -   Link           bereq 720946 pass
    > -   Timestamp      Fetch: 1593622218.746588 0.461734 0.461734
    > -   RespProtocol   HTTP/1.1
    > -   RespStatus     503
    > -   RespReason     Backend fetch failed
  1. I’ve tried increasing the first byte and connect timeouts in Varnish as per the VCL configuration below:

VCL Configuration

backend default {
    .host = "localhost";
    .host_header = "mysite.example.com";
    .port = "8080";
    .connect_timeout = 600s;
    .first_byte_timeout = 600s;
    .probe = {
         .url = "/pub/health_check.php";
         .timeout = 2s;
         .interval = 5s;
         .window = 10;
         .threshold = 5;
    }
}
  1. I also tried removing Magento’s health check probe as per this answer

windows 10 – How can I properly sysprep a Win10 VM in Azure to avoid any questions being asked at startup?

The default Windows when creating a new VM in Azure is Win10 1809.

I am trying to follow these instructions for using an unattend file:
https://bartsimons.me/sysprep-generalize-windows-image-without-oobe/

With 1809, after sysprep:
C:WindowsSystem32Sysprepsysprep.exe /oobe /generalize /unattend:C:deploy.xml

I create the image of the VM and then create a new VM from that image. When connecting via RDP for the first time to the VM built from the image I still see the security settings and network settings questions.

I then attempted to try a newer Win10 (2004). This was even worse. The first time after using the unnatend file I wasn’t even able to RDP into the VM created from the image. The RDP session hung on “Just a moment” for a dozen minutes or so and I gave up. After rebooting the VM I was never able to reconnect.

I tried again to sysprep without using the unattend file, and simply rebooted the same VM. When I did that, I had to answer ALL the fun Windows questions (keyboard layout, language, etc). No thanks.

Can anyone assist in the right sysprep incantation with the right Win10 version to be able to get this to have a VM that boots with no questions asked?

As an extension to that question, I’d like for a few specific desktop icons to be present. Anything that was copied to the desktop before sysprep is nuked.

Thanks!

seo – Switch properly from HTML website to WordPress without hurting Google rankings

My question is about specific technicalities of the switch from HTML website to WordPress. I looked through similar questions but my question still remains.

I think my situation is pretty standard.

I’m about to switch my current HTML website to WordPress. My website has been up since 2006.

Main details of the transition:

-My current site is in the /public folder

-Most pages have .php extension

-The WordPress folder is /clickandbuilds/mywebsite (WordPress.org, hosted by 1&1)

-I’ll also need to do 301 redirects for all .php pages to the WP pages

I guess my main question is the following:

Is it safe to just switch my domain from the /public folder to the WordPress folder once everything is ready? I assume it’s a standard procedure – but still wanted to get a second opinion.

Thanks,
Leo

windows 10 – Disable Microsoft Office Telemetry not working properly. Data Logging Locations very confusing

Due to the Data Privacy regulations in our Country we have been asked by management to disable Microsoft Office Pro Plus, 365, 2016 from sending Telemetry Data to Microsoft so i did the following as stated on the official website https://docs.microsoft.com/en-us/deployoffice/compat/manage-the-privacy-of-data-monitored-by-telemetry-in-office .

So I downloaded ADMX templates > Configuration > Administrative Templates > Microsoft Office 2016 > Telemetry Dashboard and did the following in order to disable Telemetry
Agent policy settings that disable logging

TO STOP LOGGING BY USING THE GROUP POLICY SETTINGS

Setting

Turn on telemetry data collection

Set this setting to Disabled to turn off data collection.

Turn on data uploading for Office Telemetry Agent

Set this setting to Disabled to stop uploading data to the shared folder.

According to Microsoft if logging is deactivated folder this %LocalAppData%MicrosoftOffice16.0Telemetry folder does not exit.
I double checked on one of our test clients and truly that path doesnt exist.

Nevertheless my attention was then drawn to another location %localappdata%MicrosoftOfficeOTele. Check out this article https://www.gruppenrichtlinien.de/artikel/office-20162019365-telemetrie-deaktivieren-disabletelemetry/

This location also logs some kind of Office Telemetry Data and it gets populated anytime office is active.
Is this location relevant? If so how do we stop it from logging office Data?

Reference link: https://social.technet.microsoft.com/Forums/office/en-US/f98dd521-fc45-4187-af30-f00031585f44/disable-microsoft-office-telemetry-not-working-properly-data-logging-locations-very-confusing?forum=Office2016ITPro#f98dd521-fc45-4187-af30-f00031585f44

How to compare dates using Flow properly / Date validation in calendars

I’m trying to validate entries in a classic sharepoint calendar, let’s name it Cal1.

Explanation of the superseding problem:
People enter dates in the calendar. Calendar entries resemble planned access times to building parts. For this purpose additional fields in Cal1 are created: Person, Group, Rooms

In another list (let’s call it Acc1) I hold assignments to user groups. List item has the fields: Person, Group, Start-Date, End-Date. This means: If a date is within the designated period, the person will be assigned to a certain group. For keeping history there will be more than one possible item for each person.

Normal column validation won’t work, because of the multiple entries in Acc1.
I looked at
Help with date list validation and blank fields but it doesn’t address the different column definitions and is limited to comparisons within one item.

Now, when a new item is added to the Cal1 or an existing is altered, I want to trigger a flow which does the following:
Takes the beginning and end of Date plus Person entered in the new item, checks for every item of Acc1, if Person matches Person there and if the complete Date is within Start-Date and and End-Date.

Of course, the date of the calendar will have Time, too. Acc1 should only have a dates without time.

For the comparison in Flow I assume the following might happen.

If the date has no time (as selected in the column definition) the hours, minutes and seconds will be set to 0.
I.e. End of a date with same day as Acc1’s End-Date e.g. Sep. 19th 15:15:00 will be considered greater than a Sep. 19th without time.
Am I thinking right, that if I want the End-Date to mark the last valid day of an assignment to a group, I have to add 24 hours to it for the comparison?

And for the comparison of the start days is it the other way round?

Or are there other pitfalls when comparing dates with different column settings, i.e. do I have to convert the dates retrieved by Flow?

Should I even change the column definition of Acc1 to Date+Time?

apache flink – “Distinct with KeySelector function”in official document did not work properly

I’m learning the example from

Distinct with KeySelector function

I’m trying to complete it.

DistinctwithKeySelectorfunction.java is:
https://pastebin.ubuntu.com/p/9pDBcsbYBh/

AbsSelector.java is in:
https://paste.ubuntu.com/p/NXFfnHwGmg/

both of above are in src/main/java

But the result from Intellij is:

log4j:WARN No appenders could be found for logger (org.apache.flink.api.java.ExecutionEnvironment).

log4j:WARN Please initialize the log4j system properly.

log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

-1

2

3

——————–Final Result——-
Math.abs(t)=1

Math.abs(t)=2

Math.abs(t)=3

3

-1(This is wrong)

2

Process finished with exit code 0