Search This Blog

Wednesday, October 8, 2014

Jenkins Email Error: Network is unreachable

Jenkins > Email > Network is unreachable error

send failed, exception: javax.mail.MessagingException: Could not connect to SMTP host:     , port: 25;
nested exception is:  java.net.SocketException: Network is unreachable: connect


Solution:

The problem is because java 1.7 uses IPv6 by default.
To fix this add Java Option from command line:

setx _JAVA_OPTIONS -Djava.net.preferIPv4Stack=true**




Tuesday, October 7, 2014

Set Next Build Number Jenkins

Jenkins > Next Build Number

Install plugin Next Build Number

https://wiki.jenkins-ci.org/display/JENKINS/Next+Build+Number+Plugin

After install you have to reload configuration from disk


Go to configure project and click on Set Next Build Number





Friday, October 3, 2014

ProcessStartInfo Example - Start Microsoft Word

C# > DiagnosticsProcessStartInfo

ProcessStartInfo specifies a set of values that are used when you start a process.

Example 

Start word

ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = "WINWORD.EXE";
Process.Start(startInfo);






Process Class C#

C# > Diagnostics > Process Class

A process is a running application.
Process class provide access to a process that is running on a computer. 
The Process component is a useful tool for starting, stopping, controlling, and monitoring apps.

Methods:






System.Diagnostics Namespace C#

C# > System.Diagnostics

System.Diagnostics contains classes that allow to interact with 

  • system processes
  • event logs
  • performance counters
Classes





    Tuesday, September 30, 2014

    SqlClient namespace

    C# > System.Data  > SqlClient

    SqlClient namespace is the.NET Framework Data Provider for SQL Server.





    SqlBulkCopy C# SQL Server import data example

    C# > System.Data  > SqlClient > SqlBulkCopy

    SqlBulkCopy efficiently bulk load a SQL Server table with data from another source.
    The data source is not limited to SQL Server, any data source can be used.
    SqlBulkCopy offers a significant performance.






    Example:

    string sourceConnectionString = "YourSourceConnectionString";
    string destinationConnectionString = "YourDestinationConnectionString";

    using (SqlConnection sourceConnection =
           new SqlConnection(sourceConnectionString))
                {
                    sourceConnection.Open();
                    SqlCommand commandSourceData = new SqlCommand(
                        "SELECT * FROM source_table;", sourceConnection);
                    SqlDataReader reader = commandSourceData.ExecuteReader();
                    using (SqlConnection destinationConnection =
                               new SqlConnection(destinationConnectionString))
                    {
                        destinationConnection.Open();
                        using (SqlBulkCopy bulkCopy =
                                   new SqlBulkCopy(destinationConnection))
                        {
                            bulkCopy.DestinationTableName = "dbo.destination_table";
                            try
                            {
                                bulkCopy.WriteToServer(reader);
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show(ex.Message);
                            }
                            finally
                            {
                                reader.Close();
                            }
                        }
                    }

                }