text:
Q: Uploading using FTP but website not adapting to changes (not cache) I am developing a Wordpress theme for a blog I want to start.
I am using Dreamweaver to upload my files to the server using FTP. It appears that the FTP is working perfectly. I have edited files, uploaded, then checked on the server and the changes are being made.
The problem is the changed are not showing up on my website. They are showing up maybe 5 - 10 minutes after, if at all. The strange thing is .css files work and update perfectly, but the .php files do not.
The issue does not appear to be the cache. I am clearing cache, doing hard-refreshes and using incognito to develop.

A: change your css links to
<link href="stack.css?ver=<?php echo rand(1,10000) ?>">

this may help

A: You can press ctrl+r for refresh your page and check it . if still out put not come check then follow my suggestion.
1.check your file permission
2.wordpress disabled cache.
3.check htacces


text:
Q: convert local date time to UTC time in php I'm trying to converting local date time to UTC time but it's not converting.
i'm using this:-
$check= 13-07-2015 12:03:41;
$userdate=gmdate("Y-m-d H:i:s", strtotime($check));

Its giving me only 2 hours difference between my local time to UTC time but actual difference is 5:30 hours.
Please suggest me how to convert this.

A: $check needs to be a string (I'll assume it is and you just forgot to add the quotes in the edit)
$check = '13-07-2015 12:03:41';

find out what timezone your php thinks you're in:
echo date_default_timezone_get();

if it's not your timezone (it should be something like 'Asia/Kolkata' from the 5 1/2 hrs difference) then update your timezone in your  php.ini file with the correct one
if you can't access your php.ini file then you'll need to set the timezone in your script using date_default_timezone_set

redpajama_set_name: RedPajamaStackExchange


text:
Q: Dput() syntax error vectbl_as_col_location I am using the data found here: https://www.kaggle.com/cdc/behavioral-risk-factor-surveillance-system. In my R studio, I have named the csv file, BRFSS2015. I am learning how to create a reproducible example, so that I can post questions in agreement with the site guidelines. Below is the code I am trying to execute:
dput(head(BRFSS2015[, c(157, 2119)]))

structure(list(MARITAL = c(1, 2, 2, 1, 1, 3),
    PA1MIN_ = c(NA, 168, NA, NA, NA, 330)), .Names = c("MARITAL",
"PA1MIN_"), row.names = c(NA, 6L), class = "data.frame")

This is leading to output:
Error in vectbl_as_col_location(j, length(x), names(x), j_arg = j_arg, :
I don't understand what is wrong. MARITAL and PA1MIN_ are variables in the BRFSS2015 dataset. I am trying to present the first 6 rows of these two columns in a reproducible example. Number one, I am getting the error message shown above. Number two, I would rather not have NAs in an example, but I don't know how to remove them for the purpose I am talking about.


text:
Q: Why does this disk img mount only though a CDROM block device? I've created a disk image (not just a partition) of an SD card using dd. It contains one ext4 partition.
parallels@debian-gnu-linux-10:/media/psf/Irfan$ file -k old_armbian.img
old_armbian.img: Linux rev 1.0 ext4 filesystem data, UUID=62974604-6430-48bc-9f66-90d77651e3bf (extents) (large files) (huge files) (Lepton 3.x), scale 0-0, spot sensor temperature 0.000000, unit celsius, color scheme 0, calibration: offset 0.000000, slope 0.000000 (Lepton 2.x), scale 0-0, spot sensor temperature 0.000000, unit celsius, color scheme 0, calibration: offset 0.000000, slope 0.000000\012- data

I've been trying to mount this img on Debian via a loopback mount, but it refuses to detect and mount the ext4 that is contained in it.
The only way I was able to mount it was through a VM where I attached this img file to the CDROM device. After which I was able to mount it through the CDROM block device (/dev/sr0)
The issue:
$ sudo mount -t ext4 -o loop,ro ./old_armbian.img /mnt/PEND/
mount: /mnt/PEND: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error.
$ sudo mount ./old_armbian.img /mnt/PEND/
mount: /mnt/PEND: can't read superblock on /dev/loop0.

I've also tried doing losetup:
$ sudo losetup --partscan -f old_armbian.img
$ sudo mount -t ext4 /dev/loop0 /mnt/test
mount: /mnt/test: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error.

Only this one worked:
$ sudo mount -t ext4 -o ro /dev/sr0 /mnt/PEND

What gives?

A: With -o loop mount creates a loop device and tries to mount it, but the device doesn't contain an ext4 filesystem, it contains a partition table which is not mountable. You need to mount the partition on the image and mount can't do that, you need to create the loop device manually first with --partscan to tell kernel to probe the partition table and the mount the partition:
# losetup --partscan -f old_armbian.img

# mount /dev/loop0p1 /mnt/PEND

I'm not sure why this works with the virtual CD, it should have the same problem (it's possible the virtual CD is created with an offset and actually starts at the first partition or something like that).


text:
Q: Checking for odd integers causing errors in Java I am a Java beginner. Here's my question:
The following method is supposed to determine if an int value passed as the argument, is an odd number:
public static boolean isOdd(int i) {
    return i % 2 == 1;
}

However, I am getting an error.
May I know what I am missing?

A: The operator % (with 2 as second argument) can also return -1. Thus, either use the absolute value of the argument, or - preferable - compare the absolute value of i%2 with 1.
Math.abs() is available:
 public static boolean isOdd(int i) {
    return Math.abs(i % 2) == 1;
 }

A: I assume that this method is failing for negative numbers.
The following fails.
assertTrue(isOdd(-1));

The following code will pass the test.
return Math.abs(i % 2) == 1;


text:
Q: javascript return multiple strings with .join() --- string[i].join("") not working creating a solution to a piglatin homework problem. successfully returning single words.  going for multiple words now.
everything is working up until outputting two separate words. attempting to use join to output multiple words, but not working
attempted to output with this: // return ${splitWords[i].join("")}yay;
hit a wall after looking through MDN and stackoverflow.
function pigLatin(string) {
  // Global variables
  const vowels = ["a", "e", "i", "o", "u"];
  const splitWord = string
    .toLowerCase()
    .trim()
    .split("");
  const words = string.split(" ");

  // Multiple Words iteration
  for (let i = 0; i < words.length; i++) {
    const splitWords = words[i]
      .toLowerCase()
      .trim()
      .split("");
    console.log(splitWords);
    for (let i = 0; i < splitWords.length; i++) {
      for (let v = 0; v < vowels.length; v++) {
        if (splitWords[i][0] === vowels[v]) {
          // return `${splitWords[i].join("")}yay`;
        }
      }
    }
  }

expected results are to return multiple joined words with "yay" attached at end.
actual result is splitWords[i].join("") is not a function.

A: Ok,the problem here is that you are creating an array of strings and accesing one of their elements as if it was the array.In this expression splitWords[i].join("").Try this instead return ${splitWords}yay.

A: You are thinking like a C-Programmer. You are writing JavaScript now, so stop doing that. Thinking the wrong way I mean. Also you should spend a little bit more effort in the naming of things. Names are important! It's well worth watching Giving code a good name - Kevlin Henney if you have a spare hour and a half.
Anyway back to the main point. Javascript shines in functional programming. It's pretty much built on the concept of functions being first class citizens. That's why the Array has all these fancy methods like find, map and grep and so on.
So you should get into the habit of playing with the language. Consider this code:
function pigLatin(input) {

  const maybe_add_yay = function(word) {
    const vowels = ["a", "e", "i", "o", "u"];
    const yay_re = new RegExp( vowels.join("|") );
    return yay_re.test(word) ? word + 'yay' : word;
  };

  return input
    .toLowerCase()
    .trim()
    .split(" ")
    .map( maybe_add_yay )
    .join(" ");
}

console.log( pigLatin("bababa Güllühüllü kptnk giumalo") );
// bababayay Güllühüllü kptnk giumaloyay

This nicely decouples two problems (parsing input into chunks and process the chunk). The "collect multiple values and join them" problem is autosolved by the use of the Arraymethods.
I wasn't sure which piglatin rules you actually wanted to implement, so this code just adds yay to whatever word contains one of the vowels, as your OP seems to indicate.
If you need another rule you can just tweak the maybe_add_yay function. Like getting rid of the vowels array completely and use a handwritten (arbitrarily complex) regular expression in the first place.


text:
Q: classic asp/vbscript class to track employees and performance metrics I am trying to create a classic asp/vbscript class that will allow me to easily manage a small number of employees (30-40) along with some metrics associated with those employees, about 14 metrics each. I've done some tutorials online and can't quite get how I should proceed. What I have so far is below. It's not much, basically I think I can only add the employees to a dictionary in the class, but I don't know where to go from here.
class iagent
    private di_agents
    private ar_metrics
    private pri_agent_counter

    Public function add_agent(uuid)
        di_agents.Add uuid, pri_agent_counter
        pri_agent_counter=pri_agent_counter+1
    end function

    private sub Class_initialize
        pri_agent_counter=1
        dim ar_metrics(14, 5)
        set di_agents = CreateObject("Scripting.Dictionary")
    end sub

end class

A: The class you have is just a wrapper around a dictionary. Are you talking about creating a class that represents an employee?
Class Employee
  Public Name
  Public Age
  Public Phone
  'other properties
End Class

Then you can instantiate Employee like this and set your properties
Set e = New Employee
e.Name = "Some name"

You could then store your instances of Employee in a dictionary, perhaps paired with an ID:
Set d = CreateObject("Scripting.Dictionary")
Call d.Add(uuid, e)

However, you're better off using a database for this and using ASP/VBS to extract records... Unless this is just an exercise


text:
Q: Show the same divs on different pages in ASP.net I have, for example, 3 different pages. All pages should have a menu div, a logo div and a footer div. All divs should be the same on every page.
Is there any way to develop only one page and when I make a change on that page, this change should appear on every other page, in ASP.NET?

A: You can use Master Pages. As well as that MSDN page, you can view more tutorials on the official ASP.NET site.

A: If you use a master page then you get that same effect.  Or you can use user controls and then include them in all 3 pages.


text:
Q: Sharing stories, test plans and updates between our devops instance and clients devops instance i'm wondering if anyone has had a similar requirement to this:

*

*A client has a stream of work. They generate user stories in a project. Some are assigned to us as development projects.

*We add the General user story to our dev ops, then generate more user stories, do the development and create test plans, etc.

*We hand the work back over to the client and the test.

They do not want to be a stake holder in our devops, they have other work inside their devops that their users want to access.
We dont want to be a stakehodler in their teanancy as we expand ont eh user stories, add taks, link code and commits to the user stories.
What we would like to do is update each others project via power automate or custom code. Tehy want to send us the initial user stories. We want to send discussions to their user tory, as well as test plans and new user stories.
Anyone achieved this except with import/Export to excel?
i know it's a slightly strange scenario as we're managing smaller chunks of a larger project for them.
thanks!

A: There are tools like TaskTop and OpsHub that enable syncing and conflict resolving changes between tools like Azure DevOps. They tend to be relatively expensive. But are feature rich and can resolve most issues.
You could use the Azure DevOps Sync/Migration tools to automatically sync changes from one Azure DevOps to another. It's a free solution, but can be complex to setup.
I'd urge not to rely on custom API solutions, since there are many strange conditions to take into account.

A: You could check Work Items - Update and Work Items - Create REST apis of Azure DevOps and customize your own solution:
Work Items - Create sample:
POST https://dev.azure.com/{organization}/{project}/_apis/wit/workitems/${type}?api-version=6.0

[
  {
    "op": "add",
    "path": "/fields/System.Title",
    "from": null,
    "value": "Sample task"
  }
]

Work Items - Update sample:
PATCH https://dev.azure.com/{organization}/{project}/_apis/wit/workitems/{id}?api-version=6.0

[
  {
    "op": "test",
    "path": "/rev",
    "value": 1
  },
  {
    "op": "add",
    "path": "/fields/System.AreaPath",
    "value": "Fabrikam-Fiber-Git\\Website"
  },
  {
    "op": "add",
    "path": "/fields/System.History",
    "value": "Moving to the right area path"
  }
]


text:
Q: error in python: list assignment index out of range I searched everywhere and even though there were a couple of questions and answers regarding this error I couldn't find a solution to fix my problem
I'm reading in from a file that contains letters and numbers and I'm populating my matrix depending on the values in that file.
ex: file
description of letters and numbers ...
table:
  a b c d
a 1 2 5 6
b 5 6 3 4
c 3 2 1 4
d 2 4 6 8

Here's the code
matrix = [[0 for j in range(4)] for i in range(4)]
i = 0
j = 0

for line in file:
   for a in line:
      if is_number(a):
         matrix[i][j] = int(a)
         j+= 1
      if matrix.count(0) < 2: #since matrix already populated with zeroes. it shouldn't have
                               #many per program specifications, that's why I use this
                               #conditional to increment i and reset j back to 0
         i += 1
         j = 0

file.close()

I don't understand why I keep getting that error.

A: I see two possible ways you could end up with an IndexError in your code.
The first problem occurs because of the way you are iterating through the file that you're reading. Your code:
for line in file:
    for a in line:
        if is_number(a):
            # do stuff

Reads a line in the file into the variable line. Then, each character is stored in the variable a and you check if it is a number. If any of the integers you are reading in are greater than 9 you will see an IndexError since it will count each digit as a separate number, causing you to eventually run out of room in your pre-allocated array.
A possible fix would be to change the line:
for a in line:

to
for a in line.split()

which will split the line into a list of words (that is, a new entry for everything separated by whitespace). So, "6 12 4 5" will become [6,12,4,5], making it so that you don't count the 1 and 2 in 12 separately.
The second issue I see with your code is in the line:
if matrix.count(0) < 2:

If your input file ever contains a zero, it will cause this line to stay true for one iteration of the loop longer than you would like. A possible fix would be to change the line to:
if j == len(matrix[0]) - 1:

A: try something like this:
with open("data1.txt") as f:
    next(f)                  #skip the first line
    lis=[map(int,x.split()[1:]) for x in f]  #use x.split()[1:] to remove the alphabet
    print lis

output:
[[1, 2, 5, 6], [5, 6, 3, 4], [3, 2, 1, 4], [2, 4, 6, 8]]

A: If you know the input file already has the right matrix (line by line) layout you could use the following :
matrix = filter(lambda x: len(x)>0, [[int(a) for a in l.split() if is_number(a)] for l in file])

If you cannot expect anything from the input layout, you could try:
data = open("test").read()
l = filter(lambda x: is_number(x), data.replace("\n"," ").split())
width = int(math.sqrt(len(l)))
print [[int(l[i+width*j]) for i in range(width)] for j in range(width)]

A: You're constructing a 4x4 matrix in the first line of code, but your data is a 6x6 matrix.  When you try to store an element at index 4 in row 0, you get an IndexError.

A: The problem is here:
matrix = [[0 for j in range(4)] for i in range(4)]

Your matrix is 6x6, but your code only compensates for a 4x4 matrix.


text:
Q: Difference between Boolean(x) and !!x Using JavaScript, is there any difference between
Boolean(x)

and
!!x

?

A: They both have the same output, but you have to watch out for the Boolean object vs function. The Boolean constructor (using the new keyword) is not a primitive true or false value. Whereas the !! operator evaluates if an object is truthy/falsey.
Here's a quote from MDN:

Any object of which the value is not undefined or null, including a
  Boolean object whose value is false, evaluates to true when passed to
  a conditional statement.

So the following evaluates to false:
new Boolean(false) === false
but the following evaluates to true:
Boolean(false) === false

A: What's also an interesting difference between them is that you are able to explicitly pass Boolean as an callback inside Array#filter function, while if you would like to use !!, you'd would firstly have to set a callback function and then return it.
.filter(Boolean) ✓
.filter(!!) ✕
.filter((x) => !!x) ✓ (can be simplified, though - .filter((x) => x))


text:
Q: 10BASE-T Layout Guidelines How critical are parameters like trace length matching, differential impedance, vias, etc. when designing a 10BASE-T only application? I know that due to the reduced frequency, there is a larger margin for error than for higher data rates, but there must be good-practice maximums and minimums.
For example, in a two-layer PCB that I am designing, I have the following parameters:

*

*TX+ length: 25.946mm

*TX- length: 26.764mm

*RX+ length: 26.420mm

*RX- length: 27.769mm

*Differential impedance: 123ohm

*Odd impedance: 61.7ohm

The 8P8C connector has integrated magnetics and the MAC/PHY is the ENC28J60. Sorry about the messy labels.

A: 10 Base-T runs at 10MHz, usually you don't need to worry about transmission line effects and impedance matching until 50MHz. It would be slightly better to keep traces short, and a ground plane underneath them if you can, this design looks ok.


text:
Q: Issue with using Electron.NET I have been following the instructions on the Electron.NET Github page https://github.com/ElectronNET/Electron.NET and I have been running into an issue. When I have run the commands in VS Code the Electron code still is not recognised. E.g.
public static IWebHost BuildWebHost(string[] args) =>
    WebHost.CreateDefaultBuilder(args)
        .UseElectron(args)
        .UseStartup<Startup>()
        .Build();

When using this snippit of code my IDE doesn't recognise the .UseElectron(args) part of the code
Is there something I am doing wrong or a step I have missed? I made sure to run the following commands
dotnet new mvc
dotnet add package ElectronNet.API

and changing the .csproj file to include
<ItemGroup>
 <DotNetCliToolReference Include="ElectronNET.CLI" Version="0.0.9" />
</ItemGroup>

and running dotnet restore. If there is any way of figuring out what step I have missed out please let me know.


text:
Q: My Intellij-IDEA build my project too slow for Jrebel Last month, I was using IntelliJ IDEA Community which equipped with Jrebel.If I update one line of the html or Java file, and immediately press ctrl+F9, It will only take 2~3 sec.
Recently, I choose to use IntelliJ IDEA Ultimate instead, which also equipped with Jrebel.After same actions, It will take 8~11 sec. I believe it is too slow.
I have seen details of my IntelliJ's building. I believe it execute so many unnecessary steps,such as installing. All the information is as below:
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------------< com.*:centre >--------------------------
[INFO] Building centre 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ centre ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO] Copying 30 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ centre ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ centre ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory F:\my\centre\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ centre ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ centre ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:3.1.2:jar (default-jar) @ centre ---
[INFO] Building jar: F:\my\centre\target\centre-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- spring-boot-maven-plugin:2.2.2.RELEASE:repackage (repackage) @ centre ---
[INFO] Replacing main artifact with repackaged archive
[INFO]
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ centre ---
[INFO] Installing F:\my\centre\target\centre-0.0.1-SNAPSHOT.jar to H:\localRepository\com\*\centre\0.0.1-SNAPSHOT\centre-0.0.1-SNAPSHOT.jar
[INFO] Installing F:\my\centre\pom.xml to H:\localRepository\com\*\centre\0.0.1-SNAPSHOT\centre-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  7.280 s
[INFO] Finished at: 2021-02-16T11:59:46+08:00
[INFO] ------------------------------------------------------------------------

Process finished with exit code 0

A: IntelliJ recently introduced a feature to delegate build and run actions to the build tool which seems to be happening in your case. The feature is useful for overly complicated project setups that generate and process classes/resources using various plugins. In such cases IntelliJ's own build wouldn't know of these plugins and may not produce correct output. The downside is that a full maven build takes more time and unlike NetBeans, IntelliJ currently doesn't allow specifying goals (e.g. package) to run during a build and will run a full mvn install. Instead of invoking Build you may manually run a maven goal if building via maven is needed but want more control.
Standard projects like yours can disable the feature via File | Settings | Build, Execution, Deployment | Build Tools | Maven | Runner | Delegate IDE build/run actions to Maven


text:
Q: What are the differences between various VM software? I have only ever used VirtualBox and I would like to know, for example, what could I be missing from other offerings. I have heard of KVM and VMWare and I'm sure there's others. Short of reading Wikipedia articles on each (phew!), how do they differ?

A: VirtualBox is a software application that runs on top of your OS. It can use capabilities of your OS and hardware to accelerate the virtualization.  The VirtualBox software must remain running for the virtualized systems to remain operational.
Xen is a subclass of operating systems called a hypervisor, it is an OS which only provides virtualization. It offloads management capabilities to a separate management OS which it calls the "dom0", usually Linux.  The management OS provides drivers for the physical hardware.
VMWare has several products. VMWare Workstation works like VirtualBox, while VMWare ESX is a hypervisor similar to Xen.  A major difference to Xen is that ESX provides its own hardware drivers and as a result has limited hardware support.
KVM is a project which adds a hypervisor into the Linux kernel.  Because KVM uses a hypervisor, it does not need to remain running in the same fashion as VirtualBox. While KVM is a hypervisor such as Xen and ESX, it is simultaneously a Linux kernel & OS of its own accord.
It should be noted that KVM's inclusion into Linux is often misunderstood as being generally accepted as being the "blessed way forward". The KVM project is officially supported in Linux as it is a Linux kernel modification, while Xen and ESX are entirely separate operating systems.

A: I would classify virtual machine technologies into three categories (not all products fit clearly into one category):

*

*Full virtualization, i.e., complete hardware emulation. Examples: Qemu, Dosbox. Pro: you can potentially emulate any architecture on any hardware. Con: it's the slowest way to do it.

*Hardware-assisted virtualization, where you can emulate machine X on machine X. This can be a lot faster than full virtualization, because most instructions are executed natively, but you lose the ability to run a foreign architecture. There are two sub-categories:

*

*Hypervisor-based VMs: you run several OSes alongside each other. The bottom layer, called the hypervisor, is a special-purpose OS that runs the VMs and nothing else. Examples: Xen, VMware ESX.

*Hosted VMs: there is a main OS, the VM is an application on this main OS. Examples: VirtualBox, KVM.

*OS-level virtualization: you run several instances of the same OS. This can be in turn a lot more lightweight than hardware virutalization, but you lose some isolation and of course the ability to run different OSes. Examples: OpenVZ, FreeBSD jails.

First determine the category that corresponds to your needs.

A: it's a hypervisor technique various performance inside system


text:
Q: Package "sun.org.mozilla.javascript.internal" not found in rt.jar for jdk1.8.0_131 I'm upgrading my app from jdk 7 to jdk8, but found that Package "sun.org.mozilla.javascript.internal" no longer exist in rt.jar, is there a alternative jar i can import to resolve the problem? Thanks in advance!

A: I try to use rhino.jar instead, and it works!


text:
Q: how to solve the problem occurs during build Conductor I'm new to Conductor.I cloned the source code from the github and try to start the local server according to the tutorial at https://netflix.github.io/conductor/intro/ using windows OS,howerver,it builds failed,the error message is as follows:
> Task :conductor-server:server FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':conductor-server:server'.
> A problem occurred starting process 'command 'C:\Program Files\Java\jdk1.8.0_74\bin\java.exe''

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':conductor-server:server'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:110)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:77)
        at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
        at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
        at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
        at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
        at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.run(EventFiringTaskExecuter.java:51)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:317)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:309)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:185)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:97)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:46)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$ExecuteTaskAction.execute(DefaultTaskExecutionGraph.java:262)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$ExecuteTaskAction.execute(DefaultTaskExecutionGraph.java:246)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:136)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:130)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.execute(DefaultTaskPlanExecutor.java:201)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.executeWithTask(DefaultTaskPlanExecutor.java:192)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:130)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: org.gradle.process.internal.ExecException: A problem occurred starting process 'command 'C:\Program Files\Java\jdk1.8.0_74\bin\java.exe''
        at org.gradle.process.internal.DefaultExecHandle.execExceptionFor(DefaultExecHandle.java:231)
        at org.gradle.process.internal.DefaultExecHandle.setEndStateInfo(DefaultExecHandle.java:209)
        at org.gradle.process.internal.DefaultExecHandle.failed(DefaultExecHandle.java:355)
        at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:85)
        at org.gradle.internal.operations.CurrentBuildOperationPreservingRunnable.run(CurrentBuildOperationPreservingRunnable.java:42)
        ... 3 more
Caused by: net.rubygrapefruit.platform.NativeException: Could not start 'C:\Program Files\Java\jdk1.8.0_74\bin\java.exe'
        at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27)
        at net.rubygrapefruit.platform.internal.WindowsProcessLauncher.start(WindowsProcessLauncher.java:22)
        at net.rubygrapefruit.platform.internal.WrapperProcessLauncher.start(WrapperProcessLauncher.java:36)
        at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:67)
        ... 4 more
Caused by: java.io.IOException: Cannot run program "C:\Program Files\Java\jdk1.8.0_74\bin\java.exe" (in directory "F:\gitdemo\conductor\server"): CreateProcess error=206, ▒ļ▒▒▒▒▒▒▒չ▒▒̫▒▒▒▒
        at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25)
        ... 7 more
Caused by: java.io.IOException: CreateProcess error=206, ▒ļ▒▒▒▒▒▒▒չ▒▒̫▒▒▒▒
        ... 8 more

A: This happens due to all jar files with absolute path being added to classpath and windows having a limit use below plugin in your build.gradle and you should be able to start your conductor server
plugins {
  id 'com.github.ManifestClasspath' version '0.1.0-RELEASE'
}

A: I recommend not using windows for Conductor. I was also using conductor in my windows machine, I faced a lot of issues. I am using the Conductor in my ubuntu machine now for almost 2 months. I did not face any issue with it until now.
Adding this plugin helps for now. But you face issues later.
plugins {
id 'nebula.netflixoss' version '5.1.1'
id 'com.github.kt3k.coveralls' version '2.8.2'
id 'com.github.ManifestClasspath' version '0.1.0-RELEASE'}


text:
Q: Does the series $\sum_{n=1}^{\infty} \log(\frac{n+1}{n})$ converge? I was working on the convergence or divergence of this series
$\sum_{n=1}^{\infty} \log(\frac{n+1}{n})$. I would like if someone gives me some feedback on my answer and on my understanding of the limit comparison test:
Consider the sequence $b_n = \log(\frac{n+1}{n}) = \log(n+1)-\log(n)$. Since log(x) is a monotonically increasing concave function, then $b_n>b_{n+1}$, for all $n\in\mathbb{N}$. Thus $b_n$ is monotonically decreasing sequence. Moreover $\log(n+1)>\log(n)$, so $\log(n+1)- \log(n)>0$, for all $n$. So $(b_n)$ is bounded by 0.
Every monotonically decreasing sequence converges to its greatest lower bound. For $b_n$ it is equal to zero. Moreover, there certainly exist a sequence $(a_n)$ of positive terms such that its limit is some real number distinct from zero, and $\sum_{n=1}^{\infty} a_n$ converges. Hence because $\lim_{n\to\infty}\frac{b_n}{a_n} = 0$ and $\sum_{n=1}^{\infty} a_n$ converges, then $\sum_{n=1}^{\infty} b_n$ must converge.
What doesn't fit in my argument is that, it will be implying that the series of any sequence of non-negative terms that converges to zero, must converge. But certainly this is not true since $\sum_{n=1}^{\infty} \frac{1}{n}$ diverges. But i don't see where I am blundering.
I'll appreciate any feedback. Moreover, if someone may give an argument without appealing to the concave part.

A: Your argument that $b_n\to 0$ can be made much simpler: $\frac{n+1}{n}\to 1$ and since $\log$ is continuous so $\log(\frac{n+1}{n})\to \log 1 = 0$. However this won't help as your proof breaks down after that: you say that there is some convergent $\sum a_n$ such that $a_n\to L\ne 0$ but this is not possible as if $\sum a_n$ converges then $a_n\to 0$.
We know that $\log x \sim x-1$ for $x\to 1$ (as follows from the Taylor series expansion of $\log x$). Since $\frac{k+1}{k}\to 1$ this means that your series $\sum b_n$ behaves roughly like $\sum (\frac{k+1}{k}-1)=\sum \frac{1}{k}$ and hence diverges. To prove this rigorously use the comparison test with $\sum_{n=1}^{\infty} \frac{1}{n}$.
Another way to prove divergence is by writing the partial sums of the series and noticing that by telescoping all elements cancel and you are left with $\sum_{k=1}^n \log(\frac{k+1}{k})=\log(n+1)\to\infty$.

A: Why not to write that
$$\sum_{n=1}^{p} \log \left(\frac{n+1}{n}\right)=\log\Bigg[\prod_{n=1}^{p} \frac{n+1}{n}\Bigg]=\log\Bigg[\frac{ \prod_{n=1}^{p}(n+1)} {\prod_{n=1}^{p}n }\Bigg]=\log(p+1)$$


text:
Q: Inject ThreeJs models on an Angular JS App It a quite a general question.
I'm building a webapp with Angular Js (v1.5/1.6) and I wish to add some little 3D animated models using Three Js.
I already tried to set up little things but Angular refuse all Three Js methods... So if anyone of you know or already saw any tutorial, books, article in this area please do not hesitate to share.
Thanks everyone.

A: There are quite a lot of examples on how to integrate ThreeJS and Angular 1/2.
In my experience the best way to achieve that is by creating a directive that will initialize ThreeJS (create camera, scene, etc...) and like any other directive will communicate with the controller throw the scope (using $watch).
For example:
angular.module('nxGeometry', []).directive('nxGeometry', function () {
    return {
        restrict: 'A',
        link: function (scope, element, attrs) {
              var camera, scene, geometry, renderer, material, object, container;
              function init() {
                  scene = new THREE.Scene();
                  // continue init threejs stuff
              }
        }
    }
});

You can see a complete example here (not mine): https://jsfiddle.net/awolf2904/y0dvo582/


text:
Q: Where is the generic.xaml file located? If you want to use the default styles, colors, etc..., you need to bring them from the generic.xaml file that comes with WindowsAppSDK NuGet packages.
Hence the question, where is located the generic.xaml file?

A: You can find the default generic.xaml inside each WindowsAppSDK NuGet package folder.
For example, in the case of WindowsAppSDK v1.2.230118.102, you can find 3 generic.xaml files.
First, let's locate the folder for the WindowsAppSDK v1.2.230118.102 NuGet package.
C:\Users\USERNAME\.nuget\packages\microsoft.windowsappsdk\1.2.230118.102

Note: Replace USERNAME with your user name.
Now, inside this folder you'll find 3 generic.xaml files.

*

*\lib\net6.0-windows10.0.17763.0\Microsoft.WinUI\Themes\generic.xaml

*\lib\net6.0-windows10.0.18362.0\Microsoft.WinUI\Themes\generic.xaml

*\lib\uap10.0\Microsoft.UI\Themes\generic.xaml

AFAIK, these generic.xaml files are identical as long as they belong the same WindowsAppSDK version. But keep in mind that generic.xaml might be different between WindowsAppSDK versions.
If WinUI 3 gets be open sourced, I guess we'll be able to get the generic.xaml file  from the repo. But for now, this is the way to go.
UPDATE
Additional sources thanks to @YangXiaoPo-MSFT and @mm8:

*

*microsoft-xaml-ui build project shows the path.

*XAML theme resources

*Uncompiled styles and templates in GitHub


text:
Q: How not to delete category if it has products? I have a product which has a category name: "Shorts". So if I'll delete the category name shorts the product will also be deleted. So, I want, if the shorts will be deleted it will not delete because it has a product. Help me please
Function of my delete category...
   public function destroy(){
         $category= Category::find(Input::get('id'));

         if($category){
            $category->delete();
            return Redirect::to('admin/categories/index')
                ->with('message', 'Category Deleted');
         }

         return Redirect::to('admin/categories')
            ->with('message', 'Something went wrong');

A: First you need to check if there's a product belongs to that category
Product::where('category_id', Input::get('id'))->count();

Then simply delete the category if the count is not greater than 0. *Not tested *
$products = Product::where('category_id', Input::get('id'))->count();
    if($products > 0){
         return Redirect::to('admin/categories')
                ->with('message', 'Something went wrong');
    }
    else{
        $category= Category::find(Input::get('id'));
        $category->delete();
        return Redirect::to('admin/categories/index')
                    ->with('message', 'Category Deleted');
    }


text:
Q: How do I create an inner drop shadow in text with php Imagick please? I'm at the beginning of the learning curve with ImageMagick.
I have successfully created some text on a patterned background with outer light drop shadow to give the nice appearance of cut-out text.
To finish off the effect I need to give the text and inner dark drop shadow.
Are there any ImageMagick experts out there who can help with the php please?
This is my code so far which I'm happy with.
<?php
header('Content-type: image/jpeg');
$background_layer = new Imagick('test_background.jpg'); # background image
$d = $background_layer->getImageGeometry();
$w = $d['width'];
$h = $d['height'];
$text_layer = new Imagick();
$text_layer->newImage($w, $h, new ImagickPixel('none'));
$text_layer->setImageFormat('png');
$ImagickDraw = new ImagickDraw();
$ImagickDraw->setFillColor('#484848');
$ImagickDraw->setFont('Helvetica-Bold');
$ImagickDraw->setFontSize( 40 );
$ImagickDraw->setTextAlignment(2); // centre

$text_layer->annotateImage( $ImagickDraw, $w / 2, 50, 0, "Stuart's\niPhone" );

// create white drop shadow on it's own layer
$shadow_layer_white = $text_layer->clone();
$shadow_layer_white->setImageBackgroundColor( new ImagickPixel( 'white' ) );
$shadow_layer_white->shadowImage( 70, .3, 1, 1 );

// composite original text_layer onto shadow_layer
$shadow_layer_white->compositeImage( $text_layer, Imagick::COMPOSITE_OVER, 0, 0 );
// composite shadow_layer (which now has text AND the shadow) onto image_layer
$background_layer->compositeImage( $shadow_layer_white, Imagick::COMPOSITE_OVER, 0, 0 );
echo($background_layer);
?>

I'm too new to post images so you can see what I have so far at
http://www.avforums.com/images/temptest.php
Any help you can give to add an internal dark drop shadow in the text would be appreciated.
Thanks

A: You are using Imagick not Imagemagick directly and may want to add that tag as well.
I do not use Imagick but shadeimage should do what you want in one go?


text:
Q: How to generate Table Of Contents using OpenXML SDK 2.0? Using the SDK I'm building Word documents that contain reports. These documents need to have TOC.
Does anybody have a complete solution that I can follow in order to understand how to do this?
(I've read everything on http://openxmldeveloper.org/)

A: Thanks to Dmitri Pavlov (@DmitryPavlov) for the help.
I don't want to give an answer to my own question, but this is just to illustrate the steps that I've taken.
The advice for anyone interested is to watch the 5-part screen-cast by Eric White - Exploring Tables-of-Contents in Open XML WordprocessingML Documents. This has all the info with respect to adding and updating a TOC (am much more).
My solution was to use a Template (just a regular empty document that had styles for everything I needed: Header 1-5, TOC style, etc.). This is particularly useful as a quick fix for the styles issue (the new document, that has the TOC, will have a new style.xml created; this file has some additional data; as a result the hierarchy in the TOC isn't as expected – i.e., header 2 is the child of header 1, header 3 is a child of header 2, etc.).
Therefore:

*

*Create a Word document and add all the elements that you expect to be added later programmatically (e.g., Header 1-5, Table of Contents, etc.). Delete all the contents and save the document (the reason for this is to create styles for all the necessary elements).

*I personally added the template (the file created at step #1) as a resource in my project.

*In your code, create a new copy of the template (this will be the actual file that you will work on). I used:
byte[] stream = Properties.Resources.Template;
File.WriteAllBytes(@"D:\Template.docx", stream);
File.Copy(@"D:\Template.docx", @"D:\New.docx");

*Flush all the data to this document.

*Add the source files from screen-cast 2, 3 or 4 to your project (for this please see screen-cast 3) - at the end of those posts you will find a link to download TocAdder.zip. Or just add a reference to TocAdder.dll.

*Insert the TOC. Just an example:
using (WordprocessingDocument wdoc = WordprocessingDocument.Open(@"D:\New.docx", true))
{
    XElement firstPara = wdoc
        .MainDocumentPart
        .GetXDocument()
        .Descendants(W.p)
        .FirstOrDefault();
    TocAdder.AddToc(wdoc, firstPara,
        @"TOC \o '1-3' \h \z \u", null, null);
}

*Replace the styles in the newly created document with the ones from the template. You can use this resource from MSDN: Replacing the Styles Parts in Word 2010 Documents by Using the Open XML SDK 2.0. Again, an example:
string fromDoc = @"D:\Template.docx";
string toDoc = @"D:\New.docx";
var node = WDExtractStyles(fromDoc, false);
if (node != null)
    WDReplaceStyles(toDoc, node, false);
node = WDExtractStyles(fromDoc);
if (node != null)
    WDReplaceStyles(toDoc, node);

*Optionally use one of the methods described in screen-cast 3, 4 or 5 in order to get around the problem with the modal dialog box that Word puts up.
Hope this will be useful for somebody.

A: If you have a TOC field, this will cause it to be updated when the document is opened in Word (body is a reference to the document body):
DocumentFormat.OpenXml.Wordprocessing.SimpleField f;
f = new SimpleField();
f.Instruction="sdtContent";
f.Dirty = true;
body.Append(f);

A: Have a look at Fourth and Final Screen-Cast in Series on Adding/Updating the TOC in OpenXML WordprocessingML Documents by Eric White.
Hope that helps!
UPDATE:

According FAQ from MSDN Forums I see that this feature is not supported:

8) How to generate TOC (table of contents) in Word document?
Open XML SDK 2.0 does not have this feature supported. But you can generate
  a small TOC through Word app, and reflect the TOC parts with Document
  Reflector component in Open XML SDK Productivity Tool to see how to
  generate a TOC programmatically. For more detailed information, please
  refer to:

*

*
MSDN forum thread: Generating Table of Contents and Applying a Custom Style,

*
MSDN forum thread: How can i Create dir for word document.

UPDATE 2

Based on our comments below I could propose to use this scenario:

*

*You manually create an empty DOCX file and insert TOC inside it.

*Then you save this file and open it in OpenXML SDK 2.0 Tool, which provides you with the C# code to generate such empty file with TOC placeholder inside.

*Then you programmatically flush all the data you need to this DOCX file and save it.

*In addition you will need provide the mechanism that will auto update TOC once the data are flushed (or once the document is opened). There are a few options to do that - see screen-casts 3-5 fromthe link to Eric White post I provided above. Especially, I think youshould pay your attention to 5th one - "Shows how to use an AutoOpen macro to update the TOC whenever any document that contains a TOC is opened".

All of that look a bit tricky, but I hope that helps.

A: Use auto Table of contents (clickable)

*

*Set Heading
 public static Paragraph SetHeading1(this Paragraph p)
 {
     var pPr = p.Descendants<ParagraphProperties>().First();
     pPr.ParagraphStyleId = new ParagraphStyleId() { Val = "Heading1" };
     return p;
 }

*Generate TOC from empty document, you can use this:
private static string GetTOC(string title, int titleFontSize)
    {
        return $@"<w:sdt>
     <w:sdtPr>
        <w:id w:val=""-493258456"" />
        <w:docPartObj>
           <w:docPartGallery w:val=""Table of Contents"" />
           <w:docPartUnique />
        </w:docPartObj>
     </w:sdtPr>
     <w:sdtEndPr>
        <w:rPr>
           <w:rFonts w:asciiTheme=""minorHAnsi"" w:eastAsiaTheme=""minorHAnsi"" w:hAnsiTheme=""minorHAnsi"" w:cstheme=""minorBidi"" />
           <w:b />
           <w:bCs />
           <w:noProof />
           <w:color w:val=""auto"" />
           <w:sz w:val=""22"" />
           <w:szCs w:val=""22"" />
        </w:rPr>
     </w:sdtEndPr>
     <w:sdtContent>
        <w:p w:rsidR=""00095C65"" w:rsidRDefault=""00095C65"">
           <w:pPr>
              <w:pStyle w:val=""TOCHeading"" />
              <w:jc w:val=""center"" />
           </w:pPr>
           <w:r>
                <w:rPr>
                  <w:b />
                  <w:color w:val=""2E74B5"" w:themeColor=""accent1"" w:themeShade=""BF"" />
                  <w:sz w:val=""{titleFontSize * 2}"" />
                  <w:szCs w:val=""{titleFontSize * 2}"" />
              </w:rPr>
              <w:t>{title}</w:t>
           </w:r>
        </w:p>
        <w:p w:rsidR=""00095C65"" w:rsidRDefault=""00095C65"">
           <w:r>
              <w:rPr>
                 <w:b />
                 <w:bCs />
                 <w:noProof />
              </w:rPr>
              <w:fldChar w:fldCharType=""begin"" />
           </w:r>
           <w:r>
              <w:rPr>
                 <w:b />
                 <w:bCs />
                 <w:noProof />
              </w:rPr>
              <w:instrText xml:space=""preserve""> TOC \o ""1-3"" \h \z \u </w:instrText>
           </w:r>
           <w:r>
              <w:rPr>
                 <w:b />
                 <w:bCs />
                 <w:noProof />
              </w:rPr>
              <w:fldChar w:fldCharType=""separate"" />
           </w:r>
           <w:r>
              <w:rPr>
                 <w:noProof />
              </w:rPr>
              <w:t>No table of contents entries found.</w:t>
           </w:r>
           <w:r>
              <w:rPr>
                 <w:b />
                 <w:bCs />
                 <w:noProof />
              </w:rPr>
              <w:fldChar w:fldCharType=""end"" />
           </w:r>
        </w:p>
     </w:sdtContent>
  </w:sdt>"
        }

*Create SdtBlock, and set TOC xml
     var sdtBlock = new SdtBlock();
     sdtBlock.InnerXml = GetTOC(Translations.ResultsBooksTableOfContentsTitle, 16);
     document.MainDocumentPart.Document.Body.AppendChild(sdtBlock);

*Set UpdateFieldsOnOpen
     var settingsPart = document.MainDocumentPart.AddNewPart<DocumentSettingsPart>();
     settingsPart.Settings = new Settings { BordersDoNotSurroundFooter = new BordersDoNotSurroundFooter() { Val = true } };

     settingsPart.Settings.Append(new UpdateFieldsOnOpen() { Val = true });

if you need generate pdf file from docx, it's working fine!


text:
Q: How to stop form resubmission on page refresh Hi I have a form that adds attachments to a post, however when the form posts it obviously doesn't show the post with the new attachment echoing "your file has been uploaded". When the user refreshes the page (to try and show their new attachment) the form posts again!
Is it possible to either (1) stop the form posting again on refresh, (2) automatically refresh the page to display the post with its new attachment?? (2 is way better)
<?php $post_id = $post->ID;
if ( isset( $_POST['html-upload'] ) && !empty( $_FILES ) ) {
require_once(ABSPATH . 'wp-admin/includes/admin.php');
$id = media_handle_upload('async-upload', $post_id); //post id of Client Files page
unset($_FILES);
if ( is_wp_error($id) ) {
    $errors['upload_error'] = $id;
    $id = false;
}

if ($errors) {
    echo "
There was an error uploading your file.
";
} else {
    echo "
Your file has been uploaded.
";
}
}

?>
<form id="file-form" enctype="multipart/form-data" action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="POST">

upload
<input type="file" id="async-upload" name="async-upload"> <input type="submit" value="Upload" name="html-upload">

<input type="hidden" name="post_id" id="post_id" value="<?php echo $post_id ?>" />
<?php wp_nonce_field('client-file-upload'); ?>
<input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>" />

<input type="submit" value="Save all changes" name="save" style="display: none;">

</form>

Thanks! :)

A: Basically, the general idea is to redirect the user to some other pages after the form submission which would stop the form resubmission on page refresh but if you need to hold the user in the same page after the form is submitted, you can do it in multiple ways.
Unset Form Data
One way to stop page resubmission on page refresh is to unset the form data after it is submitted so that the variable storing form data becomes empty and wrap up your form processing block of codes to check if the form is empty.

if(!empty($_POST) && $_SERVER['REQUEST_METHOD'] == 'POST'){
   $data = // processing codes here
   unset $data;
}

This will make $data empty after processing and the first clause would stop form resubmission on page refresh.
Javascript
This method is quite easy and blocks the pop up asking for form resubmission on refresh once the form is submitted. Just place this line of javascript code at the footer of your file and see the magic.

More on such queries you can visit this link.

A: Instead of …
} else {
    echo "
Your file has been uploaded.
";
}

… redirect to another address on success:
} else {

    $new_url = add_query_arg( 'success', 1, get_permalink() );
    wp_redirect( $new_url, 303 );
    exit;
}

Status code 303 triggers a GET request:

This method exists primarily to allow the output of a POST-activated script to redirect the user agent to a selected resource. The new URI is not a substitute reference for the originally requested resource. The 303 response MUST NOT be cached, but the response to the second (redirected) request might be cacheable.

In your form handler check first if $_GET['success'] is set and its value is 1, then print a success message. The visitor can reload this page again and again – and nothing will be sent.

A: I had the same problem and it was "complicated" by the fact that I redirect all URLs to a single .php file. It turned out all I had to do to solve it was to insert the following piece of code before any html is written to the page.
<?php
if (isset($_POST['mypostvar']) && isset($_SERVER['REQUEST_URI']))
{
    [process the post data in 'mypostvar']
    header ('Location: ' . $_SERVER['REQUEST_URI']);
    exit();
}
?>

This will redirect to the same page after the postdata is processed as you want it.
After the redirect the original postdata is vanished and will not trigger the resubmit.
The function 'header()' will only work if you insert it before anything is written to the page.
exit() is necessary.
You have to process the post data before you place the header().

A: I solved this my using the template_redirect action (either in a a plugin or on your themes functions.php file).
add_action('template_redirect','myfunction') ;

function myfunction() {
  global $post;
  $post_id = $post->ID;
  if ( isset( $_POST['html-upload'] ) && !empty( $_FILES ) ) {
     require_once(ABSPATH . 'wp-admin/includes/admin.php');
     $id = media_handle_upload('async-upload', $post_id); //post id of Client Files page
     unset($_FILES);
     if ( is_wp_error($id) ) {
        $errors['upload_error'] = $id;
        $id = false;
    }

  }
  $error = ($errors) ? 1 : 0;
  wp_redirect( "/?p={$post_id}?errors={$error}",301);
}

Then on your page you can check for errors
if ($_GET['errors']) {
    echo "
There was an error uploading your file.
";
} else {
    echo "
Your file has been uploaded.
";
}

(I've not tested this code.. it should give you a good starting point).

A: You can also test for $_SERVER['REQUEST_METHOD'] === 'POST' to make sure that the page has been refreshed via POST before processing the form.
if ( $_SERVER['REQUEST_METHOD'] === 'POST' )
{
   // Do Stuff
}

A: an easier way is to remove the action from your form and have a hidden action so for example:

<form action="" method="post><input type="text" name="name" />
<input type="submit" value="Submit" />
<input type="hidden" name="action" value="Submit" />
</form>

have your controller checking for validity and for submissions so to check if the form was submitted:
<?php
if (isset($_POST['action']) && $_POST['action'] == 'Submit'){
   //you should add code to validate user input here
   //if all ok submit the form
   header('Location: .'); //redirects to the controller without resubmitting
}
?>

this method is very useful for scripts where you are adding or removing records on an admin page as it would reload the page without resubmitting and the record removed or added would be either removed or added to the page :)

A: The best method I found is using javascript and css. Common php redirection method  header('Location: http://www.yourdomain.com/url); will work but It cause warning " Warning: Cannot modify header information - headers already sent" in different frameworks and cms like wordpress, drupal etc. So my suggestion is to follow the below code
echo '';
echo '';
exit;

The style tag is important otherwise the user may feel like page loaded twice. If we use style tag with body display none and then refresh the page , then the user experience will be like same as php header('Location: ....);
I hope this will help :)

A: Solution 1 :
If you are inserting post in post type then just generate the random code using rand() php function and save the code while inserting post. Also set the same code in $_POST['uniqueid'] variable.
Then check on insert if the the current uniqueid is there in posts or not, you can do the same using wp_query().
Solution 2 :
Redirect to another page using javascript. But kindly not that user can go back to page and on again it will save post on refresh. For this issue the first solution is best.
Solution 3 :
Use ajax to insert post there will be no issues like this. But if you want page hits. It's not a good idea, may be for Google Adsense.
I just tried to help by my experience. If anyone need code to fix the problem, simply ask, I will share.

A: the simple and easy way to do this in php.
example here:
dont forget the html tags(this form wont allow it here so i use [this])
$firstname = $post[firstname]

$lastname = $post[lastname]

[form action="here.php" method="post"]

first name[input type='firstname' name='firstname']

last name[input type='text' name='lastname']

[input type=submit value=submit]
[/form]

if($firstname==""||$lastname=="")
{

echo"the firstname and lastname are empty";

}
else
{

mysql_query("YOUR DATABASE INSERT HERE");

header("Location:here.php");

}

this is how to keep the data enter in the database from posting the same data twice on page refresh


text:
Q: Parsing and Ignore Null Data Inside Multidimensional Array on Angular 6 I have multidimensional array, that shown from console.log(temp) in my dashboard.component.ts just like this:
[[],[],[],[],[],[],[],[],[],[],[{"user_id":"ismail.rahman.saanin@gmal.com","status":"Idle"},{"user_id":"lutfi.aldi.nugroho@gmil.com","status":"Overload"}]]

Basically, this kind of array (contain null array inside) is rare condition. But it disturb me, i cant parse the data.
My Dashboard.component.ts
this.scheduleService.getShiftSchedule().subscribe((temp)=>{
  this.api = temp;
//console.log(temp);
  var ids = [['user_id', 1], ['status', 2]],
  result = Object.keys(temp).map(o => ids.map(([key, id]) => ({ id, content: temp[o][key] })));
  this.tablePresetData = result;
})

My question is, how to filter data if there is condition null array in multidimensional array like in my case ?
Need Help, Thanks guys...

A: You can check if length is greater than 0.

let arr = [[],[],[],[],[],[],[],[],[],[],[{"user_id":"ismail.rahman.saanin@gmal.com","status":"Idle"},{"user_id":"lutfi.aldi.nugroho@gmil.com","status":"Overload"}]];
arr = arr.filter(item => Array.isArray(item) && item.length > 0)
console.log(arr);

A: You can use  .filter() and return element .length where 0 evaluates to false
let [res] = array.filter(({length}) => length)

or use .flat()
let res = array.flat()


text:
Q: Deadline exceeded while waiting for HTTP response, Python, Google App Engine I am using a cron job to download a web page and save it, using Google App Engine.
After 5 seconds I get a Dealine exceeded error.
How can I avoid the error.  Searching around this site, I can extend the time limit for urlfetch.  But it isn't urlfetch that is causing issues. It is the fact that I can't run the task for over 5 seconds.
For example, I have tried this fix, but it only works if I am running the page myself, not via a cron job:
HTTPException: Deadline exceeded while waiting for HTTP response from URL: #deadline

A: Cron jobs can run for a maximum of 10 minutes, but that doesn't mean the URLFetch can't timeout before then. The default timeout for URLFetch is exactly 5 seconds but you can raise this.

"You can set a deadline for a request, the most amount of time the service will wait for a response. By default, the deadline for a fetch is 5 seconds. The maximum deadline is 60 seconds for HTTP requests and 10 minutes for task queue and cron job requests. When using the URLConnection interface, the service uses the connection timeout (setConnectTimeout()) plus the read timeout (setReadTimeout()) as the deadline."

see: https://developers.google.com/appengine/docs/java/urlfetch/?csw=1#Requests

"A cron job will invoke a URL, using an HTTP GET request, at a given time of day. An HTTP request invoked by cron can run for up to 10 minutes, but is subject to the same limits as other HTTP requests."

see: https://developers.google.com/appengine/docs/python/config/cron
Furthermore check out this older stackoverflow question with very similar issue.
If Google App Engine cron jobs have a 10 minute limit, then why do I get a DeadlineExceededError after the normal 30 seconds?


text:
Q: does running a synchronous function inside an async function make the function still run synchronously or will it make it run asynchronously? node.js specfically when using fs.copyFilesync()  and running it in an async function, will fs.copyFilesync() still run synchronously or will it run in an asynchronous manner like the fs.copyfile() function. My issue is that i have an async function and i need to copy the file first inside the async function and make sure it has finished copying the file before it executes the rest of the code inside the async function, so in this case is it better to use fs.copyfile() inside the async function or fs.copyFilesync() inside the async function?
const fs = require("fs");
async function hi(){
fs.copyFilesync()
//or
//fs.copyFile()

/*rest of code inside this async function must run only after the file has been fully copied, so i assume it is better to use fs.copyFilesync inside the async function or does the async function make fs.copyFilesync() run asynchrnously? */
}


text:
Q: Which deflate (zip) algorithm characteristics can cause a 50% compression factor on the recompression of certain data? It's well-known that recompression (compressing a compressed dataset) generally yields a very low (or no) compression.
Hence, I've been very surprised to find a dataset where the second ZIP recompression yields a roughly 50% compressions factor (tested via two runs of the Unix zip tool, on maximum compression factor (9)).
Therefore, I'm curious: which characteristics (limits) of the Deflate algorithm, can cause such behavior? I've tried other programs, and for example, algorithms like zstd yield a much better compression on the first pass.
For reference, the dataset is here.

A: Deflate is limited to a match length of 258 bytes. If there are often repeated strings much longer than that, then a second compression may yield fruit. zstd codes match lengths up to 128K bytes.
gzip -9 once on your data gives 36340381 bytes. gzip -9 twice on your data gives 18860632 bytes. zstd -9 once gives 18985681 bytes. A second zstd -9 reduces it only slightly to 18882745 bytes.


text:
Q: How do I prevent this process from starting on startup? I was installing postgres and may have installed it twice. The first installation appears to be spinning up a postgres server with a password I admittedly don't remember.
I used netstat -vanp tcp | grep 5432 to determine the PID then I used ps aux | grep 560 to find the program (as seen below)
postgres           560   0.0  0.0 408830848   2208   ??  Ss   18Apr22   0:10.26 /Library/PostgreSQL/14/bin/postmaster -D /Library/PostgreSQL/14/data

How can I go about preventing this program from starting up automatically?
EDIT: I'm on a M1 mac with Monterey 12.3.1
EDIT2:
I've run sudo launchctl list | grep post and was able to find the postgres program under
560 0   postgresql-14

now I'm looking into how to remove it from launchctl

A: You can enable or disable services that run on start up by running systemctl command
sudo systemctl disable postgres


text:
Q: Why are my header and paragraph on the same line? I've been searching for hours and can't find answers that I've been able to make work for my case.
I'm trying to make a simple (one line header, one line paragraph) page for a personal-use wordpress plugin I'm writing, with all text centered both vertically and horizontally, but the header and paragraph always display on the same line, like this:

Server Is DownThe game server is currently down. Please check back later.

Here's the full code of the page:
<?php $sitename = get_bloginfo('name'); ?>
<!DOCTYPE html>

    <title><?php echo $sitename; ?> - Game Server Is Down</title>

Server Is Down

The game server is currently down. Please check back later.

What am I missing here?

A: The use of Flex is making both elements go on the same line, because the default flex-direction is row.
Use
  flex-direction: column;

Example:

body {
  margin: 0;
}

.centered {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

Server Is Down

The game server is currently down. Please check back later.


text:
Q: In-memory version of Java's FileChannel I'm in the process of making some changes to a library that I'm using. In order to reduce memory usage the library is writing its temporary data to disk instead of keeping it in memory. However, for my usage scenario it is more efficient to keep it in memory. It also has some concurrency issues, because it has constant names for its temp-files and can therefore not run concurrently in different threads (because the threads will corrupt each other's data).
I therefore need to change the library so that it keeps all its data in memory instead. I have not originally written the library and I'm therefore not very comfortable with making drastic changes to the code. I'd therefore like to do this with as little refactoring as possible. The code which writes to disk is quite simple. Here's a (somewhat simplified) example:
final FileChannel fileChannel = this.randomAccessFile.getChannel();
fileChannel.position(calculatePosition());
while (blockData.hasRemaining())
{
 fileChannel.write(blockData);
}

The reading of a block is very similar (i.e. it uses a FileChannel, which it gets from a RandomAccessFile).
It feels like the easiest solution would be if I can use some implementation of FileChannel, which maps to a place in memory instead of to a file. I know I can map a file to a place in memory using FileChannel's map-method. However, that is the other way around. That gives me a "memory-API" to a file. I want a FileChannel-interface against some memory. Are there any available implementations of this?

A: Java 7 will allow pluggable filesystems, so you'll be able to use a memory based filesystem and keep the current FileChannel API.  Short of that you're likely to have to change the API you use to Commons-VFS as Adrian suggests or use memory only structures.

A: Maybe you can use an in-memory filesystem, such as Apache Commons VFS.


text:
Q: What might be threats in WCF response? What are the different types of threats that could occur while receiving WCF response?. And what might be the mitigation plan to prevent these type of threats?
Note: This query is based on WCF threat modeling concepts.

A: The biggest threat with any API is that its an attack surface.  You are exposing functionality that could be vulnerable to common vulnerabilities such as SQL Injection and Directory Traversal.
When it comes to a WCF response,  it depends how the data is being used.  For instance if you are fetching data from a WCF interface and then building a query you could still be vulnerable to SQL Injection!  If you are fetching that data and then displaying it on an HTML page then you cloud be vulnerable to XSS.
The vulnerabilities that are possible depend entirely on how the data is being used.  You shouldn't trust any data source,  not even your own database.  Make sure that you sanitize data at the time of use.  Use parametrized quires to stop SQLi.


text:
Q: Why does certbot suddenly fall back to http-01 challenge instead of tls-sni-01 (https)? I have a well-tested bash script that was running fine until a few weeks ago.
It seems that certbot challenge defaults now to http instead of https. I can't figure out the reason.
echo 'rsa-key-size = 2048
renew-hook = /usr/sbin/ipsec reload && /usr/sbin/ipsec secrets
' > /etc/letsencrypt/cli.ini

certbot certonly --non-interactive --agree-tos --email $EMAIL --standalone -d $VPNHOST

Firewall settings:
Firewall stopped and disabled on system startup
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
DROP       all  --  anywhere             anywhere             state NEW recent: UPDATE seconds: 60 hit_count: 12 name: DEFAULT side: source mask: 255.255.255.255
           all  --  anywhere             anywhere             state NEW recent: SET name: DEFAULT side: source mask: 255.255.255.255
ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:https
ACCEPT     all  --  anywhere             anywhere
DROP       all  --  anywhere             anywhere             state INVALID
ACCEPT     udp  --  anywhere             anywhere             udp dpt:isakmp
ACCEPT     udp  --  anywhere             anywhere             udp dpt:ipsec-nat-t
DROP       all  --  anywhere             anywhere

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  ip-10-10-10-0.eu-west-2.compute.internal/24  anywhere             policy match dir in pol ipsec proto esp
ACCEPT     all  --  anywhere             ip-10-10-10-0.eu-west-2.compute.internal/24  policy match dir out pol ipsec proto esp
DROP       all  --  anywhere             anywhere

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Certbot:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator standalone, Installer None
Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for vpn-1.duelify.com
Waiting for verification...
Cleaning up challenges
Failed authorization procedure. vpn-1.duelify.com (http-01): urn:acme:error:connection :: The server could not connect to the client to verify the domain :: Fetching http://vpn-1.duelify.com/.well-known/acme-challenge/BsPR5NK4JVb8rgIyS2VR4VTOv4Bc1F5TNppjoo95O70: Timeout

IMPORTANT NOTES:
 - The following errors were reported by the server:

   Domain: vpn-1.duelify.com
   Type:   connection
   Detail: Fetching
   http://vpn-1.duelify.com/.well-known/acme-challenge/BsPR5NK4JVb8rgIyS2VR4VTOv4Bc1F5TNppjoo95O70:
   Timeout

   To fix these errors, please make sure that your domain name was
   entered correctly and the DNS A/AAAA record(s) for that domain
   contain(s) the right IP address. Additionally, please check that
   your computer has a publicly routable IP address and that no
   firewalls are preventing the server from communicating with the
   client. If you're using the webroot plugin, you should also verify
   that you are serving files from the webroot path you provided.
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.

A: It could be due to the recent vulnerability announced with the tls-sni-01 verification method, Let's Encrypt disabled this until it's been fixed patched.
Until then, they have advised using http for verification.
Lets Encrypt tls-sni-01 bug details


text:
Q: Processos do node.js não estão sendo fechados Eu estava estudando react (utilizei o comando npx create-react-app) mas fechei o prompt que eu digitei o comando npm start. Quando vi os processos do meu computador, havia mais de 20 processos do node.

Tentei fechar os processos pelo "gerenciador de tarefas"> detalhes> finalizar processo. Depois tentei pelo prompt com stop-process -name node, mas não fechou nenhum processo.
Depois desinstalei o node e os processos ainda continuavam ativos.
Depois instalei o node novamente, e tentei executar o comando npm --version mas travou o prompt

A: Acontece que era só desinstalar o node.js e desligar o computador por um tempo (eu desinstalei e fui dormir) e os processos acabam de vez.


text:
Q: Prove by induction for $n\geq1, n \in \mathbb{N}$ $, 2^{2n+1}\equiv 9n^2-3n + 2\pmod{54}$. Question taken from the book by Andre Weil, titled Introductory number theory, chapter 5, question #V.3.
Prove by induction that, if $n$ is a positive integer, then
$2^{2n+1}\equiv 9n^2-3n + 2\pmod{54}$.
Take base case, $n=1, 2^3\equiv 9-3+ 2\pmod{54}$ $\implies  8\equiv 8\pmod{54}$.
So, the base case should be a value that yields LHS $\geq 54$.
$n=3, 2^7\equiv 9.9-3.3+ 2\pmod{54}$ $ \implies  128\equiv 81-9+2\pmod{54}$ $\implies 128\equiv 74\pmod{54}$ $\implies 20\equiv 20\pmod{54}$.
Assume, it is true for $n=k$, get:
$2^{2k+1}\equiv 9k^2-3k + 2\pmod{54}$.
Need show that it is true also for $n=k+1$.
$2^{2k+3}\equiv 9(k+1)^2-3(k+1) + 2\pmod{54}$
$\implies 2^{2k+1}.2^2\equiv 9(k)^2 +18k +9-3(k)-3 + 2\pmod{54}$
As LHS is proved, so need take the RHS, and show:
$\implies 9(k)^2 +18k +9-3(k)-3 + 2\equiv 9(k)^2 -3(k)+ 2 \pmod{54}$
$\implies 9(k)^2 +18k -3k +8 \equiv 9(k)^2 -3(k)+ 2 \pmod{54}$
$\implies 18k +6 \equiv 0 \pmod{54}$
$\implies 3k +1 \equiv 0 \pmod{9}$
Why got such a wrong result?

Edit. As per the selected answer, get:
$2^{2k+3}  \equiv  9k^2 +18k +9-3k-3 + 2\pmod{54}$
But, $2^{2k+1} \equiv 9(k)^2 -3(k)+ 2 \pmod{54}$
So, $2^{2k+3} = 4.2^{2k+1}\equiv  4.(9(k)^2 -3(k)+ 2) \pmod{54}$
So, $9k^2 +15k +8\equiv  4.(9(k)^2 -3(k)+ 2) \pmod{54}$
$9k^2 +15k +8\equiv  36k^2 -12k+ 8 \pmod{54}$
$0\equiv  27k^2 -27k\pmod{54}$
$0\equiv  27k(k-1)\pmod{54}$
$0\equiv  54k'\pmod{54}$
$0\equiv  0\pmod{54}$

A: Alternatively if induction is not mandatory, $$2^{2n+1}-2=2(4^n-1)$$
$$(1+3)^n-1\equiv\binom n13^1+\binom n23^2\pmod{27}\equiv\dfrac{9n^2-3n}2 $$
$$\implies2(4^n-1)\equiv9n^2-3n\pmod{54}$$

A: Key Idea The trick is to eliminate the exponential $\,g_n = 2^{2n+1}\,$ in $\,f_n = g_n-9n^2+3n-2.\,$ Since $\,g_{n+1} = \color{#C00}4 g_n\,$ it will be eliminated in $\,f_{n+1}-\color{#c00}4f_n = 27n(n\!-\!1)$. But $\,54\mid 27n(n\!-\!1)\,$ by $\,2\mid n(n\!-\!1)$ so we conclude that $\,54\mid f_{n+1}\,$ if $\,54\mid f_{n},\,$ i.e. the induction step. $ $ QED

A: Hint:
$$2^{2(n+1)+1} -(9(n+1)^2-3(n+1)+2)$$
$$\equiv36n^2-12n-8-(9n^2+18n+9-3n-3+2)$$
$$\equiv27n(n-1)$$
$$\equiv0\pmod{2\cdot27}$$


text:
Q: DB2 SQL-Error: -519, SQLState: 24506 There is a strut application which throws -519 error sometimes. I would have to restart tomcat whenever this error occures.
You can find te detail of -519 here
It rarely happens. But I am not able to understand the actual cause and its solution.

A: Please make sure that your code always fetches all results from the ResultSet and make sure ResultSet and PreparedStatement get also always close()d. If you do not ensure these things it is possible that a cursor will not be automatically closed in DB2.
In your case a database connection gets returned back to the connection pool but not all resources have been freed properly. When the eactly same SQL statement is prepared again using the same connection you get the error in question.
If this is custom code of yours I would recommend using PMD and FindBugs extensively while developing because they warn eagerly about not closing all resources.


text:
Q: Send userID in method or send Token I have a concern on, how do I need to send the userID to map an entity:
Assuming that i am using angular or react or whatever front page framework, how do i need to send the userID on the entity.
For example, if the user is creating a Product, My Options are:
1)Send the Product with the userID:

*

*My back-end will search the user by userID

*set the user in the product.

2)Send the product with the user Token:

*

*My back-end will validate the token.

*get from the jwt the userID that is in the claim.

*Search the user by the id

*Set the user in the product
What is the best option to do this?
I think that if I send the userID explicity from the front-page, will be a security issue, instead of sending the token.

A: The first one is insecure. Someone might send another userId.  Second one has some security problems too but, not as bad as the first one. And if you have access token, send access token not Id token. Id token is for client side.


text:
Q: MVC3 input button triggered by Enter button I have an ASP.NET MVC 3 C#.NET web application and I want the Enter button to trigger a particular Save button on my form.  How would I do that?

A: What I would do is utilize JavaScript for this one.  Handle the onkeypress even of the form.  Like so:
<form onkeypress="yourKeyPressFunction(event)">
...
</form>

Then your yourKeyPressFunction() would look something like this:
function yourKeyPressFunction(e)
{
    if (e.keyCode == 13)
    {
        // submit or do what you'd like when you hit enter
    }

    // ... so on and so forth
}


text:
Q: For any positive integer $n$, let $f(n) = 70 + n^2$ and $g(n)$ be the HCF of $f(n)$ and $f(n+1)$ find the highest possible value of $g(n)$. For any positive integer $n$, let $f(n) = 70 + n^2$ and $g(n)$ be the HCF of  $f(n)$ and $f(n+1)$ find the highest possible value of $g(n)$.
This question is from HKIMO prelims 2006. I didn't quite understand what was happening when I went through the solution.
So far all I've gotten is:
$g(n) = (70+n^2, 70+(n+1)^2)$
$g(n) = (70+n^2, 2n+1)$
Not sure what to do from here -_-
Thank you!

A: Using your
$$g(n) = (70+n^2, 2n+1) \tag{1}\label{eq1}$$
note $2n + 1$ is odd, so can multiply $70 + n^2$ by $4$ to $280 + 4n^2$, but with it still giving the same HCF. However, note that $2n \equiv -1 \pmod{2n + 1}$, so $4n^2 \equiv 1 \pmod{2n + 1}$. Thus,
$$280 + 4n^2 \equiv 281 \pmod{2n + 1} \tag{2}\label{eq2}$$
I trust you can finish the rest yourself now.
In general, if the $70$ is replaced by a positive integral constant $c$, then you'll get that $2n + 1 | 4c + 1$, so $g(n) | 4c + 1$, which means that $g(n) \le 4c + 1$. To show it reaches this potential maximum, note that at $n = 2c$, you get $f(2c) = c + (2c)^2 = c + 4c^2 = c(4c + 1)$ and $f(2c + 1) = c + (2c + 1)^2 = 4c^2 + 5c + 1 = (4c + 1)(c + 1)$. This shows that $g(2c) \ge 4c + 1$, so it must be $4c + 1$.

A: $g(n)$ divides $2n+1$
Also divides $2(70+n^2)-n(2n+1)=140-n$
and consequently divides $2(140-n)+2n+1=?$


text:
Q: How to Reset Adminer Password? Was trying to Change my Database password by adminer. While updating the password suddenly it not working while trying to login. What should do to reset the adminer database password.

A: Adminer.php has no password: he uses that of the database. The password you need to reset is the password of the database. How to do this depends the sort of database you are using. For MySQL, see https://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html


text:
Q: `': uninitialized constant ActiveModelSerializers (NameError) I am getting this error while running rails server as well as rake db:migrate, and I am using rails-4.2.7
api/config/initializers/active_model_serializers.rb:1:in `<top (required)>': uninitialized constant ActiveModelSerializers (NameError)
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/railties-4.2.8/lib/rails/engine.rb:652:in `block in load_config_initializer'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/activesupport-4.2.8/lib/active_support/notifications.rb:166:in `instrument'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/railties-4.2.8/lib/rails/engine.rb:651:in `load_config_initializer'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/railties-4.2.8/lib/rails/engine.rb:616:in `block (2 levels) in <class:Engine>'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/railties-4.2.8/lib/rails/engine.rb:615:in `each'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/railties-4.2.8/lib/rails/engine.rb:615:in `block in <class:Engine>'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/railties-4.2.8/lib/rails/initializable.rb:30:in `instance_exec'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/railties-4.2.8/lib/rails/initializable.rb:30:in `run'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/railties-4.2.8/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/ganeshmohan/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
from /home/ganeshmohan/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from /home/ganeshmohan/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/tsort.rb:420:in `block (2 levels) in each_strongly_connected_component_from'
from /home/ganeshmohan/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
from /home/ganeshmohan/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/tsort.rb:419:in `block in each_strongly_connected_component_from'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/railties-4.2.8/lib/rails/initializable.rb:44:in `each'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/railties-4.2.8/lib/rails/initializable.rb:44:in `tsort_each_child'
from /home/ganeshmohan/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/tsort.rb:413:in `call'
from /home/ganeshmohan/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/tsort.rb:413:in `each_strongly_connected_component_from'
from /home/ganeshmohan/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /home/ganeshmohan/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/tsort.rb:345:in `each'
from /home/ganeshmohan/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/tsort.rb:345:in `call'
from /home/ganeshmohan/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
from /home/ganeshmohan/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
from /home/ganeshmohan/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/railties-4.2.8/lib/rails/initializable.rb:54:in `run_initializers'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/railties-4.2.8/lib/rails/application.rb:352:in `initialize!'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/railties-4.2.8/lib/rails/railtie.rb:194:in `public_send'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/railties-4.2.8/lib/rails/railtie.rb:194:in `method_missing'
from /home/ganeshmohan/work_space/Givecorps-site/config/environment.rb:19:in `<top (required)>'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/skylight-1.2.2/lib/skylight/probes.rb:81:in `require'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/skylight-1.2.2/lib/skylight/probes.rb:81:in `require'
from /home/ganeshmohan/work_space/Givecorps-site/config.ru:3:in `block in <main>'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/rack-1.6.8/lib/rack/builder.rb:55:in `instance_eval'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/rack-1.6.8/lib/rack/builder.rb:55:in `initialize'
from /home/ganeshmohan/work_space/Givecorps-site/config.ru:in `new'
from /home/ganeshmohan/work_space/Givecorps-site/config.ru:in `<main>'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/rack-1.6.8/lib/rack/builder.rb:49:in `eval'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/rack-1.6.8/lib/rack/builder.rb:49:in `new_from_string'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/rack-1.6.8/lib/rack/builder.rb:40:in `parse_file'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/rack-1.6.8/lib/rack/server.rb:300:in `build_app_and_options_from_config'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/rack-1.6.8/lib/rack/server.rb:209:in `app'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/railties-4.2.8/lib/rails/commands/server.rb:61:in `app'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/rack-1.6.8/lib/rack/server.rb:337:in `wrapped_app'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/railties-4.2.8/lib/rails/commands/server.rb:139:in `log_to_stdout'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/railties-4.2.8/lib/rails/commands/server.rb:78:in `start'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/railties-4.2.8/lib/rails/commands/commands_tasks.rb:80:in `block in server'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/railties-4.2.8/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/railties-4.2.8/lib/rails/commands/commands_tasks.rb:75:in `server'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/railties-4.2.8/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/railties-4.2.8/lib/rails/commands.rb:17:in `<top (required)>'
from /home/ganeshmohan/work_space/Givecorps-site/bin/rails:10:in `require'
from /home/ganeshmohan/work_space/Givecorps-site/bin/rails:10:in `<top (required)>'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/spring-2.0.1/lib/spring/client/rails.rb:28:in `load'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/spring-2.0.1/lib/spring/client/rails.rb:28:in `call'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/spring-2.0.1/lib/spring/client/command.rb:7:in `call'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/spring-2.0.1/lib/spring/client.rb:30:in `run'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/spring-2.0.1/bin/spring:49:in `<top (required)>'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/spring-2.0.1/lib/spring/binstub.rb:31:in `load'
from /home/ganeshmohan/.rvm/gems/ruby-2.2.5/gems/spring-2.0.1/lib/spring/binstub.rb:31:in `<top (required)>'
from /home/ganeshmohan/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
from /home/ganeshmohan/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
from /home/ganeshmohan/work_space/Givecorps-site/bin/spring:16:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'

A: you can explicitly write gem "active_model_serializers", require: true at Gemfile instead of requiring it at config/application.rb
OR
try to add below gems in Gemfile
gem "rails", "~> 5.0.0"
gem "rack-cors"
gem "active_model_serializers", "~> 0.10.0"


text:
Q: How to let system switch different version of installed packages? Foc example if I had libclang 3.4 and 3.5 installed, how do I switch?
aptitude search libclang

p   libclang-3.3-dev                                                                                - clang library - Development package
i A libclang-3.4-dev                                                                                - clang library - Development package
p   libclang-3.5-dev                                                                                - clang library - Development package
p   libclang-common-3.3-dev                                                                                - clang library - Common development package
i A libclang-common-3.4-dev                                                                                - clang library - Common development package
p   libclang-common-3.5-dev                                                                                - clang library - Common development package
i   libclang-dev                                                                                - clang library - Development package
p   libclang1                                                                                - C, C++ and Objective-C compiler (LLVM based)
p   libclang1-3.3                                                                                - C interface to the clang library
p   libclang1-3.3-dbg                                                                                - clang library
i A libclang1-3.4                                                                                - C interface to the clang library
p   libclang1-3.4-dbg                                                                                - clang library
i   libclang1-3.5                                                                                - C interface to the clang library
p   libclang1-3.5-dbg                                                                                - clang library


text:
Q: Why a " sentence" without predicate can stand alone? In the sentence below:

Five days ago the Evertons left San Francisco in order to extend the family's Mexican history and patch the present onto the past. To find out if there was still copper underground and how much of the rest of it was true, the width of the sky, the depth of the stars, the air like new wine. To weave chance and hope into a fabric that would clothe them as long as they lived.

For the sentence in bold, I do not comprehend why it can stand alone ending with a period even if there is no predicate but a infinitive plus a restrictive relative clause. And also the meaning of this "sentence" just elude me completely.

A: If you want it to be a technically correct sentence, it should be punctuated like this:

Five days ago the Evertons left San Francisco in order to extend the family's Mexican history and patch the present onto the past; to find out if there was still copper underground and how much of the rest of it was true, the width of the sky, the depth of the stars, the air like new wine; (and) to weave chance and hope into a fabric that would clothe them as long as they lived.

Each "to" clause is building off of "in order to." For lists you usually use commas, but if the items in your list are long and contain commas themselves, then use semicolons to divide your list.
The usage of periods and the lack of "and" on the last sentence are to make it seem more dramatic, I suppose, but I don't think I like it.


text:
Q: Let $f$ be a nonconstant entire function such that $|f(z)|$ depends on $Re(z)$ only. Is $f(z) = ce^{az}$, where $c, a$ are constants and $a$ is real? My thoughts so far: since the zeros of $f$ are isolated, $f(z)$ never assumes the value zero. It follows that $f(z) = e^{g(z)}$ for some entire function $g$, and that $Re(g(z))$ depends only on $Re(z)$ only. The problem then reduces to showing that $g(z) = uz+v$, with $u$ real. It may or may not be easier to show this than to show that $f$ has the given form directly. Intuitively I doubt that it is possible for $g$ to be a polynomial of higher degree, although I have yet to prove this. Therefore I'd be satisfied with a proof that assumes that $g$ is not a polynomial and reaches a contradiction.

A: Nevermind, I figured out a proof as soon as I posted this. Note that $g(z + ih) = g(z) + g'(z)ih + o(h)$. If $h$ is real and $|h|$ is sufficiently small, then it follows that $Re(g(z+ih)) = Re(g(z))$ iff $g'(z)$ is real. We therefore conclude $g'(z)$ is a purely real entire function, which is constant by the Cauchy-Riemann equations. The result follows.
Alternatively you could try the same approach with $f$ directly. We have $f(z + ih) = f(z) + f'(z)ih + o(h)$, where $h$ is real. As $h$ goes to zero, the only way that $|f(z+ih)| = |f(z)|$ is if $arg(f'(z)) = \pm arg(f(z))$ for all $z$. By the polar Cauchy-Riemann equations $f'(z) = af(z)$ for some real $a$, and of course you can conclude that $f(z) = ce^{az}$ for some constant $c$ by noting the uniqueness of solutions to that differential equation.


text:
Q: What are tag comments good for in pom.xml? I'm currently going through https://spring.io/guides/gs/maven/#scratch and I just found
<dependencies>
    <!-- tag::joda[] -->
    <dependency>
        <groupId>joda-time</groupId>
        <artifactId>joda-time</artifactId>
        <version>2.9.2</version>
    </dependency>
    <!-- end::joda[] -->
    <!-- tag::junit[] -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
        <scope>test</scope>
    </dependency>
    <!-- end::junit[] -->
</dependencies>

and I wonder:
What is <!-- tag::joda[] --> good for?

A: The Getting Started Guide you are reading, is generated from an AsciiDoc file:
https://github.com/spring-projects/spring-boot/blob/master/README.adoc
AsciiDoc is a document format equivalent to DocBook XML.
Instead of copy-pasting part of the source code, the AsciiDoc syntax allows to point to some parts of the source code.
To include a part of the pom.xml you can use the following syntax:
include::complete/pom.xml[tag=joda]

which will include the snippet:
<!-- tag::joda[] -->
<dependency>
    <groupId>joda-time</groupId>
    <artifactId>joda-time</artifactId>
    <version>2.9.2</version>
</dependency>
<!-- end::joda[] -->

To answer you question, <!-- tag::joda[] --> is a marker allowing AsciiDoc to extract a part of the file and inserting it into the getting started guide.


text:
Q: Eclipse RCP - how to listen for selection from the editor in focus I have created a simple Eclipse RCP application where I can open multiple editor instances based on user action. I have a separate view (ViewPart) where I listen for the selection changes on the editor.
The problem is that the view is notified only of the selections from the last opened editor, the other editors which were opened earlier don't provide the events any more/or maybe the view listens only to the last opened editor and nothing else. This happens even if the previously opened editors gain focus.
In other words, only the newest editor in editor area provides selection events, what I want is, when I click on the other editor's tabs, I want to see the changes on my view when I click one of the previously opened editors.
In my view I use:
IWorkbench workbench = PlatformUI.getWorkbench();
        workbench.getActiveWorkbenchWindow().getActivePage().addSelectionListener(DocumentsEditor.ID,(ISelectionListener)this);

where DocumentEditor is one of the editors opened in application editor area.

A: From the JavaDoc for ISelectionService.addSelectionListener(String partId, ISelectionListener listener) (emphasis is mine):

Adds a part-specific selection listener which is notified when selection changes in the part with the given id. This is independent of part activation - the part need not be active for notification to be sent.
When the part is created, the listener is passed the part's initial selection. When the part is disposed, the listener is passed a null selection, but only if the listener implements INullSelectionListener.
Note: This will not correctly track editor parts as each editor does not have a unique partId.

So don't use this method when you want to track editor selections. Instead use ISelectionService.addSelectionListener(ISelectionListener listener) and check the given part in ISelectionListener.selectionChanged(IWorkbenchPart part, ISelection selection) using instanceof...
Small note to the code: The selection service exists on a per window basis, so if you have multiple workbench windows, they each have their own service instance.
For this reason I usually use the following code in my views and editors:
ISelectionService ss = getSite().getWorkbenchWindow().getSelectionService();
ss.addPostSelectionListener(listener);

This way the used listener will come from the correct window.


text:
Q: PHP, MySQL - how to display all results from all rows with values higher than I have a MySQL database with following columns and rows (few listed below):
ID |     Date   | Event
1  | 1994-05-01 | EventDesc1
2  | 1994-07-04 | EventDesc2
3  | 1996-02-02 | EventDesc3
4  | 1998-04-07 | EventDesc4
5  | 1999-01-01 | EventDesc5

I want to echo all rows from the column Event that happened after a specified date. The date would be specified in a php variable.
e.g.
Date specified: 27.2.1995; it would echo EventDesc3, EventDesc4, EventDesc5

A: As far as i understood your question, I think that this is what you are looking for..
<?php
$date = your date value

$result = mysql_query("SELECT Event FROM your_table_name WHERE Date >= $date");
if (!$result) {
    echo 'Could not run query: ' . mysql_error();
    exit;
}
$row = mysql_fetch_row($result);

echo $row[0];

?>


text:
Q: Django игнорирует settings.py, лежащий в проекте и вместо него использует свой global_settings.py Весь вопрос в заголовке. Использую PyCharm и настройки берутся из global_settings.py, хотя я ожидаю, что они должны браться из settings.py в папке проекта. Может что-то куда-то надо прописать?

A: У вас в проекте есть файл -  manage.py. В нем есть строка:
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "<projectname>.settings")

вот этот вот settings в конце и есть имя файла настроек.


text:
Q: Better way of implementing message box and run in both windows and linux in python I am implementing message box in python 2.7.9. I m writing code that should run in both Windows and Linux. Below code works fine in windows, but not in Linux. I know there is no module object of windll in Linux. Is there anything guidelines need to taken care to write a code which runs in windows and Linux environment? That would be great any documentation link for this. Thanks in advance.
import ctypes  # An included library with Python install.
ctypes.windll.user32.MessageBoxA(0, "Your text", "Your title", 1)

AttributeError: 'module' object has no attribute 'windll'

A: The simplest option is probably to use a GUI framework; specifically Tkinter, which comes bundled with Python. The below code should work cross-platform (although Tkinter needs a bit of extra installation work in Mac OS X) in Python 2.x and 3.x:
try:
    # Python 3.x imports
    import tkinter as tk
    from tkinter import messagebox
except ImportError:
    # Fall back to 2.x
    import Tkinter as tk
    import tkMessageBox as messagebox

root = tk.Tk().withdraw()  # hide the root window

messagebox.showinfo('hello', 'world')  # show the messagebox

Result (in 2.7.10 or 3.5.0 on Windows 7):

There are other messagebox options, either to ask... (with various combinations of yes, no and cancel) or show... (error, warning or info).

A: Portability issues are usually solved by using an abstraction layer over the platform specific parts - an example being the os.path module in the stdlib, which has different implementations (one per platform) of the same API, and loads the right implementation at runtime.
Now when it comes to GUI, things get more complicated - specially on the unix world where there's no builtin gui toolkit, and quite a few possible choices. If you don't care about native look&feel and only need simple features then Tkinter is probably your best, else you'll have to look for a more complex crossplatform GUI toolkit (Qt comes to mind) or try to build and maintain your own abstraction level over "native" toolkits for the target platforms (which is mostly going to be a major PITA).