Unable to clone Git repository due to self signed certificate

[Origin]: https://confluence.atlassian.com/bitbucketserverkb/resolving-ssl-self-signed-certificate-errors-806029899.html

Symptoms

Git server is using self signed certificate and FishEye/Crucible unable to clone the Git repository.

The following appears in the atlassian-fisheye-<date>.log:

2013-07-02 18:15:48,400 WARN  [InitialPinger2 ] fisheye IndexingPingRequest-doRequest - Exception during FishEye Incremental Indexing of Gitrepo: com.cenqua.fisheye.config.ConfigException: Unable to clone remote repository: https://fisheyeuser@git.server:8443/scm/test/gitrepo.git
 - [fatal: unable to access 'https://fisheyeuser:XXXX@git.server:8443/scm/test/gitrepo.git/': SSL certificate problem: self signed certificate in certificate chain]
 - Cloning into bare repository 'clone'...

Cause

Git client in FishEye/Crucible server perform verification on the SSL certificate and stop the process if it is unknown.

Workaround

Disable Git SSL verification in the server hosting FishEye/Crucible with the following commands:

git config --global http.sslVerify false

Resolution

1. Import the Git server self signed certificate into FishEye/Crucible server according to PKIX Path Building Failed - Cannot Set Up Trusted Applications To SSL Services
2. Configure the Git client in FishEye/Crucible server to refer to the cacerts that have the imported certificate: 

git config --system http.sslCAPath /path/to/cacerts

3. Restart FishEye/Crucible server

Count function in XPath

[Originally posted by]: http://stackoverflow.com/questions/1985453/count-function-in-xpath

I have got an XML document and trying to get the number of nodes that have a particular text using xpath. see xml below

count(//event_type) returns the number of event_type nodes but what I want is the number of event_type nodes that have the Error text.

  <Response>
    <run_id>20091231-105000</run_id>
    <message>
      <timestamp>2009-12-31T10:50:00.46875+00:00</timestamp>
      <event_type>Information</event_type>
      <operation>LoadProjects</operation>
      <error_code />
      <details>LoadProjects request detected</details>
    </message>
    <message>
      <timestamp>2009-12-31T10:50:02.296875+00:00</timestamp>
      <event_type>Error</event_type>
      <operation>Processor.InitaliseDCFiles</operation>
      <error_code />
      <details>some error details</details>
    </message>
    <message>
      <timestamp>2009-12-31T10:50:02.296875+00:00</timestamp>
      <event_type>Debug</event_type>
      <operation>Processor.InitaliseDCFiles</operation>
      <error_code />
      <details>some details</details>
    </message>
  <Response> 

Thanks

shareedit
count(//event_type[text()='Error']) 

should do the trick. Also, a handy tool for XPath :http://www.whitebeam.org/library/guide/TechNotes/xpathtestbed.rhtm

Hoping this helps.

shareedit

What is the difference between a Field and a Property in C#?

In C#, what makes a field different from a property, and when should a field be used instead of a property?

shareedit

Properties expose fields. Fields should (almost always) be kept private to a class and accessed via get and set properties. Properties provide a level of abstraction allowing you to change the fields while not affecting the external way they are accessed by the things that use your class.

public class MyClass
{
    // this is a field.  It is private to your class and stores the actual data.
    private string _myField;

    // this is a property.  When you access it uses the underlying field, but only exposes
    // the contract that will not be affected by the underlying field
    public string MyProperty
    {
        get
        {
            return _myField;
        }
        set
        {
            _myField = value;
        }
    }
}

@Kent points out that Properties are not required to encapsulate fields, they could do a calculation on other fields, or serve other purposes.

@GSS points out that you can also do other logic, such as validation, when a property is accessed, another useful feature.

shareedit