Sign Up

Have an account? Sign In Now

Sign In

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask question.

Forgot Password?

Need An Account, Sign Up Here

You must login to add post.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Passionable Logo Passionable Logo
Sign InSign Up

Passionable

Passionable Navigation

  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • New Questions
  • Trending Questions
  • Must read Questions
  • Hot Questions

Share & grow the world's knowledge!

We want to connect the people who have knowledge to the people who need it, to bring together people with different perspectives so they can understand each other better, and to empower everyone to share their knowledge.

Create A New Account
  • Recent Questions
  • Most Answered
  • Bump Question
  • Answers
  • Most Visited
  • Most Voted
  • No Answers
  1. Asked: January 13, 2022

    Get list from pandas dataframe column or row?

    Alek Richter Enlightened
    Added an answer on January 13, 2022 at 2:21 pm

    Pandas DataFrame columns are Pandas Series when you pull them out, which you can then call x.tolist() on to turn them into a Python list. Alternatively you cast it with list(x). import pandas as pd data_dict = {'one': pd.Series([1, 2, 3], index=['a', 'b', 'c']), 'two': pd.Series([1, 2, 3, 4], index=Read more

    Pandas DataFrame columns are Pandas Series when you pull them out, which you can then call x.tolist() on to turn them into a Python list. Alternatively you cast it with list(x).

    import pandas as pd

    data_dict = {‘one’: pd.Series([1, 2, 3], index=[‘a’, ‘b’, ‘c’]),
    ‘two’: pd.Series([1, 2, 3, 4], index=[‘a’, ‘b’, ‘c’, ‘d’])}

    df = pd.DataFrame(data_dict)

    print(f”DataFrame:\n{df}\n”)
    print(f”column types:\n{df.dtypes}”)

    col_one_list = df[‘one’].tolist()

    col_one_arr = df[‘one’].to_numpy()

    print(f”\ncol_one_list:\n{col_one_list}\ntype:{type(col_one_list)}”)
    print(f”\ncol_one_arr:\n{col_one_arr}\ntype:{type(col_one_arr)}”)

    Output:

    DataFrame:
    one two
    a 1.0 1
    b 2.0 2
    c 3.0 3
    d NaN 4

    column types:
    one float64
    two int64
    dtype: object

    col_one_list:
    [1.0, 2.0, 3.0, nan]
    type:

    col_one_arr:
    [ 1. 2. 3. nan]
    type:

    See less
    • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  2. Asked: January 13, 2022

    Received fatal alert: handshake_failure through SSLHandshakeException

    Alek Richter Enlightened
    Added an answer on January 13, 2022 at 2:19 pm

    The handshake failure could have occurred due to various reasons: Incompatible cipher suites in use by the client and the server. This would require the client to use (or enable) a cipher suite that is supported by the server. Incompatible versions of SSL in use (the server might accept only TLS v1,Read more

    The handshake failure could have occurred due to various reasons:

    Incompatible cipher suites in use by the client and the server. This would require the client to use (or enable) a cipher suite that is supported by the server.
    Incompatible versions of SSL in use (the server might accept only TLS v1, while the client is capable of only using SSL v3). Again, the client might have to ensure that it uses a compatible version of the SSL/TLS protocol.
    Incomplete trust path for the server certificate; the server’s certificate is probably not trusted by the client. This would usually result in a more verbose error, but it is quite possible. Usually the fix is to import the server’s CA certificate into the client’s trust store.
    The cerificate is issued for a different domain. Again, this would have resulted in a more verbose message, but I’ll state the fix here in case this is the cause. The resolution in this case would be get the server (it does not appear to be yours) to use the correct certificate.

    Since, the underlying failure cannot be pinpointed, it is better to switch on the -Djavax.net.debug=all flag to enable debugging of the SSL connection established. With the debug switched on, you can pinpoint what activity in the handshake has failed.

    Update

    Based on the details now available, it appears that the problem is due to an incomplete certificate trust path between the certificate issued to the server, and a root CA. In most cases, this is because the root CA’s certificate is absent in the trust store, leading to the situation where a certificate trust path cannot exist; the certificate is essentially untrusted by the client. Browsers can present a warning so that users may ignore this, but the same is not the case for SSL clients (like the HttpsURLConnection class, or any HTTP Client library like Apache HttpComponents Client).

    Most these client classes/libraries would rely on the trust store used by the JVM for certificate validation. In most cases, this will be the cacerts file in the JRE_HOME/lib/security directory. If the location of the trust store has been specified using the JVM system property javax.net.ssl.trustStore, then the store in that path is usually the one used by the client library. If you are in doubt, take a look at your Merchant class, and figure out the class/library it is using to make the connection.

    Adding the server’s certificate issuing CA to this trust store ought to resolve the problem. You can refer to my answer on a related question on getting tools for this purpose, but the Java keytool utility is sufficient for this purpose.

    Warning: The trust store is essentially the list of all CAs that you trust. If you put in an certificate that does not belong to a CA that you do not trust, then SSL/TLS connections to sites having certificates issued by that entity can be decrypted if the private key is available.

    Update #2: Understanding the output of the JSSE trace

    The keystore and the truststores used by the JVM are usually listed at the very beginning, somewhat like the following:

    keyStore is :
    keyStore type is : jks
    keyStore provider is :
    init keystore
    init keymanager of type SunX509
    trustStore is: C:\Java\jdk1.6.0_21\jre\lib\security\cacerts
    trustStore type is : jks
    trustStore provider is :

    If the wrong truststore is used, then you’ll need to re-import the server’s certificate to the right one, or reconfigure the server to use the one listed (not recommended if you have multiple JVMs, and all of them are used for different needs).

    If you want to verify if the list of trust certs contains the required certs, then there is a section for the same, that starts as:

    adding as trusted cert:
    Subject: CN=blah, O=blah, C=blah
    Issuer: CN=biggerblah, O=biggerblah, C=biggerblah
    Algorithm: RSA; Serial number: yadda
    Valid from SomeDate until SomeDate

    You’ll need to look for if the server’s CA is a subject.

    The handshake process will have a few salient entries (you’ll need to know SSL to understand them in detail, but for the purpose of debugging the current problem, it will suffice to know that a handshake_failure is usually reported in the ServerHello.

    1. ClientHello

    A series of entries will be reported when the connection is being initialized. The first message sent by the client in a SSL/TLS connection setup is the ClientHello message, usually reported in the logs as:

    *** ClientHello, TLSv1
    RandomCookie: GMT: 1291302508 bytes = { some byte array }
    Session ID: {}
    Cipher Suites: [SSL_RSA_WITH_RC4_128_MD5, SSL_RSA_WITH_RC4_128_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA, SSL_RSA_WITH_DES_CBC_SHA, SSL_DHE_RSA_WITH_DES_CBC_SHA, SSL_DHE_DSS_WITH_DES_CBC_SHA, SSL_RSA_EXPORT_WITH_RC4_40_MD5, SSL_RSA_EXPORT_WITH_DES40_CBC_SHA, SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA, SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA]
    Compression Methods: { 0 }
    ***

    Note the cipher suites used. This might have to agree with the entry in your merchant.properties file, for the same convention might be employed by the bank’s library. If the convention used is different, there is no cause of worry, for the ServerHello will state so, if the cipher suite is incompatible.

    2. ServerHello

    The server responds with a ServerHello, that will indicate if the connection setup can proceed. Entries in the logs are usually of the following type:

    *** ServerHello, TLSv1
    RandomCookie: GMT: 1291302499 bytes = { some byte array}
    Cipher Suite: SSL_RSA_WITH_RC4_128_SHA
    Compression Method: 0
    ***

    Note the cipher suite that it has chosen; this is best suite available to both the server and the client. Usually the cipher suite is not specified if there is an error. The certificate of the server (and optionally the entire chain) is sent by the server, and would be found in the entries as:

    *** Certificate chain
    chain [0] = [
    [
    Version: V3
    Subject: CN=server, O=server’s org, L=server’s location, ST =Server’s state, C=Server’s country
    Signature Algorithm: SHA1withRSA, OID = some identifer

    …. the rest of the certificate
    ***

    If the verification of the certificate has succeeded, you’ll find an entry similar to:

    Found trusted certificate:
    [
    [
    Version: V1
    Subject: OU=Server’s CA, O=”Server’s CA’s company name”, C=CA’s country
    Signature Algorithm: SHA1withRSA, OID = some identifier

    One of the above steps would not have succeeded, resulting in the handshake_failure, for the handshake is typically complete at this stage (not really, but the subsequent stages of the handshake typically do not cause a handshake failure). You’ll need to figure out which step has failed, and post the appropriate message as an update to the question (unless you’ve already understood the message, and you know what to do to resolve it).

    See less
    • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  3. Asked: January 13, 2022

    Why is the apt-get function not working in the terminal on Mac OS X v10.9 (Mavericks)?

    Alek Richter Enlightened
    Added an answer on January 13, 2022 at 2:18 pm

    Mac OS X doesn't have apt-get. There is a package manager called Homebrew that is used instead. This command would be: brew install python Use Homebrew to install packages that you would otherwise use apt-get for. The page I linked to has an up-to-date way of installing homebrew, but at present, youRead more

    Mac OS X doesn’t have apt-get. There is a package manager called Homebrew that is used instead.

    This command would be:

    brew install python

    Use Homebrew to install packages that you would otherwise use apt-get for.

    The page I linked to has an up-to-date way of installing homebrew, but at present, you can install Homebrew as follows:

    Type the following in your Mac OS X terminal:

    /usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

    After that, usage of Homebrew is brew install .

    One of the prerequisites for Homebrew are the XCode command line tools.

    Install XCode from the App Store.
    Follow the directions in this Stack Overflow answer to install the XCode Command Line Tools.

    Background

    A package manager (like apt-get or brew) just gives your system an easy and automated way to install packages or libraries. Different systems use different programs. apt and its derivatives are used on Debian based linux systems. Red Hat-ish Linux systems use rpm (or at least they did many, many, years ago). yum is also a package manager for RedHat based systems.

    Alpine based systems use apk.
    Warning

    As of 25 April 2016, homebrew opts the user in to sending analytics by default. This can be opted out of in two ways:

    Setting an environment variable:

    Open your favorite environment variable editor.
    Set the following: HOMEBREW_NO_ANALYTICS=1 in whereever you keep your environment variables (typically something like ~/.bash_profile)
    Close the file, and either restart the terminal or source ~/.bash_profile.

    Running the following command:

    brew analytics off

    the analytics status can then be checked with the command:

    brew analytics

    See less
    • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  4. Asked: January 13, 2022

    ORA-12505, TNS:listener does not currently know of SID given in connect descriptor

    Alek Richter Enlightened
    Added an answer on January 13, 2022 at 2:17 pm

    I fixed this issue by correcting my jdbc string. For example, the correct jdbc string should be... jdbc:oracle:thin:@myserver:1521/XE But the jdbs string I was using is ... jdbc:oracle:thin:@myserver:1521:XE (Note: between 1521 and XE should be a /) This bad jdbc string give me a ORA-12505 error tooRead more

    I fixed this issue by correcting my jdbc string.

    For example, the correct jdbc string should be…

    jdbc:oracle:thin:@myserver:1521/XE

    But the jdbs string I was using is …

    jdbc:oracle:thin:@myserver:1521:XE

    (Note: between 1521 and XE should be a /)

    This bad jdbc string give me a ORA-12505 error too.

    See less
    • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  5. Asked: January 13, 2022

    What is AF_INET, and why do I need it?

    Alek Richter Enlightened
    Added an answer on January 13, 2022 at 2:16 pm

    AF_INET is an address family that is used to designate the type of addresses that your socket can communicate with (in this case, Internet Protocol v4 addresses). When you create a socket, you have to specify its address family, and then you can only use addresses of that type with the socket. The LRead more

    AF_INET is an address family that is used to designate the type of addresses that your socket can communicate with (in this case, Internet Protocol v4 addresses). When you create a socket, you have to specify its address family, and then you can only use addresses of that type with the socket. The Linux kernel, for example, supports 29 other address families such as UNIX (AF_UNIX) sockets and IPX (AF_IPX), and also communications with IRDA and Bluetooth (AF_IRDA and AF_BLUETOOTH, but it is doubtful you’ll use these at such a low level).

    For the most part, sticking with AF_INET for socket programming over a network is the safest option. There is also AF_INET6 for Internet Protocol v6 addresses.

    Hope this helps,

    See less
    • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  6. Asked: January 13, 2022

    What is the “right” JSON date format?

    Alek Richter Enlightened
    Added an answer on January 13, 2022 at 2:15 pm

    JSON itself does not specify how dates should be represented, but JavaScript does. You should use the format emitted by Date's toJSON method: 2012-04-23T18:25:43.511Z Here's why: It's human readable but also succinct It sorts correctly It includes fractional seconds, which can help re-establish chroRead more

    JSON itself does not specify how dates should be represented, but JavaScript does.

    You should use the format emitted by Date’s toJSON method:

    2012-04-23T18:25:43.511Z

    Here’s why:

    It’s human readable but also succinct

    It sorts correctly

    It includes fractional seconds, which can help re-establish chronology

    It conforms to ISO 8601

    ISO 8601 has been well-established internationally for more than a decade

    ISO 8601 is endorsed by W3C, RFC3339, and XKCD

    That being said, every date library ever written can understand “milliseconds since 1970”. So for easy portability, ThiefMaster is right.

    See less
    • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  7. Asked: January 13, 2022

    Error inflating class ImageView

    Alek Richter Enlightened
    Added an answer on January 13, 2022 at 2:14 pm

    I had the same problem. my problem has occurred because I just had used images (icons) in the "drawable-v24" folder. I solved it by copying them into "drawable" folder

    I had the same problem. my problem has occurred because I just had used images (icons) in the “drawable-v24” folder. I solved it by copying them into “drawable” folder

    See less
    • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
Load More Answers

Sidebar

Ask A Question

Stats

  • Questions 4k
  • Answers 4k
  • Best Answers 0
  • Users 2
  • Popular
  • Answers
  • Alek Richter

    When does a process get SIGABRT (signal 6)?

    • 2 Answers
  • Alek Richter

    How do I add sockets to an item?

    • 2 Answers
  • Alek Richter

    Dialog throwing "Unable to add window — token null is ...

    • 2 Answers
  • Alek Richter
    Alek Richter added an answer Pandas DataFrame columns are Pandas Series when you pull them… January 13, 2022 at 2:21 pm
  • Alek Richter
    Alek Richter added an answer The handshake failure could have occurred due to various reasons:… January 13, 2022 at 2:19 pm
  • Alek Richter
    Alek Richter added an answer Mac OS X doesn't have apt-get. There is a package… January 13, 2022 at 2:18 pm

Top Members

Alek Richter

Alek Richter

  • 4k Questions
  • 1k Points
Enlightened

Trending Tags

questin question

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • New Questions
  • Trending Questions
  • Must read Questions
  • Hot Questions

Latest News & Updates

There are no posts yet.

Explore Our Blog

© 2021 Passionable. All Rights Reserved