问:
Python3 For loop iterating through a list won't break

Breaking out of a for loop

My code will not break out of the loop:

(I truncated some parts that were for cosmetics)

lchars = ['', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '!', '@', '\\', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', '_', '+', '`', '~', '[', ']', '{', '}', '|', ';', ':', "'", ',', '.', '/', '<', '>', '?', '`', '¡', '™', '£', '¢', '∞', '§', '¶', '•', 'ª', 'º', '–', '≠', 'œ', '∑','´', '®', '†', '¥', '¨', 'ˆ', 'ø', 'π', '“', '‘', '«', 'å', 'ß', '∆', '˚', '¬', '…', '˜', 'µ', '≤', '≥', '÷', 'æ', 'Ω', '≈', 'ç', '√', '"', ' ']

guessThisPass = str(input("Enter the password you want the python-based brute force hacker to guess (Character limit is 4): "))
if len(guessThisPass) > 4:
    print('I SAID CHARACTER LIMIT IS 4!! I AM TRUNCATING YOUR PASSWORD NOW! ')
    guessThisPass[0:4]
    time.sleep(5)
print("Starting...")
time.sleep(2)
start = time.time()
for d in lchars:
    for c in lchars:
        for b in lchars:
            for a in lchars:
                tryPass = str(str(a) + str(b) + str(c) + str(d)). # I know the strs are probably unnessecary.
                print(tryPass). # Outputing the attempted password
                if tryPass == guessThisPass:
                    break # This never happens

print("Whoo!")
print("That took ", time.time()-start, "seconds.")

```

<p>Using this code, let's say my password was 'a' (which IRL, it is <strong>not</strong>). Then, <em>logically</em>, it <em>should</em> be able to break out of it almost instantly, right? Except <strong>it doesn't</strong>; it just keeps on going, not breaking, even up to the combination '^Bc' or higher. Why does it not break? Do I need to add the if statement in every single one of the loops?</p>

<h2>Tester code</h2>

<p>Also, here is the code I used to test the possible combinations:</p>

<p>(Also truncated redundant cosmetics)</p>

<pre class="lang-py prettyprint-override"><code># All possible combinations
lchars = ['', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '!', '@', '\\', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', '_', '+', '`', '~', '[', ']', '{', '}', '|', ';', ':', "'", ',', '.', '/', '<', '>', '?', '`', '¡', '™', '£', '¢', '∞', '§', '¶', '•', 'ª', 'º', '–', '≠', 'œ', '∑','´', '®', '†', '¥', '¨', 'ˆ', 'ø', 'π', '“', '‘', '«', 'å', 'ß', '∆', '˚', '¬', '…', '˜', 'µ', '≤', '≥', '÷', 'æ', 'Ω', '≈', 'ç', '√', '"', ' ']
# print("Also, there are ", len(lchars), "characters in our character database\n\n")
from time import time
start = time()
for d in lchars:
    for c in lchars:
        for b in lchars:
            for a in lchars:
                print(a+b+c+d)
print("Whoo!")
print("That took ", time()-start, "seconds.")
</code>```

I checked the output of the above code. The letter 'a' was in the output. It should work. Why is it not working?

答:
Yes, break will only get you out of the inner-most loop! I would move that code into a function, which can return tryPass when it finds the right one.

Happy Coding!

Body:
Breaking out of a for loop

My code will not break out of the loop:

(I truncated some parts that were for cosmetics)

lchars = ['', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '!', '@', '\\', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', '_', '+', '`', '~', '[', ']', '{', '}', '|', ';', ':', "'", ',', '.', '/', '<', '>', '?', '`', '¡', '™', '£', '¢', '∞', '§', '¶', '•', 'ª', 'º', '–', '≠', 'œ', '∑','´', '®', '†', '¥', '¨', 'ˆ', 'ø', 'π', '“', '‘', '«', 'å', 'ß', '∆', '˚', '¬', '…', '˜', 'µ', '≤', '≥', '÷', 'æ', 'Ω', '≈', 'ç', '√', '"', ' ']

guessThisPass = str(input("Enter the password you want the python-based brute force hacker to guess (Character limit is 4): "))
if len(guessThisPass) > 4:
    print('I SAID CHARACTER LIMIT IS 4!! I AM TRUNCATING YOUR PASSWORD NOW! ')
    guessThisPass[0:4]
    time.sleep(5)
print("Starting...")
time.sleep(2)
start = time.time()
for d in lchars:
    for c in lchars:
        for b in lchars:
            for a in lchars:
                tryPass = str(str(a) + str(b) + str(c) + str(d)). # I know the strs are probably unnessecary.
                print(tryPass). # Outputing the attempted password
                if tryPass == guessThisPass:
                    break # This never happens

print("Whoo!")
print("That took ", time.time()-start, "seconds.")

Using this code, let's say my password was 'a' (which IRL, it is not). Then, logically, it should be able to break out of it almost instantly, right? Except it doesn't; it just keeps on going, not breaking, even up to the combination '^Bc' or higher. Why does it not break? Do I need to add the if statement in every single one of the loops?

Tester code

Also, here is the code I used to test the possible combinations:

(Also truncated redundant cosmetics)

# All possible combinations
lchars = ['', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '!', '@', '\\', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', '_', '+', '`', '~', '[', ']', '{', '}', '|', ';', ':', "'", ',', '.', '/', '<', '>', '?', '`', '¡', '™', '£', '¢', '∞', '§', '¶', '•', 'ª', 'º', '–', '≠', 'œ', '∑','´', '®', '†', '¥', '¨', 'ˆ', 'ø', 'π', '“', '‘', '«', 'å', 'ß', '∆', '˚', '¬', '…', '˜', 'µ', '≤', '≥', '÷', 'æ', 'Ω', '≈', 'ç', '√', '"', ' ']
# print("Also, there are ", len(lchars), "characters in our character database\n\n")
from time import time
start = time()
for d in lchars:
    for c in lchars:
        for b in lchars:
            for a in lchars:
                print(a+b+c+d)
print("Whoo!")
print("That took ", time()-start, "seconds.")

I checked the output of the above code. The letter 'a' was in the output. It should work. Why is it not working?


来源: stackexchange

问:
NodeJS - Cant find JSON File
I'm working on a express API and i want to connect to a mysql server with this api. Settings are stored in a settings.json file. I read this using

```<code>const config = JSON.parse(require(`fs`).readFileSync('../../settings.json'));
</code>```

This works if the json file is in the same directory. But in this case, the settings file is in the base directory(./settings.json) but the file from where i want it to access is: ./modules/sql/mysql.js. It doesnt work:

```<code>Error: ENOENT: no such file or directory, open '../../settings.json'
</code>```

Is there a better way to access/read a json file? or what am i doing wrong?

Btw. i dont want to pass the settings as a variable. I already tried it but if possible - i want to avoid it.

File/Directory strcture

答:
did you not miss a ../ there?

try replace '../../settings.json' for '../../../settings.json'

btw, its better to use the __dirname approach, but it should work just fine without that too :)

ContentLicense: CC BY-SA 4.0

Title: NodeJS - Cant find JSON File

Body:
I'm working on a express API and i want to connect to a mysql server with this api. Settings are stored in a settings.json file. I read this using

const config = JSON.parse(require(`fs`).readFileSync('../../settings.json'));

This works if the json file is in the same directory. But in this case, the settings file is in the base directory(./settings.json) but the file from where i want it to access is: ./modules/sql/mysql.js. It doesnt work:

Error: ENOENT: no such file or directory, open '../../settings.json'

Is there a better way to access/read a json file? or what am i doing wrong?

Btw. i dont want to pass the settings as a variable. I already tried it but if possible - i want to avoid it.

File/Directory strcture


问:
Azure Data Factory Limits
I have created a simple pipeline that operates as such:

Generates an access token via an Azure Function. No problem.

Uses a Lookup activity to create a table to iterate through the rows (4 columns by 0.5M rows). No problem.

For Each activity (sequential off, batch-size = 10):

(within For Each): Set some variables for checking important values.

(within For Each): Pass values through web activity to return a json.

(within For Each): Copy Data activity mapping parts of the json to the sink-dataset (postgres).

Problem: The pipeline slows to a crawl after approximately 1000 entries/inserts.

I was looking at this documentation regarding the limits of ADF.

ForEach items: 100,000

ForEach parallelism: 20

I would expect that this falls within in those limits unless I'm misunderstanding it.
I also cloned the pipeline and tried it by offsetting the query in one, and it tops out at 2018 entries.

Anyone with more experience be able to give me some idea of what is going on here?

答:
As a suggestion, whenever I have to fiddle with variables inside a foreach, I made a new pipeline for the foreach process, and call it from within the foreach. That way I make sure that the variables get their own context for each iteration of the foreach.

Have you already checked that the bottleneck is not at the source or sink? If the database or web service is under some stress, then going sequential may help if your scenario allows that.

Hope this helped!

Title: Azure Data Factory Limits


问:
How to join strings between parentheses in a list of strings
```<code>poke_list = [... 'Charizard', '(Mega', 'Charizard', 'X)', '78', '130', ...] #1000+ values
</code>```

Is it possible to merge strings that start with '(' and end with ')' and then reinsert it into the same list or a new list?

My desired output poke_list = [... 'Charizard (Mega Charizard X)', '78', '130', ...]

答:
Simple plus-signs can concatenate the strings:</p>

```<code>new_charizard = 'Charizard '+'(Mega'+' Charizard '+'X)'
</code>```

Body:
poke_list = [... 'Charizard', '(Mega', 'Charizard', 'X)', '78', '130', ...] #1000+ values

Is it possible to merge strings that start with '(' and end with ')' and then reinsert it into the same list or a new list?

My desired output poke_list = [... 'Charizard (Mega Charizard X)', '78', '130', ...]

Body:
Simple plus-signs can concatenate the strings:

new_charizard = 'Charizard '+'(Mega'+' Charizard '+'X)'


答:
It is breaking. The problem is, break only breaks from the inner loop; not every loop that contains it. The inner-most loops breaks, then the loop that surrounds it picks up where it left off.

Without changing your code too much, the simplest solution would be to wrap that code in a function and return from it:

```<code>def try_all(lchars):
    for d in lchars:
        for c in lchars:
            for b in lchars:
                for a in lchars:
                    tryPass = a + b + c + d
                    print(tryPass)
                    if tryPass == guessThisPass:
                        return tryPass

cracked_password = try_all(lchars)
</code>```

There are many other improvements that should be touched on, but that isn't appropriate here. Once you get the code working and complete, you can post it on Code Review for general suggestions.

Title: Python3 For loop iterating through a list won't break

Body:
It is breaking. The problem is, break only breaks from the inner loop; not every loop that contains it. The inner-most loops breaks, then the loop that surrounds it picks up where it left off.

Without changing your code too much, the simplest solution would be to wrap that code in a function and return from it:

def try_all(lchars):
    for d in lchars:
        for c in lchars:
            for b in lchars:
                for a in lchars:
                    tryPass = a + b + c + d
                    print(tryPass)
                    if tryPass == guessThisPass:
                        return tryPass

cracked_password = try_all(lchars)

There are many other improvements that should be touched on, but that isn't appropriate here. Once you get the code working and complete, you can post it on Code Review for general suggestions.


问:
add variable to json
So there are many questions on here about this and I tried quite a few without success. </p>

<p>I am trying to add a php variable to a javascript variable and then put it in json. </p>

```<code><?php $symbol_json =  $row['symbol_json']; echo $symbol_json; ?> <!--This is OK!-->
</div>
</center>
<center>
<!-- Widget BEGIN -->
<div class="widget-container">
  <div class="widget-container__widget"></div>
  <div class="widget-copyright"><a href="https://aaaaaaa.com/symbols/<?php echo $row['symbol_html']; ?>/" rel="noopener" target="_blank"><span class="blue-text"><?php echo $row['symbol']?> Symbol Info</span></a></div>

  <script>
    var myVar = '<?php echo $symbol_json ?>'; alert(myVar); //This works ok!

    var myObject = JSON.parse('<?php echo json_encode($symbol_json) ?>'); alert(myObject); //Alert works ok!
  </script>

  <script type="text/javascript" src="https://aaaaaaa.com/external-embedding/symbol-info.js" async>
  {
  //"symbol": "SDT", //This how it is at present and it works. I need to change it to a variable like below.
  "symbol": myObject, //Whether I use myObject or myVar (which both contain SDT) the widget loads a different symbol.
  "width": 1000,
  "locale": "uk",
  "colorTheme": "light",
  "isTransparent": false
}
  </script>
</div>
<!-- Widget END -->
</code>```

答: I realised that I could simply add: <code>"symbol": "<?php echo $symbol_json ?>",</code> although placing PHP into a JS variable worked in a different instance, this seemed to work here. The console error: SyntaxError: Unexpected token m in JSON -- said basically that m (was the first letter of myObject was the error). myObject was therefore not being treated as a variable.    </p>

Title: add variable to json

Body:
So there are many questions on here about this and I tried quite a few without success.

I am trying to add a php variable to a javascript variable and then put it in json.

<?php $symbol_json =  $row['symbol_json']; echo $symbol_json; ?>

<a href="https://aaaaaaa.com/symbols/<?php echo $row['symbol_html']; ?>/" rel="noopener" target="_blank"><?php echo $row['symbol']?> Symbol Info

Body: I realised that I could simply add: "symbol": "<?php echo $symbol_json ?>", although placing PHP into a JS variable worked in a different instance, this seemed to work here. The console error: SyntaxError: Unexpected token m in JSON -- said basically that m (was the first letter of myObject was the error). myObject was therefore not being treated as a variable.


问:
Advice on Web Service or related technology
I am developing a system that must be able to receive an XML  messages (preferably without SOAP envelope) from other's company external system through the internet. I am not sure what technology is external system written in.
The developers from the external company must create a XML sending feature. I would like to minimazie their effort.
Is WCF good choice for that?

The OS will be either Windows XP with IIS 5.1 or Windows Server 2003 with IIS 6.0.
.NET Framework is 3.5.

Thanks.

答:
You can use jQuery using AJAX

```<code>$.ajax( {
  type:'Get',
  url:'http://mysite.com/mywebservice',
  success:function(data) {
    alert(data);
  }
})
</code>```

related examples:

How to call a web service from jQuery

http://vincenthomedev.wordpress.com/2009/02/10/consuming-an-aspnet-web-service-or-page-method-using-jquery/

http://elegantcode.com/2008/12/02/calling-remote-aspnet-web-services-from-jquery/

ContentLicense: CC BY-SA 3.0

Body:
You can use jQuery using AJAX

$.ajax( {
  type:'Get',
  url:'http://mysite.com/mywebservice',
  success:function(data) {
    alert(data);
  }
})

related examples:

How to call a web service from jQuery

http://vincenthomedev.wordpress.com/2009/02/10/consuming-an-aspnet-web-service-or-page-method-using-jquery/

http://elegantcode.com/2008/12/02/calling-remote-aspnet-web-services-from-jquery/


问:
Searching JSON, but NOT case sensitive
So, the title pretty much says it all. I want to search a JSON, but try and not make it case sensitive. So here is my JSON file:

```<code>{    "Data" :
    [
    {"Name": "Widget", "Price": "25.00", "Quantity": "5" },
    {"Name": "Thing", "Price": "15.00", "Quantity": "5" },
    {"Name": "Doodad", "Price": "5.00", "Quantity": "10" }
    ]
}
</code>```

Unfortunately for me, I have not coded in a long time so basically I wrote the JavaScript part of my code in the HTML file also. It's a bit muddled together:

```<code><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
    <body>
        <div>
            <form id="form1">
                What product do you wish to find? <input name="name" type="text" size="20">
            </form>
            <button id="fetchUserDataBtn">Cauta</button>
        </div>
        <hr>
        <div id="response"></div>
        <script>
            document.getElementById('fetchUserDataBtn').addEventListener('click', fetchUserData);

            function fetchUserData(){
                fetch('Vlad3.json')
                    .then(response => response.json())
                    .then(Data => {

                        let output = "Product list"
                        output += '<ul>';
                        var cauta1, cauta2;
                        cauta1=document.getElementById("form1");
                        cauta2=cauta1.elements["name"].value;
                        console.log(cauta2);
                        var nr=0;
                        Data.Data.forEach(function(Data) {
                            if(Data.Name==cauta2)
                            {nr++;
                            output += "Product "+Data.Name;
                            output+="<br>";
                            output+="Price "+Data.Price;
                            output+="<br>";
                            output+="Quantity "+Data.Quantity;
                            }
                        });
                        if(nr==0) {output+="We are sorry, this is not available";}
                        output += '</ul>'
                        document.getElementById("response").innerHTML = output;
                    });
            }
    </script>
    </body>
</html>
</code>```

Can I manage to add a function somewhere in here, so that when the user introduces "Thing" or "Widget" in the search area, it will find the product, even though it's not written exactly like in the JSON file?

答:
Use .toLowerCase or .toUpperCase to do a case-insensitive compare.

```<code>if(Data.Name.toLowerCase()===cauta2.toLowerCase())
</code>```

Title: Searching JSON, but NOT case sensitive

Body:
So, the title pretty much says it all. I want to search a JSON, but try and not make it case sensitive. So here is my JSON file:

{    "Data" :
    [
    {"Name": "Widget", "Price": "25.00", "Quantity": "5" },
    {"Name": "Thing", "Price": "15.00", "Quantity": "5" },
    {"Name": "Doodad", "Price": "5.00", "Quantity": "10" }
    ]
}

Unfortunately for me, I have not coded in a long time so basically I wrote the JavaScript part of my code in the HTML file also. It's a bit muddled together:

<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

            <form id="form1">
                What product do you wish to find? <input name="name" type="text" size="20">
            </form>
            <button id="fetchUserDataBtn">Cauta</button>

Can I manage to add a function somewhere in here, so that when the user introduces "Thing" or "Widget" in the search area, it will find the product, even though it's not written exactly like in the JSON file?

Body:
Use .toLowerCase or .toUpperCase to do a case-insensitive compare.

if(Data.Name.toLowerCase()===cauta2.toLowerCase())


问:
Extend (python's) jsonschema module to allow specification of non-primitive property types
I have a situation where I want a series of modular components to express their parameter requirements via an inline jsonschema definition, held within the code as an attribute containing a dict in which a jsonschema definition is stored. This is used to validate inputs at runtime, but also is used to build a UI at design/specification time.

Most of the time, the parameter requirements fit neatly into the vanilla string, number, object sub-categories as defined by normal jsonschema - but on occasion I want to specify that a particular property be a very particular python datatype - maybe pandas.DataFrame, numpy.ndarray, or MyClass.

Clearly, I'm pushing what would normally be expected of a json schema document, but this feels as though it's something that might be useful, and I was wondering if and whether this extension of the core set of datatypes was possible - and if so, how to go about defining something along those lines.

```<code>{ "title" : "Named DataFrame",
  "type" : "object",
  "properties" : {
      "name" : {      "type" : "string",
                      "description" : "Name of a dataframe"},
      "dataframe" : { "description" : "A pandas.DataFrame object",
                      "type" : pandas.DataFrame }
                },
"additionalProperties" : "false"}
</code>```

答: Yes, the object responsible for this extensibility is jsonschema.TypeChecker.</p>

Body:
I have a situation where I want a series of modular components to express their parameter requirements via an inline jsonschema definition, held within the code as an attribute containing a dict in which a jsonschema definition is stored. This is used to validate inputs at runtime, but also is used to build a UI at design/specification time.

Most of the time, the parameter requirements fit neatly into the vanilla string, number, object sub-categories as defined by normal jsonschema - but on occasion I want to specify that a particular property be a very particular python datatype - maybe pandas.DataFrame, numpy.ndarray, or MyClass.

Clearly, I'm pushing what would normally be expected of a json schema document, but this feels as though it's something that might be useful, and I was wondering if and whether this extension of the core set of datatypes was possible - and if so, how to go about defining something along those lines.

{ "title" : "Named DataFrame",
  "type" : "object",
  "properties" : {
      "name" : {      "type" : "string",
                      "description" : "Name of a dataframe"},
      "dataframe" : { "description" : "A pandas.DataFrame object",
                      "type" : pandas.DataFrame }
                },
"additionalProperties" : "false"}


问:
How to create a N-dimentional feature vector in python
I have 20 pixel values for an image, and i would like to store them in a 20D feature vector, not a 20 length feature vector. I'm new to Python, so i don't know if in Python a regular array is considered a n-dimentional vector, or i need to vectorize a single array somehow. These are the pixels value:

```<code>[245, 247, 199, 199, 210, 213, 216, 196, 225,
    199, 189, 189, 195, 221, 225, 201, 221, 201, 216, 222]
</code>```

I wish to turn them into a 20d dimentional vector, how would i proceed to do that?

答:
You can process each value and then convert it into n-dimensional vector to get 20-D vectorised array.  </p>

```<code>def convertN(arr):
    #create n-dimensional arr
    #Return n-dimensional arr

input =[245,247,199...216,222]

for i,v in enumerate(input):
    input[i] = convertN(v)

print(input)
</code>```

Body:
I have 20 pixel values for an image, and i would like to store them in a 20D feature vector, not a 20 length feature vector. I'm new to Python, so i don't know if in Python a regular array is considered a n-dimentional vector, or i need to vectorize a single array somehow. These are the pixels value:

[245, 247, 199, 199, 210, 213, 216, 196, 225,
    199, 189, 189, 195, 221, 225, 201, 221, 201, 216, 222]

I wish to turn them into a 20d dimentional vector, how would i proceed to do that?

Body:
You can process each value and then convert it into n-dimensional vector to get 20-D vectorised array.

def convertN(arr):
    #create n-dimensional arr
    #Return n-dimensional arr

input =[245,247,199...216,222]

for i,v in enumerate(input):
    input[i] = convertN(v)

print(input)


问:
Visual Studio Code .NET framework not working when launched through unity
I am having trouble getting the .net framework to run inside vscode. I can get the .net framework running fine when I open vscode normally. However, when I open a .cs file in unity and use vscode as my default editor, I get error messages because the .net framework no longer works inside vscode. I need the framework for c# specific autocomplete and syntax errors. I have gotten comments on another post that has been closed saying I need to be more specific about this issue. This is not an issue with unity not supporting the .net framework. I have tried restarting my pc, restarting vscode, restarting unity, reimporting unity packages, and redownloading the .net framework. All c# code runs fine inside and outside of unity regardless of whether vscode was launched using the unity shortcut, but running the dotnet command and any c# related autocomplete/syntax do not work. I can edit c# code from unity by running vscode without unity and navigating to the file. Thanks for your help.

dotnet command run in vscode launched by unity

dotnet command run in vscode launched via shortcut

c# code working inside of unity

Omnisharp error message/log:

Starting OmniSharp server at 5/30/2020, 9:41:51 PM
      Target: a:\Github\Unity\2_Terminal_Hacker\2_Terminal_Hacker.sln

OmniSharp server started.
      Path: c:\Users\0dps1.vscode\extensions\ms-dotnettools.csharp-1.22.0.omnisharp\1.35.2\OmniSharp.exe
      PID: 15076

[info]: OmniSharp.Stdio.Host
          Starting OmniSharp on Windows 6.2.9200.0 (x64) [info]: OmniSharp.Services.DotNetCliService
          DotNetPath set to dotnet [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
          Located 2 MSBuild instance(s)
              1: Visual Studio Community 2019 16.6.30114.105 - "A:\Program Files\Microsoft Visual
  Studio\2019\Community\MSBuild\Current\Bin"
              2: StandAlone 16.4 - "c:\Users\0dps1.vscode\extensions\ms-dotnettools.csharp-1.22.0.omnisharp\1.35.2.msbuild\Current\Bin"
  [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
          Registered MSBuild instance: Visual Studio Community 2019 16.6.30114.105 - "A:\Program Files\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin" [info]:
  OmniSharp.Cake.CakeProjectSystem
          Detecting Cake files in 'a:\Github\Unity\2_Terminal_Hacker'. [info]: OmniSharp.Cake.CakeProjectSystem
          Could not find any Cake files [info]: OmniSharp.MSBuild.ProjectSystem
          Detecting projects in 'a:\Github\Unity\2_Terminal_Hacker\2_Terminal_Hacker.sln'. [info]:
  OmniSharp.MSBuild.ProjectManager
          Queue project update for 'a:\Github\Unity\2_Terminal_Hacker\Assembly-CSharp.csproj' [info]:
  OmniSharp.Script.ScriptProjectSystem
          Detecting CSX files in 'a:\Github\Unity\2_Terminal_Hacker'. [info]: OmniSharp.Script.ScriptProjectSystem
          Could not find any CSX files [info]: OmniSharp.WorkspaceInitializer
          Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider,
  Order: 0 [info]: OmniSharp.MSBuild.ProjectManager
          Loading project: a:\Github\Unity\2_Terminal_Hacker\Assembly-CSharp.csproj [info]:
  OmniSharp.WorkspaceInitializer
          Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider,
  Order: 100 [info]: OmniSharp.WorkspaceInitializer
          Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider,
  Order: 110 [info]: OmniSharp.WorkspaceInitializer
          Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.BlockStructureWorkspaceOptionsProvider,
  Order: 140 [info]: OmniSharp.WorkspaceInitializer
          Configuration finished. [info]: OmniSharp.Stdio.Host
          Omnisharp server running using Stdio at location 'a:\Github\Unity\2_Terminal_Hacker' on host 13388. [fail]:
  OmniSharp.MSBuild.ProjectLoader
          The reference assemblies for .NETFramework,Version=v4.7.1 were not found. To resolve this, install the Developer Pack (SDK/Targeting
  Pack) for this framework version or retarget your application. You can
  download .NET Framework Developer Packs at
  https://aka.ms/msbuild/developerpacks [warn]:
  OmniSharp.MSBuild.ProjectManager
          Failed to load project file 'a:\Github\Unity\2_Terminal_Hacker\Assembly-CSharp.csproj'.
  a:\Github\Unity\2_Terminal_Hacker\Assembly-CSharp.csproj A:\Program
  Files\Microsoft Visual
  Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(1177,5):
  Error: The reference assemblies for .NETFramework,Version=v4.7.1 were
  not found. To resolve this, install the Developer Pack (SDK/Targeting
  Pack) for this framework version or retarget your application. You can
  download .NET Framework Developer Packs at
  https://aka.ms/msbuild/developerpacks

[fail]: OmniSharp.MSBuild.ProjectManager
          Attempted to update project that is not loaded: a:\Github\Unity\2_Terminal_Hacker\Assembly-CSharp.csproj

答:
The answer is in the log:

[fail]: OmniSharp.MSBuild.ProjectLoader The reference assemblies for
  .NETFramework,Version=v4.7.1 were not found. To resolve this, install
  the Developer Pack (SDK/Targeting Pack) for this framework version or
  retarget your application. You can download .NET Framework Developer
  Packs at https://aka.ms/msbuild/developerpacks [warn]:
  OmniSharp.MSBuild.ProjectManager Failed to load project file
  'a:\Github\Unity\2_Terminal_Hacker\Assembly-CSharp.csproj'.
  a:\Github\Unity\2_Terminal_Hacker\Assembly-CSharp.csproj A:\Program
  Files\Microsoft Visual
  Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(1177,5):
  Error: The reference assemblies for .NETFramework,Version=v4.7.1 were
  not found. To resolve this, install the Developer Pack (SDK/Targeting
  Pack) for this framework version or retarget your application. You can
  download .NET Framework Developer Packs at
  https://aka.ms/msbuild/developerpacks

.Net sdk/system libraries are installed through Visual Studio, so vscode/omnisharp tried to pull them from your Visual Studio Community 16.6 installation (info for that is on the start of the log). But it looks like VSCommunity is installed without v4.7.1 targetting pack.

To fix this, go to:

Visual Studio Installer -> Visual Studio Community -> More -> Modify ->
  Individual Components

and check ".NETFramework v4.7.1" pack. Afrer this gets installed, reboot stuff and you should be good to go.


问:
undefined method `assets' for #<Rails::Application::Configuration>
Hi I was upgrading a Rails 2 app to Rails 3.
When I want to run something like: rails c, rake -T, etc. It throws this:

```<code>$ rails c
/usr/lib/ruby/gems/1.8/gems/railties-3.0.9/lib/rails/railtie/configuration.rb:77:in `method_missing': undefined method `assets' for #<Rails::Application::Configuration:0xb6569120> (NoMethodError)
    from /home/neoriddle/proyectos/interkids/config/application.rb:49
    from /usr/lib/ruby/gems/1.8/gems/railties-3.0.9/lib/rails/commands.rb:21:in `require'
    from /usr/lib/ruby/gems/1.8/gems/railties-3.0.9/lib/rails/commands.rb:21
    from script/rails:6:in `require'
    from script/rails:6
</code>```

this was with rails c and next log is running rake -T:

```<code>$ rake -T --trace
rake aborted!
undefined method `assets' for #<Rails::Application::Configuration:0xb658aa64>
/usr/lib/ruby/gems/1.8/gems/railties-3.0.9/lib/rails/railtie/configuration.rb:77:in `method_missing'
/home/neoriddle/proyectos/interkids/config/application.rb:49
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
/home/neoriddle/proyectos/interkids/Rakefile:5
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:501:in `raw_load_rakefile'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:82:in `load_rakefile'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:81:in `load_rakefile'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:65:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/bin/rake:33
/usr/bin/rake:19:in `load'
/usr/bin/rake:19
</code>```

Do you have some ideas to solve this?

答:
My app was api_only so Rails skipped creating assets when generating a new resource.

I removed the references to config.assets from development.rb and production.rb and it worked.

So you can remove the references to assets if your App doesn't need it.

Body:
Hi I was upgrading a Rails 2 app to Rails 3.
When I want to run something like: rails c, rake -T, etc. It throws this:

$ rails c
/usr/lib/ruby/gems/1.8/gems/railties-3.0.9/lib/rails/railtie/configuration.rb:77:in `method_missing': undefined method `assets' for #<Rails::Application::Configuration:0xb6569120> (NoMethodError)
    from /home/neoriddle/proyectos/interkids/config/application.rb:49
    from /usr/lib/ruby/gems/1.8/gems/railties-3.0.9/lib/rails/commands.rb:21:in `require'
    from /usr/lib/ruby/gems/1.8/gems/railties-3.0.9/lib/rails/commands.rb:21
    from script/rails:6:in `require'
    from script/rails:6

this was with rails c and next log is running rake -T:

$ rake -T --trace
rake aborted!
undefined method `assets' for #<Rails::Application::Configuration:0xb658aa64>
/usr/lib/ruby/gems/1.8/gems/railties-3.0.9/lib/rails/railtie/configuration.rb:77:in `method_missing'
/home/neoriddle/proyectos/interkids/config/application.rb:49
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
/home/neoriddle/proyectos/interkids/Rakefile:5
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:501:in `raw_load_rakefile'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:82:in `load_rakefile'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:81:in `load_rakefile'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:65:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/bin/rake:33
/usr/bin/rake:19:in `load'
/usr/bin/rake:19

Do you have some ideas to solve this?


问:
Cake is NOT able to connect to the database
I am using Wamp server and I'm trying to install CakePHP 2.0.0 but I'm having trouble with it.

I put the CakePHP 2.0.0 files in my wamp server folder "www" and then "cake" folder.

When I enter address http://localhost/cake in my browser then following message is displayed:

```<code>CakePHP: the rapid development php framework
Release Notes for CakePHP 2.0.0-dev.

Notice (1024): Please change the value of 'Security.salt' in app/config/core.php to a salt value specific to your application [CORE\Cake\Utility\Debugger.php, line 647]

Notice (1024): Please change the value of 'Security.cipherSeed' in app/config/core.php to a numeric (digits only) seed value specific to your application [CORE\Cake\Utility\Debugger.php, line 651]

Your tmp directory is writable.

The FileEngine is being used for caching. To change the config edit APP/config/core.php

Your database configuration file is present.

Cake is NOT able to connect to the database.
Editing this Page

To change the content of this page, create: APP/views/pages/home.ctp.
To change its layout, create: APP/views/layouts/default.ctp.
You can also add some CSS styles for your pages at: APP/webroot/css.
</code>```

答:
They are NOT errors, they are notices. This means you can do some configurations in order to make it work. Read over them and do what they tell you to do. Seems like errors happen in your config/, watch out to provide correct information such as database's name and password.

Edit

Just to answer your question, CakePHP is a PHP framework that assist you with constructing your website in MVC model. Instead writing source code from scratch, by using framework, you can inherit all its functionality that speed up your development time, help you to deal with more-complex structure/procedures more easily.

Body:
I am using Wamp server and I'm trying to install CakePHP 2.0.0 but I'm having trouble with it.

I put the CakePHP 2.0.0 files in my wamp server folder "www" and then "cake" folder.

When I enter address http://localhost/cake in my browser then following message is displayed:

CakePHP: the rapid development php framework
Release Notes for CakePHP 2.0.0-dev.

Notice (1024): Please change the value of 'Security.salt' in app/config/core.php to a salt value specific to your application [CORE\Cake\Utility\Debugger.php, line 647]

Notice (1024): Please change the value of 'Security.cipherSeed' in app/config/core.php to a numeric (digits only) seed value specific to your application [CORE\Cake\Utility\Debugger.php, line 651]

Your tmp directory is writable.

The FileEngine is being used for caching. To change the config edit APP/config/core.php

Your database configuration file is present.

Cake is NOT able to connect to the database.
Editing this Page

To change the content of this page, create: APP/views/pages/home.ctp.
To change its layout, create: APP/views/layouts/default.ctp.
You can also add some CSS styles for your pages at: APP/webroot/css.


问:
java.security.NoSuchAlgorithmException: SSL_TLSv2 SSLContext not available
I have problems while connecting IBM MQ from JBoss with SSL on JRE 1.8 (jdk1.8.0_101)

I comment below line on java.security but nothing changes:

```<code>jdk.certpath.disabledAlgorithms=MD2, MD5, RSA keySize < 1024
</code>```

```<code>Caused by: com.ibm.msg.client.jms.DetailedJMSException: JMSWMQ0018: Failed to connect to queue manager 'xxxxx' with connection mode 'Client' and host name 'xxxx'.Check the queue manager is started and if running in client mode, check there is a listener running. Please see the linked exception for more information.
at com.ibm.msg.client.wmq.common.internal.Reason.reasonToException(Reason.java:580)
at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:216)
at com.ibm.msg.client.wmq.internal.WMQConnection.<init>(WMQConnection.java:431)
at com.ibm.msg.client.wmq.internal.WMQXAConnection.<init>(WMQXAConnection.java:70)
at com.ibm.msg.client.wmq.factories.WMQXAConnectionFactory.createV7ProviderConnection(WMQXAConnectionFactory.java:190)
at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createProviderConnection(WMQConnectionFactory.java:6157)
at com.ibm.msg.client.wmq.factories.WMQXAConnectionFactory.createProviderXAConnection(WMQXAConnectionFactory.java:102)
at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.createXAConnectionInternal(JmsConnectionFactoryImpl.java:364)
at com.ibm.mq.jms.MQXAConnectionFactory.createXAConnection(MQXAConnectionFactory.java:124)
at com.ibm.mq.connector.ConnectionBuilder.createConnection(ConnectionBuilder.java:167)
... 22 more **Caused by: com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2393' ('MQRC_SSL_INITIALIZATION_ERROR')**.
at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:204)
... 30 more Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2393;AMQ9204: Connection to host 'xxxxx' rejected. [1=com.ibm.mq.jmqi.JmqiException[CC=2;RC=2393],3=xxxxx(1428),5=RemoteTCPConnection.buildTLSV1_2SocketFactory]
at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:2098)
at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1347)
at com.ibm.msg.client.wmq.internal.WMQConnection.<init>(WMQConnection.java:350)
... 29 more  Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2393
at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.buildTLSV1_2SocketFactory(RemoteTCPConnection.java:2480)
at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.chooseSocketFactory(RemoteTCPConnection.java:2130)
at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.makeSocketSecure(RemoteTCPConnection.java:1945)
at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.connnectUsingLocalAddress(RemoteTCPConnection.java:855)
at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.protocolConnect(RemoteTCPConnection.java:1262)
at com.ibm.mq.jmqi.remote.impl.RemoteConnection.connect(RemoteConnection.java:714)
at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSessionFromNewConnection(RemoteConnectionSpecification.java:356)
at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSession(RemoteConnectionSpecification.java:265)
at com.ibm.mq.jmqi.remote.impl.RemoteConnectionPool.getSession(RemoteConnectionPool.java:144)
at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1709)
... 31 more **Caused by: java.security.NoSuchAlgorithmException: SSL_TLSv2 SSLContext not available**
at sun.security.jca.GetInstance.getInstance(GetInstance.java:159) [rt.jar:1.8.0_101]
at javax.net.ssl.SSLContext.getInstance(SSLContext.java:156) [rt.jar:1.8.0_101]
at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.buildTLSV1_2SocketFactory(RemoteTCPConnection.java:2461)
... 40 more
</code>```

UPDATED: After below changes, new error like this:
TLS_RSA_WITH_AES_128_CBC_SHA256
JVM Arguments added: -Dcom.ibm.mq.cfg.useIBMCipherMappings=false

```<code>Caused by: com.ibm.msg.client.jms.DetailedIllegalStateException: JMSWMQ0018: Failed to connect to queue manager 'mqtap.uyg.uat11' with connection mode 'Client' and host name 'xxx'. Check the queue manager is started and if running in client mode, check there is a listener running. Please see the linked exception for more information.
at com.ibm.msg.client.wmq.common.internal.Reason.reasonToException(Reason.java:474)
at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:216)
at com.ibm.msg.client.wmq.internal.WMQConnection.<init>(WMQConnection.java:431)
at com.ibm.msg.client.wmq.internal.WMQXAConnection.<init>(WMQXAConnection.java:70)
at com.ibm.msg.client.wmq.factories.WMQXAConnectionFactory.createV7ProviderConnection(WMQXAConnectionFactory.java:190)
at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createProviderConnection(WMQConnectionFactory.java:6157)
at com.ibm.msg.client.wmq.factories.WMQXAConnectionFactory.createProviderXAConnection(WMQXAConnectionFactory.java:102)
at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.createXAConnectionInternal(JmsConnectionFactoryImpl.java:364)
at com.ibm.mq.jms.MQXAConnectionFactory.createXAConnection(MQXAConnectionFactory.java:124)
at com.ibm.mq.connector.ConnectionBuilder.createConnection(ConnectionBuilder.java:167)
... 22 more Caused by: com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2059' ('MQRC_Q_MGR_NOT_AVAILABLE').
at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:204)
... 30 more Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2059;AMQ9204: Connection to host 'xxx' rejected. [1=com.ibm.mq.jmqi.JmqiException[CC=2;RC=2059;AMQ9503: Channel negotiation failed. [3=xxx]],3=xxx,5=RemoteConnection.analyseErrorSegment]
at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:2098)
at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1347)
at com.ibm.msg.client.wmq.internal.WMQConnection.<init>(WMQConnection.java:350)
... 29 more Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2059;AMQ9503: Channel negotiation failed. [3=xxx]
at com.ibm.mq.jmqi.remote.impl.RemoteConnection.analyseErrorSegment(RemoteConnection.java:3850)
at com.ibm.mq.jmqi.remote.impl.RemoteConnection.receiveTSH(RemoteConnection.java:2749)
at com.ibm.mq.jmqi.remote.impl.RemoteConnection.initSess(RemoteConnection.java:1024)
at com.ibm.mq.jmqi.remote.impl.RemoteConnection.connect(RemoteConnection.java:717)
at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSessionFromNewConnection(RemoteConnectionSpecification.java:356)
at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSession(RemoteConnectionSpecification.java:265)
at com.ibm.mq.jmqi.remote.impl.RemoteConnectionPool.getSession(RemoteConnectionPool.java:144)
at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1709)
... 31 more
</code>```

UPDATED output of javax.net.debug=ssl:

```<code>trustStore is: C:\dev\eclipse\workspace\XXX\src\main\application\config\XXX\keystore.jks
trustStore type is : jks
trustStore provider is :
init truststore

adding as trusted cert:
  Subject: CN=mqClientmqtap.uyg.uat, OU=XXX BT, O=XXX TAS, L=XXX, C=TR
  Issuer:  CN=mqClientmqtap.uyg.uat, OU=XXX BT, O=XXX TAS, L=XXX, C=TR
  Algorithm: RSA; Serial number: 0x5889a408
  Valid from Thu Jan 26 10:23:52 EET 2017 until Sun Jan 24 10:23:52 EET 2027

adding as trusted cert:
  Subject: CN=mqServermqtap.uyg.uat11, OU=XXX BT, O=XXX TAS, L=XXX, C=TR
  Issuer:  CN=mqServermqtap.uyg.uat11, OU=XXX BT, O=XXX TAS, L=XXX, C=TR
  Algorithm: RSA; Serial number: 0x588996d3
  Valid from Thu Jan 26 09:27:31 EET 2017 until Sun Jan 24 09:27:31 EET 2027

adding as trusted cert:
  Subject: CN=mqServermqtap.uyg.uat12, OU=XXX BT, O=XXX TAS, L=XXX, C=TR
  Issuer:  CN=mqServermqtap.uyg.uat12, OU=XXX BT, O=XXX TAS, L=XXX, C=TR
  Algorithm: RSA; Serial number: 0x5889994c
  Valid from Thu Jan 26 09:38:04 EET 2017 until Sun Jan 24 09:38:04 EET 2027

trigger seeding of SecureRandom
done seeding SecureRandom

Allow unsafe renegotiation: falseAllow legacy hello messages: XXXueIs initial handshake: XXXueIs secure renegotiation: false
    %% No cached client session
    *** ClientHello, TLSv1.2
    RandomCookie:  GMT: 1573949056 bytes = { 248, 4, 131, 18, 179, 77, 58, 163, 213, 86, 162, 39, 153, 233, 66, 82, 68, 140, 162, 144, 245, 223, 148, 131, 41, 17, 182, 13 }
    Session ID:  {}
    Cipher Suites: [TLS_RSA_WITH_AES_128_CBC_SHA256]
    Compression Methods:  { 0 }
    Extension signature_algorithms, signature_algorithms: SHA512withECDSA, SHA512withRSA, SHA384withECDSA, SHA384withRSA, SHA256withECDSA, SHA256withRSA, SHA1withECDSA, SHA1withRSA, SHA1withDSA
    Extension server_name, server_name: [type=host_name (0), value=mqkont1.XXX.com.XXX]
    Extension renegotiation_info, renegotiated_connection: <empty>
    ***
    jmsContainerBean_DEVOPS_DEVOPS_CONSUME_MESSAGE-1, WRITE: TLSv1.2 Handshake, length = 106
    jmsContainerBean_DEVOPS_DEVOPS_CONSUME_MESSAGE-1, READ: TLSv1.2 Handshake, length = 1247
    *** ServerHello, TLSv1.2
    RandomCookie:  GMT: 710208142 bytes = { 152, 40, 119, 253, 151, 47, 206, 243, 81, 108, 25, 227, 196, 180, 235, 231, 180, 213, 136, 245, 68, 79, 87, 78, 71, 82, 68, 1 }
    Session ID:  {233, 220, 107, 227, 28, 86, 6, 240, 170, 113, 171, 164, 93, 132, 7, 120, 51, 79, 103, 215, 78, 157, 179, 176, 103, 14, 128, 68, 104, 28, 158, 75}
    Cipher Suite: TLS_RSA_WITH_AES_128_CBC_SHA256
    Compression Method: 0
    Extension renegotiation_info, renegotiated_connection: <empty>
    ***
    %% Initialized:  [Session-2, TLS_RSA_WITH_AES_128_CBC_SHA256]
    ** TLS_RSA_WITH_AES_128_CBC_SHA256
    *** Certificate chain
    chain [0] = [[  Version: V3  Subject: CN=mqServermqtap.uyg.uat11, OU=XXX BT, O=XXX TAS, L=XXX, C=XXX  Signature Algorithm: SHA256withRSA, OID = 1.2.840.113549.1.1.11  Key:  Sun RSA public key, 2048 bits  modulus: 16868959742511831543539228188322318728282173929458725924838613545208147879023122029920833782971719231363516671703224653599860963934312081835272320238812022534477095634694802627860269361713438182846321229058529392716608829685708314508449574441166109812419649123445875905638934406872091742574829759871314621197235350998579563031139677192512639546904745848670104988385994626620908449612658040233325854445643585926360496269974991459750688880211123355953429519072414353674373705386071983844550354941821794692371907044593903275788892906274112049209437573188855729556317970379842595602177784867998565702046085858658609856373  public exponent: 65537  Validity: [From: Thu Jan 26 09:27:31 EET 2017,               To: Sun Jan 24 09:27:31 EET 2027]  Issuer: CN=mqServermqtap.uyg.uat11, OU=XXX BT, O=XXX TAS, L=XXX, C=XXX  SerialNumber: [    588996d3]Certificate Extensions: 2[1]: ObjectId: 2.5.29.35 Criticality=falseAuthorityKeyIdentifier [KeyIdentifier [0000: 04 62 9C B2 40 5E E0 C7                            .b..@^..
    ]][2]: ObjectId: 2.5.29.14 Criticality=falseSubjectKeyIdentifier [KeyIdentifier [0000: 04 62 9C B2 40 5E E0 C7                            .b..@^..
    ]]]  Algorithm: [SHA256withRSA]  Signature:0000: 27 23 9A F1 20 45 4E 98   2C A7 38 83 CE 99 7A 41  '#.. EN.,.8...zA
    0010: 0A 3A 57 02 E9 0F DE 73   73 01 07 B0 D8 19 C7 E2  .:W....ss.......
    0020: F2 2D 16 85 31 37 19 37   E4 2D B1 2C 4A F1 79 E4  .-..17.7.-.,J.y.
    0030: 09 99 E0 3A 47 B3 E2 4F   F4 EE 01 C3 D4 52 D4 94  ...:G..O.....R..
    0040: 38 49 09 59 3E 63 C1 44   48 B1 1F E3 B3 16 69 38  8I.Y>c.DH.....i8
    0050: E1 FA 5A 73 6F D1 F4 64   B3 0F 2E FD 49 72 87 F2  ..Zso..d....Ir..
    0060: 7E 59 76 87 C2 97 1C 8A   69 ED 92 52 D6 A4 3A 88  .Yv.....i..R..:.
    0070: 84 43 20 4B C7 4B C8 42   18 A0 E5 BF A6 C8 A7 32  .C K.K.B.......2
    0080: F2 E4 AA A3 F0 08 1F DF   F2 5E EE 1E 9F 84 4A CB  .........^....J.
    0090: 80 A8 9D 83 ED 6D 2A 5F   A2 C1 9E FC 89 D1 08 C0  .....m*_........
    00A0: 82 DA 4D D1 97 3B AB AB   1A 8B 35 D9 1C C0 DF B4  ..M..;....5.....
    00B0: 67 E3 39 A4 C8 73 2C F0   2A 70 2B 14 F7 F1 9C E8  g.9..s,.*p+.....
    00C0: 71 89 99 93 AB AE D6 4B   A0 46 1A 13 54 4E 6B 3B  q......K.F..TNk;
    00D0: E9 CE 97 92 4D 64 25 0C   D9 4F 3B A6 CC 78 36 C0  ....Md%..O;..x6.
    00E0: AE 75 0F A9 C1 3D D8 B2   AF 5F 68 9F FB EB 31 2F  .u...=..._h...1/
    00F0: 41 16 83 04 7B F2 0D 8E   07 47 47 8F 55 F7 33 29  A........GG.U.3)
    ]
    ***
    Found XXXusted certificate:
    [[  Version: V3  Subject: CN=mqServermqtap.uyg.uat11, OU=XXX BT, O=XXX TAS, L=XXX, C=XXX  Signature Algorithm: SHA256withRSA, OID = 1.2.840.113549.1.1.11  Key:  Sun RSA public key, 2048 bits  modulus: 16868959742511831543539228188322318728282173929458725924838613545208147879023122029920833782971719231363516671703224653599860963934312081835272320238812022534477095634694802627860269361713438182846321229058529392716608829685708314508449574441166109812419649123445875905638934406872091742574829759871314621197235350998579563031139677192512639546904745848670104988385994626620908449612658040233325854445643585926360496269974991459750688880211123355953429519072414353674373705386071983844550354941821794692371907044593903275788892906274112049209437573188855729556317970379842595602177784867998565702046085858658609856373  public exponent: 65537  Validity: [From: Thu Jan 26 09:27:31 EET 2017,               To: Sun Jan 24 09:27:31 EET 2027]  Issuer: CN=mqServermqtap.uyg.uat11, OU=XXX BT, O=XXX TAS, L=XXX, C=XXX  SerialNumber: [    588996d3]Certificate Extensions: 2[1]: ObjectId: 2.5.29.35 Criticality=falseAuthorityKeyIdentifier [KeyIdentifier [0000: 04 62 9C B2 40 5E E0 C7                            .b..@^..
    ]][2]: ObjectId: 2.5.29.14 Criticality=falseSubjectKeyIdentifier [KeyIdentifier [0000: 04 62 9C B2 40 5E E0 C7                            .b..@^..
    ]]]  Algorithm: [SHA256withRSA]  Signature:0000: 27 23 9A F1 20 45 4E 98   2C A7 38 83 CE 99 7A 41  '#.. EN.,.8...zA
    0010: 0A 3A 57 02 E9 0F DE 73   73 01 07 B0 D8 19 C7 E2  .:W....ss.......
    0020: F2 2D 16 85 31 37 19 37   E4 2D B1 2C 4A F1 79 E4  .-..17.7.-.,J.y.
    0030: 09 99 E0 3A 47 B3 E2 4F   F4 EE 01 C3 D4 52 D4 94  ...:G..O.....R..
    0040: 38 49 09 59 3E 63 C1 44   48 B1 1F E3 B3 16 69 38  8I.Y>c.DH.....i8
    0050: E1 FA 5A 73 6F D1 F4 64   B3 0F 2E FD 49 72 87 F2  ..Zso..d....Ir..
    0060: 7E 59 76 87 C2 97 1C 8A   69 ED 92 52 D6 A4 3A 88  .Yv.....i..R..:.
    0070: 84 43 20 4B C7 4B C8 42   18 A0 E5 BF A6 C8 A7 32  .C K.K.B.......2
    0080: F2 E4 AA A3 F0 08 1F DF   F2 5E EE 1E 9F 84 4A CB  .........^....J.
    0090: 80 A8 9D 83 ED 6D 2A 5F   A2 C1 9E FC 89 D1 08 C0  .....m*_........
    00A0: 82 DA 4D D1 97 3B AB AB   1A 8B 35 D9 1C C0 DF B4  ..M..;....5.....
    00B0: 67 E3 39 A4 C8 73 2C F0   2A 70 2B 14 F7 F1 9C E8  g.9..s,.*p+.....
    00C0: 71 89 99 93 AB AE D6 4B   A0 46 1A 13 54 4E 6B 3B  q......K.F..TNk;
    00D0: E9 CE 97 92 4D 64 25 0C   D9 4F 3B A6 CC 78 36 C0  ....Md%..O;..x6.
    00E0: AE 75 0F A9 C1 3D D8 B2   AF 5F 68 9F FB EB 31 2F  .u...=..._h...1/
    00F0: 41 16 83 04 7B F2 0D 8E   07 47 47 8F 55 F7 33 29  A........GG.U.3)
    ]
    *** CertificateRequest
    Cert Types: RSA, DSS, ECDSA
    Supported Signature Algorithms: SHA512withRSA, SHA384withRSA, SHA256withRSA, Unknown (hash:0x3, signature:0x1), SHA1withRSA, SHA512withECDSA, SHA384withECDSA, SHA256withECDSA, Unknown (hash:0x3, signature:0x3), SHA1withECDSA, SHA1withDSA
    Cert Authorities:
    <CN=mqClientmqtap.uyg.uat, OU=XXX BT, O=XXX TAS, L=XXX, C=XXX>
    <CN=mqServermqtap.uyg.uat11, OU=XXX BT, O=XXX TAS, L=XXX, C=XXX>
    *** ServerHelloDone
    Warning: no suitable certificate found - continuing without client authentication
    *** Certificate chain
    <Empty>
    ***
    *** ClientKeyExchange, RSA PreMasterSecret, TLSv1.2
    jmsContainerBean_DEVOPS_DEVOPS_CONSUME_MESSAGE-1, WRITE: TLSv1.2 Handshake, length = 269
    SESSION KEYGEN:
    PreMaster Secret:
    0000: 03 03 B7 63 CA 3F 6F F4   A3 C8 68 5F 4E D4 84 9A  ...c.?o...h_N...
    0010: 17 03 40 12 66 C2 C3 D0   67 EE 64 54 50 5D AF ED  ..@.f...g.dTP]..
    0020: CD 8E 45 A9 6F CF 91 E1   60 6A 63 0D 9B CB AF D7  ..E.o...`jc.....
    CONNECTION KEYGEN:
    Client Nonce:
    0000: 5E D1 8F 80 F8 04 83 12   B3 4D 3A A3 D5 56 A2 27  ^........M:..V.'
    0010: 99 E9 42 52 44 8C A2 90   F5 DF 94 83 29 11 B6 0D  ..BRD.......)...
    Server Nonce:
    0000: 2A 55 EB 8E 98 28 77 FD   97 2F CE F3 51 6C 19 E3  *U...(w../..Ql..
    0010: C4 B4 EB E7 B4 D5 88 F5   44 4F 57 4E 47 52 44 01  ........DOWNGRD.
    Master Secret:
    0000: D9 0B 10 DB B5 9A 64 0C   56 2E 70 89 93 E4 52 6A  ......d.V.p...Rj
    0010: F7 C2 A9 9F 0D 6E 47 82   84 A0 6F D9 58 C0 E8 FF  .....nG...o.X...
    0020: E1 BB 6D 74 76 B0 D6 E5   83 FA 6F 89 D2 C1 BC 06  ..mtv.....o.....
    Client MAC write Secret:
    0000: 2E C0 A1 1A 6B 63 40 13   C9 2F 96 29 29 6B 46 3C  ....kc@../.))kF<
    0010: 61 48 69 06 66 9A 20 45   3C F4 63 BB 80 AE 95 84  aHi.f. E<.c.....
    Server MAC write Secret:
    0000: 64 5D 2F F0 C3 76 E7 53   61 0A D6 9A 23 80 7E 29  d]/..v.Sa...#..)
    0010: C9 15 CC 4A 1A 6A 0C F8   5D A6 2F C3 CE F8 04 88  ...J.j..]./.....
    Client write key:
    0000: A1 3C 3A F9 81 3E 4A F4   D5 30 EB 7C FB 10 AF 1B  .<:..>J..0......
    Server write key:
    0000: 0F 0C 65 F8 C5 6B C1 8B   C4 51 36 35 2E 9F ED D6  ..e..k...Q65....
    ... no IV derived for this protocol
    jmsContainerBean_DEVOPS_DEVOPS_CONSUME_MESSAGE-1, WRITE: TLSv1.2 Change Cipher Spec, length = 1
    *** Finished
    verify_data:  { 101, 32, 15, 187, 98, 153, 21, 159, 88, 122, 119, 59 }
    ***
    jmsContainerBean_DEVOPS_DEVOPS_CONSUME_MESSAGE-1, WRITE: TLSv1.2 Handshake, length = 80
    jmsContainerBean_DEVOPS_DEVOPS_CONSUME_MESSAGE-1, READ: TLSv1.2 Change Cipher Spec, length = 1
    jmsContainerBean_DEVOPS_DEVOPS_CONSUME_MESSAGE-1, READ: TLSv1.2 Handshake, length = 80
    *** Finished
    verify_data:  { 80, 170, 1, 54, 80, 55, 237, 31, 125, 189, 221, 180 }
    ***
    %% Cached client session: [Session-2, TLS_RSA_WITH_AES_128_CBC_SHA256]
    jmsContainerBean_DEVOPS_DEVOPS_CONSUME_MESSAGE-1, WRITE: TLSv1.2 Application Data, length = 288
    jmsContainerBean_DEVOPS_DEVOPS_CONSUME_MESSAGE-1, setSoTimeout(5000) called
    jmsContainerBean_DEVOPS_DEVOPS_CONSUME_MESSAGE-1, READ: TLSv1.2 Application Data, length = 96
    jmsContainerBean_DEVOPS_DEVOPS_CONSUME_MESSAGE-1, setSoTimeout(0) called
    jmsContainerBean_DEVOPS_DEVOPS_CONSUME_MESSAGE-1, called close()
    jmsContainerBean_DEVOPS_DEVOPS_CONSUME_MESSAGE-1, called closeInternal(XXXue)
    jmsContainerBean_DEVOPS_DEVOPS_CONSUME_MESSAGE-1, SEND TLSv1.2 ALERT:  warning, description = close_notify
    jmsContainerBean_DEVOPS_DEVOPS_CONSUME_MESSAGE-1, WRITE: TLSv1.2 Alert, length = 64
    jmsContainerBean_DEVOPS_DEVOPS_CONSUME_MESSAGE-1, called closeSocket(XXXue)
    01:41:04,148 WARN  [org.jboss.jca.core.connectionmanager.pool.sXXXategy.OnePool
</code>```

答:
You are running a very old version of the software on the sender side, MQ 7.1 went out of support over three years ago (April 30 2017). IBM for a cost will provide extended support for an additional three years from what I understand, so it would seem that even that avenue of support is over. The 7.1.0.7 maintenance release itself came out November 15th 2015, so it is over 4.5 years old at this point. I would strongly suggest you move to a newer version.

Note that MQ v8.0 went out of support April 30 2020, and IBM announced that MQ v9.0 goes out of support September 30 2021. When you do migrate you should go with either 9.1 which has no announced end of support (they give five years minimum so it could be 2023) or go with the next version of MQ that should be out some time later this year.

You had two issues that you have detailed in the question and comments.

You are using a non-IBM Java, because of this the ciphersuite you were passing was incorrect, I advised to do the following:

Add the java system property com.ibm.mq.cfg.useIBMCipherMappings=false

Specify the ciphersuite as TLS_RSA_WITH_AES_128_CBC_SHA256

Once the above was corrected you started to get a new error.  Based on the troubleshooting you have done and the ssl debug logs, I noticed that you are at a version of MQ that does not include APAR IT10837: WEBSPHERE MQ CHANNEL START FAILS WITH AMQ9637 WHEN USING A TLS 1.2 CIPHER RUNNING IN AN ORACLE JRE

```<code>PROBLEM DESCRIPTION:

The Oracle JVM did not create a default internal key manager
object for TLS socket connections, meaning that the client's
signed personal certificates were not available for client
authentication during the handshake, causing the connection
attempt to fail.

Problem conclusion

An internal key manager object is now created for Oracle TLS
connections, so the client's signed personal certificates are
available during the handshake and the connection attempt
succeeds.

---------------------------------------------------------------
The fix is targeted for delivery in the following PTFs:

Version    Maintenance Level
v7.1       7.1.0.8
v7.5       7.5.0.7
v8.0       8.0.0.5
</code>```

Because of this MQ does not find your keyStore and trustStore.

Recommended solution is to upgrade to a supported version of IBM MQ.  You can use Maven to get the current IBM MQ v9.1.0.5 LTS support client at the following link:

MVN REPOSITORY » com.ibm.mq  com.ibm.mq.allclient

Body:
I have problems while connecting IBM MQ from JBoss with SSL on JRE 1.8 (jdk1.8.0_101)

I comment below line on java.security but nothing changes:

jdk.certpath.disabledAlgorithms=MD2, MD5, RSA keySize < 1024

Caused by: com.ibm.msg.client.jms.DetailedJMSException: JMSWMQ0018: Failed to connect to queue manager 'xxxxx' with connection mode 'Client' and host name 'xxxx'.Check the queue manager is started and if running in client mode, check there is a listener running. Please see the linked exception for more information.
at com.ibm.msg.client.wmq.common.internal.Reason.reasonToException(Reason.java:580)
at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:216)
at com.ibm.msg.client.wmq.internal.WMQConnection.<init>(WMQConnection.java:431)
at com.ibm.msg.client.wmq.internal.WMQXAConnection.<init>(WMQXAConnection.java:70)
at com.ibm.msg.client.wmq.factories.WMQXAConnectionFactory.createV7ProviderConnection(WMQXAConnectionFactory.java:190)
at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createProviderConnection(WMQConnectionFactory.java:6157)
at com.ibm.msg.client.wmq.factories.WMQXAConnectionFactory.createProviderXAConnection(WMQXAConnectionFactory.java:102)
at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.createXAConnectionInternal(JmsConnectionFactoryImpl.java:364)
at com.ibm.mq.jms.MQXAConnectionFactory.createXAConnection(MQXAConnectionFactory.java:124)
at com.ibm.mq.connector.ConnectionBuilder.createConnection(ConnectionBuilder.java:167)
... 22 more **Caused by: com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2393' ('MQRC_SSL_INITIALIZATION_ERROR')**.
at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:204)
... 30 more Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2393;AMQ9204: Connection to host 'xxxxx' rejected. [1=com.ibm.mq.jmqi.JmqiException[CC=2;RC=2393],3=xxxxx(1428),5=RemoteTCPConnection.buildTLSV1_2SocketFactory]
at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:2098)
at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1347)
at com.ibm.msg.client.wmq.internal.WMQConnection.<init>(WMQConnection.java:350)
... 29 more  Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2393
at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.buildTLSV1_2SocketFactory(RemoteTCPConnection.java:2480)
at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.chooseSocketFactory(RemoteTCPConnection.java:2130)
at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.makeSocketSecure(RemoteTCPConnection.java:1945)
at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.connnectUsingLocalAddress(RemoteTCPConnection.java:855)
at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.protocolConnect(RemoteTCPConnection.java:1262)
at com.ibm.mq.jmqi.remote.impl.RemoteConnection.connect(RemoteConnection.java:714)
at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSessionFromNewConnection(RemoteConnectionSpecification.java:356)
at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSession(RemoteConnectionSpecification.java:265)
at com.ibm.mq.jmqi.remote.impl.RemoteConnectionPool.getSession(RemoteConnectionPool.java:144)
at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1709)
... 31 more **Caused by: java.security.NoSuchAlgorithmException: SSL_TLSv2 SSLContext not available**
at sun.security.jca.GetInstance.getInstance(GetInstance.java:159) [rt.jar:1.8.0_101]
at javax.net.ssl.SSLContext.getInstance(SSLContext.java:156) [rt.jar:1.8.0_101]
at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.buildTLSV1_2SocketFactory(RemoteTCPConnection.java:2461)
... 40 more

UPDATED: After below changes, new error like this:
TLS_RSA_WITH_AES_128_CBC_SHA256
JVM Arguments added: -Dcom.ibm.mq.cfg.useIBMCipherMappings=false

Caused by: com.ibm.msg.client.jms.DetailedIllegalStateException: JMSWMQ0018: Failed to connect to queue manager 'mqtap.uyg.uat11' with connection mode 'Client' and host name 'xxx'. Check the queue manager is started and if running in client mode, check there is a listener running. Please see the linked exception for more information.
at com.ibm.msg.client.wmq.common.internal.Reason.reasonToException(Reason.java:474)
at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:216)
at com.ibm.msg.client.wmq.internal.WMQConnection.<init>(WMQConnection.java:431)
at com.ibm.msg.client.wmq.internal.WMQXAConnection.<init>(WMQXAConnection.java:70)
at com.ibm.msg.client.wmq.factories.WMQXAConnectionFactory.createV7ProviderConnection(WMQXAConnectionFactory.java:190)
at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createProviderConnection(WMQConnectionFactory.java:6157)
at com.ibm.msg.client.wmq.factories.WMQXAConnectionFactory.createProviderXAConnection(WMQXAConnectionFactory.java:102)
at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.createXAConnectionInternal(JmsConnectionFactoryImpl.java:364)
at com.ibm.mq.jms.MQXAConnectionFactory.createXAConnection(MQXAConnectionFactory.java:124)
at com.ibm.mq.connector.ConnectionBuilder.createConnection(ConnectionBuilder.java:167)
... 22 more Caused by: com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2059' ('MQRC_Q_MGR_NOT_AVAILABLE').
at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:204)
... 30 more Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2059;AMQ9204: Connection to host 'xxx' rejected. [1=com.ibm.mq.jmqi.JmqiException[CC=2;RC=2059;AMQ9503: Channel negotiation failed. [3=xxx]],3=xxx,5=RemoteConnection.analyseErrorSegment]
at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:2098)
at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1347)
at com.ibm.msg.client.wmq.internal.WMQConnection.<init>(WMQConnection.java:350)
... 29 more Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2059;AMQ9503: Channel negotiation failed. [3=xxx]
at com.ibm.mq.jmqi.remote.impl.RemoteConnection.analyseErrorSegment(RemoteConnection.java:3850)
at com.ibm.mq.jmqi.remote.impl.RemoteConnection.receiveTSH(RemoteConnection.java:2749)
at com.ibm.mq.jmqi.remote.impl.RemoteConnection.initSess(RemoteConnection.java:1024)
at com.ibm.mq.jmqi.remote.impl.RemoteConnection.connect(RemoteConnection.java:717)
at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSessionFromNewConnection(RemoteConnectionSpecification.java:356)
at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSession(RemoteConnectionSpecification.java:265)
at com.ibm.mq.jmqi.remote.impl.RemoteConnectionPool.getSession(RemoteConnectionPool.java:144)
at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1709)
... 31 more

UPDATED output of javax.net.debug=ssl:

trustStore is: C:\dev\eclipse\workspace\XXX\src\main\application\config\XXX\keystore.jks
trustStore type is : jks
trustStore provider is :
init truststore

adding as trusted cert:
  Subject: CN=mqClientmqtap.uyg.uat, OU=XXX BT, O=XXX TAS, L=XXX, C=TR
  Issuer:  CN=mqClientmqtap.uyg.uat, OU=XXX BT, O=XXX TAS, L=XXX, C=TR
  Algorithm: RSA; Serial number: 0x5889a408
  Valid from Thu Jan 26 10:23:52 EET 2017 until Sun Jan 24 10:23:52 EET 2027

adding as trusted cert:
  Subject: CN=mqServermqtap.uyg.uat11, OU=XXX BT, O=XXX TAS, L=XXX, C=TR
  Issuer:  CN=mqServermqtap.uyg.uat11, OU=XXX BT, O=XXX TAS, L=XXX, C=TR
  Algorithm: RSA; Serial number: 0x588996d3
  Valid from Thu Jan 26 09:27:31 EET 2017 until Sun Jan 24 09:27:31 EET 2027

adding as trusted cert:
  Subject: CN=mqServermqtap.uyg.uat12, OU=XXX BT, O=XXX TAS, L=XXX, C=TR
  Issuer:  CN=mqServermqtap.uyg.uat12, OU=XXX BT, O=XXX TAS, L=XXX, C=TR
  Algorithm: RSA; Serial number: 0x5889994c
  Valid from Thu Jan 26 09:38:04 EET 2017 until Sun Jan 24 09:38:04 EET 2027

trigger seeding of SecureRandom
done seeding SecureRandom

Allow unsafe renegotiation: falseAllow legacy hello messages: XXXueIs initial handshake: XXXueIs secure renegotiation: false
    %% No cached client session
    *** ClientHello, TLSv1.2
    RandomCookie:  GMT: 1573949056 bytes = { 248, 4, 131, 18, 179, 77, 58, 163, 213, 86, 162, 39, 153, 233, 66, 82, 68, 140, 162, 144, 245, 223, 148, 131, 41, 17, 182, 13 }
    Session ID:  {}
    Cipher Suites: [TLS_RSA_WITH_AES_128_CBC_SHA256]
    Compression Methods:  { 0 }
    Extension signature_algorithms, signature_algorithms: SHA512withECDSA, SHA512withRSA, SHA384withECDSA, SHA384withRSA, SHA256withECDSA, SHA256withRSA, SHA1withECDSA, SHA1withRSA, SHA1withDSA
    Extension server_name, server_name: [type=host_name (0), value=mqkont1.XXX.com.XXX]
    Extension renegotiation_info, renegotiated_connection: <empty>
    ***
    jmsContainerBean_DEVOPS_DEVOPS_CONSUME_MESSAGE-1, WRITE: TLSv1.2 Handshake, length = 106
    jmsContainerBean_DEVOPS_DEVOPS_CONSUME_MESSAGE-1, READ: TLSv1.2 Handshake, length = 1247
    *** ServerHello, TLSv1.2
    RandomCookie:  GMT: 710208142 bytes = { 152, 40, 119, 253, 151, 47, 206, 243, 81, 108, 25, 227, 196, 180, 235, 231, 180, 213, 136, 245, 68, 79, 87, 78, 71, 82, 68, 1 }
    Session ID:  {233, 220, 107, 227, 28, 86, 6, 240, 170, 113, 171, 164, 93, 132, 7, 120, 51, 79, 103, 215, 78, 157, 179, 176, 103, 14, 128, 68, 104, 28, 158, 75}
    Cipher Suite: TLS_RSA_WITH_AES_128_CBC_SHA256
    Compression Method: 0
    Extension renegotiation_info, renegotiated_connection: <empty>
    ***
    %% Initialized:  [Session-2, TLS_RSA_WITH_AES_128_CBC_SHA256]
    ** TLS_RSA_WITH_AES_128_CBC_SHA256
    *** Certificate chain
    chain [0] = [[  Version: V3  Subject: CN=mqServermqtap.uyg.uat11, OU=XXX BT, O=XXX TAS, L=XXX, C=XXX  Signature Algorithm: SHA256withRSA, OID = 1.2.840.113549.1.1.11  Key:  Sun RSA public key, 2048 bits  modulus: 16868959742511831543539228188322318728282173929458725924838613545208147879023122029920833782971719231363516671703224653599860963934312081835272320238812022534477095634694802627860269361713438182846321229058529392716608829685708314508449574441166109812419649123445875905638934406872091742574829759871314621197235350998579563031139677192512639546904745848670104988385994626620908449612658040233325854445643585926360496269974991459750688880211123355953429519072414353674373705386071983844550354941821794692371907044593903275788892906274112049209437573188855729556317970379842595602177784867998565702046085858658609856373  public exponent: 65537  Validity: [From: Thu Jan 26 09:27:31 EET 2017,               To: Sun Jan 24 09:27:31 EET 2027]  Issuer: CN=mqServermqtap.uyg.uat11, OU=XXX BT, O=XXX TAS, L=XXX, C=XXX  SerialNumber: [    588996d3]Certificate Extensions: 2[1]: ObjectId: 2.5.29.35 Criticality=falseAuthorityKeyIdentifier [KeyIdentifier [0000: 04 62 9C B2 40 5E E0 C7                            .b..@^..
    ]][2]: ObjectId: 2.5.29.14 Criticality=falseSubjectKeyIdentifier [KeyIdentifier [0000: 04 62 9C B2 40 5E E0 C7                            .b..@^..
    ]]]  Algorithm: [SHA256withRSA]  Signature:0000: 27 23 9A F1 20 45 4E 98   2C A7 38 83 CE 99 7A 41  '#.. EN.,.8...zA
    0010: 0A 3A 57 02 E9 0F DE 73   73 01 07 B0 D8 19 C7 E2  .:W....ss.......
    0020: F2 2D 16 85 31 37 19 37   E4 2D B1 2C 4A F1 79 E4  .-..17.7.-.,J.y.
    0030: 09 99 E0 3A 47 B3 E2 4F   F4 EE 01 C3 D4 52 D4 94  ...:G..O.....R..
    0040: 38 49 09 59 3E 63 C1 44   48 B1 1F E3 B3 16 69 38  8I.Y>c.DH.....i8
    0050: E1 FA 5A 73 6F D1 F4 64   B3 0F 2E FD 49 72 87 F2  ..Zso..d....Ir..
    0060: 7E 59 76 87 C2 97 1C 8A   69 ED 92 52 D6 A4 3A 88  .Yv.....i..R..:.
    0070: 84 43 20 4B C7 4B C8 42   18 A0 E5 BF A6 C8 A7 32  .C K.K.B.......2
    0080: F2 E4 AA A3 F0 08 1F DF   F2 5E EE 1E 9F 84 4A CB  .........^....J.
    0090: 80 A8 9D 83 ED 6D 2A 5F   A2 C1 9E FC 89 D1 08 C0  .....m*_........
    00A0: 82 DA 4D D1 97 3B AB AB   1A 8B 35 D9 1C C0 DF B4  ..M..;....5.....
    00B0: 67 E3 39 A4 C8 73 2C F0   2A 70 2B 14 F7 F1 9C E8  g.9..s,.*p+.....
    00C0: 71 89 99 93 AB AE D6 4B   A0 46 1A 13 54 4E 6B 3B  q......K.F..TNk;
    00D0: E9 CE 97 92 4D 64 25 0C   D9 4F 3B A6 CC 78 36 C0  ....Md%..O;..x6.
    00E0: AE 75 0F A9 C1 3D D8 B2   AF 5F 68 9F FB EB 31 2F  .u...=..._h...1/
    00F0: 41 16 83 04 7B F2 0D 8E   07 47 47 8F 55 F7 33 29  A........GG.U.3)
    ]
    ***
    Found XXXusted certificate:
    [[  Version: V3  Subject: CN=mqServermqtap.uyg.uat11, OU=XXX BT, O=XXX TAS, L=XXX, C=XXX  Signature Algorithm: SHA256withRSA, OID = 1.2.840.113549.1.1.11  Key:  Sun RSA public key, 2048 bits  modulus: 16868959742511831543539228188322318728282173929458725924838613545208147879023122029920833782971719231363516671703224653599860963934312081835272320238812022534477095634694802627860269361713438182846321229058529392716608829685708314508449574441166109812419649123445875905638934406872091742574829759871314621197235350998579563031139677192512639546904745848670104988385994626620908449612658040233325854445643585926360496269974991459750688880211123355953429519072414353674373705386071983844550354941821794692371907044593903275788892906274112049209437573188855729556317970379842595602177784867998565702046085858658609856373  public exponent: 65537  Validity: [From: Thu Jan 26 09:27:31 EET 2017,               To: Sun Jan 24 09:27:31 EET 2027]  Issuer: CN=mqServermqtap.uyg.uat11, OU=XXX BT, O=XXX TAS, L=XXX, C=XXX  SerialNumber: [    588996d3]Certificate Extensions: 2[1]: ObjectId: 2.5.29.35 Criticality=falseAuthorityKeyIdentifier [KeyIdentifier [0000: 04 62 9C B2 40 5E E0 C7                            .b..@^..
    ]][2]: ObjectId: 2.5.29.14 Criticality=falseSubjectKeyIdentifier [KeyIdentifier [0000: 04 62 9C B2 40 5E E0 C7                            .b..@^..
    ]]]  Algorithm: [SHA256withRSA]  Signature:0000: 27 23 9A F1 20 45 4E 98   2C A7 38 83 CE 99 7A 41  '#.. EN.,.8...zA
    0010: 0A 3A 57 02 E9 0F DE 73   73 01 07 B0 D8 19 C7 E2  .:W....ss.......
    0020: F2 2D 16 85 31 37 19 37   E4 2D B1 2C 4A F1 79 E4  .-..17.7.-.,J.y.
    0030: 09 99 E0 3A 47 B3 E2 4F   F4 EE 01 C3 D4 52 D4 94  ...:G..O.....R..
    0040: 38 49 09 59 3E 63 C1 44   48 B1 1F E3 B3 16 69 38  8I.Y>c.DH.....i8
    0050: E1 FA 5A 73 6F D1 F4 64   B3 0F 2E FD 49 72 87 F2  ..Zso..d....Ir..
    0060: 7E 59 76 87 C2 97 1C 8A   69 ED 92 52 D6 A4 3A 88  .Yv.....i..R..:.
    0070: 84 43 20 4B C7 4B C8 42   18 A0 E5 BF A6 C8 A7 32  .C K.K.B.......2
    0080: F2 E4 AA A3 F0 08 1F DF   F2 5E EE 1E 9F 84 4A CB  .........^....J.
    0090: 80 A8 9D 83 ED 6D 2A 5F   A2 C1 9E FC 89 D1 08 C0  .....m*_........
    00A0: 82 DA 4D D1 97 3B AB AB   1A 8B 35 D9 1C C0 DF B4  ..M..;....5.....
    00B0: 67 E3 39 A4 C8 73 2C F0   2A 70 2B 14 F7 F1 9C E8  g.9..s,.*p+.....
    00C0: 71 89 99 93 AB AE D6 4B   A0 46 1A 13 54 4E 6B 3B  q......K.F..TNk;
    00D0: E9 CE 97 92 4D 64 25 0C   D9 4F 3B A6 CC 78 36 C0  ....Md%..O;..x6.
    00E0: AE 75 0F A9 C1 3D D8 B2   AF 5F 68 9F FB EB 31 2F  .u...=..._h...1/
    00F0: 41 16 83 04 7B F2 0D 8E   07 47 47 8F 55 F7 33 29  A........GG.U.3)
    ]
    *** CertificateRequest
    Cert Types: RSA, DSS, ECDSA
    Supported Signature Algorithms: SHA512withRSA, SHA384withRSA, SHA256withRSA, Unknown (hash:0x3, signature:0x1), SHA1withRSA, SHA512withECDSA, SHA384withECDSA, SHA256withECDSA, Unknown (hash:0x3, signature:0x3), SHA1withECDSA, SHA1withDSA
    Cert Authorities:
    <CN=mqClientmqtap.uyg.uat, OU=XXX BT, O=XXX TAS, L=XXX, C=XXX>
    <CN=mqServermqtap.uyg.uat11, OU=XXX BT, O=XXX TAS, L=XXX, C=XXX>
    *** ServerHelloDone
    Warning: no suitable certificate found - continuing without client authentication
    *** Certificate chain
    <Empty>
    ***
    *** ClientKeyExchange, RSA PreMasterSecret, TLSv1.2
    jmsContainerBean_DEVOPS_DEVOPS_CONSUME_MESSAGE-1, WRITE: TLSv1.2 Handshake, length = 269
    SESSION KEYGEN:
    PreMaster Secret:
    0000: 03 03 B7 63 CA 3F 6F F4   A3 C8 68 5F 4E D4 84 9A  ...c.?o...h_N...
    0010: 17 03 40 12 66 C2 C3 D0   67 EE 64 54 50 5D AF ED  ..@.f...g.dTP]..
    0020: CD 8E 45 A9 6F CF 91 E1   60 6A 63 0D 9B CB AF D7  ..E.o...`jc.....
    CONNECTION KEYGEN:
    Client Nonce:
    0000: 5E D1 8F 80 F8 04 83 12   B3 4D 3A A3 D5 56 A2 27  ^........M:..V.'
    0010: 99 E9 42 52 44 8C A2 90   F5 DF 94 83 29 11 B6 0D  ..BRD.......)...
    Server Nonce:
    0000: 2A 55 EB 8E 98 28 77 FD   97 2F CE F3 51 6C 19 E3  *U...(w../..Ql..
    0010: C4 B4 EB E7 B4 D5 88 F5   44 4F 57 4E 47 52 44 01  ........DOWNGRD.
    Master Secret:
    0000: D9 0B 10 DB B5 9A 64 0C   56 2E 70 89 93 E4 52 6A  ......d.V.p...Rj
    0010: F7 C2 A9 9F 0D 6E 47 82   84 A0 6F D9 58 C0 E8 FF  .....nG...o.X...
    0020: E1 BB 6D 74 76 B0 D6 E5   83 FA 6F 89 D2 C1 BC 06  ..mtv.....o.....
    Client MAC write Secret:
    0000: 2E C0 A1 1A 6B 63 40 13   C9 2F 96 29 29 6B 46 3C  ....kc@../.))kF<
    0010: 61 48 69 06 66 9A 20 45   3C F4 63 BB 80 AE 95 84  aHi.f. E<.c.....
    Server MAC write Secret:
    0000: 64 5D 2F F0 C3 76 E7 53   61 0A D6 9A 23 80 7E 29  d]/..v.Sa...#..)
    0010: C9 15 CC 4A 1A 6A 0C F8   5D A6 2F C3 CE F8 04 88  ...J.j..]./.....
    Client write key:
    0000: A1 3C 3A F9 81 3E 4A F4   D5 30 EB 7C FB 10 AF 1B  .<:..>J..0......
    Server write key:
    0000: 0F 0C 65 F8 C5 6B C1 8B   C4 51 36 35 2E 9F ED D6  ..e..k...Q65....
    ... no IV derived for this protocol
    jmsContainerBean_DEVOPS_DEVOPS_CONSUME_MESSAGE-1, WRITE: TLSv1.2 Change Cipher Spec, length = 1
    *** Finished
    verify_data:  { 101, 32, 15, 187, 98, 153, 21, 159, 88, 122, 119, 59 }
    ***
    jmsContainerBean_DEVOPS_DEVOPS_CONSUME_MESSAGE-1, WRITE: TLSv1.2 Handshake, length = 80
    jmsContainerBean_DEVOPS_DEVOPS_CONSUME_MESSAGE-1, READ: TLSv1.2 Change Cipher Spec, length = 1
    jmsContainerBean_DEVOPS_DEVOPS_CONSUME_MESSAGE-1, READ: TLSv1.2 Handshake, length = 80
    *** Finished
    verify_data:  { 80, 170, 1, 54, 80, 55, 237, 31, 125, 189, 221, 180 }
    ***
    %% Cached client session: [Session-2, TLS_RSA_WITH_AES_128_CBC_SHA256]
    jmsContainerBean_DEVOPS_DEVOPS_CONSUME_MESSAGE-1, WRITE: TLSv1.2 Application Data, length = 288
    jmsContainerBean_DEVOPS_DEVOPS_CONSUME_MESSAGE-1, setSoTimeout(5000) called
    jmsContainerBean_DEVOPS_DEVOPS_CONSUME_MESSAGE-1, READ: TLSv1.2 Application Data, length = 96
    jmsContainerBean_DEVOPS_DEVOPS_CONSUME_MESSAGE-1, setSoTimeout(0) called
    jmsContainerBean_DEVOPS_DEVOPS_CONSUME_MESSAGE-1, called close()
    jmsContainerBean_DEVOPS_DEVOPS_CONSUME_MESSAGE-1, called closeInternal(XXXue)
    jmsContainerBean_DEVOPS_DEVOPS_CONSUME_MESSAGE-1, SEND TLSv1.2 ALERT:  warning, description = close_notify
    jmsContainerBean_DEVOPS_DEVOPS_CONSUME_MESSAGE-1, WRITE: TLSv1.2 Alert, length = 64
    jmsContainerBean_DEVOPS_DEVOPS_CONSUME_MESSAGE-1, called closeSocket(XXXue)
    01:41:04,148 WARN  [org.jboss.jca.core.connectionmanager.pool.sXXXategy.OnePool

Body:
You are running a very old version of the software on the sender side, MQ 7.1 went out of support over three years ago (April 30 2017). IBM for a cost will provide extended support for an additional three years from what I understand, so it would seem that even that avenue of support is over. The 7.1.0.7 maintenance release itself came out November 15th 2015, so it is over 4.5 years old at this point. I would strongly suggest you move to a newer version.

Note that MQ v8.0 went out of support April 30 2020, and IBM announced that MQ v9.0 goes out of support September 30 2021. When you do migrate you should go with either 9.1 which has no announced end of support (they give five years minimum so it could be 2023) or go with the next version of MQ that should be out some time later this year.

You had two issues that you have detailed in the question and comments.

You are using a non-IBM Java, because of this the ciphersuite you were passing was incorrect, I advised to do the following:

Add the java system property com.ibm.mq.cfg.useIBMCipherMappings=false

Specify the ciphersuite as TLS_RSA_WITH_AES_128_CBC_SHA256

Once the above was corrected you started to get a new error.  Based on the troubleshooting you have done and the ssl debug logs, I noticed that you are at a version of MQ that does not include APAR IT10837: WEBSPHERE MQ CHANNEL START FAILS WITH AMQ9637 WHEN USING A TLS 1.2 CIPHER RUNNING IN AN ORACLE JRE

PROBLEM DESCRIPTION:

The Oracle JVM did not create a default internal key manager
object for TLS socket connections, meaning that the client's
signed personal certificates were not available for client
authentication during the handshake, causing the connection
attempt to fail.

Problem conclusion

An internal key manager object is now created for Oracle TLS
connections, so the client's signed personal certificates are
available during the handshake and the connection attempt
succeeds.

---------------------------------------------------------------
The fix is targeted for delivery in the following PTFs:

Version    Maintenance Level
v7.1       7.1.0.8
v7.5       7.5.0.7
v8.0       8.0.0.5

Because of this MQ does not find your keyStore and trustStore.

Recommended solution is to upgrade to a supported version of IBM MQ.  You can use Maven to get the current IBM MQ v9.1.0.5 LTS support client at the following link:

MVN REPOSITORY » com.ibm.mq  com.ibm.mq.allclient


问:
Convert API resource to array
I want to store data on Firestore. I need to send an array to Firestore. I have API resources and I wanted to use it.

My ApiResource:

```<code>public function toArray($request)
{
    return [
        'id' => $this->id,
        'name' => $this->name,
        'phone' => $this->phone,
        'addresses' => AddressResource::collection($this->addresses),
    ];
}
</code>```

Firestore store data:

```<code>public function set(User $user){
    $this->firestore->document($user->id)->set((new UserResource($user)));
}
</code>```

It is an error:

Argument 1 passed to
  Google\Cloud\Firestore\DocumentReference::set() must be of the type
  array, object given,...

答:
You can call the toJson() on your Api Resource object:

```<code>$data = MyModel::with('addresses')->find(1);

$myArray = json_decode((new MyModelResource($data))->toJson(), true);
</code>```

So you could just:

```<code>$this->firestore->document($user->id)->set($myArray);
</code>```

Title: Convert API resource to array

Body:
I want to store data on Firestore. I need to send an array to Firestore. I have API resources and I wanted to use it.

My ApiResource:

public function toArray($request)
{
    return [
        'id' => $this->id,
        'name' => $this->name,
        'phone' => $this->phone,
        'addresses' => AddressResource::collection($this->addresses),
    ];
}

Firestore store data:

public function set(User $user){
    $this->firestore->document($user->id)->set((new UserResource($user)));
}

It is an error:

Argument 1 passed to
  Google\Cloud\Firestore\DocumentReference::set() must be of the type
  array, object given,...

Body:
You can call the toJson() on your Api Resource object:

$data = MyModel::with('addresses')->find(1);

$myArray = json_decode((new MyModelResource($data))->toJson(), true);

So you could just:

$this->firestore->document($user->id)->set($myArray);


问:
Convert an R object to a List
I've got a script that runs R from Python:

```<code>from rpy2.robjects.packages import importr
binom = importr('binom')
from rpy2 import robjects

robjects.r('''library(binom)
p = seq(0,1,.001)
coverage = binom.coverage(p, 25, method="asymptotic")$coverage
''')

R_P = robjects.r['p']
R_C = robjects.r['coverage']
</code>```

I can see the result using plt.scatter:

But when I try plt.plot I get:

```<code>AttributeError: 'FloatVector' object has no attribute 'find'
</code>```

R_C is an:

```<code>R object with classes: ('numeric',) mapped to:
<FloatVector - Python:0x0000002CA644E448 / R:0x0000002CA14A6D38>
[1.000000, 0.024702, 0.048818, 0.072360, ..., 0.072360, 0.048818, 0.024702, 1.000000]
</code>```

To get a line plot of R_C against R_P, do I need to convert it to a list and how do I do that please?

答:
Thanks JohanC, this works!

```<code>plt.plot(list(R_P), list(R_C))
</code>```

or

```<code>R_P = list(robjects.r['p'])
R_C = list(robjects.r['coverage'])
</code>```

Title: Convert an R object to a List

Body:
I've got a script that runs R from Python:

from rpy2.robjects.packages import importr
binom = importr('binom')
from rpy2 import robjects

robjects.r('''library(binom)
p = seq(0,1,.001)
coverage = binom.coverage(p, 25, method="asymptotic")$coverage
''')

R_P = robjects.r['p']
R_C = robjects.r['coverage']

I can see the result using plt.scatter:

But when I try plt.plot I get:

AttributeError: 'FloatVector' object has no attribute 'find'

R_C is an:

R object with classes: ('numeric',) mapped to:
<FloatVector - Python:0x0000002CA644E448 / R:0x0000002CA14A6D38>
[1.000000, 0.024702, 0.048818, 0.072360, ..., 0.072360, 0.048818, 0.024702, 1.000000]

To get a line plot of R_C against R_P, do I need to convert it to a list and how do I do that please?

Body:
Thanks JohanC, this works!

plt.plot(list(R_P), list(R_C))

or

R_P = list(robjects.r['p'])
R_C = list(robjects.r['coverage'])


问:
Report command with discord python
I am trying to create a report command that sends a message to a channel. Such as *report username#1234 reasoning is put here etc etc etc.

channel receives it by {user} reported by {author} for {reason}.
and a private message is sent to the author telling them the report went through.

However if the reported user has the "kick" permission then its also sent to a second channel.
And a private message sent to me the owner. Structured the same as {user} reported by {author} for {reason}.

But... I keep getting some weird errors, like bots not defined (even though it is defined).

```<code>    async def report(self, ctx, user, *, reason=None):
        logger = bot.get_channel(644966241835941898)
        channel = bot.get_channel(641639710183129113)
        if reason is None:
            await ctx.author.send('Hey I get that you are trying to report someone but I need a reason. Please try again.')
        elif ctx.message.author.guild_permissions.read_messages:
            await ctx.channel.send(f'{user} reported by {author} for {reason}')
        elif user.guild_permissions.kick_members:
            await ctx.logger.send(f'{user}, reported by {author} for {reason}')
            await ctx.channel.send(author, user, reason)
            await ctx.author.send("""Im going to put this in a safe spot for the wizard himself to review.""")```

```

答:
Your need to make the user argument look like this: user : discord.Membersand the reason argument to take all inputs after the user. I'm not sure what the point of having a logger and a channel is.

```<code>async def report(self, ctx, user : discord.Member, *reason):
    channel = self.bot.get_channel(your channel id) #since it's a cog u need self.bot
    author = ctx.message.author
    rearray = ' '.join(reason[:]) #converts reason argument array to string
    if not rearray: #what to do if there is no reason specified
        await channel.send(f"{author} has reported {user}, reason: Not provided")
        await ctx.message.delete() #I would get rid of the command input
    else:
        await channel.send(f"{author} has reported {user}, reason: {rearray}")
        await ctx.message.delete()
</code>```

Extra

If you want a special report for people with kick perms it would be something like Permissions.kick_members for the if statement. You can find it easily in the api.

Next time do more research but if u need anything just comment :)

Title: Report command with discord python

Body:
I am trying to create a report command that sends a message to a channel. Such as *report username#1234 reasoning is put here etc etc etc.

channel receives it by {user} reported by {author} for {reason}.
and a private message is sent to the author telling them the report went through.

However if the reported user has the "kick" permission then its also sent to a second channel.
And a private message sent to me the owner. Structured the same as {user} reported by {author} for {reason}.

But... I keep getting some weird errors, like bots not defined (even though it is defined).

    async def report(self, ctx, user, *, reason=None):
        logger = bot.get_channel(644966241835941898)
        channel = bot.get_channel(641639710183129113)
        if reason is None:
            await ctx.author.send('Hey I get that you are trying to report someone but I need a reason. Please try again.')
        elif ctx.message.author.guild_permissions.read_messages:
            await ctx.channel.send(f'{user} reported by {author} for {reason}')
        elif user.guild_permissions.kick_members:
            await ctx.logger.send(f'{user}, reported by {author} for {reason}')
            await ctx.channel.send(author, user, reason)
            await ctx.author.send("""Im going to put this in a safe spot for the wizard himself to review.""")```

Body:
Your need to make the user argument look like this: user : discord.Membersand the reason argument to take all inputs after the user. I'm not sure what the point of having a logger and a channel is.

async def report(self, ctx, user : discord.Member, *reason):
    channel = self.bot.get_channel(your channel id) #since it's a cog u need self.bot
    author = ctx.message.author
    rearray = ' '.join(reason[:]) #converts reason argument array to string
    if not rearray: #what to do if there is no reason specified
        await channel.send(f"{author} has reported {user}, reason: Not provided")
        await ctx.message.delete() #I would get rid of the command input
    else:
        await channel.send(f"{author} has reported {user}, reason: {rearray}")
        await ctx.message.delete()

Extra

If you want a special report for people with kick perms it would be something like Permissions.kick_members for the if statement. You can find it easily in the api.

Next time do more research but if u need anything just comment :)


问:
Version Management / Backup solution
This is not strictly a technical question, however I feel this will be useful for many technical people as well.

I'm looking for a version management / backup solution which need not be only for source code. This could be for non-text files e.g. images.

The requirement is this -

Every time I save the file from within the application, it should create a version.

I should be able to add comments for say, major revisions.

At any time, there should be only one version current.

I should be able to view previous versions without doing a 'restore'

I should be able to move back and forth between versions.

A calendar feature showing the various versions of a file would be helpful, if I could get to it for a specific file from the Explorer context menu

I don't really need to compare different versions or anything like that.

Windows solutions only. I've looked at NTI Shadow and it comes a bit close to what I'm looking for.

Are there any paid / free / open source solutions for the above requirements?

答:
In order for this to be transparent to applications (i.e., would not need to have application implement a different API for saving/loading files to access these backup features), you'd want to do this in the Operating System, at its file system layer.

ZFS filesystem could be wrapped to provide the user interface capabilities you describe, but it is doubtful this filesystem would ever reach Windows (directly, at least).

A simpler way to think of this is to look at network storage systems which can provide you the features you need.

NetApp Snapshot offers capabilities that could be tapped to do this at the network storage level.  It implements CIFS, so is definitely available on windows.  Open your wallet.

If you think this is an extremely important feature, you may consider other OSes than Windows; filesystems and filesystem support in OSes other than Windows are more diverse.

OwnerDisplayName: globetrotter

ContentLicense: CC BY-SA 2.5

Title: Version Management / Backup solution

OwnerDisplayName: popcnt


问:
Extract the current DOM and print it as a string, with styles intact
I'd like to be able to take my DOM, as is, and convert it to a string.  Let's say I open up the inspector and make a change to the margin-left property of a particular element.  That change should be reflected in my string.

The function should properly take all the styles currently applied to an element (excluding default values) and include them in the inline style for that element.

I have written a 'solution' which has proven to be inadequate.  The getMatchedCSSRules function in webkit is extremely finicky, and I haven't been able to determine why it sometimes works and doesn't work other times.  Therefore, I would like to avoid using this function unless it works 100% of the time.  Similarly, the getComputedStyle function has problems of its own.  If use the inspector to change the #footer element on this page to be 7px solid red rather than 7px solid black, the change will be reflected in when I run getComputedStyle(document.getElementById('footer')).cssText in the console, but it will also give me a host of inherited properties that were never modified by either the user using the inspector or by the stylesheets on the page.

I am looking for a solution that works with webkit--cross browser compatibility is not an issue at the moment.

Thank you!

答:
Can't you just do document.getElementsByTagName('body')[0].innerHTML? When I make changes in the inspector and then enter the above javascript in the console, it returns the updated HTML.

EDIT: I just tried putting that script in a function and attaching it to an onclick event. Made some updates in the inspector, clicked button, and it worked:

HTML

```<code><button onclick="printDOM()">Print DOM</button>
</code>```

Javascript

```<code>function printDOM() {
    console.log(document.getElementsByTagName('body')[0].innerHTML) ;
}
</code>```

Body:
Can't you just do document.getElementsByTagName('body')[0].innerHTML? When I make changes in the inspector and then enter the above javascript in the console, it returns the updated HTML.

EDIT: I just tried putting that script in a function and attaching it to an onclick event. Made some updates in the inspector, clicked button, and it worked:

HTML

<button onclick="printDOM()">Print DOM</button>

Javascript

function printDOM() {
    console.log(document.getElementsByTagName('body')[0].innerHTML) ;
}