text:
Q: $t$ test for paired samples in R I have two vector samples $x,y$:

x = c(107.32362,  89.15552,  90.75148, 109.51189,  98.43394,  97.25716 ,115.39168,
     95.68554,  93.60000, 103.00000 ,112.70000, 138.40000,  93.30000 , 87.70000,
     83.30000, 105.00000 ,103.40000 ,105.70000, 107.80000,  96.10000, 102.00000,
     105.40000, 123.90000 ,141.10000)
y =  c(100.1,  82.0,  39.0,  18.0,  83.8 ,109.1 ,114.0 , 95.4,  93.1, 116.8  ,56.9 , 56.6,  86.3
      ,62.0,  38.9,  85.2 ,124.4, 124.3, 139.2, 105.6, 117.4 ,125.2, 111.5, 131.7)

I want to calculate the t.test for equality of means (or the differences).I am assuming the values are paired.
Because the samples are paired (matched) we must use the differences between the paired values as :
$$D = X_{1i} - X_{2i}$$
The point estimate for the paired difference population mean $\mu_{D}=\mu_{x} - \mu_{y}=0$ is denoted as $\bar{D} = \frac{\sum_{i=1}^{n}D_{i}}{n}$  and the standard deviation of the differences $$S_{D} = \sqrt{ \frac{\sum_{i=1}^{n}(D_{i}-\bar{D})^2   }{n-1}}$$
The test statistic for the equality of means is :
$$t =\frac{\bar{D}-\mu_{D}}{ \frac{S_D}{\sqrt{n}}} = 1.835492$$
d = x-y
t = (mean(d)-0)/ (sd(d)/sqrt(length(d)));t
[1] 1.835492

For a two-tail test with a given level of significance $\alpha$, we reject the null hypothesis if the calculated test statistic is greater than the upper-tail critical value $t_{n-1}$ from the $t$ distribution, or if the calculated test statistic is less than the lower-tail critical value $-t_{n-1}$ from the $t$ distribution. That is, the decision rule is:
Reject $H_{0}$ if $t > t_{n-1}$
or if $t< -t_{n-1}$  otherwise, do not reject $H_{0}$.
The degrees of freedom in our example and $24-1=23$ and for $\alpha =0.10$ the inverse cumulative distribution for $1-\alpha =0.90$ with 23 degrees of freedom of $t$ distribution is  $1.31946$
Therefore $t>t_{n-1}$ or $1.83>1.31$ and I reject the null hypothesis.
t>qt(0.9,23)
[1] TRUE

But when I run the t.test() function in R it reports me a p.value greater than 0.05 (0.0794) and I must not reject the null hypothesis.
> t.test(x,y,
        paired = TRUE,
        alternative = "two.sided",
        conf.level = 0.90)

    Paired t-test

data:  x and y
t = 1.8355, df = 23, p-value = 0.0794
alternative hypothesis: true difference in means is not equal to 0
90 percent confidence interval:
  0.7990197 23.3185494
sample estimates:
mean of the differences
               12.05878

What is wrong here ?

A: For a two-sided test the relevant critical point is $t_{n-1,\alpha/2}$ so you would find this as follows:
#Find critical point
n     <- length(d)
alpha <- 0.1
CRIT  <- qt(1-alpha/2, df = n-1)

#Show critical point
CRIT
[1] 1.713872

Since $|t| = 1.835492 > 1.713872 = t_{n-1,\alpha/2}$ you reject the null hypothesis at this significance level.  This matches the decision from the t.test output --- since $p = 0.0794 < 0.1 = \alpha$ you likewise reject the null.


text:
Q: How fetch like query with hibernate criteria? I am using below mention code to find top 5 highest count tag name which starts with queryString from the table.
           Criteria criteria = getCurrentSession().createCriteria(Tag.class, "t");
    criteria.add(Restrictions.ilike("t.name", queryString, MatchMode.START));
    criteria.addOrder(Order.desc("t.count"));
    criteria.setMaxResults(5);
    return findByCriteria(criteria);

By this code not getting the desired result. please make me correct if I am doing any mistake.
QueryString value is ban
Table tag
Id        Name             Count
101       ban               55
102       bangalore         66
103       tea               70
104       bangalore_traffic 78
105       roads             90
106       mc_D              45

so result should be like
Id        Name             Count
104      bangalore_traffic  78
102      bangalore          66
101      ban                55

A: Use like following
criteria.add(Restrictions.ilike("name", queryString, MatchMode.START));
    criteria.addOrder(Property.forName("custId").desc("count"));

Where name anf custId is your persistence class variable name

redpajama_set_name: RedPajamaStackExchange


text:
Q: Optimizing theano - reusing predefined modules as part of computational graph I know this has been asked a few years ago but I think my question is a little different (and solutions might have come up).
I'm using theano to train a neural network. My input samples are of different sizes so I'm redefining the entire cost function per input sample, which makes theano very slow (even when using the fast-compile flag, which does improve, but not enough).
As far as theano is concerned, on every new sample I'm defining a completely new function that is derived from scratch. I am, however, using the very same building blocks to yield the cost function, as 99% of the cost function is calculated via
T.nnet.softmax(T.dot(W,h)+b). The difference is which h I'm putting there every time.
As far as I know, I can't use theano.function to define this as a building block, because I cannot give it as input the symbolic variable h (that is, in turn, defined by another such calculation). I also cannot use theano.scan because I don't have a stream of data on which I'm repeatedly applying a function.
I do think that something should be able to improve this, because after all, considering the theory of neural networks, my structure here is easily* derivable using the error message passing, but I don't know how I can "tell" theano that I'm actually building my network from the same blocks over and over again.
*Since I'm always changing my network structure, I would want to avoid direct backprop calculations, that's why I'm using theano.
I'd appreciate any assistance on the subject.


text:
Q: Connection string between asp.net and SQL Server I wrote some code for getting a connection between asp.net and SQL Server but I have
Generally, the purpose of this code is to add 2 sets of data into the database using 2 text boxes.
This error is in web.config file:

Error 1 Character ';', hexadecimal value 0x3b is illegal in an XML name.

My configuration:
<?xml version="1.0"?>
<configuration>
  <connectionStrings>
    <add name="myconectionstring"
    connectionString="data source=.\SQLEXPRESS;initial catalogue=test;Integrated Security=SSPI"; providerName="System.Data.SqlClient" />
  </connectionStrings>
    <system.web>
      <compilation debug="true" targetFramework="4.5" />
      <httpRuntime targetFramework="4.5" />
    </system.web>
</configuration>

In code behind :

The type or namespace name 'SqlConnection' could not be found (are you missing a using directive or an assembly reference?)

My code :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication3
{

    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string cs = System.Configuration.ConfigurationManager.ConnectionStrings["myconectionstring"].ConnectionString;
            SqlConnection con = new SqlConnection(cs);
            SqlCommand cmd = new SqlCommand("INSERTINTO TEST (name,fathername) VALUES('" + TextBox1.Text + "','" + TextBox1.Text + "')", con);
            con.Open();
            cmd.ExecuteNonQuery();
            con.Close();
        }
    }
}

best regards :)
=========================================
EDIT: I had done according your suggestions and there is no more error but the data isn't added to the database, actually nothing happens when i click on submit. :(
my code:
web.config:
<?xml version="1.0"?>

<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->

<configuration>

  <connectionStrings>
    <add name="myconectionstring"
    connectionString="data source=.\SQLEXPRESS;initial catalogue=test;Integrated Security=SSPI;" providerName="System.Data.SqlClient" />
  </connectionStrings>

    <system.web>
      <compilation debug="true" targetFramework="4.5" />
      <httpRuntime targetFramework="4.5" />
    </system.web>

</configuration>

code behind :
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;

namespace WebApplication3
{

    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {

            string cs = System.Configuration.ConfigurationManager.ConnectionStrings["myconectionstring"].ConnectionString;
            SqlConnection con = new SqlConnection(cs);
            SqlCommand cmd = new SqlCommand("INSERT INTO Table_1 (name,fathername) VALUES('" + txt1.Text + "','" + txt2.Text + "')", con);
            con.Open();
            cmd.ExecuteNonQuery();

            txt1.Text = "";
            txt2.Text = "";

            con.Close();
        }
    }
}

A: Error1: You have added semicolon at the end of the connection string asbelow:
connectionString="data source=.\SQLEXPRESS;initial catalogue=test;
       Integrated Security=SSPI";
                            ^^^^^

Solution1: You need to move the semicolon  inside connectionstring
Try This:
connectionString="data source=.\SQLEXPRESS;initial catalogue=test;
                                         Integrated Security=SSPI;"

Error 2: You did not import the System.Data.SqlClient namespace to use the SqlConnection class members
Solution2:
You need to import System.Data.SqlClient; Namespace asbelow
using System.Data.SqlClient;

Solution 3: initial catalogue spelling is wrong, instead you should use Initial Catalog in your Connection string asbelow:
connectionString="data source=.\SQLEXPRESS;initial catalog=test;
           Integrated Security=SSPI";
EDIT: Try the following code to get the exceptiondetails
protected void Button1_Click(object sender, EventArgs e)
    {
        string cs = System.Configuration.ConfigurationManager.ConnectionStrings["myconectionstring"].ConnectionString;
        SqlConnection con = new SqlConnection(cs);

       try
       {
        string cs = System.Configuration.ConfigurationManager.ConnectionStrings["myconectionstring"].ConnectionString;

        SqlCommand cmd = new SqlCommand("INSERT INTO TEST (name,fathername) VALUES('" + TextBox1.Text + "','" + TextBox1.Text + "')", con);
        con.Open();
        cmd.ExecuteNonQuery();
       }
    catch(Exception ex)
    {
    String ErrorMsg=ex.ToString();
    }
   finally
   {
       con.Close();
   }
    }

A: You have a couple of errors. The first is that you have placed the semi-colon (;) outside the connectionString attribute value in the configuration it should be:
<connectionStrings>
    <add name="myconectionstring"
    connectionString="data source=.\SQLEXPRESS;initial catalogue=test;Integrated Security=SSPI;"
    providerName="System.Data.SqlClient" />
  </connectionStrings>

In your code file you have not imported the required namespace try adding:
using System.Data.SqlClient

A: I think you should have this configuration
<connectionStrings>
   <add name="myconectionstring"
        connectionString="data source=.\SQLEXPRESS;initial catalog=test;Integrated Security=SSPI;"
        providerName="System.Data.SqlClient" />
</connectionStrings>

or
<connectionStrings>
   <add name="myconectionstring"
        connectionString="server=.\SQLEXPRESS;database=test;Integrated Security=SSPI;"
        providerName="System.Data.SqlClient" />
</connectionStrings>

Use Initial Catalog or database instead of your initial catalogue= (or use server= and database= which are clearer and more obvious names, in my opinion)
This website http://www.connectionstrings.com/ is a great and extensive resource about how to build valid connection strings.
And of course, as all the others have mentioned - you need to add a using System.Data.SqlClient to your code file!

A: Error says clearly! Remove semicolon(;) from your connection string in configuration tag.
As shown below
  <connectionStrings>
    <add name="myconectionstring"
    connectionString="data source=.\SQLEXPRESS;initial catalogue=test;Integrated Security=SSPI" providerName="System.Data.SqlClient" />
  </connectionStrings>

Also you missed the namespace,
using System.Data.SqlClient


text:
Q: Is a git folder self-contained? I'm just starting to use Git, and I have a question:
When I create a new repository I get a folder in which I should put all the files (this folder contains .git folder). Is this folder completely self-contained?
Let's say I've created a new repository and worked on the project for a while (doing commits). If I would take that folder and move it to another location (say another disk) would it still work? What if I move it to another computer? Could I have the repository/folder on an external device (external HDD or USB stick) and work with it on several computers?

A: Yes. That is the local repository, and it contains all the information about the repository.
The only thing that's not included is the global configuration.
See this free Git documentation for more details. Quoting from there:

Git creates the .git directory, which is where almost everything that Git stores and manipulates is located. If you want to back up or clone your repository, copying this single directory elsewhere gives you nearly everything you need.

A: The folder itself is self-contained.
Actually, if you have committed everything and don't have local changes, the .git folder itself should be enough. The .git folder is your repository. The rest of the contents of the folder is the checked out working directory. You may not copy those ( especially if there are lots of files ) to other machines.

A: Yes, it contains everything git needs.
And it does work with usb sticks.

A: Yes the folder is self contained, but you do need to have git installed if you want to do git operations on it from a different machine

A: Almost.

*

*Serge already mentioned the global config.

*hooks, for obvious security reason, aren't part of the repo (they are not replicated by a push or clone or a bundle), even though they are store within the .git folder.
In your case (duplication of the .git directory), a hook working a local machine might not work on another one (because it is, for instance, a perl script, and perl isn't installed on the other machine).

*submodules reference external repos (which might not be accessible once you copy your git repo over the other machine)

*git attributes can reference scripts only stored on one machine, and not accessible on the other.

*git remote address (stored in the local config) can reference repos no longer accessible once you copy your repo elsewhere.

Git will recognized the moved repo as a git repo, so you can say it is self-contained in that regard.
I prefer moving my repo as a git bundle (only one file to move).
But if you depend on any other (script/tools/other repos) for your repo to be complete and actually allowing you to work with it, you might need to consider moving other external elements as well.

A: Git folder may be sel contained but doesn't always act like it.
For example, today I struggled trying to copy a recovered .git folder and files to a new Virtual Box system after a hard drive corruption of repo stored on external usb drive inside Virtual Box/Lubuntu got disconnected accidentally before proper shutdown (fixed with chkdsk /f /x) .
As far as I could tell, all files seemed intact, and git log appeared normal except headings were in red.  But all attempts to push to the newly created remote repo were met with various errors such as "cannot traverse parent" for various commit #'s and "are you sure you have permission?"  Also, there were some messages about "symlinks" when files were originally copied from my  recovered drive to the
newly created VM.  Ithought it might be a permissions issue but all files were read/write all.  Maybe .git has internal checks?   End result I only succeeded in push to remote by deleting .git and initializing the local repo (basically a hard reset)...all history lost (was only a class project so was local only beforehand, now Bitbucket will prevent recurrence I hope.
 But I thought .git folder was self contained.


text:
Q: What are the best strategies to playing Touchdown Mode in Clash Royale? I am frustrated by how easily my opponents beat me in Touchdown Mode in Clash Royale. I know that cards like Royal Recruits and Bomb Tower are quite useful in this mode, but solely relying on this strategy doesn't seem to work. What is the most effective strategy to play Touchdown Mode in Clash Royale, such as in positive elixir trades, successful counters, time taken to win a crown, etc.

A: The same strategies you use for the normal game are relatively effective in this mode as well with a few tweaks.  Units that have speed increases are good, especially the battle ram since it only targets buildings.  Like Kyle said in the comments, this lets you do a sneaky strategy where you put some kind of tanky unit on one side like a PEKKA or a lava hound and then put a faster unit on the other side when they've played their hand.
A building unit is a must have in order to stop strategies like this and if I remember correctly, there are areas where bigger buildings can draw aggro from both sides.  You also should have some flying units like bats or minion horde to DPS down melee units and tanks but do not rely heavily on them (keep a dedicated tank killer in your team).  Spawners like witches and night witches along with exploders like lava hound and skeleton barrel occasionally cheese a round win off of not being stopped in time or left alone for too long.  To counter these, make sure you have some AoE in your squad with a bowler for ground troops/tank and/or a baby dragon for the air.
A lot of the units I mentioned are pretty high cost so you need to balance around what you find the most important.  Each high elixir unit has a lower cost replacement and some can play two roles (bowler = tank + ground AoE).  Your spells should also be relatively low cost and mostly used for dealing with low cost units (think zap, arrows, log, barbarian barrel) unless you are going for a cheese win with a battle ram + rocket on whatever building they put up.
A good check list for making a starting deck is something like this:

*

*Tank 5-7 elixir

*AoE clear (arrows, zap) 2-3 elixir

*Push back spell (tornado, log, barbarian barrel) 2-3 elixir

*Tank killer most are 4 elixir

*Ranged DPS like musketeer or electro wizard if you have it 3-4 elixir

*Fast flying group unit 2-5 elixir

*Building any will do so just take the one that best completes your deck

*Fast/exploder unit that ignores troops battle ram/skeleton barrel 3-4 elixir

This is just a general layout of a good all around deck for this game mode.  With this kind of setup, you do not have to worry as much about what your teammate has.  All strategies are much easier if you have a duo partner so you can make decks that compliment each other but that is a whole different question in my opinion.  Obviously, some of these unit types can overlap so you have room to take a few buildings, tanks, ranged units, etc depending on what you feel you need.  Cater your deck to what you have that is strong and just try to have some fun with it.
Hopefully this helps you out a bit as there is not a "correct answer" so to speak for a question about best decks.


text:
Q: What is a "django backend"? I've been encountering quite a few django Apps mentioning 'backend', but don't exactly know what it is. Searching around google does not give much results regarding django backends in general. Could someone give an explanation?
To be specific, take these examples:

*

*django.contrib.auth.backends.ModelBackend

*django.contrib.sessions.backends.cache

*"The messages framework can use different backends to store
temporary messages"
Actually I think the first two and the third are a bit different, what I was more unsure about was the first two: backends included in Apps.

A: django comes with one or more implementations of authentication, caching, etc but the framework anticipates the need for adding your own custom "backend" implementation. They generally provide a simple well-documented interface as well as a setting variable so it is easy to plug in your own custom module.
This term/pattern is also used by common django apps such as django-registration.
If you are into design patterns this blog provides some analysis: http://charlesleifer.com/blog/django-patterns-pluggable-backends/


text:
Q: Ajax Bing Maps version 7 - move and delete push pin - beginner's tutorial I am currently learning about these maps. Now I would like to create a method which updates my push pin if I already have one.
a. I tried to use setLocation(newLocation) but unfortunately, when I did this, my client side code wasn't even reached (I'm thinking that the code syntax is incorrect, yet no error was given on chrome)
b. I then tried to learn how to delete it and create another one, yet I cannot find any resources from http://msdn.microsoft.com/en-us/library/gg427610.aspx - maybe I am not searching well enough.
Can anyone provide me with some guide on how to move a push pin and how to delete one? Thank you all very very much
var loc = new Microsoft.Maps.Location(lat, lon);

var pin = new Microsoft.Maps.Pushpin(loc);

Edit: partial answer
Removing a push pin:
if (pin != null)
{
    map.entities.remove(pin)
}

A: To move a pushpin, setLocation() is indeed the function you need to use.  Are you trying to call setLocation from an event handler on the map?  If that's the case, it's possible that the event handler wasn't set up properly so it is never called.  However, if you already have defined a pushpin(with a variable name myPushpin) and inserted it into the map, then executing the follow code will move it:
// Move pushpin to "38.0", "-97.0"
var loc = new Microsoft.Maps.Location(38.0, -97.0);
myPushpin.setLocation(loc);

To see this in action, head over to the Ajax Bing Maps v7 interactive SDK, modify the code in blue on the lower center of the screen by putting in different coordinates, hit the Run button and see the pushpin move.
To delete a pushpin that has been added to the map, you need to remove it from the EntityCollection from which it was added to.  For example, if you simply inserted the Pushpin into yourmap.entities, this is how you remove it:
var index = yourmap.entities.indexOf(myPushpin);
if (index != -1) {
    yourmap.entities.removeAt(index);
}

Or you can just remove it directly without using an index:
yourmap.entities.remove(myPushpin);

UPDATE:
To delete a pushpin when the user clicks on it, you essentially have to first identify the pushpin that was clicked in the click event handler.  The pushpin can be obtained from the target Property of the MouseEventArgs Object that is passed into your click handler:
Microsoft.Maps.Events.addHandler(pushpin, 'click', function (mouseEvent) {
    var pushPinThatWasClicked = mouseEvent.target;
    // Do whatever you want with pushPinThatWasClicked
});

A: The following function can remove all the pushpins from the map:
//remove all the pushpins
function deletePushpin()
{
  for(var i=map.entities.getLength()-1;i>=0;i--)
  {
      var pushpin= map.entities.get(i);
      if (pushpin instanceof Microsoft.Maps.Pushpin) {
        map.entities.remove(pushpin);
      }
   }
}


text:
Q: Loop iteration in c #include<stdio.h>
int main()
{
    int i,x=10;
    for(i=0;i<7;i++);
    {
        x++;
    }
    printf("%d",x);
}

Output : 11
No matter how many times the for loop iterates, the value of x stays 11. Why is that ?

A: Remove the semicolon from here:
for(i=0;i<7;i++);

The semicolon makes the for loop have an empty body. It makes it equivalent to
for(i=0;i<7;i++){}

Including warning flags in your compiler(-Wextra in GCC) emits a warning about these kind of issues.

A: Semicolon (; ) punctuation mark in C means that block of code is finished. That means if you use
for(i=0;i<7;i++);
    {
        x++;
    }

For loop ends before it reaches brackets. Then code between your brackets runs like normal lines out of loop. If you want your loop to include brackets, get rid of the semicolon, like:
for(i=0;i<7;i++)
    {
        x++;
    }


text:
Q: Python: Patch classless function which is called inside other function in test class I have defined two functions in a utils file, one call the other inside it code. Like this:
utils.py
def huge_db_call():
    return colossal_sql_query_what_i_dont_want_to_test
def main_function():
    variable = huge_db_call()
    some irrelevant stuff

But now I want to test it in a test class which test the whole utils file. The main problem is that the function which is in called in the main function is a huge db call what I must not run in test, under this circumstances i'd prefer to define an output value which could be called when the huge db call function doesn't do his things and return the predefined output in the test method. So far I've tried this:
test_utils.py
from mock import patch
class test():
    @patch('huge_db_call')
    def test_main_function(self, mock_huge_db_call):
         right_response = -- the_right_main_function_output
         reasonable_test_return = -- not_a_huge_db_call_but_a_controlled_test_case--
         mock_huge_db_call.return_value = reasonable_test_return
         response = utils.main_function()
         self.assertEqual(response, right_response)

But with no success
Can anyone help me please?


text:
Q: PasteSpecial of Range class failed I am trying to select copy everything from a "database" workbook. and paste it in the current workbook, sheet 5. The code I am using is the following.
Sub Import()

Dim DBaseWB As Workbook
Set DBaseWB = Workbooks.Open("http://collaboration.pwc.ca/team/Plant5EngineLines/Documents/Plant 5 master build plan/Database.xlsm", UpdateLinks:=False)
' set DBaseWB as the database workbook after opening it from sharepoint.

Dim DBaseSheet As Worksheet
Set DBaseSheet = DBaseWB.Sheets(1)        'DBaseSheet is referenced to sheet 1 of Database workbook.

Sheet5.Cells.Clear
DBaseSheet.UsedRange.Copy                               'Copy everything from the database
Sheet5.Range("A1").PasteSpecial xlPasteAll              'Paste everything in sheet 5 of current workbook

Application.DisplayAlerts = False
DBaseWB.Close saveChanges:=False
Application.DisplayAlerts = True

End Sub

I am receiving an error when running the following code. Though, sometimes it doesn't give me an error.

Run-time error '1004': PasteSpecial method of Range class failed

I think I know why it's giving me an error at the PasteSpecial line. When I have a different cell selected in sheet 5, it gives me no error. but when I recheck, without selecting any other cell, (so it will have the pasted range selected), I get this error.
I tried using the following line between copy and pastespecial,
Sheet5.range("A1").select

it gives me the same error.
----------UPDATE----------
I first used DisplayName's solution and it worked until yesterday. But this morning, it was causing problems. It another error. Then I tried all other solutions with no luck. all gave me the same errors. I also added the workbook.worksheet to the solutions below giving me no luck. This time the error was with the copy method. I also noticed that lots of columns say #REF.
Versions I tried:
DisplayName's solution combined with thisworkbook.worksheet
Sheet5.UsedRange.Clear
With Workbooks.Open("http://collaboration.pwc.ca/team/Plant5EngineLines/Documents/Plant 5 master build plan/Database.xlsm", UpdateLinks:=False) 'open and reference your Database workbook
    .Sheets(1).UsedRange.Copy Destination:=ThisWorkbook.Sheets(5).Range("A1") ' copy referenced workbook sheet 1 content and paste it to sheet 5
    .Close False
End With

Gary's Student's solution combined with thisworkbook.worksheet
Dim DBaseWB As Workbook
Set DBaseWB = Workbooks.Open("http://collaboration.pwc.ca/team/Plant5EngineLines/Documents/Plant 5 master build plan/Database.xlsm", UpdateLinks:=False)
' set DBaseWB as the database workbook after opening it from sharepoint.

Dim DBaseSheet As Worksheet
Set DBaseSheet = DBaseWB.Sheets(1)        'DBaseSheet is referenced to sheet 1 of Database workbook.

Dim Destination As Worksheet
Set DestinSh = ThisWorkbook.Sheets(5)

Sheet5.Cells.Clear
DBaseSheet.UsedRange.Copy DestinSh.Range("A1").PasteSpecial     'copy database info in planning tool.

Application.DisplayAlerts = False
DBaseWB.Close saveChanges:=False
Application.DisplayAlerts = True

errors:

Run-time error '1004': Copy method of Range class failed

A: First insure that there are no merged cells on either worksheet, and then try:
DBaseSheet.UsedRange.Copy Sheet5.Range("A1")

A: you could simply go:
Sub Import()
    Sheet5.UsedRange.Clear
    With Workbooks.Open("http://collaboration.pwc.ca/team/Plant5EngineLines/Documents/Plant 5 master build plan/Database.xlsm", UpdateLinks:=False) 'open and reference your Database workbook
        .Sheets(1).UsedRange.Copy Destination:=Sheet5.Range("A1") ' copy referenced workbook sheet 1 content and paste it to sheet 5
        .Close False
    End With
End Sub

A: I am with Bruce Wayne on this one
As you have opened a new workbook the focus is now on that workbook.
If you are trying to clear the cells in the workbook the code resides in (destination) after you have launched a new workbook and switched the focus you will need to reference the original workbook to do so, like this:
ThisWorkbook.Sheets(5).Cells.Clear

Hope this helps


text:
Q: No scrollbar when screen content expands in android app I'm creating an android app that stores some data in the database. The main activity screen has a couple of EditTexts. There is also a multiline EditText which expands depending on the text that is written in it. Now, whenever the textbox expands, the screen size stays the same, there is now way to scroll down. No scrollbar is shown.
Here is my xml layout:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:fillViewport="true">

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="be.example.timelogger.NewLogActivity" >

    <TextView
        android:id="@+id/tvDate"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="20dp"
        android:layout_marginTop="25dp"
        android:text="@string/dateText"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <TextView
        android:id="@+id/tvStartTime"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/tvDate"
        android:layout_below="@+id/inputDate"
        android:layout_marginTop="22dp"
        android:text="@string/startTimeText"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <TextView
        android:id="@+id/tvEndTime"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/tvStartTime"
        android:layout_below="@+id/inputStartTime"
        android:layout_marginTop="26dp"
        android:text="@string/endTimeText"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <TextView
        android:id="@+id/tvDurationTime"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/inputEndTime"
        android:layout_centerVertical="true"
        android:text="@string/durationTimeText"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <EditText
        android:id="@+id/inputDate"
        android:layout_width="150dp"
        android:layout_height="wrap_content"
        android:layout_alignTop="@+id/tvDate"
        android:layout_marginLeft="18dp"
        android:layout_toRightOf="@+id/tvDuration"
        android:ems="10"
        android:inputType="date"
        android:onClick="showDatePickerDialog" >

        <requestFocus />
    </EditText>

    <EditText
        android:id="@+id/inputEndTime"
        android:layout_width="150dp"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/tvEndTime"
        android:layout_alignBottom="@+id/tvEndTime"
        android:layout_alignLeft="@+id/inputDate"
        android:ems="10"
        android:inputType="time"
        android:onClick="showTimePickerDialogEnd" />

    <EditText
        android:id="@+id/inputStartTime"
        android:layout_width="150dp"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/inputEndTime"
        android:layout_alignTop="@+id/tvStartTime"
        android:ems="10"
        android:inputType="time"
        android:onClick="showTimePickerDialogStart" />

    <TextView
        android:id="@+id/tvDuration"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/tvEndTime"
        android:layout_centerVertical="true"
        android:text="@string/durationText"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <TextView
        android:id="@+id/tvCourse"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/tvDuration"
        android:layout_below="@+id/tvDuration"
        android:layout_marginTop="30dp"
        android:text="@string/tvCourseText"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <Spinner
        android:id="@+id/spinCourse"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@+id/tvCourse"
        android:layout_toRightOf="@+id/tvDurationTime" />

    <EditText
        android:id="@+id/txtComment"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/tvComment"
        android:layout_alignRight="@+id/inputEndTime"
        android:layout_below="@+id/tvComment"
        android:layout_marginTop="17dp"
        android:ems="10"
        android:isScrollContainer="true"
        android:inputType="textMultiLine"  />

    <TextView
        android:id="@+id/tvComment"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/tvCourse"
        android:layout_below="@+id/spinCourse"
        android:layout_marginTop="28dp"
        android:text="@string/commentText"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <Button
        android:id="@+id/btnSave"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/txtComment"
        android:layout_centerHorizontal="true"
        android:text="@string/btnSaveText" />
</RelativeLayout>

Anybody got an idea?

A: The RelativeLayout inside your ScrollView should have height wrap_content instead of match_parent.

A: Scroll View should be closed at the end
 .


text:
Q: Gradle config file get unknown property with System.setProperty I have a problem with my settings.gradle :
pluginManagement {
    System.setProperty('javax.net.ssl.trustStore', trust_store_location)
    System.setProperty('javax.net.ssl.trustStorePassword', trust_store_password)

}

When I try to run my project I have this error :
Could not get unknown property 'trust_store_location'

I have a file param.properties with this parameter trust_store_location=conf/truststore.jks
But I don't know where can I put this file for working... ?

A: You have 2 choices here :
1# Put your properties in the gradle.properties file. Gradle automatically reads this file and give you access to the properties as variables
2# Manually load param.properties
pluginManagement {
    def props = new Properties()
    file('param.properties').withInputStream { props.load(it) }
    System.setProperty('javax.net.ssl.trustStore', props.getProperty('trust_store_location'))
    System.setProperty('javax.net.ssl.trustStorePassword', props.getProperty('trust_store_password'))
}


text:
Q: Twitter 4j - Get tweets by user ID - Processing There seems to be many different tutorials and examples out there to allow for tweets to be pulled into Processing from one specific user.
And yet I'm still having problems getting any code to work. I have managed to get tweets by searching with hashtags, so the twitter4j library (latest) is working within Processing (also latest software). I still a complete coding novice...
I've found the following code to do exactly what I need, but unfortunately it isn't complete, where I'm assuming you need to declare your Consumer Keys and Access tokens... But I've no idea how to do this with this code. Is this something that someone is able to provide and explain?
Essentially, I need the full sketch... Any help would be greatly appreciated!
Code from elsewhere:

  final Twitter twitter = new TwitterFactory().getInstance();
    twitter.setOAuthConsumer(CONSUMER_KEY, CONSUMER_KEY_SECRET);
    AccessToken accessToken = new AccessToken(TWITTER_TOKEN,
            TWITTER_TOKEN_SECRET);
    twitter.setOAuthAccessToken(accessToken);
    try {
        Status status = twitter.showStatus(Long.parseLong(tweetID));
        if (status == null) { //
            // don't know if needed - T4J docs are very bad
        } else {
            System.out.println("@" + status.getUser().getScreenName()
                        + " - " + status.getText());
        }
    } catch (TwitterException e) {
        System.err.print("Failed to search tweets: " + e.getMessage());
        // e.printStackTrace();
        // DON'T KNOW IF THIS IS THROWN WHEN ID IS INVALID
    }

EDIT: This is how I've added the consumer/access keys - is this right?
 twitter.setOAuthConsumer("MyConsumerKey", "MyConsumerSecret");
AccessToken accessToken = new AccessToken("MyAccessToken", "MyAccessTokenSecret");
twitter.setOAuthAccessToken(accessToken);

EDIT2: This is what I have now to get the User's tweets. But produced the error: 'cannot convert from ResponseList to Status'
    String user="USER ID";

final Twitter twitter = new TwitterFactory().getInstance();
twitter.setOAuthConsumer("MY CONSUMER KEY", "MY CONSUMER KEY SECRET");
AccessToken accessToken = new AccessToken("MY TWITTER TOKEN", "MY TWITTER     TOKEN SECRET");
twitter.setOAuthAccessToken(accessToken);
try {

    Status status = twitter.getUserTimeline(user);
    if (status == null) { //
        // don't know if needed - T4J docs are very bad
    } else {
        System.out.println("@" + status.getUser().getScreenName()
                    + " - " + status.getText());

    }
} catch (TwitterException e) {
    System.err.print("Failed to search tweets: " + e.getMessage());
    // e.printStackTrace();
    // DON'T KNOW IF THIS IS THROWN WHEN ID IS INVALID
}

A: you need first to create a twitter app, to do so go to https://apps.twitter.com/, from there you can get all the infos needed to get your credentials.
in your code just replace the 'CONSUMER_KEY','CONSUMER_KEY_SECRET','Access Token','Access Token Secret' by the credentials.
ConfigurationBuilder cb = new ConfigurationBuilder();
        cb.setDebugEnabled(true)
                .setOAuthConsumerKey("XXXXX")
                .setOAuthConsumerSecret("XXXXXX")
                .setOAuthAccessToken("XXXX-XXXXX")
                .setOAuthAccessTokenSecret("XXXXXXX");

hope this help!


text:
Q: Sed replace between 2 strings with special character I have an XML file containing a code and to use it with xmllink I need to remove a link.
XML file containing:
<xml version="1.0" encoding="UTF-8" standalone="yes"?>
<PackingList xmlns="Link to somewhere#">
<morecode></morecode>

Using sed 'sed s/PackingList.*\>/PackingList/g' xmlfile gives me the following result (on the 2nd line):
<PackingList#">

while it should be
<PackingList>

What am I doing wrong?

A: Three things wrong:-

*

*The first quote in the sed command should be before the s/ option, not before sed itself - I presume this is a typing error.

*The > character has no special meaning in regular expressions, and must not be escaped - the sequence \> has special significance: it means end of word, and because .* is "greedy" it matches the end of the last word on the line, hence the retention of the #".

*If you match the source >, this will be included in the string to be replaced, so it must also appear in the replacement string.

So your edit command should be:
sed 's/PackingList.*>/PackingList>/g' xmlfile

This is similar to jherran's solution, but takes account of your original attempt at matching. It might be neater to match up to the trailing double-quote:
sed 's/PackingList.*"/PackingList/g' xmlfile

If you don't want to rely on greediness (and make it more readable), use:
sed 's/PackingList.*".*"/PackingList/g' xmlfile

Note that any subsequent XML tags on the same line may be deleted by any of the above: to avoid this, use:
sed 's/PackingList[^>]*"[^>]*"/PackingList/g' xmlfile

A: Try this way:
sed 's/PackingList.*/PackingList>/g' xmlfile


text:
Q: What are these words meaning in Soul Calibur terminology? I've made a custom character in Soul Calibur IV and I'm able to choose some skills but I don't understand them. There are some keywords which are not really clear like:

*

*impact

*guard breaker

*counter

I tried the SC wiki but there is no thorough explanation how these work. Can you help me out?

A: Guard Impact
A Guard Impact (or just "Impact" for short) is a counter where you press forward/back plus guard at the same time. If you time it right, you will push your opponents attack away and stagger him a bit, giving you time to follow up with free damage (unless he Guard Impacts you back). You can Guard Impact with forward/back, which blocks high and mid attacks, or with downforward/downback, which blocks low attacks.
Guard Breaker
Any attack you do that has an extra blue fiery animation is a Guard Breaker. If your opponent blocks it, it will break his guard and stagger him for a few seconds. It is usually difficult to actually follow this up with damage because of the recovery frames on your own attack.
Counter
Any attack you make that hits your opponent during one of his animations is a counter. You can tell if a hit is a counter hit because the little explosion animation will be red instead of the normal yellow for generic hits. There are different kinds of counter hits (a run counter if you hit your opponent while running vs. an attack counter if you hit him while he's in the middle of attacking). The type of counter you get (and whether you get a counter at all) will affect your opponent's recovery speed from the hits. You can get longer, more damaging combos off counter hits than normal hits.


text:
Q: If $f(x_0+x)=P(x)+O(x^n)$, is $f$ $mLet $f : \mathbb{R} \to \mathbb{R}$ be a real function and $x_0 \in \mathbb{R}$ be a real number. Suppose that there exists a polynomial $P \in \mathbb{R}[X]$ such that $f(x_0+x)=P(x)+ \underset{x \to 0}{O} (x^n)$ with $n> \text{deg}(P)$.
Is it true that for $m<n$, $f^{(m)}(x_0)$ exists? (Of course, it is obvious for $m=1$.) If so, we can notice that $f^{(m)}(x_0)=P^{(m)}(x_0)$.

A: No, these are not true, and classical counterexamples are based on $f(x)=|x|^a\sin(1/|x|^b)$ for $x\ne0$ and $f(0)=0$, considered at $x_0=0$, for well chosen positive $a$ and $b$.
Basically, the idea is that the limited expansion of $f$ at $0$ is $f(x)=O(|x|^n)$ (no polynomial term) with $n$ large if $a$ is large but that $f''(0)$ need not exist when $b$ is suitably larger than $a$.


text:
Q: Override Spring Security autoconfiguration I have an jar with a own spring security filter and my own security configuration.
This jar is called from a Spring Boot application and I would like disable the spring boot security configuration (without excludes or properties) and put my spring security configuration (this jar is in spring 4.X). How can I build an autoconfiguration for my Spring Security,and  override the autoconfiguration of Spring Boot by default?:

A: Finally, I have created my own auto-configuration, an class @autoconfiguration with an @conditionalonmissingclass and an import of my security.


text:
Q: SUM and VLOOKUP combination I have a table like this:
Year  V1 V2 V3
2022  1% 2% 3%
2023  3% 1% 2%
2024  4% 3% 1%
2025  1% 4% 2%

I want to look up and sum percentages for values based on start and end years (so an outcome would look like this):
Value StartYear EndYear CumulativePercentage
V1    2022      2025    9%
V2    2023      2024    4%
V3    2022      2023    5%

Is it possible to create a single formula that would do this?

A: This gives you the answer for V1:
 =SUMIFS(B2:B5;A2:A5;">="&B10;A2:A5;"<="&C10)


text:
Q: Error: "The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)" when using CNAME Running Get-WmiObject Win32_ComputerSystem -ComputerName 'MyCnameRecord' gives error: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA).
However running Get-WmiObject Win32_ComputerSystem -ComputerName 'ServerNameToWhichTheAboveCnameRefers' all works.
Equally Get-WmiObject Win32_ComputerSystem -ComputerName 'IPOfServerWhichCnameAlsoCorrectlyResolvesTo' works.
Is anyone aware of some configuration / security setting which may be required to allow RPC calls to a server via a CNAME record?  I'd assumed that as the IP is correctly resolving, and this works by IP, it should work by cname record; however clearly it doesn't.
Background
We recently migrated our SQL Servers from a physical cluster to a stand-alone VM.  We'd used a DNS alias for the cluster, which we kept after migrating to the VM in order to minimise reconfiguration (i.e. we use this approach: https://www.mssqltips.com/sqlservertip/2663/using-friendly-names-for-sql-servers-via-dns/).
After this migration, some of our monitoring software began giving errors when attempting to query the database server's performance.  It was accessing the database server via the DNS alias, rather than by the server name (this had worked previously for the cluster; though no longer worked when using the DNS CNAME record).
The PowerShell code above is just a simplified way to demonstrate the underlying issue.

A: Have you looked at OptionalNames and DisableStrictNameChecking in the LanmanServer parameters? Depending on your Windows version these may be the issue.
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LanmanServer\Parameters

This has worked with shares & printing for me in the past so should (could) work for other Win32 RPC stuff.

A: What TheFiddlerWins describes is a very likely culprit. I dealt with a similar issue a couple months ago, see WMI queries can't run with a FQDN?.


text:
Q: Camel netty consumer always sends immediate response even if route not finished I am using apache camel 3.8 and trying to make a simple tcp server that sends the request message back to the client (the client I am using is PacketSender).
The problem is, if the process() method takes too long an empty response is sent back by netty in the background after 15ms, even if the process() is still in the Thread.sleep hold.
If I do not let the method (thread) sleep, the response is sent with the received content immediatly.
How can I manage it, that netty is waiting until I finished my process and send the response I set in the exchange message body?
Here is the route I am using:
fromF("netty:tcp://%s:%d?sync=true&synchronous=true&disconnectOnNoReply=false&connectTimeout=100000", host, receivePort)
    .bean(HL7Request.class, "process", BeanScope.Request);

The bean process method looks like this, for simulation purpose of my long taking process I used a Thread.sleep:
public void process(Exchange exchange) throws Exception {

        try {
            CamelContext context = exchange.getContext();
            exchange.setException(null);

            Thread.sleep(5000); // <-- Here the method stopps for 5 seconds but the response is sent by netty anyway
            String content = exchange.getMessage().getBody(String.class);
            System.out.println(content);
        }
        catch (Exception e) {
            exchange.setException(e);
        }
    }

PacketSender receives an empty response
Thank you.
Regards,
Florian

A: I think it was an issue with PacketSender Software. It perfectly works using command line telnet.
More details to the bug


text:
Q: Extract keys from a string I have a column named Notes_Key where the vendor has stuck three keys (with whitespace padding) into that column.  I am on MS SQL2012
Example Data
THOBUI         R4044     004

I access out each value so I can access these
THOBUI
R4044
004

Update - I actually need the data this way

VendorCode
JobCode
OrderCode

THOBUI
R4044
004

This way I can join to other tables.  And there shouldn't be more records than these 3.
NOTE:
Arbitrary code from a comment below...
SELECT
    Members.Member.value('.','VARCHAR(8000)') Keys
FROM
    (SELECT
        CAST('<Notes_Type><PA_NOTES_MC>'
        + REPLACE(Notes_Key, ' ' , '</PA_NOTES_MC><PA_NOTES_MC>')
        + '</PA_NOTES_MC></Notes_Type>' AS XML) AS tempCRN
    FROM
        PA_NOTES_MC
    WHERE
        Company_Code = 'REC' AND
        Notes_Key LIKE '%R4044%' ) AS tempCRN
    CROSS APPLY
    tempCRN.nodes('/Notes_Type/PA_NOTES_MC') Members(Member))

SELECT
    Keys,
    'Name' AS KeyName
FROM
    tmp
WHERE
    Keys !=''

A: The use of charindex() suggests that you are using SQL Server.  If so, you can use string_split() in the more recent versions:
select e.*, s.valu
from example e cross apply
     string_split(e.col, ' ') s
where s.value <> '';


text:
Q: Cleaning/Debugging services I have a shell environment library where I maintain all types of checks and helpers functions for my bash/zsh environments (Linux and macOS). I like that periodic checks automatically inspect my OS' functionalities so that I don't forget certain things and always keep everything fresh.
Today I was running some service things on my Raspberry and when listing all services with systemctl list-units --type=service --all I noticed some failures and not-found entries. The failures were easy to clean because they were non-well-cleaned old pihole and vsftpd service files. But how should I approach the not-found ones? Are there certain ones to simply ignore or generate basic service files for them?
pi@raspberrypi [130] % systemctl list-units --type=service --all | grep "not-found"
● auditd.service                  not-found inactive dead    auditd.service
● console-screen.service          not-found inactive dead    console-screen.service
● exim4.service                   not-found inactive dead    exim4.service
● firewalld.service               not-found inactive dead    firewalld.service
● gssproxy.service                not-found inactive dead    gssproxy.service
● kbd.service                     not-found inactive dead    kbd.service
● mountkernfs.service             not-found inactive dead    mountkernfs.service
● NetworkManager.service          not-found inactive dead    NetworkManager.service
● nfs-blkmap.service              not-found inactive dead    nfs-blkmap.service
● nfs-server.service              not-found inactive dead    nfs-server.service
● nslcd.service                   not-found inactive dead    nslcd.service
● sendmail.service                not-found inactive dead    sendmail.service
● sssd.service                    not-found inactive dead    sssd.service
● systemd-update-done.service     not-found inactive dead    systemd-update-done.service
● systemd-vconsole-setup.service  not-found inactive dead    systemd-vconsole-setup.service
● ypbind.service                  not-found inactive dead    ypbind.service

A: Units in not-found state only show up if they're not inactive or if something depends on them.
If the unit is "not-found" but "active", it means the package has been uninstalled but didn't stop the corresponding units. Stop them manually (or reboot).
If the unit is "failed", it's there so that you could inspect the failure. After doing so, systemctl reset-failed will remove it.
If the unit is "not-found" and "inactive" yet stays in the list, then it's probably wanted or required by another unit. For example, the unit is probably still "enabled", i.e. your /etc/systemd/system/*.target.wants contains a symlink to it. Remove the links either manually or using systemctl disable. It could also be that you started something that lists it as Wants= or Requires= the nonexistent service (having a Wants= on nonexistent units is perfectly fine; it's an "optional dependency").


text:
Q: Answer-verification: Show that $f(x,y)=1+2x+3y$ for all $(x,y)\in \Bbb R^2$ Define the function $f: \Bbb R^2\to \Bbb R$ has first order partial derivatives and that $f(0,0)=1$
While $\frac{\partial f}{\partial x}(x,y)=2$ and $\frac{\partial f}{\partial y}(x,y)=3$ for all $(x,y)\in \Bbb R^2$
Prove that $f(x,y)=1+2x+3y$ for all $(x,y)\in \Bbb R^2$
$\bf{solution:}$
Let $\frac{\partial f}{\partial x}(x,y)=g(x,y)$
Then $\int g(x,y)dx=2x +c_1$ for $c_1 $ is constant
Similarly, let $\frac{\partial f}{\partial y}=h(x,y)$
Then $\int h(x,y)=2y+c_2$ for $c_2$ constant
Since $f(0,0)=1$ is constant so, $c:=(c_1,c_2)=1$
Thus, $f(x,y)=1+2x+3y$ for all $(x,y)\in \Bbb R^2$

Is this answer true? If there exist mistakes, please can somebody correct this?

A:
Then $\int g(x,y)dx=2x +c_1$ for $c_1 $ is constant

This isn't correct. For instance take $\alpha (x,y)=2x+2y^3+\log (|y|+1)$. Then $\dfrac{\partial \alpha }{\partial x}(x,y)=2$ and $\alpha (x,y) \neq 2x$.
Correct would be: then $\int g(x,y)dx=2x+\varphi (y)=f(x,y)$, for some differentiable function $\varphi$.
Now you differentiate the above with respect to $y$ to get $$3=\frac{\partial f}{\partial y}(x,y)=\varphi '(y).$$
Therefore $\varphi (y)=3y+C$, for some constant $C\in \Bbb R$.
Now replacing $\varphi$ by what was just gotten it follows that $f(x,y)=2x+3y+C$.
Edit: You're also given that $f(0,0)=1$, so $2\cdot 0+3\cdot 0+C=1$ and it follows that $C=1$.


text:
Q: What is the best way to update the match formula to conditionally format? =MATCH(C$13, 'Vacation - Holiday'!$B:$B, 0)
C13 is the date 01/01/2016.
I am using this formula to conditionally format a cell in a calendar dashboard.   It works great but I need the lookup array to be dependent on the name listed in cell B15.
Can I use AND(Match())?  I have tried many things and feel so close but so far.
"Meg" is the header of the "B" column on sheet 'Vacation - Holiday'!$B:$B.  There are names in columns A - J.
A     B           C           D        E            F         G           H
              1/1/2016   1/4/2016   1/5/2016    1/6/2016    1/7/2016    1/8/2016
     Meg

A: The formula you want is:
=ISNUMBER(MATCH(C$13,INDEX(Sheet6!$A:$J,0,MATCH($B15,Sheet6!$1:$1,0)),0))


text:
Q: Query to schedule a match between each team How to fetch Below Output Using SQL Query in Oracle
Scenario:
suppose that in a Table named Team contains  4 records, we need to schedule a match between each team vs opposite team:
 Team
    ----
    India
    Pakistan
    Srilanka
    Australia

    Output :
    ----
    India VS Pakistan
    India VS Srilanka
    India VS Australia
    Pakistan VS Srilanka
    Pakistan VS Australia
    Srilanka VS Australia

A: You can use a full join between the same table   where a.team <> b.team
select
       a.team_name || 'VS' || b.team_name
from
table_team a,
table_team b
where
       a.team_id < b.team_id ;

if we consider <> then there will be duplicates eg. Ind vs Pak and Pak vs Ind. So string compare less that will always choose on combination

A: You can do this with a simple join . . . but not a cross join:
with teams as (
      select 'India' as team FROM dual UNION ALL
      select 'Pakistan' as team FROM dual UNION ALL
      select 'Srilanka' as team FROM dual UNION ALL
      select 'Australia' as team FROM dual UNION ALL
     )
select t1.team as team1, team2.team team2
from teams t1 join
     teams t2
     on t1.name < t2.name;

This produces one row for each pair.
If you actually wanted to keep the ordering so you get the output as exactly the pairs you specify, you need an ordering column:
with teams as (
      select 'India' as team, 1 as n FROM dual UNION ALL
      select 'Pakistan' as team, 2 FROM dual UNION ALL
      select 'Srilanka' as team, 3 FROM dual UNION ALL
      select 'Australia' as team, 4 FROM dual UNION ALL
     )
select t1.team as team1, team2.team team2
from teams t1 join
     teams t2
     on t1.n < t2.n;

A: WITH teams
     AS (SELECT 'India' team
         FROM dual
         UNION ALL
         SELECT 'Pakistan' team
         FROM dual
         UNION ALL
         SELECT 'Srilanka' team
         FROM dual
         UNION ALL
         SELECT 'Australia' team
         FROM dual
         )
SELECT DISTINCT CASE
                  WHEN t1.team >= t2.team THEN t2.team
                  ELSE t1.team
                END  || ' VS '||
                CASE
                  WHEN t1.team >= t2.team THEN t1.team
                  ELSE t2.team
                END Matches
FROM teams t1
       cross join teams t2
WHERE t1.team != t2.team
ORDER BY Matches;

Output:
Australia VS India
Australia VS Pakistan
Australia VS Srilanka
India VS Pakistan
India VS Srilanka
Pakistan VS Srilanka

You may use a different combinations within the CASE block

A: WITH wc
     AS (SELECT 'India' team
         FROM   dual
         UNION ALL
         SELECT 'Pakistan' team
         FROM   dual
         UNION ALL
         SELECT 'England' team
         FROM   dual
         UNION ALL
         SELECT 'Australia' team
         FROM   dual)
SELECT wc1.team,
       wc2.team
FROM   wc wc1
       CROSS JOIN wc wc2
WHERE  wc1.team != wc2.team
GROUP  BY wc2.team,
          wc1.team;

A: Write query like below.
SELECT us.user_firstname   AS FirstPlayerFName,
       us.user_lastname    AS FirstPlayerLName,
       u.user_firstname    AS SecondPlayerFName,
       u.user_lastname     AS SecondPlayerLName,
       tm1.mapped_playerid AS firstPlayerId,
       tm2.mapped_playerid AS SecondPlayerId
FROM   tbl_tournamentplayermapping tm1
       JOIN tbl_tournamentplayermapping tm2
         ON tm1.mapped_playerid < tm2.mapped_playerid
       JOIN tbl_user u
         ON u.user_id = tm1.mapped_playerid
       JOIN tbl_user us
         ON us.user_id = tm2.mapped_playerid
WHERE  tm1.mapped_tournamnetgroup = 'A'
       AND tm2.mapped_tournamnetgroup = 'A'
       AND tm1.mapped_scheduleid = tm2.mapped_scheduleid

A: you can do without cross join. try this one.
 create table testData(
    team varchar(10),
   );

insert into testData values ('India');
insert into testData values ('Pakistan');
insert into testData values ('Srilanka');
insert into testData values ('Australia');

select t1.team + ' VS ' + t2.team
  from testData t1,testData t2
 where t1.team < t2.team
 order by t1.team

A: you could try that query :
select a.ename "team-a",b.ename "team-b" from #emp a,#emp b where  a.eid != b.eid  order by "team-a"


text:
Q: Send middle click when double right click is detected with Autohotkey Hey my middle click button is kinda dead so I'm looking for a solution using Autohotkey.
What I want to do is send a middle click whenever I double right click, but I haven't been able to find a reliable solution so far.
Any suggestions?

A: Maybe not the most elegant way, but you could try this:
Modyfied from: http://www.autohotkey.com/board/topic/16321-map-a-double-left-mouse-click-to-a-single-key/
$RButton::
if clicks > 0
   clicks++
else
{
   clicks := 1
   SetTimer, ClickWait, 400
}
return

ClickWait:
SetTimer, ClickWait, off
if clicks = 1
{
   Click, Right
}
else
{
   Click, Middle
}
clicks := 0
return

When you don't mind having the Right-Click menu appear, you can use this code, which sends the Right-Click straight through and corrects it later.
~RButton::
if (A_PriorHotkey <> "~RButton" OR A_TimeSincePriorHotkey > 600)
    Return ; No double click, so stop!
Sleep, 100
Send, {Esc}
Sleep, 100
Click, Middle
return


text:
Q: Saving 3 php variables from javascript <?php

include ('config.php');

?>
<!DOCTYPE html>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Platser</title>

<link rel="stylesheet" href="style.css" type="text/css"/>

<?php

    if(isset($_POST['Spara'])){

    }

    $antal = $mysqli->query("SELECT `Grupp ID` FROM `Elevgrupper` WHERE `Grupp ID`=25");
    $num = $antal->num_rows;

    $res = $mysqli->query("SELECT `Namn`, `Efternamn` FROM `Elever` WHERE `ID` IN (SELECT `Användar ID` FROM `Elevgrupper` WHERE `Grupp ID` = 25)");

    for ($i = 1; $i<=$num; $i++){
        $get_coords = mysqli_query($mysqli, "SELECT * FROM coords WHERE id = '" . $i . "'");
        $row = $get_coords->fetch_assoc();
        $ok = $res->data_seek($i-1);
        $row1 = $res->fetch_assoc();

        //
        $x = $row['x_pos'];
        $y = $row['y_pos'];
        echo '

'. $row1["Namn"] . " " . $row1["Efternamn"] . '

';
        }

?>

<form action="<?echo $_SERVER['PHP_SELF'];?>">
    <input onclick="spara();" type="submit" name="Spara">
</form>

<?php
if(!$_POST["data"]){
    echo "Nothing Sent";
    exit;
}

include ('config.php');

$data = json_decode($_POST["data"]);

foreach($data->coords as $item) {
    //Extract X number for panel
    $coord_X = preg_replace('/[^\d\s]/', '', $item->coordTop);
    //Extract Y number for panel
    $coord_Y = preg_replace('/[^\d\s]/', '', $item->coordLeft);
    //escape just-in case
    $x_coord = mysqli_real_escape_string($mysqli, $coord_X);
    $y_coord = mysqli_real_escape_string($mysqli, $coord_Y);

    //Setup Query
    $sql = "UPDATE coords SET x_pos = '" . $x_coord . "' WHERE id"= . substr($data->id, -1) .;
    mysqli_query($mysqli, $sql);

    $sql = "UPDATE coords SET y_pos = "'. $y_coord .'"  WHERE id"= . substr($data->id, -1) .;
    mysqli_query($mysqli, $sql);

}

//Return Success
echo "success";

?>

If I am not mistaken everything except the spara function should work and it's driving me crazy since I don't get even get any error messages, seems like it runs through the entire script without errors and without saving anything.
What I am trying to do is a teacher tool that from a database which contains all students places out benches that you can drag around and move to your choosing so that you can decide seats for everyone without having to do much work as the teacher. And I want the layout to save by pressing a button which runs the function.

A: I believe this line could be wrong:
$.post('updatecoords.php', 'data='+$.toJSON(order), function(response)

Usually I would have something like this:
$.post('updatecoords.php', {data: somevar}, function(response)

Give that a try, assign $.toJSON(order) to a variable and pass it as suggested.
UPDATE:
Based on Domeniks feedback below, you probably just need to do this:
$.post('/updatecoords.php', somevar, function(response)


text:
Q: WebView go back WebView can go back, forward  and reload on virtual device. When I test it on real device back and forward doesn't work.As for reload it works fine. I know the same question was asked but i didn't find solution for my example.
class Site : android.support.v4.app.Fragment(), OnBackPressedListener {

    var changeU: String = "https://www.google.ru/search?client=opera&q=google&sourceid=opera&ie=UTF-8&oe=UTF-8"

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
            return inflater.inflate(R.layout.site, container, false)
    }

    override fun onSaveInstanceState(outState: Bundle) {
            super.onSaveInstanceState(outState)
            webView.saveState(outState)
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
            setHasOptionsMenu(true)
            webView.settings.javaScriptEnabled = true
            webView.settings.cacheMode = WebSettings.LOAD_CACHE_ELSE_NETWORK
            if (savedInstanceState == null) {
                    webView.loadUrl(changeU)
            }
            webView.settings.setSupportZoom(true)
            webView.settings.builtInZoomControls = true
            webView.settings.displayZoomControls = false
            webView.webViewClient = MyWebViewClient()
            super.onViewCreated(view, savedInstanceState)
    }

    private inner class MyWebViewClient : WebViewClient() {
            override fun shouldOverrideUrlLoading(view: WebView, url: String): Boolean {
                    view.loadUrl(url)
                    return true
            }
    }

    override fun onCreateOptionsMenu(menu: Menu?, inflater: MenuInflater?) {
            inflater!!.inflate(R.menu.site_menu, menu)
            super.onCreateOptionsMenu(menu, inflater)
    }

    override fun onOptionsItemSelected(item: MenuItem): Boolean {
            when (item.itemId) {
                    R.id.backT -> {
                            if (webView.canGoBack()) {
                                    webView.goBack()
                            } else {
                            }
                            return true
                    }
                    R.id.reloadT -> {
                            webView.reload()
                            return true
                    }
                    R.id.forwardT -> {
                            if (webView.canGoForward()) {
                                    webView.goForward()
                            }
                            return true
                    }
                    else -> return super.onOptionsItemSelected(item)
            }
    }

    override fun onBackPressed() {
            if (webView.canGoBack()) {
                    webView.goBack()
            } else {
            }
    }
}

I suppose it's so simple mistake but i can't solve it.

A: Android WebView new tab action urls can be handled by extending WebChromeClient.
Please take a look for activity class
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.webkit.*
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {

    private val changeU: String = "https://www.google.ru/search?client=opera&q=google&sourceid=opera&ie=UTF-8&oe=UTF-8"

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        webView.settings.javaScriptEnabled = true
        webView.settings.cacheMode = WebSettings.LOAD_CACHE_ELSE_NETWORK
        webView.settings.setSupportZoom(true)
        webView.settings.builtInZoomControls = true
        webView.settings.displayZoomControls = false
        // add multi window support
        webView.settings.javaScriptCanOpenWindowsAutomatically = true
        webView.webViewClient = MyWebViewClient()
        webView.webChromeClient = MyWebChromeClient()

        if (savedInstanceState == null) {
            webView.loadUrl(changeU)
        }

    }

    private inner class MyWebChromeClient : WebChromeClient() {
        // handle new tab action urls if required
        override fun onShowCustomView(view: View?, callback: CustomViewCallback?) {
            super.onShowCustomView(view, callback)
        }
    }

    private inner class MyWebViewClient : WebViewClient() {
        override fun shouldOverrideUrlLoading(view: WebView, url: String): Boolean {
            view.loadUrl(url)
            return true
        }

        override fun shouldOverrideUrlLoading(view: WebView?, request: WebResourceRequest?): Boolean {
            return super.shouldOverrideUrlLoading(view, request)
        }
    }
    override fun onBackPressed() {
        if (webView.canGoBack()) {
            webView.goBack()
        } else {
        }
    }
}


text:
Q: iPhone 10 fullscreen camera non-working Xcode // iPhone 10 vs iPhone 8 iPhone 10 screenshot
iPhone 8 screenshot
As you can see on a iPhone 10 screen camera is not full screen, and I can not understand what to change in Xcode if I want set camera view in a full screen in any device.

A: Did you use AVCaptureSessionPresetPhoto ?


text:
Q: No sound on my Compaq CQ43 I'm new to linux. I've ubuntu 10.04LTS installed, but I'm not able to play any sound. I don't know how to install sound drivers on my machine.

A: Sound drivers should be detected automatically by Ubuntu although sometimes one of the channels is muted which causes nothing to play...
Go into Terminal and type:   sudo apt-get pavucontrol
This will install a much better volume/sound manager that you can play with which will let you set up your sound driver a little easier...


text:
Q: Converting the mean and std of Normal distribution to the mean and std of lognormal distribution Hi
I feel a little bit confused about transforming the parameters of normal distribution to log normal.
I have a random variable that is N(0.06,0.000144). Because this random variable cannot take negative values, I want to use an equivalent lognormal distribution.
I calculated the mu (location parameter) as -2.83 and sigma squared (scale parameter) as 0.39. The model that I am using for simulation takes the mean and standard deviation of the lognormal distribution. when I calculate the mean and standard deviation of lognormal using the mu and sigma I get the original mean and standard deviation of the normal distribution. Is that correct?
Ps. I used the following formulas to calculate mu, sigma, mean and standard deviation of the lognormal:


text:
Q: Adjusting SoapUI for simple REST web service I have REST web service based on Jersey that runs on TomCat 9 in my Eclipse IDE.
Server runs fine while test with broser:
openning link    http://localhost:8080/messenger/webapi/messages
brings:
<messages>
<message>
<author>koukushik</author>
<created>2019-02-20T12:48:41.817+02:00</created>
<id>1</id>
<message>Hello World</message>
</message>
<message>
<author>koukushik</author>
<created>2019-02-20T12:48:41.817+02:00</created>
<id>2</id>
<message>Hello Jersey</message>
</message>
</messages>

I'm trying to do the same in SoapUI 4.5.1:
I do:
New SoapUI project:
    project name: "pro1"
New REST Service
    Service name: "serv1"
    Service endpoint: http://localhost:8080/messenger/webapi/messages
New REST Resource
    Name resource1
    Resource Path/Endpoint http://localhost:8080/messenger/webapi/messages
New REST Method
    Method_1
    GET

Do request RAW:
GET http://localhost:8080/messenger/webapi/messages/messenger/webapi/messages HTTP/1.1
Accept-Encoding: gzip,deflate
Host: localhost:8080
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

Answer HTML:

      <meta content="HTML Tidy for Java (vers. 26 Sep 2004), see www.w3.org" name="generator"/>
      <title>HTTP Status 404  Not Found</title>

HTTP Status 404  Not Found

         Type
         Status Report

         Message
         Not Found

         Description
         The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

Apache Tomcat/9.0.14

Looks like GET method contains HTTP/1.1 at the end. Is that problem? How to make SoapUI work with my project?
UPD
Works fine now:

A: The problem is that the URL you are trying to access as seen in the RAW request is not the one you want which as a result returns you a 404 status code
Please try the following settings


text:
Q: @ObservedObject model lifecycle? I'm testing @ObservedObject to test how SwiftUI handles the lifecycle of the model.
As I understand things now, from WWDC videos and documentation, is that the View that creates the model object (a class adopting ObservableObject) should use @StateObject.
From WWDC videos they clearly state that @ObservedObject does not own the observed instance lifecycle.
So I created this simple setup:
struct TestParentView: View {

    @ObservedObject var model:TestModel

    var body: some View {

        VStack {
            Text("TEST TEXT. \(model.name)")
            TestChildView(model: model)
        }
    }

}

struct TestParentView_Previews: PreviewProvider {
    static var previews: some View {
        TestParentView(model: TestModel())
    }
}

struct TestChildView: View {

    @ObservedObject var model:TestModel

    var body: some View {

        Button(action: {
            print("change name")
            model.changeName()
        }, label: {
            Text("Change Name")
        })

    }

}

struct TestChildView_Previews: PreviewProvider {
    static var previews: some View {
        TestChildView(model: TestModel())
    }
}

The model I used here is this:
class TestModel:ObservableObject {

    @Published var name:String = ""
    let id = UUID()

    func changeName() {
        name = "\(UUID())"
    }

    deinit {
        print("TestModel DEINIT. \(id)")
    }

}

When I run this app, I was expecting the TestModel instance created in TestParentView to be de-initialized at least at some point since @ObservedObject does not own the lifecycle of the model.
When I tap on the button to trigger a name change all works, but the TestModel DEINIT never gets called.
From all of this, it looks like TestParentView has a strong reference to the TestModel and it never lets it go.
So, what do they mean then when they say that @ObservedObject does not manage the lifecycle of model in this case?
Why is the TestModel DEINIT never called if @ObservedObject does not manage the model's lifecycle?
I'm obviously missing something here.

A: Assume this View:
struct Foo: View {
    @ObservedObject var model = TestModel()

    var body: some View {
        Text(model.name)
    }
}

Every time this view is created, it instantiates a new instance of TestModel.
SwiftUI views are really more like view descriptions which are created and destroyed a lot during your app lifecycle. Therefore it's important that the structs are lightweight. The Foo view isn't very lightweight because every rendering pass it instantiates a new model.
If you instead used @StateObject, the framework will only instantiate a TestModel the first time. After that it will reuse that same instance. This makes it way more performant.
Rule of thumb:

*

*If the view creates its own model (such as the Foo view), use @StateObject.

*If the model is passed in from the outside, use @ObservedObject.

To answer your question: "Why is the TestModel DEINIT never called".
You state that: "When I run this app, I was expecting the TestModel instance created in TestParentView to be de-initialized at least at some point".
The subtle detail is that the TestModel is not created in the TestParentView, it's merely passed in.
It is created in the TestParentView_Previews. And since the body of the TestParentView_Previews is only executed once, the TestModel will also only be initialised once, and thus never deallocated.


text:
Q: How many samples do I need to estimate a gaussian distribution? Background: I'm comparing the performance of two algorithms. The data is noisy so the results tend to form a nice normal distribution.
I'd like to estimate the mean with a high confidence: up to 1% error with a 95% confidence.
As I collect samples, I start to get a better idea of the mean & stddev, but but how do I know when to stop?

A: If you want the width of your confidence interval to have length no larger than 1 (0.5 on each side) then let's do some simple math.
The radius of a confidence interval, as a function of the sample size, is
$$ \dfrac{1.96 \cdot \sigma}{\sqrt{n}}$$
I'm using the z-statistic here instead of a t-statistic because in the limit, the two are equivalent (I'm also assuming you will need enough so that the difference between the two is negligible).  We want this to be smaller than 1, so
$$ \dfrac{1.96 \cdot \sigma}{\sqrt{n}} \leq 0.5 \implies (2 \cdot 1.96)^2 \sigma^2 \approx 16 \times \sigma^2 \leq n $$
So a good rule of thumb is that you will need a sample size 16 times larger than the variance of your data in order to get a confidence interval with length 1 (0.5 on each side).  This isn't a guarantee, but just a rule of thumb.
Here is a little plot of a simulation I performed. I construct 10 confidence intervals for varying levels of $\sigma$ and compute their lengths.  I use the exact calculation ($n = (2 \cdot 1.96)^2 \sigma^2$ rather than the rule of thumb, which will result in smaller confidence intervals since $16>(2 \cdot 1.96)^2$).  When the noise is small, our computation results in fewer samples, meaning the difference between using a z and t stat becomes important.  As more noise is added, that difference becomes negligible.

If you want the width of the confidence interval to be some percent of the mean (e.g. the width of the confidence interval should be no larger than 1% of the estimate of the mean) then just replace $0.5$ with $0.005 \hat{\mu}$, where $\hat{\mu}$ is the estimate of the mean from the data.


text:
Q: GPS finding neighboring roads So I'm building a GPS application. I have a collection of Road objects each containing a start and end point (plus other in-between points where the road curves). I've implemented dijkstra's algorithm for finding the shortest path (where roads are nodes in the graph) but before I can run it I need to determine which roads neighbor (connect to) one another so to create edges.
The easy(?) way would be to iterate through each road and in a nested loop see if any other roads too start/end at the same point. But this seems inefficient being O(N^2). One idea was to pre segregate roads into regions (i.e. in the UK there'd  be NW, NE, E, SE, SW etc...) then only look for neighbors in the same region reducing the search space.
Looking for advice from more experience programmers, how would you tackle the problem?
This is not a homework, having recently graduated I am working on this as a pet project to gain some practical experience and pad out the CV a bit.
Edit: I should add roads only ever connect at start/end points

A: You could sort all the (x,y) points you have, by x first and then by y. For n points this should be O(nlogn) or even linear if you use radix sort. Then you just need to go through the list; whenever two adjacent entries are equal, their corresponding roads intersect.


text:
Q: illegal character in firefox when passing hex colour into a function I have a function call and I am trying to pass a hex color (#000000) to a function but I keep getting an illegal character call in firebug and the function is failing.
I am assuming it is the '#' at the beginning of the colour thats causing this.
should I :
a, escape the hash
b, just pass the colour code minus the hash
the problem I have with each is
a, when I try to escape I am having an issue as the colour is a substring of a variable and the escape character makes the substring call not work
var linecolor="\"+content.substr(content.search("#"),7);

b, when I pass just '000000' to the function, it is received as just '0'
any ideas?

A: Try
var linecolor = new String(content.substr((content.search("#")+1),(content.search("#")+7));
function showColor(linecolor){
alert(" content="+linecolor);
}
showColor(linecolor);

A: Are you trying something like this?
var content = "#222222"

function showColor(content){
 alert(" content="+content);
}

showColor(content);


text:
Q: Jquery check required field before submission I have a form with a hyper link for submission. What I would like to achieve is that jquery could check all required fields then execute my logic. If any of the required fields is empty jquery should simply do what browser's default behavior does. But my implementation below is only able to pop up an alert window. Please help me improve.
if($("#required_field_1")[0].checkValidity() == false ||
   $("#required_filed_2")[0].checkValidity() == false) {
   alert("Please fill all required field");
}
else {
  $('#form_1').ajaxForm({
    delegation: true,
    beforeSend: myFunc1,
    success:    myFunc2,
    data:       {"op": op,
                 "payslip_date_start": $("#payslip_date_start").val(),
                 "payslip_date_end": $("payslip_date_end").val()}
  });
  $('#form_1').submit();
}

A: The only way to do that is by submitting the form, like this and be sure you added the required attribute
var $myForm = $('form#myForm')
if (!$myForm[0].checkValidity()) {
  // If the form is invalid, submit it. The form won't actually submit;
  // this will just cause the browser to display the native HTML5 error messages.
  $myForm.find(':submit').click()
}

You can found more here: https://stackoverflow.com/a/11867013/3914736


text:
Q: How to define the function type with an existing type in a more readable way? With a very simple and readable function like:
function signIn(...) {...}

To define its type with an existing definition Action, it becomes something that's not very readable:
const signIn: Action = function (...) {...}

That is a lot of changes, and not very readable, just to specify that the function is of the Action type.
I wonder if there's any way to not use the const and to keep signIn next to function? I realise I can copy the existing type definition Action and apply it directly to the function, but it's not good for maintainability – what if the original Action definition changes?

A: So you have a function type like this:
type MyFunc = (x: string, y: number) => boolean;

but which can't be used as an annotation for a general function declaration:
// where to annotate?
function myFunc(x: string, y: number) {
    return x.length > y;
}

It would be nice if you could annotate the function above somehow, like the following hypothetical syntax (which currently doesn't work):
// do not do this, it doesn't work:
function myFunc: MyFunc (x, y) {
    return x.length > y;
}

Sadly this is not currently supported in TypeScript. There is, however, an open suggestion for this feature: microsoft/TypeScript#22063. It doesn't look like there's been any movement on that issue, but if you head over there and give it a  you might very slightly increase the chance of it being implemented.  Or, if your use case is particularly compelling and not already mentioned, you might make a comment there describing it.  Realistically this might never make it into the language.

So what are the workarounds?  The obvious one and the best one is to change your declared function into a declared const of a function type, as you've already done:
const myFunc: MyFunc = function (x, y) {
  return x.length > y;
}

You could opt to use the built-in utility types Parameters<T> and ReturnType<T> to convert the annotation of the function itself into annotation of the arguments and return type, but it's so hideous that I can't imagine anyone would prefer this to the previous version:
function myFunc(...[x, y]: Parameters<MyFunc>): ReturnType<MyFunc> {
    return x.length > y;
}

Another possibility is to try using the type system to verify that your declared function is assignable to the MyFunc type in a separate line.  If you have a helper type called Extends:
type Extends<T, U extends T> = void;

then you can do this:
type MyFuncWorks = Extends<MyFunc, typeof myFunc>; // okay
function myFunc(x: string, y: number) {
    return x.length > y;
}

and you'd see an error if you changed myFunc to something incompatible:
type MyFuncBroken = Extends<MyFunc, typeof myFunc>; // error!
// number is not boolean ---------> ~~~~~~~~~~~~~
function myFunc(x: string, y: number) {
    return x.length + y; // + instead of <, oops
}

The least ugly workaround is still the function-typed const, so if I were you, I'd go with that.

Okay, hope that helps; good luck!
Playground link to code


text:
Q: How to pass c# type Guid type variable from ajax call parameters I've post method in my controller, it has Guid Type parameter as shown below
  [HttpPost]
    public ActionResult SaveDiscussion(Guid guid, string Title)
    {
        try
        {
           // some logics here
            return Json(new { success = true, message = "success" }, JsonRequestBehavior.AllowGet);
        }
        catch (Exception e)
        {
            return Json(new { success = false, message = e }, JsonRequestBehavior.AllowGet);
        }
    }

this is my ajax call
    $.ajax({
        url: '/Base/SaveDiscussion',
        data: {  guid: $("#DiscussionItemTempId").val(), Title: $(".discussionBox").val() },
        type: "post",
        success: function (response) {
           // some code here
        },
    });

I'm getting this exception as shown below in screenshot.
I think it's something wrong with Guid type parameter in controller

This is network tab status:

i've added debugger on my controller, its not hitting my controller so there is nothing wrong code inside my controller method, that's why i've not shown it

A: Simply sending GUID as string works, since controller with a GUID param parses it automatically
data: {
    appID: '@Model.ID'
},

with 'ID' being a GUID type in the model


text:
Q: Porque este metodo não esta somando? Estou tentando somar dois números pelo Swing e JOptionPane, mas está aparecendo o erro abaixo.
Alguém para me ajudar como resolver isso ?

Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: JOptionPane: parentComponent does not have a valid parent
    at javax.swing.JOptionPane.createInternalFrame(JOptionPane.java:1510)
    at javax.swing.JOptionPane.showInternalOptionDialog(JOptionPane.java:1286)
    at javax.swing.JOptionPane.showInternalMessageDialog(JOptionPane.java:1099)
    at javax.swing.JOptionPane.showInternalMessageDialog(JOptionPane.java:1073)
    at javax.swing.JOptionPane.showInternalMessageDialog(JOptionPane.java:1047)
    at DAO.Soma.somarNumeros(Soma.java:15)  at GUI.TesteMiniFrame.B_SomarActionPerformed(TesteMiniFrame.java:119)
    at GUI.TesteMiniFrame.access$000(TesteMiniFrame.java:6)
    at GUI.TesteMiniFrame$1.actionPerformed(TesteMiniFrame.java:33)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2346)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
    at java.awt.Component.processMouseEvent(Component.java:6525)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
    at java.awt.Component.processEvent(Component.java:6290)
    at java.awt.Container.processEvent(Container.java:2234)
    at java.awt.Component.dispatchEventImpl(Component.java:4881)
    at java.awt.Container.dispatchEventImpl(Container.java:2292)
    at java.awt.Component.dispatchEvent(Component.java:4703)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4533)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462)
    at java.awt.Container.dispatchEventImpl(Container.java:2278)
    at java.awt.Window.dispatchEventImpl(Window.java:2750)  at

Segue a classe Soma
import javax.swing.JOptionPane;

public class Soma {
    public int somarNumeros(int numero1,int numero2){
        int resultado = numero1 + numero2;
        JOptionPane.showInternalMessageDialog(null, resultado);
        return 0;
    }
}

Segue a classe TesteJInternalFrame
import javax.swing.JOptionPane;

public class TesteJInternalFrame extends javax.swing.JInternalFrame {

    Soma somar;

    public TesteJInternalFrame(){
        initComponents();
        somar = new Soma();
    }

    private void B_SomarActionPerformed(java.awt.event.ActionEvent evt) {
        int num1,num2,res;
        num1 = Integer.parseInt(TF_Valor1.getText());
        num2 = Integer.parseInt(TF_Valor2.getText());
        res = Integer.parseInt(TF_Resultado.getText());
        TF_Resultado.setText(String.valueOf(res));
        JOptionPane.showMessageDialog(null, somar.somarNumeros(num1,num2));
        //B_Somar.setText(String.valueOf());
        //JOptionPane.showInputDialog(null,s);

    }

    private void TF_Valor1ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
    }

    private void TF_Valor2ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
    }

    // Variables declaration - do not modify
    private javax.swing.JButton B_Somar;
    private javax.swing.JTextField TF_Resultado;
    private javax.swing.JTextField TF_Valor1;
    private javax.swing.JTextField TF_Valor2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    // End of variables declaration
}

A: A chamada JOptionPane.showInternalMessageDialog(); foi feita para ser usada quando você possui um JDesktopPane ou JInternalFrame, e no seu caso, não está sendo chamado de nenhum frame interno, apenas está passando null.
Substitua por JOptionPane.showMessageDialog(null, resultado); que resolverá o erro.

Analisando melhor seu código, pude ver que existe a possibilidade de utilizar o showInternalMessageDialog(), uma vez que sua classe principal herda de JInternalFrame. Apesar do método já sugerido acima funcionar, pelo fato de JOptionPane ser uma janela modal, ele trava o acesso as outras janelas até que seja fechado, e se o alerta for apenas para os Frames internos, este comportamento pode não ser o desejável.
Como alternativa ao método acima, sugiro que você altere sua classe Soma conforme abaixo:
import javax.swing.JOptionPane;

public class Soma {
    public int somarNumeros(int numero1,int numero2){
        int resultado = numero1 + numero2;
        JOptionPane.showInternalMessageDialog(this, resultado);
        return resultado;
    }
}

E depois, apenas altere a linha onde você exibe o resultado, dentro do JInternalFrame, no método B_SomarActionPerformed. Ficaria assim:
import javax.swing.JOptionPane;

public class TesteJInternalFrame extends javax.swing.JInternalFrame {

    Soma somar;

    public TesteJInternalFrame(){
        initComponents();
        somar = new Soma();
    }

    private void B_SomarActionPerformed(java.awt.event.ActionEvent evt) {
        int num1,num2,res;
        num1 = Integer.parseInt(TF_Valor1.getText());
        num2 = Integer.parseInt(TF_Valor2.getText());
        res = Integer.parseInt(TF_Resultado.getText());
        TF_Resultado.setText(String.valueOf(res));

        JOptionPane.showInternalMessageDialog(this, somar.somarNumeros(num1,num2));
        //B_Somar.setText(String.valueOf());
        //JOptionPane.showInputDialog(null,s);

    }

    private void TF_Valor1ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
    }

    private void TF_Valor2ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
    }

    // Variables declaration - do not modify
    private javax.swing.JButton B_Somar;
    private javax.swing.JTextField TF_Resultado;
    private javax.swing.JTextField TF_Valor1;
    private javax.swing.JTextField TF_Valor2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    // End of variables declaration
}

O método showInternalMessageDialog, assim como a maioria dos métodos de JOptionPane, espera como um de seus parâmetros um container parente, se for passado null, ele vai buscar o container principal da aplicação, no caso, um JFrame, mas este método em especial espera que o container seja um JInternalFrame ou JDesktopPane, por isso estoura o erro informado. Passando o this da forma que fiz, estou referenciado a própria classe TesteJInternalFrame como parente, dessa forma o JOptionPane funcionará normalmente, sem travar toda a janela da aplicação, apenas os frames internos.


text:
Q: How to create a new variable using old variable and assiging it some value in groovy I am trying to create a new variable using the name of old variable (appending old variable with some string) and assign that new variable with some value as in example below in jenkinsfile using groovy:
def var1= "value1"
def var1 + "_someval"= 50  // creating a new variable which will have name value1_someval and it will have value 50
print( "value for value1_someval  is" + value1_someval)
// expected output is that new  variable value1_someval is created with value 50 assigned to it.

A: Whatyou want to do is possible, but it's messy and can cause problems. I strongly suggest that you use a list instead:
List li = []
li[0] = "value1"
li[1] = 50

A: I got this working by using quoted identifies in following way:
def map = [:]
def lastchar = "_someval"

map."val1${lastchar}" = 50

//assert map.'val1_someval' == 50

print map.VA_REPOSITORY_VERSION

prints out 50 as output


text:
Q: Why does an analytic function $z^2$, which satisfies the Cauchy-Riemann equations, not satisfy the condition of being harmonic? Why does an analytic function $z^2$, which satisfies the Cauchy-Riemann equations, not satisfy the condition of being harmonic?
We have $u = x^2-y^2$ and $v = 2xy$
\begin{align}
du/dx &= 2x, &du/dy &= -2y\\
dv/dx &= 2y, &dy/dy &= 2x
\end{align}
Which satisfies the condition such that $du/dx = dv/dy$ and $dv/dy = -dv/dx$.
I am asked to prove that $u$ and $v$ are each harmonic functions of $x$ and $y$.
but when I take the second derivative $d^2u/dx^2 = 2$, $d^2u/dy^2 = -2$, which both when added together equal to zero. So $u$ is harmonic.
BUT v is not because $dv^2/dy^2 = 2$ and $dv^2/dx^2$ is 2, which when added together are not equal to 0.
An analytic function should satisfy these conditions and I seem to do it right.
Any hints?
I am asked to prove that u and v are each harmonic functions of x and y.