问:
Nil Value encountered when unwrapping optional in Swift 3
I am nw to Swift programming and am trying to display JSON objects in an iOS application, but keep receiving the error "unexpectedly found nil while unwrapping an Optional value" when running the code.

Here is the code to display the JSON:

```<code>import Foundation
import UIKit

class EventList
{
    static var listOfEvents = [Event]()

    static var eventService:EventService?

    static func getEventsFromWebService()->[Event]
        // _ siteURL:String, _ searchTerm:String
    {
        let searchURL = "http://api.eventful.com/json/events/search?
        date=2018&app_key=wjwMpjZWRD7JXHPQ"
        print ("Web Service call = \(searchURL)")

        eventService = EventService(searchURL)

        let operationQ = OperationQueue()

        operationQ.maxConcurrentOperationCount = 1

        operationQ.addOperation(eventService!)

        operationQ.waitUntilAllOperationsAreFinished()

        listOfEvents.removeAll()

        let returnedJSON = eventService!.jsonFromResponse
        let JSONObjects = returnedJSON?["event"] as! [[String:String]]

        for eachJSONObject in JSONObjects
        {
            print("Creating Movie object from JSON: \(eachJSONObject)")
            listOfEvents.append(Event(eachJSONObject))
        }

        return listOfEvents
    }

    private static func showCreatedList()
    {
        for evt in listOfEvents
        {
            print(evt.displayEvent())
        }

    }
}

class Event
{
    private (set)var title:String
    private (set)var city_name:String
    private (set)var country_name:String
    private (set)var venue_name:String
    private (set)var venue_address:String
    private (set)var start_time:String
    private (set)var url:String
    private (set)var isSaved:Bool

    init?(_ t:String, _ ci:String, _ co:String, _ vn:String, _ va:String, _
s:String, _ u:String)
    {
        if ((t == "") || (va == "") || (s == ""))
        {
            return nil
        }
        else
        {
            title = t
            city_name = ci
            country_name = co
            venue_name = vn
            venue_address = va
            start_time = s
            url = u
            isSaved = false
        }
    }

    convenience init(_ JSONObject:[String:String])
    {
        let title = JSONObject["title"]
        let city = JSONObject["city_name"]
        let country = JSONObject["country_name"]
        let venue = JSONObject["venue_name"]
        let address = JSONObject["venue_address"]
        let time = JSONObject["start_time"]
        let url = JSONObject["url"]

        self.init(title!,city!,country!,venue!,address!,time!,url!)!
    }

    func displayEvent()->String
    {
        let strEvent = "\(title) will take place at \(venue_name)"
        return strEvent
    }
}

class EventService:Operation
{
    var urlReceived: URL?

    var jsonFromResponse: [String:Any]?

    init(_ incomingURLString:String)
    {
        urlReceived = URL(string:
incomingURLString.addingPercentEncoding(withAllowedCharacters:
CharacterSet.urlQueryAllowed)!)
    }

    override func main()
    {
        var responseData:Data?

        do
        {
            responseData = try Data(contentsOf: urlReceived!)
            print("Service call (request) successful! Returned: \
(responseData)")
        }
        catch
        {
             print("Service call (request) failed")
        }

        do
        {
            jsonFromResponse = try JSONSerialization.jsonObject(with:
responseData!,options: .allowFragments) as? [String:Any]
            print("JSON Parser successful. Returned: \(jsonFromResponse!)")
        }
        catch
        {
            print("JSON Parser failed")
        }
    }
}
</code>```

Here is part of the JSON I am using:

```<code>{
"last_item": null,
"total_items": "3983377",
"first_item": null,
"page_number": "1",
"page_size": "10",
"page_items": null,
"search_time": "0.129",
"page_count": "398338",
"events": {
  "event": [
    {
      "watching_count": null,
      "olson_path": "America/New_York",
      "calendar_count": null,
      "comment_count": null,
      "region_abbr": "VA",
      "postal_code": "23229",
      "going_count": null,
      "all_day": "0",
      "latitude": "37.5949",
      "groups": null,
      "url": "http://richmond.eventful.com/events/lettermen-/E0-001-
102252139-0?utm_source=apis&utm_medium=apim&utm_campaign=apic",
      "id": "E0-001-102252139-0",
</code>```

The JSON continues on showing different event objects.
The error is being flagged on the line:

```<code>let JSONObjects = returnedJSON?["event"] as! [[String:String]]
</code>```

I am working with people who have used similar code but a different set of JSON data, so I am not sure if it is my JSON data or my code that is the problem.

Thanks in advance for any help.

答:
From what I can see at first glance it seems that you have null values on your JSON, but when initializing the class Event you're saying that all fields are mandatory.

```<code>self.init(title!,city!,country!,venue!,address!,time!,url!)!
</code>```

These are all mandatory fields and from what I can see your JSON only has the url field the translation from JSON to your class will reproduce an error unless you initialize the class by yourself

Body:
I am nw to Swift programming and am trying to display JSON objects in an iOS application, but keep receiving the error "unexpectedly found nil while unwrapping an Optional value" when running the code.

Here is the code to display the JSON:

import Foundation
import UIKit

class EventList
{
    static var listOfEvents = [Event]()

    static var eventService:EventService?

    static func getEventsFromWebService()->[Event]
        // _ siteURL:String, _ searchTerm:String
    {
        let searchURL = "http://api.eventful.com/json/events/search?
        date=2018&app_key=wjwMpjZWRD7JXHPQ"
        print ("Web Service call = \(searchURL)")

        eventService = EventService(searchURL)

        let operationQ = OperationQueue()

        operationQ.maxConcurrentOperationCount = 1

        operationQ.addOperation(eventService!)

        operationQ.waitUntilAllOperationsAreFinished()

        listOfEvents.removeAll()

        let returnedJSON = eventService!.jsonFromResponse
        let JSONObjects = returnedJSON?["event"] as! [[String:String]]

        for eachJSONObject in JSONObjects
        {
            print("Creating Movie object from JSON: \(eachJSONObject)")
            listOfEvents.append(Event(eachJSONObject))
        }

        return listOfEvents
    }

    private static func showCreatedList()
    {
        for evt in listOfEvents
        {
            print(evt.displayEvent())
        }

    }
}

class Event
{
    private (set)var title:String
    private (set)var city_name:String
    private (set)var country_name:String
    private (set)var venue_name:String
    private (set)var venue_address:String
    private (set)var start_time:String
    private (set)var url:String
    private (set)var isSaved:Bool

    init?(_ t:String, _ ci:String, _ co:String, _ vn:String, _ va:String, _
s:String, _ u:String)
    {
        if ((t == "") || (va == "") || (s == ""))
        {
            return nil
        }
        else
        {
            title = t
            city_name = ci
            country_name = co
            venue_name = vn
            venue_address = va
            start_time = s
            url = u
            isSaved = false
        }
    }

    convenience init(_ JSONObject:[String:String])
    {
        let title = JSONObject["title"]
        let city = JSONObject["city_name"]
        let country = JSONObject["country_name"]
        let venue = JSONObject["venue_name"]
        let address = JSONObject["venue_address"]
        let time = JSONObject["start_time"]
        let url = JSONObject["url"]

        self.init(title!,city!,country!,venue!,address!,time!,url!)!
    }

    func displayEvent()->String
    {
        let strEvent = "\(title) will take place at \(venue_name)"
        return strEvent
    }
}

class EventService:Operation
{
    var urlReceived: URL?

    var jsonFromResponse: [String:Any]?

    init(_ incomingURLString:String)
    {
        urlReceived = URL(string:
incomingURLString.addingPercentEncoding(withAllowedCharacters:
CharacterSet.urlQueryAllowed)!)
    }

    override func main()
    {
        var responseData:Data?

        do
        {
            responseData = try Data(contentsOf: urlReceived!)
            print("Service call (request) successful! Returned: \
(responseData)")
        }
        catch
        {
             print("Service call (request) failed")
        }

        do
        {
            jsonFromResponse = try JSONSerialization.jsonObject(with:
responseData!,options: .allowFragments) as? [String:Any]
            print("JSON Parser successful. Returned: \(jsonFromResponse!)")
        }
        catch
        {
            print("JSON Parser failed")
        }
    }
}

Here is part of the JSON I am using:

{
"last_item": null,
"total_items": "3983377",
"first_item": null,
"page_number": "1",
"page_size": "10",
"page_items": null,
"search_time": "0.129",
"page_count": "398338",
"events": {
  "event": [
    {
      "watching_count": null,
      "olson_path": "America/New_York",
      "calendar_count": null,
      "comment_count": null,
      "region_abbr": "VA",
      "postal_code": "23229",
      "going_count": null,
      "all_day": "0",
      "latitude": "37.5949",
      "groups": null,
      "url": "http://richmond.eventful.com/events/lettermen-/E0-001-
102252139-0?utm_source=apis&utm_medium=apim&utm_campaign=apic",
      "id": "E0-001-102252139-0",

The JSON continues on showing different event objects.
The error is being flagged on the line:

let JSONObjects = returnedJSON?["event"] as! [[String:String]]

I am working with people who have used similar code but a different set of JSON data, so I am not sure if it is my JSON data or my code that is the problem.

Thanks in advance for any help.

Body:
From what I can see at first glance it seems that you have null values on your JSON, but when initializing the class Event you're saying that all fields are mandatory.

self.init(title!,city!,country!,venue!,address!,time!,url!)!

These are all mandatory fields and from what I can see your JSON only has the url field the translation from JSON to your class will reproduce an error unless you initialize the class by yourself


来源: stackexchange

问:
How to get certificates for identities from CA in Hyperledger Composer
When following the documentation at here in order to issue identities in Hyperledger Composer, they say that:

The Hyperledger Fabric certificate authority generates an enrollment secret that can be given to the participant, who can then use the enrollment secret to request their enrollment certificate and private keys from the Hyperledger Fabric certificate authority.

I have successfully issued an identity and got the enrollment secret. However, it is not clear how to request the certificates from the CA.

Could anyone help?

答:
that instruction is not entirely clear, will need to get this changed.

A Business Network Card is the definitive means to connect to a Composer business network, and a constituent part of that is identity that you issued (and which was mapped to a participant in Composer) - it is only possible to access a Composer business network through a valid Business Network Card. It consists of a connection profile, some metadata for the identity using it, and ultimately, a set of credentials (certificate/private key which get populated automatically to the user's wallet from where it is used to 'connect' - a 'ping' is also a connect). FYI an identity (linked to a participant in Composer) can have one or more cards (each to connect to one or more business networks).

The document you need to read to do that is https://hyperledger.github.io/composer/latest/reference/composer.identity.issue.html

you'll see it has a -f flag to create a card file - that is the file you import  (eg using Composer Playground to import or composer card import -f ). If you've done that import from the CLI, do a composer network ping so that it will use the one-time enrolment secret to request the certificate/key from the CA server and then store it in the user's wallet under $HOME/.composer - the card should be listable using the command  composer card list

ContentLicense: CC BY-SA 4.0

ContentLicense: CC BY-SA 3.0


问:
How do I add an animated scrolling option on a html webpage?
I've recently started learning html and CSS. I have no knowledge of javascript, but I will learn soon. I want to know how to use a link on a page to scroll the page down to another portion of the same page in an animated fashion. For instance if the page has 2 parts, a "home" and an "about me" part, I want a link that will scroll the page down to the about me part from the home part. Is it possible to do this without javascript?  </p>

答:
For the section you want to jump to, like the "about me" section, what you do is you create an anchor tag and you give it an id and then in your link, you set the link href source to the id of the anchor tag. This will make your link, when clicked, jump to the section that has the matching ID. Now this will jump you to the section, not necessarily animate it in a scrolling fashion.

Example:

```<code>link:
<a href="#about_me">About Me</a>

About me section
<a id="about_me">About Me section</a>
</code>```

You could even leave the anchor tag blank and the link will still jump to that section like so:

```<code><a id="about_me"></a>
</code>```

Body:
For the section you want to jump to, like the "about me" section, what you do is you create an anchor tag and you give it an id and then in your link, you set the link href source to the id of the anchor tag. This will make your link, when clicked, jump to the section that has the matching ID. Now this will jump you to the section, not necessarily animate it in a scrolling fashion.

Example:

link:
<a href="#about_me">About Me</a>

About me section
<a id="about_me">About Me section</a>

You could even leave the anchor tag blank and the link will still jump to that section like so:

<a id="about_me"></a>


问:
Ubuntu 17: Can't install mysqlclient
Trying to follow a Django tutorial but I cannot install mysqlclient.

The tutorial claims that I can do so with the following command:

pip install mysqlclient

but this generates this error:

```<code>Collecting mysqlclient   Using cached mysqlclient-1.3.12.tar.gz
    Complete output from command python setup.py egg_info:
    /bin/sh: 1: mysql_config: not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-rrolctwh/mysqlclient/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "/tmp/pip-build-rrolctwh/mysqlclient/setup_posix.py", line 44, in get_config
        libs = mysql_config("libs_r")
      File "/tmp/pip-build-rrolctwh/mysqlclient/setup_posix.py", line 26, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    OSError: mysql_config not found

----------------------------------------  Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-rrolctwh/mysqlclient/
</code>```

I have the most up-to-date pip and virtualenv installed.

I would like to be able to install mysqlclient so that I may continue with the tutorial.

答:
I had also similar issue on Centos 6, where there was a problem with mysql migration to maria, I had some conflicts, but finally I installed:

```<code> yum list installed |grep MariaDB
MariaDB-client.x86_64  10.2.7-1.el6     @bull
MariaDB-common.x86_64  10.2.7-1.el6     @bull
MariaDB-compat.x86_64  10.2.7-1.el6     @bull
MariaDB-devel.x86_64   10.2.7-1.el6     @bull
MariaDB-server.x86_64  10.2.7-1.el6     @bull
</code>```

And the issue was resolved.

Title: Ubuntu 17: Can't install mysqlclient

Body:
Trying to follow a Django tutorial but I cannot install mysqlclient.

The tutorial claims that I can do so with the following command:

pip install mysqlclient

but this generates this error:

Collecting mysqlclient   Using cached mysqlclient-1.3.12.tar.gz
    Complete output from command python setup.py egg_info:
    /bin/sh: 1: mysql_config: not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-rrolctwh/mysqlclient/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "/tmp/pip-build-rrolctwh/mysqlclient/setup_posix.py", line 44, in get_config
        libs = mysql_config("libs_r")
      File "/tmp/pip-build-rrolctwh/mysqlclient/setup_posix.py", line 26, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    OSError: mysql_config not found

----------------------------------------  Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-rrolctwh/mysqlclient/

I have the most up-to-date pip and virtualenv installed.

I would like to be able to install mysqlclient so that I may continue with the tutorial.

Body:
I had also similar issue on Centos 6, where there was a problem with mysql migration to maria, I had some conflicts, but finally I installed:

 yum list installed |grep MariaDB
MariaDB-client.x86_64  10.2.7-1.el6     @bull
MariaDB-common.x86_64  10.2.7-1.el6     @bull
MariaDB-compat.x86_64  10.2.7-1.el6     @bull
MariaDB-devel.x86_64   10.2.7-1.el6     @bull
MariaDB-server.x86_64  10.2.7-1.el6     @bull

And the issue was resolved.


问:
Magento 2 EE elasticsearch Content-Type header is not supported
I have successfully integrated elastic search(Elasticsearch 6.0) with Magento Enterprise Edition 2.1. As per their documentation, I have tried to reindex calalog by using magento cli command

```<code>bin/magento indexer:reindex catalogsearch_fulltext
</code>```

But it throws an error like

```<code>Catalog Search indexer process unknown error:
Content-Type header [] is not supported
</code>```

I read that,Elasticsearch 6.0 is implemented strict content-type checking.So how can I solve this in Magento EE 2.1 ?

答:
Problem in the module - magento/module-elasticsearch.
In this module "composer.json" contain "elasticsearch/elasticsearch": "~2.0". And he doesn't support Elasticsearch 6.0.

For version 6, there should be an additional parameter "Content-Type" in header to be sent
https://github.com/elastic/elasticsearch-php/commit/fd3b0f16f7e09cb2096ef5f2d656c9fd8dd3d61d#diff-1b0215334399d80759820e3229367adf

https://github.com/elastic/elasticsearch-php/blob/master/src/Elasticsearch/Connections/Connection.php, line 159, $this->headers

```<code>   $request = [
    'http_method' => $method,
    'scheme'      => $this->transportSchema,
    'uri'         => $this->getURI($uri, $params),
    'body'        => $body,
    'headers'     => array_merge([
    'Host'  => [$this->host]
    ], $this->headers)
    ];
</code>```

Body:
I have successfully integrated elastic search(Elasticsearch 6.0) with Magento Enterprise Edition 2.1. As per their documentation, I have tried to reindex calalog by using magento cli command

bin/magento indexer:reindex catalogsearch_fulltext

But it throws an error like

Catalog Search indexer process unknown error:
Content-Type header [] is not supported

I read that,Elasticsearch 6.0 is implemented strict content-type checking.So how can I solve this in Magento EE 2.1 ?

Body:
Problem in the module - magento/module-elasticsearch.
In this module "composer.json" contain "elasticsearch/elasticsearch": "~2.0". And he doesn't support Elasticsearch 6.0.

For version 6, there should be an additional parameter "Content-Type" in header to be sent
https://github.com/elastic/elasticsearch-php/commit/fd3b0f16f7e09cb2096ef5f2d656c9fd8dd3d61d#diff-1b0215334399d80759820e3229367adf

https://github.com/elastic/elasticsearch-php/blob/master/src/Elasticsearch/Connections/Connection.php, line 159, $this->headers

   $request = [
    'http_method' => $method,
    'scheme'      => $this->transportSchema,
    'uri'         => $this->getURI($uri, $params),
    'body'        => $body,
    'headers'     => array_merge([
    'Host'  => [$this->host]
    ], $this->headers)
    ];


问:
Error running application that uses ms access database
When I try to run my application I get:

"The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine."

Is there a better way to make the call to the Microsoft access database that runs the application so that this error will not come up.  I would like the application to run on the machine even if Access is not installed.

Visual Studio 2008 - VB.Net is what I used to write it.

What method/technology should I use to make the call to Access db?

答:
For the easiest method, use an MDB file and use Jet 4.0, which is installed on all versions of Windows starting with Win2000.

One caveat: if you are compiling your app for 64-bit, you won't be able to use the installed Jet 4.0, since it's only 32-bit. The Access Database Engine download that @Conrad Frix cites will work for both MDB and ACCDB (the new file format for the ACE, i.e., the new version of Jet introduced with Access 2007), but if you're using MDB format for your data file, you'd only need it if you're compiling for 64-bit.

ContentLicense: CC BY-SA 2.5


问:
Replacing Text in Word with Currency from Excel
First time post, please go easy...
I wrote some code to replace placeholder text in a Word template, with text from an Excel file. (e.g. replaces all occurrences of Business_Name with Buddy's Dog Grooming) The code runs, and replaces everything as planned, but when it comes to replacing the Word text Total_FMV with the currency from Excel of $100,000, the code spits out 100000. Any thoughts on how I can get the text in Word to read $100,000 without the decimals?</p>

```<code>Private Sub OnSite_Builder_Click()

Template = "C:\Users\Me\Desktop\TEMPLATE.docx"
Set wrdApp = CreateObject("Word.Application")
Set wrdDoc = wrdApp.Documents.Open(Template, ReadOnly:=True)

    wrdApp.Visible = True

    wrdApp.Selection.Find.ClearFormatting
    wrdApp.Selection.Find.Replacement.ClearFormatting

'Total FMV
With wrdApp.Selection.Find
    .Text = "Total_FMV"
    .Replacement.Text = Range("C28")
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
End With

    wrdApp.Selection.Find.Execute Replace:=wdReplaceAll

End Sub
</code>```

答:
Try</p>

```<code>  .Replacement.Text =Format(Range("C28"),"$#,##0")
</code>```

Body:
First time post, please go easy...
I wrote some code to replace placeholder text in a Word template, with text from an Excel file. (e.g. replaces all occurrences of Business_Name with Buddy's Dog Grooming) The code runs, and replaces everything as planned, but when it comes to replacing the Word text Total_FMV with the currency from Excel of $100,000, the code spits out 100000. Any thoughts on how I can get the text in Word to read $100,000 without the decimals?

Private Sub OnSite_Builder_Click()

Template = "C:\Users\Me\Desktop\TEMPLATE.docx"
Set wrdApp = CreateObject("Word.Application")
Set wrdDoc = wrdApp.Documents.Open(Template, ReadOnly:=True)

    wrdApp.Visible = True

    wrdApp.Selection.Find.ClearFormatting
    wrdApp.Selection.Find.Replacement.ClearFormatting

'Total FMV
With wrdApp.Selection.Find
    .Text = "Total_FMV"
    .Replacement.Text = Range("C28")
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
End With

    wrdApp.Selection.Find.Execute Replace:=wdReplaceAll

End Sub

Body:
Try

  .Replacement.Text =Format(Range("C28"),"$#,##0")


问:
Loop cells in VBA.
I am trying to make my code better, as every beginner I have problem to make it more "systematic", I would like your advice on how to do it.

I open few workbook, so now my macro looks like this.

```<code> Sub OpenWorkbooks()
 workbooks.Open Filename :="C/.../file1.xlsx"
 workbooks.Open Filename :="C/.../file2.xlsx"
 workbooks.Open Filename :="C/.../file3.xlsx"
 .
 .
 End sub
</code>```

Its quite ugly, I would like to have each path in a cell. Let say from A1 to A3 and to loop this cell to open the workbooks. Any idea how I could do this?

In an other part of my code, nicely found on the web, I have the same problem. I would like to be able to enter my paths somewhere in my spreadsheet and then to loop it from there instead of entering manually one by one...

This is the second part of the code, quite clueless how I should do this...

```<code>Sub GetNumber()
Dim wWbPath As String, WbName As String
Dim WsName As String, CellRef As String
Dim Ret As String

Workbooks("file1").Close SaveChanges:=True

wbPath = "C:/etc...."

WbName = "file1.xlsx"
WsName = "Sheet1"
CellRef = "AD30"

arg = "'" & wbPath & "[" & wbName & "]" & _
wsName & "'!" & Range(cellRef).Address(True, True, xlR1C1)

Worksheets("Sheet1").Range("A1") = ExecuteExcel4Macro(arg)

'Then I need to do all again for the second workbook etc....

End sub
</code>```

Any idea is welcome,
Thank you!

答:
To answer the first part of your question:

```<code> Sub OpenWorkbooks()
 For i = 1 to 3 ' Loop 3 times
     Workbooks.Open Filename:=Sheet1.cells(i,1).value
'Cells refers to Row and column, so i will iterate three times while keeping the column the same.
 Next i
 End sub
</code>```

If you don't know how many loops you will want to make, you could use the following to check the Last Row with data and loop until you reach it:

```<code>Sub OpenWorkbooks()
LastRow = Sheet1.Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 to LastRow ' Loop as many times until the last row with data
     Workbooks.Open Filename:=Sheet1.cells(i,1).value
'Cells refers to Row and column, so i will iterate three times while keeping the column the same.
 Next i
 End sub
</code>```

For the second part of your code you could do something like:

```<code>Sub GetNumber()
Dim wWbPath As String, WbName As String
Dim WsName As String, CellRef As String
Dim Ret As String

For i = 1 to 5 'Change this to however many files you will be using
FileName = Sheet1.cells(i,1).value
Workbooks(FileName).Close SaveChanges:=True

wbPath = "C:/etc...."

WbName = FileName & ".xlsx"
WsName = "Sheet1"
CellRef = "AD30"

arg = "'" & wbPath & "[" & wbName & "]" & _
wsName & "'!" & Range(cellRef).Address(True, True, xlR1C1)

Worksheets("Sheet1").Range("A" & i) = ExecuteExcel4Macro(arg)

'Then I need to do all again for the second workbook etc....
Next i
End sub
</code>```

Title: Loop cells in VBA.

Body:
I am trying to make my code better, as every beginner I have problem to make it more "systematic", I would like your advice on how to do it.

I open few workbook, so now my macro looks like this.

 Sub OpenWorkbooks()
 workbooks.Open Filename :="C/.../file1.xlsx"
 workbooks.Open Filename :="C/.../file2.xlsx"
 workbooks.Open Filename :="C/.../file3.xlsx"
 .
 .
 End sub

Its quite ugly, I would like to have each path in a cell. Let say from A1 to A3 and to loop this cell to open the workbooks. Any idea how I could do this?

In an other part of my code, nicely found on the web, I have the same problem. I would like to be able to enter my paths somewhere in my spreadsheet and then to loop it from there instead of entering manually one by one...

This is the second part of the code, quite clueless how I should do this...

Sub GetNumber()
Dim wWbPath As String, WbName As String
Dim WsName As String, CellRef As String
Dim Ret As String

Workbooks("file1").Close SaveChanges:=True

wbPath = "C:/etc...."

WbName = "file1.xlsx"
WsName = "Sheet1"
CellRef = "AD30"

arg = "'" & wbPath & "[" & wbName & "]" & _
wsName & "'!" & Range(cellRef).Address(True, True, xlR1C1)

Worksheets("Sheet1").Range("A1") = ExecuteExcel4Macro(arg)

'Then I need to do all again for the second workbook etc....

End sub

Any idea is welcome,
Thank you!

Body:
To answer the first part of your question:

 Sub OpenWorkbooks()
 For i = 1 to 3 ' Loop 3 times
     Workbooks.Open Filename:=Sheet1.cells(i,1).value
'Cells refers to Row and column, so i will iterate three times while keeping the column the same.
 Next i
 End sub

If you don't know how many loops you will want to make, you could use the following to check the Last Row with data and loop until you reach it:

Sub OpenWorkbooks()
LastRow = Sheet1.Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 to LastRow ' Loop as many times until the last row with data
     Workbooks.Open Filename:=Sheet1.cells(i,1).value
'Cells refers to Row and column, so i will iterate three times while keeping the column the same.
 Next i
 End sub

For the second part of your code you could do something like:

Sub GetNumber()
Dim wWbPath As String, WbName As String
Dim WsName As String, CellRef As String
Dim Ret As String

For i = 1 to 5 'Change this to however many files you will be using
FileName = Sheet1.cells(i,1).value
Workbooks(FileName).Close SaveChanges:=True

wbPath = "C:/etc...."

WbName = FileName & ".xlsx"
WsName = "Sheet1"
CellRef = "AD30"

arg = "'" & wbPath & "[" & wbName & "]" & _
wsName & "'!" & Range(cellRef).Address(True, True, xlR1C1)

Worksheets("Sheet1").Range("A" & i) = ExecuteExcel4Macro(arg)

'Then I need to do all again for the second workbook etc....
Next i
End sub


问:
SQL procedure to show how many hours has worker worked
```<code>+-----------+-------------------------------+-------+
| Worker ID | Time(MM/DD/YYYY Hour:Min:Sec) | InOut |
+-----------+-------------------------------+-------+
|        1  |  12/04/2017 10:00:00          | In    |
|        2  |  12/04/2017 10:00:00          | In    |
|        2  |  12/04/2017 18:40:02          | Out   |
|        3  |  12/04/2017 10:00:00          | In    |
|        1  |  12/04/2017 12:01:00          | Out   |
|        3  |  12/04/2017 19:40:05          | Out   |
+-----------+-------------------------------+-------+
</code>```

Hi! I have problem with my project and I thought some of you would help me. I have table like that. It is simple table that indicates worker getting in and out of company. I need to do procedure which would take ID and number of day as In parameters and it would show how many hours and minutes that worker has worked that day. Thanks for help.

答:
Maybe something similar to </p>

```<code>select sum( time1 - prev_time1 ) from (
    select InOut, time1,
  prev(time1) over (partition by worker_id order by time1) prev_time1,
  prev(InOut) over (partition by worker_id order by time1) prev_inOut
from MyTABLE
where TimeColumn between trunc(:date1) and trunc( :date1 + 1 )
and workerId = :workerId
) t1
where InOut = 'Out' and prev_InOut = 'In'
</code>```

<p>would go.
:workerId and :date1 are variables to constrain to one date and one worker as required. </p>

Body:
+-----------+-------------------------------+-------+
| Worker ID | Time(MM/DD/YYYY Hour:Min:Sec) | InOut |
+-----------+-------------------------------+-------+
|        1  |  12/04/2017 10:00:00          | In    |
|        2  |  12/04/2017 10:00:00          | In    |
|        2  |  12/04/2017 18:40:02          | Out   |
|        3  |  12/04/2017 10:00:00          | In    |
|        1  |  12/04/2017 12:01:00          | Out   |
|        3  |  12/04/2017 19:40:05          | Out   |
+-----------+-------------------------------+-------+

Hi! I have problem with my project and I thought some of you would help me. I have table like that. It is simple table that indicates worker getting in and out of company. I need to do procedure which would take ID and number of day as In parameters and it would show how many hours and minutes that worker has worked that day. Thanks for help.

Body:
Maybe something similar to

select sum( time1 - prev_time1 ) from (
    select InOut, time1,
  prev(time1) over (partition by worker_id order by time1) prev_time1,
  prev(InOut) over (partition by worker_id order by time1) prev_inOut
from MyTABLE
where TimeColumn between trunc(:date1) and trunc( :date1 + 1 )
and workerId = :workerId
) t1
where InOut = 'Out' and prev_InOut = 'In'

would go.
:workerId and :date1 are variables to constrain to one date and one worker as required.


问:
Creating files from a Python script within a shell script within a shell script
I'm trying to run a Python script from a shell script within a shell script, but I'm running into some problems.

Imagine my root shell script looks like this:

```<code>echo "test0"
sh ./test/test1/test2.sh
</code>```

and my test2.sh:

```<code>echo "test2"
python testme.py
</code>```

The python file is in the same directory as test2.sh but test2.sh's working directory seems to be the root's so it cannot find the python script. So, if I give the python script's absolute location to test2.sh, the python file runs, but when the python file creates new files, it's created in the root.

If there is a solution so that I don't have to edit the python script to create new files in the directory of the python script, please let me know.

答:
Here is your root script:

```<code>echo "test0"
cd test/test1
sh ./test2.sh
</code>```

Your script test2 is launched with the environment of your root script. So you just have to cd in your root script.

Body:
I'm trying to run a Python script from a shell script within a shell script, but I'm running into some problems.

Imagine my root shell script looks like this:

echo "test0"
sh ./test/test1/test2.sh

and my test2.sh:

echo "test2"
python testme.py

The python file is in the same directory as test2.sh but test2.sh's working directory seems to be the root's so it cannot find the python script. So, if I give the python script's absolute location to test2.sh, the python file runs, but when the python file creates new files, it's created in the root.

If there is a solution so that I don't have to edit the python script to create new files in the directory of the python script, please let me know.

Body:
Here is your root script:

echo "test0"
cd test/test1
sh ./test2.sh

Your script test2 is launched with the environment of your root script. So you just have to cd in your root script.


问:
This program is blocked by group policy. in godaddy windows hosting
I am trying to execute a .exe file through Scheduled Tasks in Godaddy but when this task is run there is an error of

"This program is blocked by group policy".

Application is a C# console application.

答:
In the web.config, comment out everything within <system.codedom>. GoDaddy blocks it.

```<code><!--<compilers>
  <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.8.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701"/>
  <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.8.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+"/>
</compilers>-->
</code>```

Body:
In the web.config, comment out everything within <system.codedom>. GoDaddy blocks it.

<!--<compilers>
  <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.8.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701"/>
  <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.8.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/>
</compilers>-->


问:
How to delete an SMS from the inbox in Android programmatically?
On Android phones SMS messages registered to applications also get sent to the device's inbox.  However to prevent clutter, it'd be nice to be able to remove application specific SMS messages from the inbox to reduce the potential overflow of those messages.

Questions on other Google groups on getting a definitive answer on a programmatic way to delete SMS messages from the Android inbox don't seem to be pressing.

So the scenario:

Android App startup.

register SMS message types X,Y and Z

messages P,Q,X,Y,Z stream in over the course of time, all deposited in inbox

Android application detects receipt of X,Y,Z (presumably as part of the program interrupt event)

process X,Y,Z

Desirement!!! X,Y,Z are deleted from the Android inbox

Has it been done?  Can it be done?

答:
Sample for deleting one SMS, not conversation:</p>

```<code>getContentResolver().delete(Uri.parse("content://sms/conversations/" + threadID), "_id = ?", new String[]{id});
</code>```

OwnerDisplayName: dmyung

Body:
Sample for deleting one SMS, not conversation:

getContentResolver().delete(Uri.parse("content://sms/conversations/" + threadID), "_id = ?", new String[]{id});


问:
Unable to populate custom fields in template from API
Docusign API V3 - I have a sandbox account, a template set up with custom fields. I have the soap xml code to create the envelope, attach the template (by ID) but I cannot figure out how to populate the custom fields before it is emailed. I have tried using both

```<code>          <CustomField>
            <Name>Custom Field List</Name>
            <Show>True</Show>
            <Required>True</Required>
            <Value />
            <CustomFieldType>List</CustomFieldType>
            <ListItems>One; Two; Three</ListItems>
          </CustomField>
        <CustomFields>
          <CustomField>
            <Name>FullName</Name>
            <Show>True</Show>
            <Required>True</Required>
            <Value>John W Smith</Value>
          </CustomField>
          <CustomField>
            <Name>Address</Name>
            <Show>True</Show>
            <Required>True</Required>
            <Value>123 Any Way Tempe, AZ 85082</Value>
            <CustomFieldType>List</CustomFieldType>
            <ListItems>One; Two; Three</ListItems>
          </CustomField>
        </CustomFields>
</code>```

and

```<code>    <Document>
      <ID>1</ID>
      <Name>3 Page Purchase Contract Template - test </Name>
      <!--PDFBytes>base64Binary</PDFBytes-->
      <!--TransformPdfFields>true</TransformPdfFields-->
      <FileExtension>pdf</FileExtension>
        <DocumentFields>
          <DocumentField>
            <Name>FullName</Name>
            <Value>John W Smith</Value>
          </DocumentField>
        </DocumentFields>
    </Document>
</code>```

In the code, even in different places, I don't get errors but nothing happens either. There is no information filled in - This is my sample XML code so far - Security is fine - the envelope with the template is emailed - I cannot figure out what I am missing.

```<code><?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
<CreateEnvelopeFromTemplatesAndForms xmlns="http://www.docusign.net/API/3.0">
  <EnvelopeInformation>
    <TransactionID></TransactionID>
    <Asynchronous>false</Asynchronous>
    <AccountId>123</AccountId>
    <EmailBlurb>Test CreateEnvelopeFromTemplatesAndForms - Customized message goes here. This is good progress, need to complete building the script then integrate with SMS script. </EmailBlurb>
    <Subject>Test CreateEnvelopeFromTemplatesAndForms</Subject>
    <SigningLocation>Online</SigningLocation>
            <CustomFields>
              <CustomField>
                <Name>Home Owner</Name>
                <Show>True</Show>
                <Required>True</Required>
                <Value>John W Smith</Value>
              </CustomField>
              <CustomField>
                <Name>Home Address</Name>
                <Show>True</Show>
                <Required>True</Required>
                <Value>123 Any Way Tempe, AZ 85082</Value>
              </CustomField>
              <!--CustomField>
                <Name>Custom Field List</Name>
                <Show>True</Show>
                <Required>True</Required>
                <Value />
                <CustomFieldType>List</CustomFieldType>
                <ListItems>One; Two; Three</ListItems>
              </CustomField-->
            </CustomFields>
    <AutoNavigation>true</AutoNavigation>
    <EnvelopeIdStamping>true</EnvelopeIdStamping>
    <AuthoritativeCopy>false</AuthoritativeCopy>
    <EnforceSignerVisibility>false</EnforceSignerVisibility>
    <EnableWetSign>false</EnableWetSign>
    <AllowRecipientRecursion>true</AllowRecipientRecursion>
    <AllowMarkup>false</AllowMarkup>
  </EnvelopeInformation>
  <CompositeTemplates>
    <CompositeTemplate>
      <ServerTemplates>
        <ServerTemplate>
          <Sequence>1</Sequence>
          <TemplateID>123</TemplateID>
        </ServerTemplate>
      </ServerTemplates>
      <InlineTemplates>
        <InlineTemplate>
          <Sequence>2</Sequence>
          <Envelope>
            <Recipients>
              <Recipient>
                <ID>1</ID>
                <UserName>Home Owner Email</UserName>
                <Email>mm@mm.com</Email>
                <Type>Signer</Type>
                <AccessCode />
                <RequireIDLookup>false</RequireIDLookup>
                <RoutingOrder>1</RoutingOrder>
                <Note />
                <RoleName>SignerOne</RoleName>
                <DefaultRecipient>true</DefaultRecipient>
              </Recipient>
            </Recipients>
            <Tabs>
              <Tab>
                <DocumentID>1</DocumentID>
                <RecipientID>1</RecipientID>
                <PageNumber>3</PageNumber>
                <XPosition>12</XPosition>
                <YPosition>10</YPosition>
                <ScaleValue>1.00000</ScaleValue>
                <Type>SignHere</Type>
                <Name>SignHere</Name>
                <TabLabel>Sign Here 1</TabLabel>
                <Value />
                <CustomTabHeight>0</CustomTabHeight>
                <CustomTabRequired>false</CustomTabRequired>
                <CustomTabLocked>false</CustomTabLocked>
                <CustomTabDisableAutoSize>false</CustomTabDisableAutoSize>
                <TemplateLocked>false</TemplateLocked>
                <TemplateRequired>false</TemplateRequired>
              </Tab>
            </Tabs>
            <Subject>Sample Form</Subject>
            <EmailBlurb />
            <SigningLocation>Online</SigningLocation>
            <EnableWetSign>true</EnableWetSign>
          </Envelope>
       </InlineTemplate>
      </InlineTemplates>
        <PDFMetaDataTemplate>
          <Sequence>3</Sequence>
        </PDFMetaDataTemplate>
        <Document>
          <ID>1</ID>
          <Name>3 Page Purchase Contract Powerform.doc.pdf</Name>
          <!--PDFBytes>base64Binary</PDFBytes-->
          <TransformPdfFields />
          <FileExtension>pdf</FileExtension>
            <DocumentFields>
              <DocumentField>
                <Name>Address</Name>
                <Value>123 Any Way Tempe, AZ 85281</Value>
              </DocumentField>
            </DocumentFields>
        </Document>
    </CompositeTemplate>
  </CompositeTemplates>
   <ActivateEnvelope>true</ActivateEnvelope>
</CreateEnvelopeFromTemplatesAndForms>
  </soap:Body>
</soap:Envelope>
</code>```

答:
Tazz602,

DocuSign terms can be a little misleading, Custom Fields are Sender only fields that don't get burnished to the visible document, aka metadata for data collection that the recipients can't change. Tabs | Secure Fields are visible and can be sender or recipient, editable or read-only and are burnished to the visible document unless they are fields for CarbonCopy users.

If you really mean Custom Fields (metadata filled in by the sender) or tabs filled in by sender or recipient (in this example, just signing tabs) then I suggest you look at below JSON example and then the XML below so that you will see how and where to set and to retrieve the different types of custom fields and tabs. Remember Recipient Custom fields are the oldest and are just an array of 3 of 100 characters, where envelope and document custom fields are an array of key-value pairs. It appears you are sending XML via SOAP yet the same rules apply and if you look at an envelope sent via REST by using SOAP you can see the actual XML format to send via SOAP as well.

Header

```<code>Content-Type: multipart/form-data; boundary=AAA
</code>```

JSON

```<code>    --AAA
Content-Type: application/json
Content-Disposition: form-data

{
"emailBlurb": "Test for CEFTAF Lab 2 Custom Fields Recipient Fields Document Fields",
"emailSubject": "Test for Dev 201 Lab 2",
"status": "created",
"enforceSignerVisibility" : "true",
               "notification":{
              "useAccountDefaults":"false",
              "reminders":{
                 "reminderEnabled":"true",
                 "reminderDelay":"2",
                 "reminderFrequency":"2"
              },
              "expirations":{
                 "expireEnabled":"true",
                 "expireAfter":"15",
                 "expireWarn":"1"
              }
              },
"compositeTemplates": [{
"inlineTemplates": [{
"sequence": "1",
"customFields": {
    "textCustomFields": [
      {
        "fieldId": "123",
        "name": "MYCustomID",
        "show": "false",
        "required": "false",
        "value": "myId012345"
      }
    ],
    "listCustomFields": [
      {
        "listItems": [
          "elementValue1","elementValue2","elementValue3"
        ],
        "fieldId": "1234",
        "name": "myArrayListofItems",
        "show": "false",
        "required": "false",
        "value": "3"
      }
    ]
  },

"documents": [{
"documentId": "1",
"name": "test1.txt",
      "documentFields": [
        {
          "name": "Test1",
          "value": "value for test1"
        }
      ],
},
            {
"documentId": "2",
"name": "test2.txt"
},
            {
"documentId": "3",
"name": "test3.txt"
}

            ],
"recipients": {
            "carbonCopies": [
                            {
                                "email": "dsproservedemosoap01+Testcc@gmail.com",
                                "name": "David Grigsby (see all but 3 document)",
                                "recipientId": "3",
                                "routingOrder": "3"
                            },
                            {
                                "email": "dsproservedemosoap01+Testcc1@gmail.com",
                                "name": "David Grigsby (see all)",
                                "recipientId": "4",
                                "routingOrder": "4"
                            }
                            ],
"signers": [{
"recipientId": "1",
"customFields": [
  "Recip 1 ID 1234"
],
"name": "David Grigsby (Sees all)",
"email": "dsproservedemosoap01+Test1@gmail.com",
                    "routingOrder": "1",
                    "tabs": {
                    "signHereTabs": [{
                      "anchorString": "Sign1",
                      "tabLabel": "Sign Here 1"
                      }]
                    }
},
                {
"recipientId": "2",
"name": "David Grigsby (sees all but page 2)",
"email": "david.grigsby@example.com",
                    "requireSignOnPaper": "true",
                    "routingOrder": "2",
                    "tabs": {
                    "signHereTabs": [{
                      "anchorString": "Sign2",
                      "tabLabel": "Sign Here 2"
                      }]
                    }
}
                ]
}
}]
}]
}

--AAA
Content-Type: application/txt
Content-Disposition: file; filename="test1.txt"; documentid=1

Test Document 1

Sign1 Here _______________________________    Custom1 Approve:

Sign2 Here _______________________________    Custom2 Approve:

--AAA
Content-Type: application/txt
Content-Disposition: file; filename="test2.txt"; documentid=2

Test Document 2

Sign1 Here _______________________________

--AAA
Content-Type: application/txt
Content-Disposition: file; filename="test3.txt"; documentid=3

Test Document 3

No Tabs for anyone means visbile to all by default unless excluded

--AAA--
</code>```

XML
GET - REST

https://demo.docusign.net/restapi/v2/accounts/999999/envelopes/35f51755-5945-4db1-a376-bf5ce7fb4dbf/custom_fields.xml

```<code><customFields xmlns="http://www.docusign.com/restapi" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<listCustomFields>
    <listCustomField>
        <fieldId>210499477</fieldId>
        <name>myArrayListofItems</name>
        <required>false</required>
        <show>false</show>
        <value>3</value>
        <listItems xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
            <a:string>elementValue1</a:string>
            <a:string>elementValue2</a:string>
            <a:string>elementValue3</a:string>
        </listItems>
    </listCustomField>
</listCustomFields>
<textCustomFields>
    <textCustomField>
        <fieldId>210499476</fieldId>
        <name>MYCustomID</name>
        <required>false</required>
        <show>false</show>
        <value>myId012345</value>
    </textCustomField>
</textCustomFields>
</code>```

SOAP

```<code><?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <soap:Header>
        <wsa:Action>http://www.docusign.net/API/3.0/RequestEnvelopeResponse</wsa:Action>
        <wsa:MessageID>urn:uuid:40ffda2d-b9f9-423a-8e39-74dac07cf994</wsa:MessageID>
        <wsa:RelatesTo>urn:uuid:24dc8bbd-92a0-4dcc-b517-6a3aac69d596</wsa:RelatesTo>
        <wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
        <wsse:Security>
            <wsu:Timestamp wsu:Id="Timestamp-6ca93662-5aad-4cc0-92ad-f614e4aeb225">
                <wsu:Created>2017-12-05T16:34:20Z</wsu:Created>
                <wsu:Expires>2017-12-05T16:39:20Z</wsu:Expires>
            </wsu:Timestamp>
        </wsse:Security>
    </soap:Header>
    <soap:Body>
        <RequestEnvelopeResponse xmlns="http://www.docusign.net/API/3.0">
            <RequestEnvelopeResult>
                <AccountId>46d46020-570f-9999-8f02-c9859f65fc45</AccountId>
                <Documents>
                    <Document>
                        <ID>1</ID>
                        <Name>test1.txt</Name>
                        <PDFBytes>AA==</PDFBytes>
                        <FileExtension>pdf</FileExtension>
                    </Document>
                    <Document>
                        <ID>2</ID>
                        <Name>test2.txt</Name>
                        <PDFBytes>AA==</PDFBytes>
                        <FileExtension>pdf</FileExtension>
                    </Document>
                    <Document>
                        <ID>3</ID>
                        <Name>test3.txt</Name>
                        <PDFBytes>AA==</PDFBytes>
                        <FileExtension>pdf</FileExtension>
                    </Document>
                </Documents>
                <Recipients>
                    <Recipient>
                        <ID>1</ID>
                        <UserName>David Grigsby (Sees all)</UserName>
                        <Email>dsproservedemosoap01+Test1@gmail.com</Email>
                        <Type>Signer</Type>
                        <AccessCode />
                        <RequireIDLookup>false</RequireIDLookup>
                        <RoutingOrder>1</RoutingOrder>
                        <Note />
                    </Recipient>
                    <Recipient>
                        <ID>2</ID>
                        <UserName>David Grigsby (sees all but page 2)</UserName>
                        <Email>david.grigsby@example.com</Email>
                        <Type>Signer</Type>
                        <AccessCode />
                        <RequireIDLookup>false</RequireIDLookup>
                        <RoutingOrder>2</RoutingOrder>
                        <Note />
                    </Recipient>
                    <Recipient>
                        <ID>3</ID>
                        <UserName>David Grigsby (see all but 3 document)</UserName>
                        <Email>dsproservedemosoapui+Testcc@gmail.com</Email>
                        <Type>CarbonCopy</Type>
                        <AccessCode />
                        <RequireIDLookup>false</RequireIDLookup>
                        <RoutingOrder>3</RoutingOrder>
                        <Note />
                    </Recipient>
                    <Recipient>
                        <ID>4</ID>
                        <UserName>David Grigsby (see all)</UserName>
                        <Email>dsproservedemosoap01+Testcc1@gmail.com</Email>
                        <Type>CarbonCopy</Type>
                        <AccessCode />
                        <RequireIDLookup>false</RequireIDLookup>
                        <RoutingOrder>4</RoutingOrder>
                        <Note />
                    </Recipient>
                </Recipients>
                <Tabs>
                    <Tab>
                        <DocumentID>1</DocumentID>
                        <RecipientID>1</RecipientID>
                        <PageNumber>1</PageNumber>
                        <XPosition>70</XPosition>
                        <YPosition>49</YPosition>
                        <ScaleValue>1</ScaleValue>
                        <AnchorTabItem>
                            <AnchorTabString>Sign1</AnchorTabString>
                            <Unit>Pixels</Unit>
                        </AnchorTabItem>
                        <Type>SignHere</Type>
                        <Name>SignHere</Name>
                        <TabLabel>Sign Here 1</TabLabel>
                        <Value />
                        <CustomTabRequired>false</CustomTabRequired>
                        <CustomTabLocked>false</CustomTabLocked>
                    </Tab>
                    <Tab>
                        <DocumentID>1</DocumentID>
                        <RecipientID>1</RecipientID>
                        <PageNumber>1</PageNumber>
                        <XPosition>350</XPosition>
                        <YPosition>92</YPosition>
                        <ScaleValue>1</ScaleValue>
                        <AnchorTabItem>
                            <AnchorTabString>Custom1 Approve:</AnchorTabString>
                            <Unit>Pixels</Unit>
                        </AnchorTabItem>
                        <Type>Approve</Type>
                        <Name>Please Approve this</Name>
                        <TabLabel>Custom API Approve_1</TabLabel>
                        <Value />
                        <CustomTabWidth>125</CustomTabWidth>
                        <CustomTabHeight>39</CustomTabHeight>
                        <CustomTabRequired>false</CustomTabRequired>
                        <CustomTabLocked>false</CustomTabLocked>
                        <CustomTabDisableAutoSize>false</CustomTabDisableAutoSize>
                    </Tab>
                    <Tab>
                        <DocumentID>1</DocumentID>
                        <RecipientID>2</RecipientID>
                        <PageNumber>1</PageNumber>
                        <XPosition>70</XPosition>
                        <YPosition>92</YPosition>
                        <ScaleValue>1</ScaleValue>
                        <AnchorTabItem>
                            <AnchorTabString>Sign2</AnchorTabString>
                            <Unit>Pixels</Unit>
                        </AnchorTabItem>
                        <Type>SignHere</Type>
                        <Name>SignHere</Name>
                        <TabLabel>Sign Here 2</TabLabel>
                        <Value />
                        <CustomTabRequired>false</CustomTabRequired>
                        <CustomTabLocked>false</CustomTabLocked>
                    </Tab>
                    <Tab>
                        <DocumentID>1</DocumentID>
                        <RecipientID>2</RecipientID>
                        <PageNumber>1</PageNumber>
                        <XPosition>350</XPosition>
                        <YPosition>135</YPosition>
                        <ScaleValue>1</ScaleValue>
                        <AnchorTabItem>
                            <AnchorTabString>Custom2 Approve:</AnchorTabString>
                            <Unit>Pixels</Unit>
                        </AnchorTabItem>
                        <Type>Approve</Type>
                        <Name>Please Approve this</Name>
                        <TabLabel>Custom API Approve_2</TabLabel>
                        <Value />
                        <CustomTabWidth>125</CustomTabWidth>
                        <CustomTabHeight>39</CustomTabHeight>
                        <CustomTabRequired>false</CustomTabRequired>
                        <CustomTabLocked>false</CustomTabLocked>
                        <CustomTabDisableAutoSize>false</CustomTabDisableAutoSize>
                    </Tab>
                </Tabs>
                <Subject>Test for Dev 201 Lab 2</Subject>
                <EmailBlurb>Test for CEFTAF Lab 2 Custom Fields Recipient Fields Document Fields</EmailBlurb>
                <SigningLocation>Online</SigningLocation>
                <CustomFields>
                    <CustomField>
                        <Name>MYCustomID</Name>
                        <Show>False</Show>
                        <Required>False</Required>
                        <Value>myId012345</Value>
                    </CustomField>
                    <CustomField>
                        <Name>myArrayListofItems</Name>
                        <Show>False</Show>
                        <Required>False</Required>
                        <Value>3</Value>
                        <CustomFieldType>List</CustomFieldType>
                        <ListItems>elementValue1;elementValue2;elementValue3</ListItems>
                    </CustomField>
                </CustomFields>
                <AutoNavigation>true</AutoNavigation>
                <EnvelopeIdStamping>true</EnvelopeIdStamping>
                <AuthoritativeCopy>false</AuthoritativeCopy>
                <Notification>
                    <Reminders>
                        <ReminderEnabled>true</ReminderEnabled>
                        <ReminderDelay>2</ReminderDelay>
                        <ReminderFrequency>2</ReminderFrequency>
                    </Reminders>
                    <Expirations>
                        <ExpireEnabled>true</ExpireEnabled>
                        <ExpireAfter>15</ExpireAfter>
                        <ExpireWarn>1</ExpireWarn>
                    </Expirations>
                </Notification>
                <EnforceSignerVisibility>false</EnforceSignerVisibility>
                <AllowMarkup>false</AllowMarkup>
                <AllowReassign>true</AllowReassign>
            </RequestEnvelopeResult>
        </RequestEnvelopeResponse>
    </soap:Body>
</soap:Envelope>
</code>```

Body:
Docusign API V3 - I have a sandbox account, a template set up with custom fields. I have the soap xml code to create the envelope, attach the template (by ID) but I cannot figure out how to populate the custom fields before it is emailed. I have tried using both

          <CustomField>
            <Name>Custom Field List</Name>
            <Show>True</Show>
            <Required>True</Required>
            <Value />
            <CustomFieldType>List</CustomFieldType>
            <ListItems>One; Two; Three</ListItems>
          </CustomField>
        <CustomFields>
          <CustomField>
            <Name>FullName</Name>
            <Show>True</Show>
            <Required>True</Required>
            <Value>John W Smith</Value>
          </CustomField>
          <CustomField>
            <Name>Address</Name>
            <Show>True</Show>
            <Required>True</Required>
            <Value>123 Any Way Tempe, AZ 85082</Value>
            <CustomFieldType>List</CustomFieldType>
            <ListItems>One; Two; Three</ListItems>
          </CustomField>
        </CustomFields>

and

    <Document>
      <ID>1</ID>
      <Name>3 Page Purchase Contract Template - test </Name>

      <FileExtension>pdf</FileExtension>
        <DocumentFields>
          <DocumentField>
            <Name>FullName</Name>
            <Value>John W Smith</Value>
          </DocumentField>
        </DocumentFields>
    </Document>

In the code, even in different places, I don't get errors but nothing happens either. There is no information filled in - This is my sample XML code so far - Security is fine - the envelope with the template is emailed - I cannot figure out what I am missing.

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
<CreateEnvelopeFromTemplatesAndForms xmlns="http://www.docusign.net/API/3.0">
  <EnvelopeInformation>
    <TransactionID></TransactionID>
    <Asynchronous>false</Asynchronous>
    <AccountId>123</AccountId>
    <EmailBlurb>Test CreateEnvelopeFromTemplatesAndForms - Customized message goes here. This is good progress, need to complete building the script then integrate with SMS script. </EmailBlurb>
    <Subject>Test CreateEnvelopeFromTemplatesAndForms</Subject>
    <SigningLocation>Online</SigningLocation>
            <CustomFields>
              <CustomField>
                <Name>Home Owner</Name>
                <Show>True</Show>
                <Required>True</Required>
                <Value>John W Smith</Value>
              </CustomField>
              <CustomField>
                <Name>Home Address</Name>
                <Show>True</Show>
                <Required>True</Required>
                <Value>123 Any Way Tempe, AZ 85082</Value>
              </CustomField>

            </CustomFields>
    <AutoNavigation>true</AutoNavigation>
    <EnvelopeIdStamping>true</EnvelopeIdStamping>
    <AuthoritativeCopy>false</AuthoritativeCopy>
    <EnforceSignerVisibility>false</EnforceSignerVisibility>
    <EnableWetSign>false</EnableWetSign>
    <AllowRecipientRecursion>true</AllowRecipientRecursion>
    <AllowMarkup>false</AllowMarkup>
  </EnvelopeInformation>
  <CompositeTemplates>
    <CompositeTemplate>
      <ServerTemplates>
        <ServerTemplate>
          <Sequence>1</Sequence>
          <TemplateID>123</TemplateID>
        </ServerTemplate>
      </ServerTemplates>
      <InlineTemplates>
        <InlineTemplate>
          <Sequence>2</Sequence>
          <Envelope>
            <Recipients>
              <Recipient>
                <ID>1</ID>
                <UserName>Home Owner Email</UserName>
                <Email>mm@mm.com</Email>
                <Type>Signer</Type>
                <AccessCode />
                <RequireIDLookup>false</RequireIDLookup>
                <RoutingOrder>1</RoutingOrder>
                <Note />
                <RoleName>SignerOne</RoleName>
                <DefaultRecipient>true</DefaultRecipient>
              </Recipient>
            </Recipients>
            <Tabs>
              <Tab>
                <DocumentID>1</DocumentID>
                <RecipientID>1</RecipientID>
                <PageNumber>3</PageNumber>
                <XPosition>12</XPosition>
                <YPosition>10</YPosition>
                <ScaleValue>1.00000</ScaleValue>
                <Type>SignHere</Type>
                <Name>SignHere</Name>
                <TabLabel>Sign Here 1</TabLabel>
                <Value />
                <CustomTabHeight>0</CustomTabHeight>
                <CustomTabRequired>false</CustomTabRequired>
                <CustomTabLocked>false</CustomTabLocked>
                <CustomTabDisableAutoSize>false</CustomTabDisableAutoSize>
                <TemplateLocked>false</TemplateLocked>
                <TemplateRequired>false</TemplateRequired>
              </Tab>
            </Tabs>
            <Subject>Sample Form</Subject>
            <EmailBlurb />
            <SigningLocation>Online</SigningLocation>
            <EnableWetSign>true</EnableWetSign>
          </Envelope>
       </InlineTemplate>
      </InlineTemplates>
        <PDFMetaDataTemplate>
          <Sequence>3</Sequence>
        </PDFMetaDataTemplate>
        <Document>
          <ID>1</ID>
          <Name>3 Page Purchase Contract Powerform.doc.pdf</Name>

          <TransformPdfFields />
          <FileExtension>pdf</FileExtension>
            <DocumentFields>
              <DocumentField>
                <Name>Address</Name>
                <Value>123 Any Way Tempe, AZ 85281</Value>
              </DocumentField>
            </DocumentFields>
        </Document>
    </CompositeTemplate>
  </CompositeTemplates>
   <ActivateEnvelope>true</ActivateEnvelope>
</CreateEnvelopeFromTemplatesAndForms>
  </soap:Body>
</soap:Envelope>

Body:
Tazz602,

DocuSign terms can be a little misleading, Custom Fields are Sender only fields that don't get burnished to the visible document, aka metadata for data collection that the recipients can't change. Tabs | Secure Fields are visible and can be sender or recipient, editable or read-only and are burnished to the visible document unless they are fields for CarbonCopy users.

If you really mean Custom Fields (metadata filled in by the sender) or tabs filled in by sender or recipient (in this example, just signing tabs) then I suggest you look at below JSON example and then the XML below so that you will see how and where to set and to retrieve the different types of custom fields and tabs. Remember Recipient Custom fields are the oldest and are just an array of 3 of 100 characters, where envelope and document custom fields are an array of key-value pairs. It appears you are sending XML via SOAP yet the same rules apply and if you look at an envelope sent via REST by using SOAP you can see the actual XML format to send via SOAP as well.

Header

Content-Type: multipart/form-data; boundary=AAA

JSON

    --AAA
Content-Type: application/json
Content-Disposition: form-data

{
"emailBlurb": "Test for CEFTAF Lab 2 Custom Fields Recipient Fields Document Fields",
"emailSubject": "Test for Dev 201 Lab 2",
"status": "created",
"enforceSignerVisibility" : "true",
               "notification":{
              "useAccountDefaults":"false",
              "reminders":{
                 "reminderEnabled":"true",
                 "reminderDelay":"2",
                 "reminderFrequency":"2"
              },
              "expirations":{
                 "expireEnabled":"true",
                 "expireAfter":"15",
                 "expireWarn":"1"
              }
              },
"compositeTemplates": [{
"inlineTemplates": [{
"sequence": "1",
"customFields": {
    "textCustomFields": [
      {
        "fieldId": "123",
        "name": "MYCustomID",
        "show": "false",
        "required": "false",
        "value": "myId012345"
      }
    ],
    "listCustomFields": [
      {
        "listItems": [
          "elementValue1","elementValue2","elementValue3"
        ],
        "fieldId": "1234",
        "name": "myArrayListofItems",
        "show": "false",
        "required": "false",
        "value": "3"
      }
    ]
  },

"documents": [{
"documentId": "1",
"name": "test1.txt",
      "documentFields": [
        {
          "name": "Test1",
          "value": "value for test1"
        }
      ],
},
            {
"documentId": "2",
"name": "test2.txt"
},
            {
"documentId": "3",
"name": "test3.txt"
}

            ],
"recipients": {
            "carbonCopies": [
                            {
                                "email": "dsproservedemosoap01+Testcc@gmail.com",
                                "name": "David Grigsby (see all but 3 document)",
                                "recipientId": "3",
                                "routingOrder": "3"
                            },
                            {
                                "email": "dsproservedemosoap01+Testcc1@gmail.com",
                                "name": "David Grigsby (see all)",
                                "recipientId": "4",
                                "routingOrder": "4"
                            }
                            ],
"signers": [{
"recipientId": "1",
"customFields": [
  "Recip 1 ID 1234"
],
"name": "David Grigsby (Sees all)",
"email": "dsproservedemosoap01+Test1@gmail.com",
                    "routingOrder": "1",
                    "tabs": {
                    "signHereTabs": [{
                      "anchorString": "Sign1",
                      "tabLabel": "Sign Here 1"
                      }]
                    }
},
                {
"recipientId": "2",
"name": "David Grigsby (sees all but page 2)",
"email": "david.grigsby@example.com",
                    "requireSignOnPaper": "true",
                    "routingOrder": "2",
                    "tabs": {
                    "signHereTabs": [{
                      "anchorString": "Sign2",
                      "tabLabel": "Sign Here 2"
                      }]
                    }
}
                ]
}
}]
}]
}

--AAA
Content-Type: application/txt
Content-Disposition: file; filename="test1.txt"; documentid=1

Test Document 1

Sign1 Here _______________________________    Custom1 Approve:

Sign2 Here _______________________________    Custom2 Approve:

--AAA
Content-Type: application/txt
Content-Disposition: file; filename="test2.txt"; documentid=2

Test Document 2

Sign1 Here _______________________________

--AAA
Content-Type: application/txt
Content-Disposition: file; filename="test3.txt"; documentid=3

Test Document 3

No Tabs for anyone means visbile to all by default unless excluded

--AAA--

XML
GET - REST

https://demo.docusign.net/restapi/v2/accounts/999999/envelopes/35f51755-5945-4db1-a376-bf5ce7fb4dbf/custom_fields.xml

<customFields xmlns="http://www.docusign.com/restapi" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<listCustomFields>
    <listCustomField>
        <fieldId>210499477</fieldId>
        <name>myArrayListofItems</name>
        <required>false</required>
        <show>false</show>
        <value>3</value>
        <listItems xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
            <a:string>elementValue1</a:string>
            <a:string>elementValue2</a:string>
            <a:string>elementValue3</a:string>
        </listItems>
    </listCustomField>
</listCustomFields>
<textCustomFields>
    <textCustomField>
        <fieldId>210499476</fieldId>
        <name>MYCustomID</name>
        <required>false</required>
        <show>false</show>
        <value>myId012345</value>
    </textCustomField>
</textCustomFields>

SOAP

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <soap:Header>
        <wsa:Action>http://www.docusign.net/API/3.0/RequestEnvelopeResponse</wsa:Action>
        <wsa:MessageID>urn:uuid:40ffda2d-b9f9-423a-8e39-74dac07cf994</wsa:MessageID>
        <wsa:RelatesTo>urn:uuid:24dc8bbd-92a0-4dcc-b517-6a3aac69d596</wsa:RelatesTo>
        <wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
        <wsse:Security>
            <wsu:Timestamp wsu:Id="Timestamp-6ca93662-5aad-4cc0-92ad-f614e4aeb225">
                <wsu:Created>2017-12-05T16:34:20Z</wsu:Created>
                <wsu:Expires>2017-12-05T16:39:20Z</wsu:Expires>
            </wsu:Timestamp>
        </wsse:Security>
    </soap:Header>
    <soap:Body>
        <RequestEnvelopeResponse xmlns="http://www.docusign.net/API/3.0">
            <RequestEnvelopeResult>
                <AccountId>46d46020-570f-9999-8f02-c9859f65fc45</AccountId>
                <Documents>
                    <Document>
                        <ID>1</ID>
                        <Name>test1.txt</Name>
                        <PDFBytes>AA==</PDFBytes>
                        <FileExtension>pdf</FileExtension>
                    </Document>
                    <Document>
                        <ID>2</ID>
                        <Name>test2.txt</Name>
                        <PDFBytes>AA==</PDFBytes>
                        <FileExtension>pdf</FileExtension>
                    </Document>
                    <Document>
                        <ID>3</ID>
                        <Name>test3.txt</Name>
                        <PDFBytes>AA==</PDFBytes>
                        <FileExtension>pdf</FileExtension>
                    </Document>
                </Documents>
                <Recipients>
                    <Recipient>
                        <ID>1</ID>
                        <UserName>David Grigsby (Sees all)</UserName>
                        <Email>dsproservedemosoap01+Test1@gmail.com</Email>
                        <Type>Signer</Type>
                        <AccessCode />
                        <RequireIDLookup>false</RequireIDLookup>
                        <RoutingOrder>1</RoutingOrder>
                        <Note />
                    </Recipient>
                    <Recipient>
                        <ID>2</ID>
                        <UserName>David Grigsby (sees all but page 2)</UserName>
                        <Email>david.grigsby@example.com</Email>
                        <Type>Signer</Type>
                        <AccessCode />
                        <RequireIDLookup>false</RequireIDLookup>
                        <RoutingOrder>2</RoutingOrder>
                        <Note />
                    </Recipient>
                    <Recipient>
                        <ID>3</ID>
                        <UserName>David Grigsby (see all but 3 document)</UserName>
                        <Email>dsproservedemosoapui+Testcc@gmail.com</Email>
                        <Type>CarbonCopy</Type>
                        <AccessCode />
                        <RequireIDLookup>false</RequireIDLookup>
                        <RoutingOrder>3</RoutingOrder>
                        <Note />
                    </Recipient>
                    <Recipient>
                        <ID>4</ID>
                        <UserName>David Grigsby (see all)</UserName>
                        <Email>dsproservedemosoap01+Testcc1@gmail.com</Email>
                        <Type>CarbonCopy</Type>
                        <AccessCode />
                        <RequireIDLookup>false</RequireIDLookup>
                        <RoutingOrder>4</RoutingOrder>
                        <Note />
                    </Recipient>
                </Recipients>
                <Tabs>
                    <Tab>
                        <DocumentID>1</DocumentID>
                        <RecipientID>1</RecipientID>
                        <PageNumber>1</PageNumber>
                        <XPosition>70</XPosition>
                        <YPosition>49</YPosition>
                        <ScaleValue>1</ScaleValue>
                        <AnchorTabItem>
                            <AnchorTabString>Sign1</AnchorTabString>
                            <Unit>Pixels</Unit>
                        </AnchorTabItem>
                        <Type>SignHere</Type>
                        <Name>SignHere</Name>
                        <TabLabel>Sign Here 1</TabLabel>
                        <Value />
                        <CustomTabRequired>false</CustomTabRequired>
                        <CustomTabLocked>false</CustomTabLocked>
                    </Tab>
                    <Tab>
                        <DocumentID>1</DocumentID>
                        <RecipientID>1</RecipientID>
                        <PageNumber>1</PageNumber>
                        <XPosition>350</XPosition>
                        <YPosition>92</YPosition>
                        <ScaleValue>1</ScaleValue>
                        <AnchorTabItem>
                            <AnchorTabString>Custom1 Approve:</AnchorTabString>
                            <Unit>Pixels</Unit>
                        </AnchorTabItem>
                        <Type>Approve</Type>
                        <Name>Please Approve this</Name>
                        <TabLabel>Custom API Approve_1</TabLabel>
                        <Value />
                        <CustomTabWidth>125</CustomTabWidth>
                        <CustomTabHeight>39</CustomTabHeight>
                        <CustomTabRequired>false</CustomTabRequired>
                        <CustomTabLocked>false</CustomTabLocked>
                        <CustomTabDisableAutoSize>false</CustomTabDisableAutoSize>
                    </Tab>
                    <Tab>
                        <DocumentID>1</DocumentID>
                        <RecipientID>2</RecipientID>
                        <PageNumber>1</PageNumber>
                        <XPosition>70</XPosition>
                        <YPosition>92</YPosition>
                        <ScaleValue>1</ScaleValue>
                        <AnchorTabItem>
                            <AnchorTabString>Sign2</AnchorTabString>
                            <Unit>Pixels</Unit>
                        </AnchorTabItem>
                        <Type>SignHere</Type>
                        <Name>SignHere</Name>
                        <TabLabel>Sign Here 2</TabLabel>
                        <Value />
                        <CustomTabRequired>false</CustomTabRequired>
                        <CustomTabLocked>false</CustomTabLocked>
                    </Tab>
                    <Tab>
                        <DocumentID>1</DocumentID>
                        <RecipientID>2</RecipientID>
                        <PageNumber>1</PageNumber>
                        <XPosition>350</XPosition>
                        <YPosition>135</YPosition>
                        <ScaleValue>1</ScaleValue>
                        <AnchorTabItem>
                            <AnchorTabString>Custom2 Approve:</AnchorTabString>
                            <Unit>Pixels</Unit>
                        </AnchorTabItem>
                        <Type>Approve</Type>
                        <Name>Please Approve this</Name>
                        <TabLabel>Custom API Approve_2</TabLabel>
                        <Value />
                        <CustomTabWidth>125</CustomTabWidth>
                        <CustomTabHeight>39</CustomTabHeight>
                        <CustomTabRequired>false</CustomTabRequired>
                        <CustomTabLocked>false</CustomTabLocked>
                        <CustomTabDisableAutoSize>false</CustomTabDisableAutoSize>
                    </Tab>
                </Tabs>
                <Subject>Test for Dev 201 Lab 2</Subject>
                <EmailBlurb>Test for CEFTAF Lab 2 Custom Fields Recipient Fields Document Fields</EmailBlurb>
                <SigningLocation>Online</SigningLocation>
                <CustomFields>
                    <CustomField>
                        <Name>MYCustomID</Name>
                        <Show>False</Show>
                        <Required>False</Required>
                        <Value>myId012345</Value>
                    </CustomField>
                    <CustomField>
                        <Name>myArrayListofItems</Name>
                        <Show>False</Show>
                        <Required>False</Required>
                        <Value>3</Value>
                        <CustomFieldType>List</CustomFieldType>
                        <ListItems>elementValue1;elementValue2;elementValue3</ListItems>
                    </CustomField>
                </CustomFields>
                <AutoNavigation>true</AutoNavigation>
                <EnvelopeIdStamping>true</EnvelopeIdStamping>
                <AuthoritativeCopy>false</AuthoritativeCopy>
                <Notification>
                    <Reminders>
                        <ReminderEnabled>true</ReminderEnabled>
                        <ReminderDelay>2</ReminderDelay>
                        <ReminderFrequency>2</ReminderFrequency>
                    </Reminders>
                    <Expirations>
                        <ExpireEnabled>true</ExpireEnabled>
                        <ExpireAfter>15</ExpireAfter>
                        <ExpireWarn>1</ExpireWarn>
                    </Expirations>
                </Notification>
                <EnforceSignerVisibility>false</EnforceSignerVisibility>
                <AllowMarkup>false</AllowMarkup>
                <AllowReassign>true</AllowReassign>
            </RequestEnvelopeResult>
        </RequestEnvelopeResponse>
    </soap:Body>
</soap:Envelope>


问:
php - Convert array to an array
I have an array like below:

```<code>array:3 [▼
  "_token" => "hLuF5TLimRRkxRUOeeWoOby7iXLNXU7EiHRmTAso"
  "room_id" => array:3 [▼
    0 => "089a6ca8-26de-3ca2-bbbf-17c410d15266"
    1 => "13c56ac2-6c77-3ca7-b24a-2a70f4f0526c"
    2 => "2d9b7392-aa50-37e4-882a-804affb87223"
  ]
  "new_electric" => array:3 [▼
    0 => "123"
    1 => "234"
    2 => "345"
  ]
]
</code>```

How can I slice it into new array which like

```<code>array:4 [▼
  "_token" => "hLuF5TLimRRkxRUOeeWoOby7iXLNXU7EiHRmTAso"
  "1" => array:2 [▼
    "room_d" => "089a6ca8-26de-3ca2-bbbf-17c410d15266"
    "new_electric => "123"
  ]
  "2" => array:2 [▼
    "room_id" => "13c56ac2-6c77-3ca7-b24a-2a70f4f0526c"
    "new_electric" => "234"
  ]
  "3" => array:2 [▼
    "room_id" => "2d9b7392-aa50-37e4-882a-804affb87223"
    "new_electric" => "345"
      ]
]
</code>```

I think I need to use an array_push but I don't know how to do that ? Please help.

答:
You can use array_map with no callback for that (check example #4 in the manual for more detail):

```<code>$result = array_map(null, $arr["room_id"], $arr["new_electric"]);
$result['_token'] = $arr['_token'];
</code>```

Title: php - Convert array to an array

Body:
I have an array like below:

array:3 [▼
  "_token" => "hLuF5TLimRRkxRUOeeWoOby7iXLNXU7EiHRmTAso"
  "room_id" => array:3 [▼
    0 => "089a6ca8-26de-3ca2-bbbf-17c410d15266"
    1 => "13c56ac2-6c77-3ca7-b24a-2a70f4f0526c"
    2 => "2d9b7392-aa50-37e4-882a-804affb87223"
  ]
  "new_electric" => array:3 [▼
    0 => "123"
    1 => "234"
    2 => "345"
  ]
]

How can I slice it into new array which like

array:4 [▼
  "_token" => "hLuF5TLimRRkxRUOeeWoOby7iXLNXU7EiHRmTAso"
  "1" => array:2 [▼
    "room_d" => "089a6ca8-26de-3ca2-bbbf-17c410d15266"
    "new_electric => "123"
  ]
  "2" => array:2 [▼
    "room_id" => "13c56ac2-6c77-3ca7-b24a-2a70f4f0526c"
    "new_electric" => "234"
  ]
  "3" => array:2 [▼
    "room_id" => "2d9b7392-aa50-37e4-882a-804affb87223"
    "new_electric" => "345"
      ]
]

I think I need to use an array_push but I don't know how to do that ? Please help.

Body:
You can use array_map with no callback for that (check example #4 in the manual for more detail):

$result = array_map(null, $arr["room_id"], $arr["new_electric"]);
$result['_token'] = $arr['_token'];


问:
Why does this loop with scanf always quit?
```<code>#include <stdio.h>

int main(){

  char quit = 'n';

  do{
    printf("Quit? (Y/N)");
    scanf("%c", &quit);
  }while(quit=='n' || quit=='N');
}
</code>```

<p>Why does my program quit after inputting anything? </p>

答:
The %c format specifier accepts any character, including newlines.  So if you press N, then scanf reads that character first but the newline from pressing ENTER is still in the input buffer.  On the next loop iteration the newline character is read.  And because a newline is neither n or N the loop exits.

You need to add a space at the start of your format string.  That will absorb any leading whitespace, including newlines.

```<code>scanf(" %c", &quit);
</code>```

Body:
#include <stdio.h>

int main(){

  char quit = 'n';

  do{
    printf("Quit? (Y/N)");
    scanf("%c", &quit);
  }while(quit=='n' || quit=='N');
}

Why does my program quit after inputting anything?

Body:
The %c format specifier accepts any character, including newlines.  So if you press N, then scanf reads that character first but the newline from pressing ENTER is still in the input buffer.  On the next loop iteration the newline character is read.  And because a newline is neither n or N the loop exits.

You need to add a space at the start of your format string.  That will absorb any leading whitespace, including newlines.

scanf(" %c", &quit);


问:
Convert struct to matrix MATLAB
Is there a way to convert a struct (2 fields with 52 variables each) to a matrix (2x52)? Thank you

```<code>struct:

    sym (1x53)
    prob (1x53)
</code>```

I have tried the following which gives me a 1 x 1 cell array

```<code>symProb = reshape({x.sym}, size(53));
</code>```

I have also tried struct2cell which does the same.

答:
An alternative approach is as follows:</p>

```<code>symVec = [x.sym(:)]
probVec = [x.prob(:)
</code>```

Title: Convert struct to matrix MATLAB

Body:
Is there a way to convert a struct (2 fields with 52 variables each) to a matrix (2x52)? Thank you

struct:

    sym (1x53)
    prob (1x53)

I have tried the following which gives me a 1 x 1 cell array

symProb = reshape({x.sym}, size(53));

I have also tried struct2cell which does the same.

Body:
An alternative approach is as follows:

symVec = [x.sym(:)]
probVec = [x.prob(:)


问:
How can I add attributes to a public method in an F# type?
I'm just trying out F# for the first time, and playing around with its interop with C# projects.

I have custom attributes defined in a C# project, and added a reference to that project in my new F# project. When I attempt to define the attributes to a "let" statement, the "let" is permanently private and so it doesn't matter that the attributes work. When I attempt to change the "let" statement to something else, say, "member", I'm told the attributes can't target the object. How should I be defining the function if I want it to be public and have attributes?

```<code>module FSharp

type public MyClass() =
    class
        //this one will get the attributes, but is always private and can't be made public
        [<Core.NameAttribute("F# name")>]
        [<Core.DescriptionAttribute("F# desc")>]
        let f1 = "test from F#"

        //this one won't get the attributes, but is public and does return the value
        member this.Function1 = f1
    end
</code>```

As I've stated in the code, I seem to have a problem. My attributes are set to only target methods, and I can set them on "let" statements, but not "member" statements. I'm sure this is something silly, but I thank you in advance for your help!

答:
The issue is that your member definition is a property, not a method.  As in Wesley's answer, add some arguments (just empty parens is fine) to make it a method.

(possibly see also

http://blogs.msdn.com/b/timng/archive/2010/04/05/f-object-oriented-programming-quick-guide.aspx

and

http://lorgonblog.wordpress.com/2009/02/13/the-basic-syntax-of-f-classes-interfaces-and-members/

)

Body:
I'm just trying out F# for the first time, and playing around with its interop with C# projects.

I have custom attributes defined in a C# project, and added a reference to that project in my new F# project. When I attempt to define the attributes to a "let" statement, the "let" is permanently private and so it doesn't matter that the attributes work. When I attempt to change the "let" statement to something else, say, "member", I'm told the attributes can't target the object. How should I be defining the function if I want it to be public and have attributes?

module FSharp

type public MyClass() =
    class
        //this one will get the attributes, but is always private and can't be made public
        [<Core.NameAttribute("F# name")>]
        [<Core.DescriptionAttribute("F# desc")>]
        let f1 = "test from F#"

        //this one won't get the attributes, but is public and does return the value
        member this.Function1 = f1
    end

As I've stated in the code, I seem to have a problem. My attributes are set to only target methods, and I can set them on "let" statements, but not "member" statements. I'm sure this is something silly, but I thank you in advance for your help!


问:
How do I turn django's settings object into a dict?
What I have:

```<code>from django.conf import settings

def settings_to_dict(settings)
    cfg = {
        'BOTO3_ACCESS_KEY': settings.BOTO3_ACCESS_KEY,
        'BOTO3_SECRET_KEY': settings.BOTO3_SECRET_KEY,
        # repeat ad nauseum
    }
    return cfg

instance = SomeClassInstantiatedWithADict(**settings_to_dict(settings))
</code>```

What I'd like (using Django 1.11):

```<code>from django.conf import settings

instance = SomeClassInstantiatedWithADict(**settings.to_dict())
</code>```

I've tried:

```<code>from django.conf import settings

instance = SomeClassInstantiatedWithADict(**settings.__dict__)
</code>```

which is close, but __dict__ only gets a small subset of the settings, which I assume are hard coded ones as opposed to added attributes. Thanks for any help!

答:
This turns the entire settings object into a dictionary:

```<code>In [12]: settings_dict = {}

In [13]: for st in dir(settings):
    ...:     if st.startswith('_'):
    ...:         continue
    ...:     settings_dict[st] = getattr(settings, st)
    ...:
    ...:

In [14]: settings_dict
</code>```

This is very exhaustive and it contains all possible attributes of settings.

dir() is a Python builtin. Read about it here

Body:
What I have:

from django.conf import settings

def settings_to_dict(settings)
    cfg = {
        'BOTO3_ACCESS_KEY': settings.BOTO3_ACCESS_KEY,
        'BOTO3_SECRET_KEY': settings.BOTO3_SECRET_KEY,
        # repeat ad nauseum
    }
    return cfg

instance = SomeClassInstantiatedWithADict(**settings_to_dict(settings))

What I'd like (using Django 1.11):

from django.conf import settings

instance = SomeClassInstantiatedWithADict(**settings.to_dict())

I've tried:

from django.conf import settings

instance = SomeClassInstantiatedWithADict(**settings.__dict__)

which is close, but __dict__ only gets a small subset of the settings, which I assume are hard coded ones as opposed to added attributes. Thanks for any help!

Body:
This turns the entire settings object into a dictionary:

In [12]: settings_dict = {}

In [13]: for st in dir(settings):
    ...:     if st.startswith('_'):
    ...:         continue
    ...:     settings_dict[st] = getattr(settings, st)
    ...:
    ...:

In [14]: settings_dict

This is very exhaustive and it contains all possible attributes of settings.

dir() is a Python builtin. Read about it here


问:
Efficient way to copy or merge two ArrayList containing same objects
I have an Object like below

```<code>Product {

String name;

boolean isFiltered;

}
</code>```

We have two lists - masterProductList and filteredProductList containing product.

We have to copy values of filteredProductList(this list has property isFiltered set) to masterProductList.

I can do it with following approches -

Approach 1

```<code>for (Product filterProduct: filteredPL) {
    for (Product masterProduct: masterPL) {
        if (filterProduct.equals(masterProduct)) {
            // Copy Values
            masterProduct.setIsFiltered(filterProduct.getIsFiltered());
        }
    }
}
</code>```

Approach 2

```<code>for (Product filterProduct: filteredPL) {
    for (Product masterProduct: masterPL) {
        //Delete the old product having old values
        masterProduct.remove(filterProduct);
        //Add product with new values
        masterProduct.add(filterProduct);
    }
}
</code>```

Both of these approaches have n square complexity.

Is there any other better way to do this so that we can reduce the complexity?

答:
Create code as:

```<code> Hashmap<String, Boolean> merged =new Hashmap<>();

 for(Product product : masterList)
       Merged.put(product.getName(), product.isfiltered());

 for(Product product : filteredList)
       Merged.put(product.getName(), product.isfiltered());
</code>```

Here is solution for combining for list. Here if name is in both array list so that it can be unique in hashmap with a value of filteredlist as per your requirement.

And one major thing here complexity is very less

O(n + n) = O(2n) = O(n)

Thanks

Body:
I have an Object like below

Product {

String name;

boolean isFiltered;

}

We have two lists - masterProductList and filteredProductList containing product.

We have to copy values of filteredProductList(this list has property isFiltered set) to masterProductList.

I can do it with following approches -

Approach 1

for (Product filterProduct: filteredPL) {
    for (Product masterProduct: masterPL) {
        if (filterProduct.equals(masterProduct)) {
            // Copy Values
            masterProduct.setIsFiltered(filterProduct.getIsFiltered());
        }
    }
}

Approach 2

for (Product filterProduct: filteredPL) {
    for (Product masterProduct: masterPL) {
        //Delete the old product having old values
        masterProduct.remove(filterProduct);
        //Add product with new values
        masterProduct.add(filterProduct);
    }
}

Both of these approaches have n square complexity.

Is there any other better way to do this so that we can reduce the complexity?

Body:
Create code as:

 Hashmap<String, Boolean> merged =new Hashmap<>();

 for(Product product : masterList)
       Merged.put(product.getName(), product.isfiltered());

 for(Product product : filteredList)
       Merged.put(product.getName(), product.isfiltered());

Here is solution for combining for list. Here if name is in both array list so that it can be unique in hashmap with a value of filteredlist as per your requirement.

And one major thing here complexity is very less

O(n + n) = O(2n) = O(n)

Thanks