问:
VBScript return value in string
I am working with a product that uses VBScript extensively and I need to parse a string to extract specific data.  I know how to do this with other languages, but need to be pointed in the right direction with VBScript please.

Here's the string I am reading from a text file.

```<code><PGConfiguration GPOName="Production Policy" GPODisplayName="Production Policy" GPOVersion="0" />
</code>```

The value between GPOName="I_NEED_THIS_DATA" needs to be pulled. It is not expected to be the same between instances.

I have a script that uses InStr() to make sure GPOName= exists and gives me the character position.  I've been able to use that with Mid() to start after the GPOName=".  I don't know how to find the count or position to the closing quote.

Am I going down the right path with InStr() and Mid(), or is there a better way to approach this (regex maybe??)

This code will open the file, read in the contents and pop up a box with the first 10 characters of what I am trying to get to.  Where do I go from here?

Thanks!

```<code>Dim objFSO, objTextFile, Stream, strSearchFor, strFileName, strLine, strPosition
' the file to check
strFileName = "C:\checkme.txt"
' what are we looking for
strSearchFor = "GPOName="

' create the object and open the file
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set Stream = objFSO.OpenTextFile(strFileName, 1, False)
Set objTextFile = objFSO.OpenTextFile(strFileName, 1, 0)

' read the first line with my data on it
strLine = objTextFile.ReadLine()
' do an InStr to get the position of the data
strPosition = InStr(strLine, strSearchFor)
' set the offset to 9 to get to the end of the ="
strPosition = strPosition + 9
' print of the first 10 characters after the GPOName=" match
wscript.Echo Mid(strLine,strPosition,10)
</code>```

答:
In addition to the answer provided by Mithilesh, If you want to use Regex, you can try the following:

```<code>Dim objFSO, objTextFile, strFileName, strTemp, objReg, objMatches
' the file to check
strFileName = "C:\checkme.txt"

' create the object and open the file
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile(strFileName, 1, False)

'Read all the data, store in a variable and close the file
strTemp = objTextFile.ReadAll()
objTextFile.Close

'Regex code
Set objReg = New RegExp
objReg.Global=True
objReg.Pattern = "(?:GPOName="")([^""]+)(?="")"     'In vbscript, if we want to have a double quote inside a string, it has to be preceded with another double quote to escape it. If just one double-quote is used, it may indicate end or start of a new string.
If objReg.Test(str) Then
    Set objMatches = objReg.Execute(str)
    objMatches.Item(0).Submatches.Item(0)           'Returns the 1st match; To get all the matches run the loop to objMatches.Count
End If
Set objReg = Nothing
Set objFso = Nothing
</code>```

REGEX DEMO

Regex explanation: (?:GPOName=")([^"]+?)(?=")

( - Starts a Group

?: - makes the current group a non-capturing group

GPOName=" - Finds the substring - GPOName"

) - Non-Capturing group ends

( - Starts a group which we want to capture. Notice that it is not
  followed by ?:

[^"] - matches a character which is NOT a double quote

+ - repeats the preceding token 1 or more times greedily(as many times as possible i.e, as long as there is a match)

) - Capturing Group Ends

(?=") - Positive Lookahead. It means that a double quote must follow
  the preceding string matched/returned by our capturing group. The
  double quote will not be the part of the match

For learning the Regular expression basics, refer THIS

Title: VBScript return value in string

Body:
I am working with a product that uses VBScript extensively and I need to parse a string to extract specific data.  I know how to do this with other languages, but need to be pointed in the right direction with VBScript please.

Here's the string I am reading from a text file.

<PGConfiguration GPOName="Production Policy" GPODisplayName="Production Policy" GPOVersion="0" />

The value between GPOName="I_NEED_THIS_DATA" needs to be pulled. It is not expected to be the same between instances.

I have a script that uses InStr() to make sure GPOName= exists and gives me the character position.  I've been able to use that with Mid() to start after the GPOName=".  I don't know how to find the count or position to the closing quote.

Am I going down the right path with InStr() and Mid(), or is there a better way to approach this (regex maybe??)

This code will open the file, read in the contents and pop up a box with the first 10 characters of what I am trying to get to.  Where do I go from here?

Thanks!

Dim objFSO, objTextFile, Stream, strSearchFor, strFileName, strLine, strPosition
' the file to check
strFileName = "C:\checkme.txt"
' what are we looking for
strSearchFor = "GPOName="

' create the object and open the file
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set Stream = objFSO.OpenTextFile(strFileName, 1, False)
Set objTextFile = objFSO.OpenTextFile(strFileName, 1, 0)

' read the first line with my data on it
strLine = objTextFile.ReadLine()
' do an InStr to get the position of the data
strPosition = InStr(strLine, strSearchFor)
' set the offset to 9 to get to the end of the ="
strPosition = strPosition + 9
' print of the first 10 characters after the GPOName=" match
wscript.Echo Mid(strLine,strPosition,10)

Body:
In addition to the answer provided by Mithilesh, If you want to use Regex, you can try the following:

Dim objFSO, objTextFile, strFileName, strTemp, objReg, objMatches
' the file to check
strFileName = "C:\checkme.txt"

' create the object and open the file
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile(strFileName, 1, False)

'Read all the data, store in a variable and close the file
strTemp = objTextFile.ReadAll()
objTextFile.Close

'Regex code
Set objReg = New RegExp
objReg.Global=True
objReg.Pattern = "(?:GPOName="")([^""]+)(?="")"     'In vbscript, if we want to have a double quote inside a string, it has to be preceded with another double quote to escape it. If just one double-quote is used, it may indicate end or start of a new string.
If objReg.Test(str) Then
    Set objMatches = objReg.Execute(str)
    objMatches.Item(0).Submatches.Item(0)           'Returns the 1st match; To get all the matches run the loop to objMatches.Count
End If
Set objReg = Nothing
Set objFso = Nothing

REGEX DEMO

Regex explanation: (?:GPOName=")([^"]+?)(?=")

( - Starts a Group

?: - makes the current group a non-capturing group

GPOName=" - Finds the substring - GPOName"

) - Non-Capturing group ends

( - Starts a group which we want to capture. Notice that it is not
  followed by ?:

[^"] - matches a character which is NOT a double quote

+ - repeats the preceding token 1 or more times greedily(as many times as possible i.e, as long as there is a match)

) - Capturing Group Ends

(?=") - Positive Lookahead. It means that a double quote must follow
  the preceding string matched/returned by our capturing group. The
  double quote will not be the part of the match

For learning the Regular expression basics, refer THIS


来源: stackexchange

问:
Mysql Search for a word/sentence that has extra characteres at the end PHP
Currently I have a query that searchs for sentences/words, it works almost as expected,

I have a regex expresion that searches for names in a table, expample:

```<code>function getNames($str){
    $stmt = "SELECT * FROM users WHERE name = :name
                                    OR name REGEXP :reg1
                                    OR name REGEXP :reg2
                                    OR name LIKE :lik1";
    $query = self::$connection->prepare($stmt);
    $query->execute(array(":name"=>$str,
                          ":reg1"=>"^$str" . "[a-zA-Z\s]*$",
                          ":reg2"=>"^[a-zA-Z]*[\s]*[$str][a-zA-Z]"
                          ":lik1"=>"%" . $str . "%"
    ));
   return $query->fetchAll(PDO::FETCH_ASSOC);
}
</code>```

Let's suppose my table contains the following values

Bob

Peter

Mark

David

John

If I run my query with Bob as $name value it gets it but I would like to be able to find Bob when I run the query using BobsomeLettersExtra or Bob something as $name value
Is there a way to do this using REGEXP or LIKE ?

答:
```<code>SELECT * FROM users WHERE  name LIKE '%".$name."%'
</code>```

above query should be enough to get the result. You should validate data before you enter data to the table if not please use the regex as well

```<code>"SELECT * FROM users WHERE name LIKE '%".$name."%' AND REGEXP ^".$name."[a-zA-Z]*$"
</code>```

UPDATE

sorry if i have misunderstand the question please try this

```<code>"Select * from users  WHERE '".$name."' LIKE CONCAT(name , '%')"
</code>```

ContentLicense: CC BY-SA 3.0

Body:
Currently I have a query that searchs for sentences/words, it works almost as expected,

I have a regex expresion that searches for names in a table, expample:

function getNames($str){
    $stmt = "SELECT * FROM users WHERE name = :name
                                    OR name REGEXP :reg1
                                    OR name REGEXP :reg2
                                    OR name LIKE :lik1";
    $query = self::$connection->prepare($stmt);
    $query->execute(array(":name"=>$str,
                          ":reg1"=>"^$str" . "[a-zA-Z\s]*$",
                          ":reg2"=>"^[a-zA-Z]*[\s]*[$str][a-zA-Z]"
                          ":lik1"=>"%" . $str . "%"
    ));
   return $query->fetchAll(PDO::FETCH_ASSOC);
}

Let's suppose my table contains the following values

Bob

Peter

Mark

David

John

If I run my query with Bob as $name value it gets it but I would like to be able to find Bob when I run the query using BobsomeLettersExtra or Bob something as $name value
Is there a way to do this using REGEXP or LIKE ?

Body:
SELECT * FROM users WHERE  name LIKE '%".$name."%'

above query should be enough to get the result. You should validate data before you enter data to the table if not please use the regex as well

"SELECT * FROM users WHERE name LIKE '%".$name."%' AND REGEXP ^".$name."[a-zA-Z]*$"

UPDATE

sorry if i have misunderstand the question please try this

"Select * from users  WHERE '".$name."' LIKE CONCAT(name , '%')"


问:
jQuery Value Help
I'm having problems getting the value of the input field.

```<code>function Send(id){
var send_to=$("#id").val();
$.post("send.php", { id:id }, function(data) { if(data==="OK"){  } else { } });
}
</code>```

Below is an example of the page.

```<code><input type=text id=4543><button onclick=Send(4543);>SEND</button>
<input type=text id=8643><button onclick=Send(8643);>SEND</button>
<input type=text id=8645><button onclick=Send(8645);>SEND</button>
<input type=text id=2421><button onclick=Send(2421);>SEND</button>
</code>```

I need to get the value of the input control whose id is passed to the send method.

Thank you! :)

答:
First of all your id's are invalid(not in HTML5).

Also bind the handler in document ready function

```<code><input type=text id="txt4543"><button class="btn">SEND</button>
<input type=text id="txt8643"><button class="btn">SEND</button>
<input type=text id="txt8645"><button class="btn">SEND</button>
<input type=text id="txt2421"><button class="btn">SEND</button>

$(function(){
    $(".btn").click(function(){
        var txtElem = $(this).prev();
        var value = txtElem.val();
        $.post("send.php", { id:txtElem.attr("id") }, function(data) { if(data==="OK"){  } else { } });
    });
});
</code>```

ContentLicense: CC BY-SA 2.5

Title: jQuery Value Help

Body:
I'm having problems getting the value of the input field.

function Send(id){
var send_to=$("#id").val();
$.post("send.php", { id:id }, function(data) { if(data==="OK"){  } else { } });
}

Below is an example of the page.

<input type=text id=4543><button onclick=Send(4543);>SEND</button>
<input type=text id=8643><button onclick=Send(8643);>SEND</button>
<input type=text id=8645><button onclick=Send(8645);>SEND</button>
<input type=text id=2421><button onclick=Send(2421);>SEND</button>

I need to get the value of the input control whose id is passed to the send method.

Thank you! :)

Body:
First of all your id's are invalid(not in HTML5).

Also bind the handler in document ready function

<input type=text id="txt4543"><button class="btn">SEND</button>
<input type=text id="txt8643"><button class="btn">SEND</button>
<input type=text id="txt8645"><button class="btn">SEND</button>
<input type=text id="txt2421"><button class="btn">SEND</button>

$(function(){
    $(".btn").click(function(){
        var txtElem = $(this).prev();
        var value = txtElem.val();
        $.post("send.php", { id:txtElem.attr("id") }, function(data) { if(data==="OK"){  } else { } });
    });
});


问:
Sentence segmentation and dependency parser
I’m pretty new to python (using python 3) and spacy (and programming too). Please bear with me.

I have three questions where two are more or less the same I just can’t get it to work.
I took the “syntax specific search with spacy” (example) and tried to make different things work.

My program currently reads txt and the normal extraction

```<code>if w.lower_ != 'music':
return False
</code>```

works.

My first question is: How can I get spacy to extract two words?
For example: “classical music”
With the previous mentioned snippet I can make it extract either classical or music. But if I only search for one of the words I also get results I don’t want like.

Classical – period / era

Or when I look for only music

Music – baroque, modern

The second question is: How can I get the dependencies to work?

The example dependency with:

```<code>elif w.dep_ != 'nsubj': # Is it the subject of a verb?
return False
</code>```

works fine. But everything else I tried does not really work.

For example, I want to extract sentences with the word “birthday” and the dependency ‘DATE’. (so the dependency is an entity)

I got

```<code>if d.ent_type_ != ‘DATE’:
return False
</code>```

To work.

So now it would look like:

```<code>def extract_information(w,d):
if w.lower_ != ‘birthday’:
return False
elif d.ent_type_ != ‘DATE’:
return False
else:
return True
</code>```

Does something like this even work?

If it works the third question would be how I can filter sentences for example with a DATE. So If the sentence contains a certain word and a DATE exclude it.

Last thing maybe, I read somewhere that the dependencies are based on the “Stanford typed dependencies manual”. Is there a list which of those dependencies work with spacy?

Thank you for your patience and help :)

答:
Before I get into offering some simple suggestions to your questions, have you tried using displaCy's visualiser on some of your sentences?

Using an example sentence 'John's birthday was yesterday', you'll find that within the parsed sentence, birthday and yesterday are not necessarily direct dependencies of one another. So searching based on the birthday word having a dependency of a DATE type entity, might not be yield the best of results.

Onto the first question:
A brute force method would be to look for matching subsequent words after you have parsed the sentence.

```<code>doc = nlp(u'Mary enjoys classical music.')

for (i,token) in enumerate(doc):
    if (token.lower_ == 'classical') and (i != len(doc)-1):
        if doc[i+1].lower_ == 'music':
            print 'Target Acquired!'
</code>```

If you're unsure of what enumerate does, look it up. It's the pythonic way of using python.

To questions 2 and 3, one simple (but not elegant) way of solving this is to just identify in a parsed sentence if the word 'birthday' exists and if it contains an entity of type 'DATE'.

```<code>doc = nlp(u'John\'s birthday was yesterday.')

for token in doc:
    if token.lower_ == 'birthday':
        for entities in doc.ents:
            if entities.label_ == 'DATE':
                print 'Found ya!'
</code>```

As for the list of dependencies, I presume you're referring to the Part-Of-Speech tags. Check out the documentation on this page.

Good luck! Hope that helped.

Body:
I’m pretty new to python (using python 3) and spacy (and programming too). Please bear with me.

I have three questions where two are more or less the same I just can’t get it to work.
I took the “syntax specific search with spacy” (example) and tried to make different things work.

My program currently reads txt and the normal extraction

if w.lower_ != 'music':
return False

works.

My first question is: How can I get spacy to extract two words?
For example: “classical music”
With the previous mentioned snippet I can make it extract either classical or music. But if I only search for one of the words I also get results I don’t want like.

Classical – period / era

Or when I look for only music

Music – baroque, modern

The second question is: How can I get the dependencies to work?

The example dependency with:

elif w.dep_ != 'nsubj': # Is it the subject of a verb?
return False

works fine. But everything else I tried does not really work.

For example, I want to extract sentences with the word “birthday” and the dependency ‘DATE’. (so the dependency is an entity)

I got

if d.ent_type_ != ‘DATE’:
return False

To work.

So now it would look like:

def extract_information(w,d):
if w.lower_ != ‘birthday’:
return False
elif d.ent_type_ != ‘DATE’:
return False
else:
return True

Does something like this even work?

If it works the third question would be how I can filter sentences for example with a DATE. So If the sentence contains a certain word and a DATE exclude it.

Last thing maybe, I read somewhere that the dependencies are based on the “Stanford typed dependencies manual”. Is there a list which of those dependencies work with spacy?

Thank you for your patience and help :)

Body:
Before I get into offering some simple suggestions to your questions, have you tried using displaCy's visualiser on some of your sentences?

Using an example sentence 'John's birthday was yesterday', you'll find that within the parsed sentence, birthday and yesterday are not necessarily direct dependencies of one another. So searching based on the birthday word having a dependency of a DATE type entity, might not be yield the best of results.

Onto the first question:
A brute force method would be to look for matching subsequent words after you have parsed the sentence.

doc = nlp(u'Mary enjoys classical music.')

for (i,token) in enumerate(doc):
    if (token.lower_ == 'classical') and (i != len(doc)-1):
        if doc[i+1].lower_ == 'music':
            print 'Target Acquired!'

If you're unsure of what enumerate does, look it up. It's the pythonic way of using python.

To questions 2 and 3, one simple (but not elegant) way of solving this is to just identify in a parsed sentence if the word 'birthday' exists and if it contains an entity of type 'DATE'.

doc = nlp(u'John\'s birthday was yesterday.')

for token in doc:
    if token.lower_ == 'birthday':
        for entities in doc.ents:
            if entities.label_ == 'DATE':
                print 'Found ya!'

As for the list of dependencies, I presume you're referring to the Part-Of-Speech tags. Check out the documentation on this page.

Good luck! Hope that helped.


问:
Angular $uibmodal close and submit
Hello I'm new to angularjs and am exploring the functionality of $uibmodal.  I was able to get $uibmodal.open to operate, but with an error that is occuring that I don't understand.  My $uibmodal.close is not functioning at the moment and when I use $uibmodal.submit, instead of adding on to my current array it resets the page.  If anyone can give me a tip to get proper functionality that would be great.  Thanks.
Here is my Github repository</p>

答:
You can also try with this</p>

```<code>    modalInstance.close('resetModel');
</code>```

Title: Angular $uibmodal close and submit

Body:
You can also try with this

    modalInstance.close('resetModel');


问:
operators precedence in C
have a trouble understanding this expression:

```<code>(x + y - 1) / y * y
</code>```

The operators precedence is as follows (as per my understanding and K&R2, 2.12 table 2.1):

1) evaluate what is in the parens: firstly (x+y), then (x+y) -1

2) '*' operator has higher priority then '/' so it's supposed to go first, bit it appears  that (y * y)  is evaluated and then the result of (x+y-1) is divided by the product (y*y). I don't quite get it.

3) I ever heard that normally rounding up iw written in this form:

```<code>(x + y - 1) / y * y
</code>```

Is that correct? Thank you very much in advance!

答:
I may be wrong, but as far as I recall / and * have same precedence. So the result should be (x+y+1).

Maybe you should say (x+y+1)/(y*y) if that's what you want the result to be.

It never costs much to disambiguate in any case.

As to using ((x+y-1)/y)*y to round up or down as the case may be, this is a dubious and not very portable practice. Several reasons: 1/ you must know or remember that y is some sort of int, 2/ x must also be some sort of int, 3/ results may vary depending on the compiler.

Title: operators precedence in C

Body:
have a trouble understanding this expression:

(x + y - 1) / y * y

The operators precedence is as follows (as per my understanding and K&R2, 2.12 table 2.1):

1) evaluate what is in the parens: firstly (x+y), then (x+y) -1

2) '*' operator has higher priority then '/' so it's supposed to go first, bit it appears  that (y * y)  is evaluated and then the result of (x+y-1) is divided by the product (y*y). I don't quite get it.

3) I ever heard that normally rounding up iw written in this form:

(x + y - 1) / y * y

Is that correct? Thank you very much in advance!


问:
How to reload the webpage when orientation changes?
I'm trying to trigger an event with jQuery mobile that automatically reloads the page when the device's orientation changes. I have media queries written with max-device-width, orientation:landscape, and orientation: portrait. Since the <video> wont scale properly...the only solution I can think of is to refresh the page to the correct media query with the device is rotated.

How do I go about doing this? Thanks.

答:
Please try the following code to redirect the page on orientation event, its work well for me

```<code>if (window.DeviceOrientationEvent) {
    window.addEventListener('orientationchange', function() { location.reload(); }, false);
}
</code>```

Thanks

Body:
Please try the following code to redirect the page on orientation event, its work well for me

if (window.DeviceOrientationEvent) {
    window.addEventListener('orientationchange', function() { location.reload(); }, false);
}

Thanks


问:
Include file in textarea and make style of text
I have a textarea in which I including outside .php file which contain text.

```<code><textarea class="form-control" rows="15" id="terms" value="" disabled><?php include 'outsidefile.php'; ?></textarea>
</code>```

The text is appear on textarea perfectly. The file content is

```<code><?php
     echo 'Some text';
?>
</code>```

Now i want to make style for this Some text for example

```<code><?php
     echo '<p style="font-size: 46px;text-align: center;">Some text</p>';
?>
</code>```

But when I load the page I see exactly this
Some text
 instead of text with size 46px and centered.

How can I do this?

答: You can't add HTML to textarea values. They are simply an input type, and anything between the <textarea> tags are considered a string, and not parsed as HTML. See this post for making a div editable.

Body:
I have a textarea in which I including outside .php file which contain text.

<textarea class="form-control" rows="15" id="terms" value="" disabled><?php include 'outsidefile.php'; ?></textarea>

The text is appear on textarea perfectly. The file content is

<?php
     echo 'Some text';
?>

Now i want to make style for this Some text for example

<?php
     echo '
Some text
';
?>

But when I load the page I see exactly this
Some text
 instead of text with size 46px and centered.

How can I do this?


问:
How to read MS 97-2003 Worksheet through Selenium Webdriver?
Am trying to read the .xls file(MS 97-20003 Worksheet) that is downloaded from our application through selenium webdriver. But am getting the following error:

"org.apache.poi.poifs.filesystem.NotOLE2FileException: The supplied data appears to be a raw XML file. Formats such as Office 2003 XML are not supported"

And when I open it manually , am getting the following message :

"The file you are trying to open, 'ReportXX' is in a different format than specified by the file extension.verify that the file is not corrupted and is from a trusted source.....'.

By clicking on 'Yes' am able to open it and verify the content.

Please see the below code and let me know how can I resolve it. Thanks in Advance!!

```<code>InputStream ExcelFileToRead = null;
    Workbook   wb = null;
    File file = new File("C:\\Users\\abcdef\\Downloads\\Report.xls");

    if (file.exists()) {

        ExcelFileToRead = new FileInputStream(file);

        wb = new HSSFWorkbook(ExcelFileToRead);
        System.out.println(wb.getNumberOfSheets());

        for (int i = 0; i < wb.getNumberOfSheets(); i++) {

            System.out.println("Sheet name: " + wb.getSheetName(i));
            Sheet sh = wb.getSheetAt(i);
}
</code>```

答:
You can us the .jar file of JXL.jar which is more suitable for reading the .xls file of Microsoft excel sheet
The POI.jar which you are using is more supportive for the .xlsx format just try this.</p>

Body:
Am trying to read the .xls file(MS 97-20003 Worksheet) that is downloaded from our application through selenium webdriver. But am getting the following error:

"org.apache.poi.poifs.filesystem.NotOLE2FileException: The supplied data appears to be a raw XML file. Formats such as Office 2003 XML are not supported"

And when I open it manually , am getting the following message :

"The file you are trying to open, 'ReportXX' is in a different format than specified by the file extension.verify that the file is not corrupted and is from a trusted source.....'.

By clicking on 'Yes' am able to open it and verify the content.

Please see the below code and let me know how can I resolve it. Thanks in Advance!!

InputStream ExcelFileToRead = null;
    Workbook   wb = null;
    File file = new File("C:\\Users\\abcdef\\Downloads\\Report.xls");

    if (file.exists()) {

        ExcelFileToRead = new FileInputStream(file);

        wb = new HSSFWorkbook(ExcelFileToRead);
        System.out.println(wb.getNumberOfSheets());

        for (int i = 0; i < wb.getNumberOfSheets(); i++) {

            System.out.println("Sheet name: " + wb.getSheetName(i));
            Sheet sh = wb.getSheetAt(i);
}


问:
Azure Blobs not being created from ASP.Net Form
I'm trying to upload image files (JPG) to Azure Blob Storage. I'm using the following code

```<code>var credentials = new StorageCredentials(name, key);
CloudStorageAccount cso = new CloudStorageAccount(credentials, true);
CloudBlobClient blobClient = cso.CreateCloudBlobClient();
CloudBlobContainer container = blobClient.GetContainerReference("containerName");
string photoName = e_name + e_cr;
CloudBlockBlob blob = container.GetBlockBlobReference(photoName);
blob.Properties.ContentType = "image/jpg";
blob.UploadFromStreamAsync(img.OpenReadStream());
</code>```

My issue is that the code is not actually creating the blobs in my container. I've ran it multiple times (once last night and about three to four times today) and the attempt from last night succeeded, however it no longer works. I've tried both Blob and Container access types for my container, so I don't think it's that. img is a IFormFile, and name, key, photoName, e_name, and e_cr are all strings

答:
based on your code, few things to focus here

update the container name to "containername" as the name should contain on lowercase letters.

add below line after line #4 - this is not required if containername is already created in the storage.

await extractcontainer.CreateIfNotExistsAsync();

check the name restrictions for container and blob here and make sure photoName value respects the restrictions.

Make the change suggested by Gaurav Mantri above.

Body:
I'm trying to upload image files (JPG) to Azure Blob Storage. I'm using the following code

var credentials = new StorageCredentials(name, key);
CloudStorageAccount cso = new CloudStorageAccount(credentials, true);
CloudBlobClient blobClient = cso.CreateCloudBlobClient();
CloudBlobContainer container = blobClient.GetContainerReference("containerName");
string photoName = e_name + e_cr;
CloudBlockBlob blob = container.GetBlockBlobReference(photoName);
blob.Properties.ContentType = "image/jpg";
blob.UploadFromStreamAsync(img.OpenReadStream());

My issue is that the code is not actually creating the blobs in my container. I've ran it multiple times (once last night and about three to four times today) and the attempt from last night succeeded, however it no longer works. I've tried both Blob and Container access types for my container, so I don't think it's that. img is a IFormFile, and name, key, photoName, e_name, and e_cr are all strings


问:
Enable Tableview Scrolling but disable touches
I want to disable my tableview. Means that no button,TextFields and other controls can be touched but also i want that my tableview scroll should be working properly.

```<code>self.tableView.userInteractionEnabled=true;
</code>```

I have used this but this made scrolling also disable.

答:
You have to set only isUserInteractionEnabled & selectionStyle

```<code>func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)

        cell.selectionStyle = .none;
        cell.isUserInteractionEnabled = false;

        return cell
    }
</code>```

Body:
I want to disable my tableview. Means that no button,TextFields and other controls can be touched but also i want that my tableview scroll should be working properly.

self.tableView.userInteractionEnabled=true;

I have used this but this made scrolling also disable.

Body:
You have to set only isUserInteractionEnabled & selectionStyle

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)

        cell.selectionStyle = .none;
        cell.isUserInteractionEnabled = false;

        return cell
    }


问:
CollapsingToolbarLayout doesn't recognize scroll fling
I have created a simple CollapsingToolbarLayout and it works like a charm. My problem is, that if I try to use a fling scroll on the nestedscrollview, it just stops when I release my finger. Normal scrolling works like it should.

My activities code is unchanged => auto generated empty activity. (I just clicked on create new empty activity in android studio and edited the XML yet).

I read here, that scroll gestures on the imageview itself are buggy, but not, that the scrolling itself is buggy: see here.

I tried activating "smooth scrolling" through java code. It seems like if I scroll far enough that the imageview isn't visible anymore, fling gestures then are recognized.

TLDR: Why does the fling gesture not work as long as the imageview is visible ?
My XML Code looks like this:

```<code>    <android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/profile_app_bar_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        android:fitsSystemWindows="true">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/profile_collapsing_toolbar_layout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_scrollFlags="scroll|exitUntilCollapsed"
            app:contentScrim="?attr/colorPrimary"
            app:expandedTitleMarginStart="48dp"
            app:expandedTitleMarginEnd="64dp"
            android:fitsSystemWindows="true">

            <ImageView
                android:id="@+id/image"
                android:layout_width="match_parent"
                android:layout_height="420dp"
                android:scaleType="centerCrop"
                android:fitsSystemWindows="true"
                android:src="@drawable/headerbg"
                android:maxHeight="192dp"

                app:layout_collapseMode="parallax"/>

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
                app:layout_collapseMode="pin" />

        </android.support.design.widget.CollapsingToolbarLayout>

    </android.support.design.widget.AppBarLayout>

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        app:layout_anchor="@id/profile_app_bar_layout"
        app:layout_anchorGravity="bottom|right|end"
        android:layout_height="@dimen/fab_size_normal"
        android:layout_width="@dimen/fab_size_normal"
        app:elevation="2dp"
        app:pressedTranslationZ="12dp"
        android:layout_marginRight="8dp"
        android:layout_marginEnd="8dp"/>

    <android.support.v4.widget.NestedScrollView
        android:id="@+id/profile_content_scroll"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:clipToPadding="false"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        android:layout_gravity="fill_vertical"
        android:minHeight="192dp"
        android:overScrollMode="ifContentScrolls"
        >

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/LoremIpsum"/>

        </RelativeLayout>

    </android.support.v4.widget.NestedScrollView>

</android.support.design.widget.CoordinatorLayout>
</code>```

答:
Am just posting this here so that others do not miss it in Comments. The answer by Jinang works beautifully, but kudos to AntPachon for pointing out a far simpler method for the same. Instead of implementing an OnClick method on the Child of the NestedScrollView programatically, a better way is to set clickable=true in the xml for the child.

(Using the same example as Jinang's)

```<code><android.support.v4.widget.NestedScrollView
   xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:app="http://schemas.android.com/apk/res-auto"
   xmlns:tools="http://schemas.android.com/tools"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   app:layout_behavior="@string/appbar_scrolling_view_behavior">

  <LinearLayout
      android:id="@+id/content_container"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical"
      android:clickable="true" >                  <!-- new -->

    <!-- Page Content -->

  </LinearLayout>

</android.support.v4.widget.NestedScrollView>
</code>```

Body:
I have created a simple CollapsingToolbarLayout and it works like a charm. My problem is, that if I try to use a fling scroll on the nestedscrollview, it just stops when I release my finger. Normal scrolling works like it should.

My activities code is unchanged => auto generated empty activity. (I just clicked on create new empty activity in android studio and edited the XML yet).

I read here, that scroll gestures on the imageview itself are buggy, but not, that the scrolling itself is buggy: see here.

I tried activating "smooth scrolling" through java code. It seems like if I scroll far enough that the imageview isn't visible anymore, fling gestures then are recognized.

TLDR: Why does the fling gesture not work as long as the imageview is visible ?
My XML Code looks like this:

    <android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/profile_app_bar_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        android:fitsSystemWindows="true">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/profile_collapsing_toolbar_layout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_scrollFlags="scroll|exitUntilCollapsed"
            app:contentScrim="?attr/colorPrimary"
            app:expandedTitleMarginStart="48dp"
            app:expandedTitleMarginEnd="64dp"
            android:fitsSystemWindows="true">

            <ImageView
                android:id="@+id/image"
                android:layout_width="match_parent"
                android:layout_height="420dp"
                android:scaleType="centerCrop"
                android:fitsSystemWindows="true"
                android:src="@drawable/headerbg"
                android:maxHeight="192dp"

                app:layout_collapseMode="parallax"/>

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
                app:layout_collapseMode="pin" />

        </android.support.design.widget.CollapsingToolbarLayout>

    </android.support.design.widget.AppBarLayout>

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        app:layout_anchor="@id/profile_app_bar_layout"
        app:layout_anchorGravity="bottom|right|end"
        android:layout_height="@dimen/fab_size_normal"
        android:layout_width="@dimen/fab_size_normal"
        app:elevation="2dp"
        app:pressedTranslationZ="12dp"
        android:layout_marginRight="8dp"
        android:layout_marginEnd="8dp"/>

    <android.support.v4.widget.NestedScrollView
        android:id="@+id/profile_content_scroll"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:clipToPadding="false"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        android:layout_gravity="fill_vertical"
        android:minHeight="192dp"
        android:overScrollMode="ifContentScrolls"
        >

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/LoremIpsum"/>

        </RelativeLayout>

    </android.support.v4.widget.NestedScrollView>

</android.support.design.widget.CoordinatorLayout>

Body:
Am just posting this here so that others do not miss it in Comments. The answer by Jinang works beautifully, but kudos to AntPachon for pointing out a far simpler method for the same. Instead of implementing an OnClick method on the Child of the NestedScrollView programatically, a better way is to set clickable=true in the xml for the child.

(Using the same example as Jinang's)

<android.support.v4.widget.NestedScrollView
   xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:app="http://schemas.android.com/apk/res-auto"
   xmlns:tools="http://schemas.android.com/tools"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   app:layout_behavior="@string/appbar_scrolling_view_behavior">

  <LinearLayout
      android:id="@+id/content_container"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical"
      android:clickable="true" >                  <!-- new -->

    <!-- Page Content -->

  </LinearLayout>

</android.support.v4.widget.NestedScrollView>


答:
1) right

2) No, "/" and "*" is the same priority. So it will be performed from left to right.

3) I don't understand what your "round up" mean. But for example:

With y = 2, x = 2

(x + y -1) / y * y = (2 + 2 - 1) / 2 * 2 = (3 / 2) * 2 = 1 * 2 = 2

3 / 2 = 1 because this is the division of integer.

Title: operators precedence in C


问:
Instruction execution latencies for A53
I'm working on optimizing a function which uses floating point instructions.

For bench marking I need to know execution latency of the instructions to know theoretical possible performance.

I have found such manual for A57: http://infocenter.arm.com/help/topic/com.arm.doc.uan0015b/Cortex_A57_Software_Optimization_Guide_external.pdf

But, I don't find any such doc for A53.
Am I missing something?
Is there any such optimization guide available for A53?

答:
Some saint independently measured the instruction latencies.

http://hardwarebug.org/2014/05/15/cortex-a7-instruction-cycle-timings/

Note that the a53 evolved from the a7 and hence the timings are likely similar. It is a completely different design from the a57, which has a much longer pipeline and out of order execution.

Title: Instruction execution latencies for A53


答:
'*' operator has higher priority then
  '/'

Incorrect. Both * and / have equal precedence and are left-associative.

After evaluating the parenthesis expression we have:

```<code>(x + y - 1) / y * y = z / y * y      // where z = x + y -1

                    = (z / y) * y    // because of associativity.
</code>```

Title: operators precedence in C

Body:
'*' operator has higher priority then
  '/'

Incorrect. Both * and / have equal precedence and are left-associative.

After evaluating the parenthesis expression we have:

(x + y - 1) / y * y = z / y * y      // where z = x + y -1

                    = (z / y) * y    // because of associativity.


问:
Inserting new rows in a table
When I add news rows using the Insert into select code, the new rows get added randomly in between the already existing rows, instead of getting added to the end of the table.

I'm using, Insert into Table1 (Name1) select Name from Table2.

答:
SQL tables are modeled after unordered sets, and hence you should not assume that there is any order to your data in the table.  The only order which exists is what you specify when you query using ORDER BY, e.g.

```<code>SELECT Name1
FROM Table1
ORDER BY Name1
</code>```

An index can also be thought of a way of ordering your records, but these two are mostly distinct entities from your actual table.

Title: Inserting new rows in a table

Body:
SQL tables are modeled after unordered sets, and hence you should not assume that there is any order to your data in the table.  The only order which exists is what you specify when you query using ORDER BY, e.g.

SELECT Name1
FROM Table1
ORDER BY Name1

An index can also be thought of a way of ordering your records, but these two are mostly distinct entities from your actual table.


问:
Is there a way to get the id's of a Set<Entity> in hibernate?
I have an Entity class which contains Set<Another Entity> mapped to it, and I am saving it . Now i can get the id of the Entity by entity.getId() , but I need to get the id's of the set<anotherEntity>.
Is there a way to get them directly after saving?

答: What about List<Long> allIds = set.stream().mapToLong(e -> e.getId())?


问:
How to integrate elasticSearch with spring?
How to integrate elasticSearch with spring?
Any tutorial and example code will be very helpful.
These are part of my spring project maven dependencies, we don't use spring-boot, I already read some of the tutorials that integrate elasticSearch  with spring-boot, but it doesn't help.</p>

```<code><dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${springFramework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${springFramework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${springFramework.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>${springSecurity.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>${springSecurity.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security.oauth</groupId>
            <artifactId>spring-security-oauth2</artifactId>
            <version>${springSecurityOauth2.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-jpa</artifactId>
            <version>${springData.version}</version>
        </dependency>
</code>```

答:
You can either use Elasticsearch with

the Spring-Data project for Elasticsearch which is also documented and has an existing API defintion (Maven)

the Elasticsearch Java API which is well documented and where you can find several code snippets in their documentation as well as the internet general - though it is pretty straight forward. You may use this blog post for an introduction (Maven,also see)

or the Elasticsearch REST API which is also well documented.

In my previous project, I built a search engine using Elasticsearch. In my case I implemented a search application which utilized its Java API, while my project was built with Spring Boot.

Body:
How to integrate elasticSearch with spring?
Any tutorial and example code will be very helpful.
These are part of my spring project maven dependencies, we don't use spring-boot, I already read some of the tutorials that integrate elasticSearch  with spring-boot, but it doesn't help.

<dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${springFramework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${springFramework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${springFramework.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>${springSecurity.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>${springSecurity.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security.oauth</groupId>
            <artifactId>spring-security-oauth2</artifactId>
            <version>${springSecurityOauth2.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-jpa</artifactId>
            <version>${springData.version}</version>
        </dependency>


问:
How to convert a json object into .csv file and how to export using Ionic 2 + angular 2?
I'm using a function in my angular 2 application to convert and export a JSON data into .CSV. The below is my function and is working fine in angular 2 application
(web). The Same I tried to use in mobile app which I developed using Ionic 2, it is not working in mobile app. Is there any way to do this?

Thanks!

```<code>saveAsCSV() {
       let sampleJson : any = [{name:'ganesh', age:'24'},{name:'ramesh', age:'24'},{name:'suresh', age:'24'}]
       this.saveData = [];
       let a = document.createElement("a");
        a.setAttribute('style', 'display:none;');
        document.body.appendChild(a);
       let csvData = ConvertToCSV(sampleJson);
       let blob = new Blob([csvData], { type: 'text/csv' });
       let url= window.URL.createObjectURL(blob);
        a.href = url;
        a.download = 'sample.csv';
        a.click();
  }

ConvertToCSV(objArray) {
        let array = typeof objArray != 'object' ? JSON.parse(objArray) : objArray;
        let str = '';
        let row = "";
        for (let index in objArray[0]) {
            //Now convert each value to string and comma-separated
            row += index + ',';
        }
        row = row.slice(0, -1);
        //append Label row with line break
        str += row + '\r\n';

        for (let i = 0; i < array.length; i++) {
            let line = '';
            for (let index in array[i]) {
                if (line != '') line += ',';
                line += array[i][index];
            }
            str += line + '\r\n';
        }
        return str;
    }
</code>```

答:
Use "cordova-plugin-file" to export csv in Ionic 2.

https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-file/

If you see the following error -

code:1 message:"NOT_FOUND_ERR"

Add one of the following lines in config.xml to resolve it.

```<code><preference name="AndroidPersistentFileLocation" value="Internal" />
<preference name="AndroidPersistentFileLocation" value="Compatibility" />
</code>```

As explained in the documentation of the plugin, you can use one of these two option to:

choose whether to store files in the internal
  file storage location, or using the previous logic, with a preference
  in your application's config.xml file. Without this line, the File plugin will use Internal as the
  default. If a preference tag is present, and is not one of these
  values, the application will not start.

If your application has previously been shipped to users, using an
  older (pre- 3.0.0) version of this plugin, and has stored files in the
  persistent filesystem, then you should set the preference to
  Compatibility if your config.xml does not specify a location for the
  persistent filesystem. Switching the location to "Internal" would mean
  that existing users who upgrade their application may be unable to
  access their previously-stored files, depending on their device.

If your application is new, or has never previously stored files in
  the persistent filesystem, then the Internal setting is generally
  recommended.

Body:
I'm using a function in my angular 2 application to convert and export a JSON data into .CSV. The below is my function and is working fine in angular 2 application
(web). The Same I tried to use in mobile app which I developed using Ionic 2, it is not working in mobile app. Is there any way to do this?

Thanks!

saveAsCSV() {
       let sampleJson : any = [{name:'ganesh', age:'24'},{name:'ramesh', age:'24'},{name:'suresh', age:'24'}]
       this.saveData = [];
       let a = document.createElement("a");
        a.setAttribute('style', 'display:none;');
        document.body.appendChild(a);
       let csvData = ConvertToCSV(sampleJson);
       let blob = new Blob([csvData], { type: 'text/csv' });
       let url= window.URL.createObjectURL(blob);
        a.href = url;
        a.download = 'sample.csv';
        a.click();
  }

ConvertToCSV(objArray) {
        let array = typeof objArray != 'object' ? JSON.parse(objArray) : objArray;
        let str = '';
        let row = "";
        for (let index in objArray[0]) {
            //Now convert each value to string and comma-separated
            row += index + ',';
        }
        row = row.slice(0, -1);
        //append Label row with line break
        str += row + '\r\n';

        for (let i = 0; i < array.length; i++) {
            let line = '';
            for (let index in array[i]) {
                if (line != '') line += ',';
                line += array[i][index];
            }
            str += line + '\r\n';
        }
        return str;
    }

Body:
Use "cordova-plugin-file" to export csv in Ionic 2.

https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-file/

If you see the following error -

code:1 message:"NOT_FOUND_ERR"

Add one of the following lines in config.xml to resolve it.

<preference name="AndroidPersistentFileLocation" value="Internal" />
<preference name="AndroidPersistentFileLocation" value="Compatibility" />

As explained in the documentation of the plugin, you can use one of these two option to:

choose whether to store files in the internal
  file storage location, or using the previous logic, with a preference
  in your application's config.xml file. Without this line, the File plugin will use Internal as the
  default. If a preference tag is present, and is not one of these
  values, the application will not start.

If your application has previously been shipped to users, using an
  older (pre- 3.0.0) version of this plugin, and has stored files in the
  persistent filesystem, then you should set the preference to
  Compatibility if your config.xml does not specify a location for the
  persistent filesystem. Switching the location to "Internal" would mean
  that existing users who upgrade their application may be unable to
  access their previously-stored files, depending on their device.

If your application is new, or has never previously stored files in
  the persistent filesystem, then the Internal setting is generally
  recommended.


问:
Linker Error, Using OpenCV and Eclipse CDT on ubuntu 15.04
I'm going step by step like this guide and my code does not compile. It has gotten some linker errors which I don't know how to fix. this is my terminal's answer to : pkg-config --libs opencv

/usr/lib/x86_64-linux-gnu$ pkg-config --libs opencv
  /usr/lib/x86_64-linux-gnu/libopencv_calib3d.so -lopencv_calib3d
  /usr/lib/x86_64-linux-gnu/libopencv_contrib.so -lopencv_contrib
  /usr/lib/x86_64-linux-gnu/libopencv_core.so -lopencv_core
  /usr/lib/x86_64-linux-gnu/libopencv_features2d.so -lopencv_features2d
  /usr/lib/x86_64-linux-gnu/libopencv_flann.so -lopencv_flann
  /usr/lib/x86_64-linux-gnu/libopencv_gpu.so -lopencv_gpu
  /usr/lib/x86_64-linux-gnu/libopencv_highgui.so -lopencv_highgui
  /usr/lib/x86_64-linux-gnu/libopencv_imgproc.so -lopencv_imgproc
  /usr/lib/x86_64-linux-gnu/libopencv_legacy.so -lopencv_legacy
  /usr/lib/x86_64-linux-gnu/libopencv_ml.so -lopencv_ml
  /usr/lib/x86_64-linux-gnu/libopencv_objdetect.so -lopencv_objdetect
  /usr/lib/x86_64-linux-gnu/libopencv_ocl.so -lopencv_ocl
  /usr/lib/x86_64-linux-gnu/libopencv_photo.so -lopencv_photo
  /usr/lib/x86_64-linux-gnu/libopencv_stitching.so -lopencv_stitching
  /usr/lib/x86_64-linux-gnu/libopencv_superres.so -lopencv_superres
  /usr/lib/x86_64-linux-gnu/libopencv_ts.so -lopencv_ts
  /usr/lib/x86_64-linux-gnu/libopencv_video.so -lopencv_video
  /usr/lib/x86_64-linux-gnu/libopencv_videostab.so -lopencv_videostab

sorry if it's a mess to read but this is exactly how I received the answer.

This is how I've organized my linker

this is the error I get:

Building target: Ball_Plate Invoking: GCC C++ Linker g++ -L/usr/lib/x86_64-linux-gnu -o"Ball_Plate"  ./Src/src.o   -lopencv_core\ opencv_imgproc\ opencv_highgui\ opencv_ml\ opencv_video\ opencv_features2d\ opencv_calib3d\ opencv_objdetect\
    opencv_contrib\ opencv_legacy\ opencv_flann /usr/bin/ld: cannot find
    -lopencv_core opencv_imgproc opencv_highgui opencv_ml opencv_video opencv_features2d opencv_calib3d opencv_objdetect opencv_contrib
    opencv_legacy opencv_flann collect2: error: ld returned 1 exit status
    makefile:45: recipe for target 'Ball_Plate' failed make: ***
    [Ball_Plate] Error 1

I don't know how to fix this, I don't know much about how linker works around .so files and I would appreciate that if you could help me.

答: So I read this post and found out what the problem was, tried to compile the OpenCV library with  -DBUILD_TIFF=ON, Now Eclipse can find the header files but I get linker errors again, Eclipse cannot link the libraries.


答:
no, * and / have same precedence. (it is called "precedence", not "priority")

```<code>(x + y - 1) / y * y
</code>```

would be

```<code>( ( (x+y) - 1 ) / y ) * y
</code>```

The operation tree would be:

```<code>           *
          / \
         /   y
        ÷
       / \
      /   y
     -
    / \
   /   1
  +
 / \
x   y
</code>```

Title: operators precedence in C

Body:
no, * and / have same precedence. (it is called "precedence", not "priority")

(x + y - 1) / y * y

would be

( ( (x+y) - 1 ) / y ) * y

The operation tree would be:

           *
          / \
         /   y
        ÷
       / \
      /   y
     -
    / \
   /   1
  +
 / \
x   y


问:
TextView in LinearLayout pushed outside by another TextView
Good day! I am trying to achieve a specific kind of layout. I hope somebody could give me a hint on how to do it properly.

So, inside my layout, I have two TextView inside of a LinearLayout with horizontal orientation. The first TextView contains the name of the company and the second contains a number of the projects associated with it.

I wanted my layout to behave like this.

My current layout looks like this.

Here's the specific code for the layout:

```<code><LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">

    <TextView
        android:id="@+id/contractor_item_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:ellipsize="end"
        android:maxLines="1"
        android:text="Gem Seeker Company and  Supplies in"
        android:textColor="@color/list_title"
        android:textSize="16sp" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="(0)"
        android:textSize="16sp"
        android:textStyle="bold"
        android:maxLines="1"
        android:layout_marginStart="4dp"
        android:textColor="@color/space_gray_01"/>

</LinearLayout>
</code>```

Heres the complete code of the layout:

```<code><?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginEnd="8dp"
    android:layout_marginStart="8dp"
    android:layout_marginTop="8dp"
    android:background="@android:color/white"
    android:orientation="horizontal">

    <LinearLayout
        android:id="@+id/contractor_item_layout"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:background="?attr/selectableItemBackgroundBorderless"
        android:clickable="true"
        android:orientation="horizontal">

        <ImageView
            android:id="@+id/contractor_item_avatar"
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:layout_marginStart="16dp"
            android:layout_marginTop="16dp"
            android:background="@color/space_gray_01"
            android:contentDescription="@string/image_description"
            android:src="@drawable/ic_user_light" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:padding="16dp">

            <TextView
                android:id="@+id/contractor_item_id"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:visibility="gone" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <TextView
                    android:id="@+id/contractor_item_name"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:ellipsize="end"
                    android:maxLines="1"
                    android:text="Gem Seeker Company and  Supplies in"
                    android:textColor="@color/list_title"
                    android:textSize="16sp" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="(0)"
                    android:textSize="16sp"
                    android:textStyle="bold"
                    android:maxLines="1"
                    android:layout_marginStart="4dp"
                    android:textColor="@color/space_gray_01"/>

            </LinearLayout>

            <TextView
                android:id="@+id/contractor_item_address"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:ellipsize="end"
                android:maxLines="1"
                android:text="@string/text_no_address"
                android:textColor="@color/list_subtitle"
                android:textSize="14sp" />

            <TextView
                android:id="@+id/contractor_item_phone"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/text_no_contact"
                android:textColor="@color/list_subtitle"
                android:textSize="14sp" />

        </LinearLayout>

    </LinearLayout>

    <ImageView
        android:id="@+id/contractor_item_show"
        android:layout_width="24dp"
        android:layout_height="24dp"
        android:layout_marginTop="8dp"
        android:background="?attr/selectableItemBackgroundBorderless"
        android:clickable="true"
        android:contentDescription="@string/image_description"
        android:src="@drawable/ic_show"
        android:tint="@color/space_gray_02" />

</LinearLayout>
</code>```

答:
You can try this layout, the child you want adjust the view just give weight 1 and width odp it will work fine.

```<code><?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="horizontal" android:layout_width="match_parent"
              android:layout_height="match_parent">

    <TextView
        android:id="@+id/contractor_item_name"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_height="wrap_content"
        android:ellipsize="end"
        android:maxLines="1"
        android:text="Gem Seeker Company and  Supplies in dddddddddddds"
        android:textColor="@color/list_title"
        android:textSize="16sp" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="(0)"
        android:textSize="16sp"
        android:textStyle="bold"
        android:maxLines="1"
        android:layout_marginStart="4dp"
        android:textColor="@color/space_gray_01"/>

</LinearLayout>
</code>```

complete Layout

```<code><?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_marginEnd="8dp"
              android:layout_marginStart="8dp"
              android:layout_marginTop="8dp"
              android:background="@android:color/white"
              android:orientation="horizontal">

    <LinearLayout
        android:id="@+id/contractor_item_layout"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:background="?attr/selectableItemBackgroundBorderless"
        android:clickable="true"
        android:orientation="horizontal">

        <ImageView
            android:id="@+id/contractor_item_avatar"
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:layout_marginStart="16dp"
            android:layout_marginTop="16dp"
            android:background="@color/space_gray_01"
            android:contentDescription="@string/image_description"
            android:src="@drawable/ic_user_light" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:padding="16dp">

            <TextView
                android:id="@+id/contractor_item_id"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:visibility="gone" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <TextView
                    android:id="@+id/contractor_item_name"
                    android:layout_width="0dp"
                    android:layout_weight="1"
                    android:layout_height="wrap_content"
                    android:ellipsize="end"
                    android:maxLines="1"
                    android:text="Gem Seeker Company and  Supplies in"
                    android:textSize="16sp" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="(0)"
                    android:textSize="16sp"
                    android:textStyle="bold"
                    android:maxLines="1"
                    android:layout_marginStart="4dp"
                    android:textColor="@color/space_gray_01"
                    />

            </LinearLayout>

            <TextView
                android:id="@+id/contractor_item_address"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:ellipsize="end"
                android:maxLines="1"
                android:text="@string/text_no_address"
                android:textColor="@color/list_subtitle"
                android:textSize="14sp" />

            <TextView
                android:id="@+id/contractor_item_phone"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/text_no_contact"
                android:textColor="@color/list_subtitle"
                android:textSize="14sp" />

        </LinearLayout>

    </LinearLayout>

    <ImageView
        android:id="@+id/contractor_item_show"
        android:layout_width="24dp"
        android:layout_height="24dp"
        android:layout_marginTop="8dp"
        android:background="?attr/selectableItemBackgroundBorderless"
        android:clickable="true"
        android:contentDescription="@string/image_description"
        android:src="@drawable/ic_show"
        android:tint="@color/space_gray_02" />

</LinearLayout>
</code>```

Body:
Good day! I am trying to achieve a specific kind of layout. I hope somebody could give me a hint on how to do it properly.

So, inside my layout, I have two TextView inside of a LinearLayout with horizontal orientation. The first TextView contains the name of the company and the second contains a number of the projects associated with it.

I wanted my layout to behave like this.

My current layout looks like this.

Here's the specific code for the layout:

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">

    <TextView
        android:id="@+id/contractor_item_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:ellipsize="end"
        android:maxLines="1"
        android:text="Gem Seeker Company and  Supplies in"
        android:textColor="@color/list_title"
        android:textSize="16sp" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="(0)"
        android:textSize="16sp"
        android:textStyle="bold"
        android:maxLines="1"
        android:layout_marginStart="4dp"
        android:textColor="@color/space_gray_01"/>

</LinearLayout>

Heres the complete code of the layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginEnd="8dp"
    android:layout_marginStart="8dp"
    android:layout_marginTop="8dp"
    android:background="@android:color/white"
    android:orientation="horizontal">

    <LinearLayout
        android:id="@+id/contractor_item_layout"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:background="?attr/selectableItemBackgroundBorderless"
        android:clickable="true"
        android:orientation="horizontal">

        <ImageView
            android:id="@+id/contractor_item_avatar"
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:layout_marginStart="16dp"
            android:layout_marginTop="16dp"
            android:background="@color/space_gray_01"
            android:contentDescription="@string/image_description"
            android:src="@drawable/ic_user_light" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:padding="16dp">

            <TextView
                android:id="@+id/contractor_item_id"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:visibility="gone" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <TextView
                    android:id="@+id/contractor_item_name"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:ellipsize="end"
                    android:maxLines="1"
                    android:text="Gem Seeker Company and  Supplies in"
                    android:textColor="@color/list_title"
                    android:textSize="16sp" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="(0)"
                    android:textSize="16sp"
                    android:textStyle="bold"
                    android:maxLines="1"
                    android:layout_marginStart="4dp"
                    android:textColor="@color/space_gray_01"/>

            </LinearLayout>

            <TextView
                android:id="@+id/contractor_item_address"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:ellipsize="end"
                android:maxLines="1"
                android:text="@string/text_no_address"
                android:textColor="@color/list_subtitle"
                android:textSize="14sp" />

            <TextView
                android:id="@+id/contractor_item_phone"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/text_no_contact"
                android:textColor="@color/list_subtitle"
                android:textSize="14sp" />

        </LinearLayout>

    </LinearLayout>

    <ImageView
        android:id="@+id/contractor_item_show"
        android:layout_width="24dp"
        android:layout_height="24dp"
        android:layout_marginTop="8dp"
        android:background="?attr/selectableItemBackgroundBorderless"
        android:clickable="true"
        android:contentDescription="@string/image_description"
        android:src="@drawable/ic_show"
        android:tint="@color/space_gray_02" />

</LinearLayout>

Body:
You can try this layout, the child you want adjust the view just give weight 1 and width odp it will work fine.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="horizontal" android:layout_width="match_parent"
              android:layout_height="match_parent">

    <TextView
        android:id="@+id/contractor_item_name"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_height="wrap_content"
        android:ellipsize="end"
        android:maxLines="1"
        android:text="Gem Seeker Company and  Supplies in dddddddddddds"
        android:textColor="@color/list_title"
        android:textSize="16sp" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="(0)"
        android:textSize="16sp"
        android:textStyle="bold"
        android:maxLines="1"
        android:layout_marginStart="4dp"
        android:textColor="@color/space_gray_01"/>

</LinearLayout>

complete Layout

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_marginEnd="8dp"
              android:layout_marginStart="8dp"
              android:layout_marginTop="8dp"
              android:background="@android:color/white"
              android:orientation="horizontal">

    <LinearLayout
        android:id="@+id/contractor_item_layout"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:background="?attr/selectableItemBackgroundBorderless"
        android:clickable="true"
        android:orientation="horizontal">

        <ImageView
            android:id="@+id/contractor_item_avatar"
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:layout_marginStart="16dp"
            android:layout_marginTop="16dp"
            android:background="@color/space_gray_01"
            android:contentDescription="@string/image_description"
            android:src="@drawable/ic_user_light" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:padding="16dp">

            <TextView
                android:id="@+id/contractor_item_id"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:visibility="gone" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <TextView
                    android:id="@+id/contractor_item_name"
                    android:layout_width="0dp"
                    android:layout_weight="1"
                    android:layout_height="wrap_content"
                    android:ellipsize="end"
                    android:maxLines="1"
                    android:text="Gem Seeker Company and  Supplies in"
                    android:textSize="16sp" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="(0)"
                    android:textSize="16sp"
                    android:textStyle="bold"
                    android:maxLines="1"
                    android:layout_marginStart="4dp"
                    android:textColor="@color/space_gray_01"
                    />

            </LinearLayout>

            <TextView
                android:id="@+id/contractor_item_address"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:ellipsize="end"
                android:maxLines="1"
                android:text="@string/text_no_address"
                android:textColor="@color/list_subtitle"
                android:textSize="14sp" />

            <TextView
                android:id="@+id/contractor_item_phone"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/text_no_contact"
                android:textColor="@color/list_subtitle"
                android:textSize="14sp" />

        </LinearLayout>

    </LinearLayout>

    <ImageView
        android:id="@+id/contractor_item_show"
        android:layout_width="24dp"
        android:layout_height="24dp"
        android:layout_marginTop="8dp"
        android:background="?attr/selectableItemBackgroundBorderless"
        android:clickable="true"
        android:contentDescription="@string/image_description"
        android:src="@drawable/ic_show"
        android:tint="@color/space_gray_02" />

</LinearLayout>


问:
AXI4 delay transactions
I am just looking for advice. I currently have a custom IP integrated in VHDL which has a AXI4 slave input and an AXI4 master output, and currently the signals are directly tied together.

I would like to add a customizable latency to the AXI signals, so that way they can be delayed for a particular amount of time through the IP, rather than being connected to each other.

My question is; can I delay read and write transactions through the IP merely through the use of the AxVALID and AxREADY (and maybe the RVALID/RREADY and WVALID/WREADY) signals?

If for instance I wanted a 20 clock cycle delay, I could wait for an external master to assert VALID, and wait 20 clocks before having the IP slave assert READY? Is this correct logic?

Thanks in advance for any any advice.

答: Yes, that can be done. Depending on your infrastructure it can cause bus congestion. Alternatively, you should also insert a FIFO to buffer these delayed bus transactions.</p>

Title: AXI4 delay transactions


问:
Interpolating 3D Coordinates between known missing time intervals
The data is a Path in space. I have 3D location data (x,y,z) and the time the location point was recorded.

The x ,y, and z coordinates are the point locations of something traveling through 3D Space. The time values is the time (beginning at 0) that each point was recorded.

```<code>x     y    z    time(s)
0.1   2.2  3.3  0
2.4   2.4  4.2  0.3
4.5   2.5  1.8  0.6
</code>```

I will eventually miss some recording events. (this is known and accepted as true) And the data stream will continue at a different time interval:

```<code>x     y    z    time(s)
0.1   2.2  3.3  0
2.4   2.4  4.2  0.3
//missing x,y,z data point at time 0.6
//missing x,y,z data point at time 0.9
4.5   2.5  1.8  1.2
...
...
</code>```

Please note the data was simplified. My goal is to interpolate the missing 3D points at the known missing times. I have looked into various interpolating techniques but I am not entirely sure which interpolation method is suited for my problem.

1) Can someone succinctly explain the kind of problem this is? My math is extremely rusty and I am not sure how to properly describe it, which leads me to investigating interpolation techniques that may not be properly suited.

2) Update 1 Tricubic Interpolation should not apply here since I am not working with a grid in 3D space. I am working with a trajectory. I have found a Tricubic Interpolation implementation in the Apache math3 commons, however I am not sure if this is what I need. If you look at the arguments it takes, it takes a double[][][] fval matrix that I am not sure about.

3) If not best suited for Java, what is the best tool to interpolate this data?

Update 2 - Question regarding Spectre's solution

In your edit you provide the following tip regarding "matching first derivations of joint points":

let define our t=<-2,+2> and sample the control point like this (does not really matter how it will just affect the coefficients magnitude and including -1,0,1 will ease up the equations a lot):

```<code>p(-2) = p0
p(-1) = p1
p( 0) = p2
p( 1) = p3
</code>```

now let assume we want to interpolate all the points on the interval t=<0,1> so all points between p2 and p3. And we want continuous piecewise curve so first derivations on joint points should match. We got one more control point on the left side so the second derivation can match there too:

```<code>p'(0) = 0.5*((p3-p2)+(p2-p1)) = 0.5*(p3-p1)
p'(1) = 0.5*((p4-p3)+(p3-p2)) = 0.5*(p4-p2)
p''(0)= 0.5*(((p2-p1)-(p1-p0))+((p4-p3)-(p3-p2)))
      = 0.5*((p2-2*p1+p0)+(p4-2*p3+p2))
      = 0.5*(p0+p4)-p1+p2-p3
</code>```

Hope I did not make any silly mistake in the second derivation. Now just substitute p(t) with known control points and form system of equations and compute a0,a1,a2,a3,a4 algebraically from p0,p1,p2,p3,p4.

1) What do you mean by joint points?

2)Where do

```<code>p'(0) = 0.5*((p3-p2)+(p2-p1)) = 0.5*(p3-p1)
p'(1) = 0.5*((p4-p3)+(p3-p2)) = 0.5*(p4-p2)
</code>```

come from? Do they in any way relate to p(0) = p2 and p(1) = p3 ? Can they be anything you chose ?

It can be re written as p'(0) = 0.5*((p(3)-p(0)) + (p(0)-p(-1)) correct? It is not clear to me why this is being done. Or even why it can be done

2b) Similar question for

```<code>p''(0)= 0.5*(((p2-p1)-(p1-p0))+((p4-p3)-(p3-p2)))
      = 0.5*((p2-2*p1+p0)+(p4-2*p3+p2))
      = 0.5*(p0+p4)-p1+p2-p3
</code>```

but I am assuming that clarifying question 2) will alleviate my ambiguity for 2b) because I have no idea where the equation came from either.

What follows is pretty straight forward,then it's just systems of equations

答:
As your data are most likely just some smooth curve sampled points I would use cubic interpolation polynomial like this:

Piecewise linear integer curve interpolation in C#/Unity3D

Curve properties are such that it goes through all control points (t={-1,0,+1,+2}) and the direction (1st derivation) at inner control points is average of booth sides to join smoothly (similar to Bezier cubics).

The algo is like this:

take 2 point before missing point and 2 after

lets call them p0,p1,p2,p3 they should be ideally time equidistant ones ... and ordered by time.

compute 4 coefficients for each axis

```<code>d1=0.5*(p2.x-p0.x);
d2=0.5*(p3.x-p1.x);
ax0=p1.x;
ax1=d1;
ax2=(3.0*(p2.x-p1.x))-(2.0*d1)-d2;
ax3=d1+d2+(2.0*(-p2.x+p1.x));

d1=0.5*(p2.y-p0.y);
d2=0.5*(p3.y-p1.y);
ay0=p1.y;
ay1=d1;
ay2=(3.0*(p2.y-p1.y))-(2.0*d1)-d2;
ay3=d1+d2+(2.0*(-p2.y+p1.y));

d1=0.5*(p2.z-p0.z);
d2=0.5*(p3.z-p1.z);
az0=p1.z;
az1=d1;
az2=(3.0*(p2.z-p1.z))-(2.0*d1)-d2;
az3=d1+d2+(2.0*(-p2.z+p1.z));
</code>```

set parameter t=<0,1> to value corresponding to missing time

so if you chose points p0,p1,p2,p3 with times t0,t1,t2,t3 then the missing time tm corresponds to parameter:

```<code>t = (tm-t1)/(t2-t1);
</code>```

compute missing point.

```<code>x=ax0+ax1*t+ax2*t*t+ax3*t*t*t
y=ay0+ay1*t+ay2*t*t+ay3*t*t*t
z=az0+az1*t+az2*t*t+az3*t*t*t
</code>```

You can use polynomials of higher order if this is not enough by deriving similar equations or fitting. Also take a look at this:

How can i produce multi point linear interpolation?

[Edit1] constructing own polynomial

The answer to your comment is in [edit2] of Impact of cubic and catmull splines on image which is also linked in previous link above. To make 4th degree interpolation polynomial in similar manner you will have 5 points (p0,p1,p2,p3,p4) and equations:

```<code>p(t)= a0 + a1*t + a2*t*t + a3*t*t*t + a4*t*t*t*t
p'(t) =    a1 + 2*a2*t + 3*a3*t*t + 4*a4*t*t*t
p''(t) =        2*a2   + 6*a3*t   +12*a4*t*t
</code>```

let define our t=<-2,+2> and sample the control point like this (does not really matter how it will just affect the coefficients magnitude and including -1,0,1 will ease up the equations a lot):

```<code>p(-2) = p0
p(-1) = p1
p( 0) = p2
p( 1) = p3
p( 2) = p4
</code>```

now let assume we want to interpolate all the points on the interval t=<0,1> so all points between p2 and p3. And we want continuous piecewise curve so first derivations on joint points should match. We got one more control point on the left side so the second derivation can match there too:

```<code>p'(0) = 0.5*((p3-p2)+(p2-p1)) = 0.5*(p3-p1)
p'(1) = 0.5*((p4-p3)+(p3-p2)) = 0.5*(p4-p2)
p''(0)= 0.5*(((p2-p1)-(p1-p0))+((p4-p3)-(p3-p2)))
      = 0.5*((p2-2*p1+p0)+(p4-2*p3+p2))
      = 0.5*(p0+p4)-p1+p2-p3
</code>```

Hope I did not make any silly mistake in the second derivation. Now just substitute p(t) with known control points and form system of equations and compute a0,a1,a2,a3,a4 algebraically from p0,p1,p2,p3,p4. Hint use t=0,t=+1 and t=-1 so you will get linear equations for those. For example:

```<code>p( 0) = p2 = a0 + a1*0 + a2*0*0 + a3*0*0*0 + a4*0*0*0*0
        p2 = a0
</code>```

As you can see a0 is computed really simply the same can be used for derivations:

```<code>p'(0) = 0.5*(p3-p1)          = a1 + 2*a2*0 + 3*a3*0*0 + 4*a4*0*0*0
p''(0)= 0.5*(p0+p4)-p1+p2-p3 =      2*a2   + 6*a3*0   +12*a4*0*0
-------------------------------------------------------------------
        0.5*(p3-p1)          = a1
        0.5*(p0+p4)-p1+p2-p3 =      2*a2
-------------------------------------------------------------------
        0.5*(p3-p1)                 = a1
        0.25*(p0+p4)-0.5*(p1+p2-p3) = a2
-------------------------------------------------------------------
</code>```

Now use t=+1 and t=-1 and compute the a3,a4. You can set the joint point derivations to meet your specific needs (not just average of derivation from left and right) but to form continuous curve like yours is this the best (from my experience).

Body:
The data is a Path in space. I have 3D location data (x,y,z) and the time the location point was recorded.

The x ,y, and z coordinates are the point locations of something traveling through 3D Space. The time values is the time (beginning at 0) that each point was recorded.

x     y    z    time(s)
0.1   2.2  3.3  0
2.4   2.4  4.2  0.3
4.5   2.5  1.8  0.6

I will eventually miss some recording events. (this is known and accepted as true) And the data stream will continue at a different time interval:

x     y    z    time(s)
0.1   2.2  3.3  0
2.4   2.4  4.2  0.3
//missing x,y,z data point at time 0.6
//missing x,y,z data point at time 0.9
4.5   2.5  1.8  1.2
...
...

Please note the data was simplified. My goal is to interpolate the missing 3D points at the known missing times. I have looked into various interpolating techniques but I am not entirely sure which interpolation method is suited for my problem.

1) Can someone succinctly explain the kind of problem this is? My math is extremely rusty and I am not sure how to properly describe it, which leads me to investigating interpolation techniques that may not be properly suited.

2) Update 1 Tricubic Interpolation should not apply here since I am not working with a grid in 3D space. I am working with a trajectory. I have found a Tricubic Interpolation implementation in the Apache math3 commons, however I am not sure if this is what I need. If you look at the arguments it takes, it takes a double[][][] fval matrix that I am not sure about.

3) If not best suited for Java, what is the best tool to interpolate this data?

Update 2 - Question regarding Spectre's solution

In your edit you provide the following tip regarding "matching first derivations of joint points":

let define our t=<-2,+2> and sample the control point like this (does not really matter how it will just affect the coefficients magnitude and including -1,0,1 will ease up the equations a lot):

p(-2) = p0
p(-1) = p1
p( 0) = p2
p( 1) = p3

now let assume we want to interpolate all the points on the interval t=<0,1> so all points between p2 and p3. And we want continuous piecewise curve so first derivations on joint points should match. We got one more control point on the left side so the second derivation can match there too:

p'(0) = 0.5*((p3-p2)+(p2-p1)) = 0.5*(p3-p1)
p'(1) = 0.5*((p4-p3)+(p3-p2)) = 0.5*(p4-p2)
p''(0)= 0.5*(((p2-p1)-(p1-p0))+((p4-p3)-(p3-p2)))
      = 0.5*((p2-2*p1+p0)+(p4-2*p3+p2))
      = 0.5*(p0+p4)-p1+p2-p3

Hope I did not make any silly mistake in the second derivation. Now just substitute p(t) with known control points and form system of equations and compute a0,a1,a2,a3,a4 algebraically from p0,p1,p2,p3,p4.

1) What do you mean by joint points?

2)Where do

p'(0) = 0.5*((p3-p2)+(p2-p1)) = 0.5*(p3-p1)
p'(1) = 0.5*((p4-p3)+(p3-p2)) = 0.5*(p4-p2)

come from? Do they in any way relate to p(0) = p2 and p(1) = p3 ? Can they be anything you chose ?

It can be re written as p'(0) = 0.5*((p(3)-p(0)) + (p(0)-p(-1)) correct? It is not clear to me why this is being done. Or even why it can be done

2b) Similar question for

p''(0)= 0.5*(((p2-p1)-(p1-p0))+((p4-p3)-(p3-p2)))
      = 0.5*((p2-2*p1+p0)+(p4-2*p3+p2))
      = 0.5*(p0+p4)-p1+p2-p3

but I am assuming that clarifying question 2) will alleviate my ambiguity for 2b) because I have no idea where the equation came from either.

What follows is pretty straight forward,then it's just systems of equations

Body:
As your data are most likely just some smooth curve sampled points I would use cubic interpolation polynomial like this:

Piecewise linear integer curve interpolation in C#/Unity3D

Curve properties are such that it goes through all control points (t={-1,0,+1,+2}) and the direction (1st derivation) at inner control points is average of booth sides to join smoothly (similar to Bezier cubics).

The algo is like this:

take 2 point before missing point and 2 after

lets call them p0,p1,p2,p3 they should be ideally time equidistant ones ... and ordered by time.

compute 4 coefficients for each axis

d1=0.5*(p2.x-p0.x);
d2=0.5*(p3.x-p1.x);
ax0=p1.x;
ax1=d1;
ax2=(3.0*(p2.x-p1.x))-(2.0*d1)-d2;
ax3=d1+d2+(2.0*(-p2.x+p1.x));

d1=0.5*(p2.y-p0.y);
d2=0.5*(p3.y-p1.y);
ay0=p1.y;
ay1=d1;
ay2=(3.0*(p2.y-p1.y))-(2.0*d1)-d2;
ay3=d1+d2+(2.0*(-p2.y+p1.y));

d1=0.5*(p2.z-p0.z);
d2=0.5*(p3.z-p1.z);
az0=p1.z;
az1=d1;
az2=(3.0*(p2.z-p1.z))-(2.0*d1)-d2;
az3=d1+d2+(2.0*(-p2.z+p1.z));

set parameter t=<0,1> to value corresponding to missing time

so if you chose points p0,p1,p2,p3 with times t0,t1,t2,t3 then the missing time tm corresponds to parameter:

t = (tm-t1)/(t2-t1);

compute missing point.

x=ax0+ax1*t+ax2*t*t+ax3*t*t*t
y=ay0+ay1*t+ay2*t*t+ay3*t*t*t
z=az0+az1*t+az2*t*t+az3*t*t*t

You can use polynomials of higher order if this is not enough by deriving similar equations or fitting. Also take a look at this:

How can i produce multi point linear interpolation?

[Edit1] constructing own polynomial

The answer to your comment is in [edit2] of Impact of cubic and catmull splines on image which is also linked in previous link above. To make 4th degree interpolation polynomial in similar manner you will have 5 points (p0,p1,p2,p3,p4) and equations:

p(t)= a0 + a1*t + a2*t*t + a3*t*t*t + a4*t*t*t*t
p'(t) =    a1 + 2*a2*t + 3*a3*t*t + 4*a4*t*t*t
p''(t) =        2*a2   + 6*a3*t   +12*a4*t*t

let define our t=<-2,+2> and sample the control point like this (does not really matter how it will just affect the coefficients magnitude and including -1,0,1 will ease up the equations a lot):

p(-2) = p0
p(-1) = p1
p( 0) = p2
p( 1) = p3
p( 2) = p4

now let assume we want to interpolate all the points on the interval t=<0,1> so all points between p2 and p3. And we want continuous piecewise curve so first derivations on joint points should match. We got one more control point on the left side so the second derivation can match there too:

p'(0) = 0.5*((p3-p2)+(p2-p1)) = 0.5*(p3-p1)
p'(1) = 0.5*((p4-p3)+(p3-p2)) = 0.5*(p4-p2)
p''(0)= 0.5*(((p2-p1)-(p1-p0))+((p4-p3)-(p3-p2)))
      = 0.5*((p2-2*p1+p0)+(p4-2*p3+p2))
      = 0.5*(p0+p4)-p1+p2-p3

Hope I did not make any silly mistake in the second derivation. Now just substitute p(t) with known control points and form system of equations and compute a0,a1,a2,a3,a4 algebraically from p0,p1,p2,p3,p4. Hint use t=0,t=+1 and t=-1 so you will get linear equations for those. For example:

p( 0) = p2 = a0 + a1*0 + a2*0*0 + a3*0*0*0 + a4*0*0*0*0
        p2 = a0

As you can see a0 is computed really simply the same can be used for derivations:

p'(0) = 0.5*(p3-p1)          = a1 + 2*a2*0 + 3*a3*0*0 + 4*a4*0*0*0
p''(0)= 0.5*(p0+p4)-p1+p2-p3 =      2*a2   + 6*a3*0   +12*a4*0*0
-------------------------------------------------------------------
        0.5*(p3-p1)          = a1
        0.5*(p0+p4)-p1+p2-p3 =      2*a2
-------------------------------------------------------------------
        0.5*(p3-p1)                 = a1
        0.25*(p0+p4)-0.5*(p1+p2-p3) = a2
-------------------------------------------------------------------

Now use t=+1 and t=-1 and compute the a3,a4. You can set the joint point derivations to meet your specific needs (not just average of derivation from left and right) but to form continuous curve like yours is this the best (from my experience).