Le Kevin dot com

photographic-poetic-musical horizon

Generic type Data Helper for SQL and Oracle. This application compatible for multiple database handling in Single Connection-string Value. When the Data layer send SQL type values, Helper
automatically convert to SQL. When Data Layer send Oracle type values, Helper automatically convert to Oracle. This is really help for Professional Developers.

Download http://blog.lekevin.com/wp-content/uploads/2015/04/DBHelper0509.zip

 

via: http://www.a1vbcode.com/app-5644.asp

The pattern for disposing an object, referred to as a dispose pattern, imposes order on the lifetime of an object. The dispose pattern is used only for objects that access unmanaged resources, such as file and pipe handles, registry handles, wait handles, or pointers to blocks of unmanaged memory. This is because the garbage collector is very efficient at reclaiming unused managed objects, but it is unable to reclaim unmanaged objects.

Class BaseClass : Implements IDisposable
   ' Flag: Has Dispose already been called? 
   Dim disposed As Boolean = False 
 
   ' Public implementation of Dispose pattern callable by consumers. 
   Public Sub Dispose() _
              Implements IDisposable.Dispose
      Dispose(True)
      GC.SuppressFinalize(Me)           
   End Sub 
 
   ' Protected implementation of Dispose pattern. 
   Protected Overridable Sub Dispose(disposing As Boolean)
      If disposed Then Return 
 
      If disposing Then 
         ' Free any other managed objects here. 
         ' 
      End If 
 
      ' Free any unmanaged objects here. 
      '
      disposed = True 
   End Sub 
End Class
 
Class DerivedClass : Inherits BaseClass 
   ' Flag: Has Dispose already been called? 
   Dim disposed As Boolean = False 
 
   ' Protected implementation of Dispose pattern. 
   Protected Overrides Sub Dispose(disposing As Boolean)
      If disposed Then Return 
 
      If disposing Then 
         ' Free any other managed objects here. 
         ' 
      End If 
 
      ' Free any unmanaged objects here. 
      '
      disposed = True 
 
      ' Call base class implementation. 
      MyBase.Dispose(disposing)
   End Sub 
End Class

via: https://msdn.microsoft.com/en-us/library/fs2xkftw.aspx

SQL Data Provider VB.NET Class: This class is for simplifying and accelerating working with SQL, using this class is very simple; there is a sample below for this class, which I hope is useful. You can report bugs, opinions and suggestions to me. – Tags: .NET, ADO.NET, SQL, VB.NET, SQL Server, Documentation – http://www.developerfusion.com/code/5445/sql-data-provider-vbnet-class/

   Public Function FillDataset(ByVal cmdPara As String, ByVal cmdType As CommandType, Optional ByVal parameters() As OracleParameter = Nothing) As DataSet    
      Dim sqlda As OracleDataAdapter = Nothing
      Dim res As New DataSet
      Try
         cmd.Dispose()
         cmd = Nothing
         cmd = New OracleCommand(cmdPara, conn)
         cmd.CommandType = cmdType
         AssignParameters(parameters)
         sqlda = New OracleDataAdapter(cmd)
         sqlda.Fill(res)
         cmd.Parameters.Clear()
 
      Catch ex As Exception
         cmd.Parameters.Clear()
         OnCustomError(Me, New CustomHelpersErrorEventArgs(ErrorTypes.CustomExceptionTypes.ExecuteStoredProcedure, ex, "FillDataset()...", True))
      Finally
         If Not (sqlda Is Nothing) Then sqlda.Dispose()
      End Try
      Return res
   End Function
   Private Sub AssignParameters(ByVal cmdParameters() As OracleParameter)
      If (cmdParameters Is Nothing) Then Exit Sub
      For Each p As OracleParameter In cmdParameters
         cmd.Parameters.Add(p)
      Next
   End Sub
 
   Private Sub AssignParameters(ByVal parameterValues() As Object)
      If Not (cmd.Parameters.Count - 1 = parameterValues.Length) Then Throw New ApplicationException("Stored procedure's parameters and parameter values does not match.")
      Dim i As Integer
      For Each param As OracleParameter In cmd.Parameters
         If Not (param.Direction = ParameterDirection.Output) AndAlso Not (param.Direction = ParameterDirection.ReturnValue) Then
            param.Value = parameterValues(i)
            i += 1
         End If
      Next
   End Sub

Update AppSettings and custom configuration sections in App.config at runtime: Here is the sample App.config file used to illustrate how to add, edit or remove keys in AppSettings and custom configuration sections at runtime. – by Yi Zeng – Tags: app.config, appsettings, config, configuration, sections – http://yizeng.me/2013/08/31/update-appsettings-and-custom-configuration-sections-in-appconfig-at-runtime/

   Private Sub UpdateLastRun()
      Dim lastRun As String = Format(Now(), "MM/dd/yyyy hh:mm:ss tt") & ""
 
      Dim xmlDoc = New XmlDocument()
      xmlDoc.Load(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile)
      xmlDoc.SelectSingleNode("//FileMgrSettings/add[@key='poVerifyLastRun']").Attributes("value").Value = lastRun
      Try
         xmlDoc.Save(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile)
      Catch ex As Exception
         Throw New Exception(ex.Message().ToString())
      Finally
         oLogger.LogIt("Update lastrun timer to config: " & lastRun)
         ConfigurationManager.RefreshSection("FileMgrSettings")
      End Try
 
   End Sub

The JavaScript Task Runner: In one word: automation. The less work you have to do when performing repetitive tasks like minification, compilation, unit testing, linting, etc, the easier your job becomes. – http://gruntjs.com/

WinSCP .NET Assembly and COM Library: The WinSCP .NET assembly winscpnet.dll is a .NET wrapper around WinSCP’s scripting interface that allows your code to connect to a remote machine and manipulate remote files over SFTP, SFTP, WebDAV and SCP sessions from .NET languages, such as C#, VB. – Tags: sftp client,scp client,ftp client,windows,secure file transfer,ftp,freeware – http://winscp.net/eng/docs/library#csharp

C# Example

using System;
using WinSCP;
 
class Example
{
    public static int Main()
    {
        try
        {
            // Setup session options
            SessionOptions sessionOptions = new SessionOptions {
                Protocol = Protocol.Sftp,
                HostName = "example.com",
                UserName = "user",
                Password = "mypassword",
                .GiveUpSecurityAndAcceptAnySshHostKey = True     
            };
 
            using (Session session = new Session())
            {
                // Connect
                session.Open(sessionOptions);
 
                // Upload files
                TransferOptions transferOptions = new TransferOptions();
                transferOptions.TransferMode = TransferMode.Binary;
 
                TransferOperationResult transferResult;
                transferResult = session.PutFiles(@"d:\toupload\*", "/home/user/", false, transferOptions);
 
                // Throw on any error
                transferResult.Check();
 
                // Print results
                foreach (TransferEventArgs transfer in transferResult.Transfers)
                {
                    Console.WriteLine("Upload of {0} succeeded", transfer.FileName);
                }
            }
 
            return 0;
        }
        catch (Exception e)
        {
            Console.WriteLine("Error: {0}", e);
            return 1;
        }
    }
}

VB.NET Example

Imports System
Imports WinSCP
 
Friend Class Example
 
    Public Shared Function Main() As Integer
 
        Try
            ' Setup session options
            Dim mySessionOptions As New SessionOptions
            With mySessionOptions
                .Protocol = Protocol.Sftp
                .HostName = "example.com"
                .UserName = "user"
                .Password = "mypassword"
                .GiveUpSecurityAndAcceptAnySshHostKey = True     
            End With
 
            Using mySession As Session = New Session
                ' Connect
                mySession.Open(mySessionOptions)
 
                ' Upload files
                Dim myTransferOptions As New TransferOptions
                myTransferOptions.TransferMode = TransferMode.Binary
 
                Dim transferResult As TransferOperationResult
                transferResult = mySession.PutFiles("d:\toupload\*", "/home/user/", False, myTransferOptions)
 
                ' Throw on any error
                transferResult.Check()
 
                ' Print results
                For Each transfer In transferResult.Transfers
                    Console.WriteLine("Upload of {0} succeeded", transfer.FileName)
                Next
            End Using
 
            Return 0
        Catch e As Exception
            Console.WriteLine("Error: {0}", e)
            Return 1
        End Try
 
    End Function
 
End Class

Project Ara: hands-on with Google’s latest modular smartphone prototype: Right now, there’s a war to make the thinnest smartphone in the world. Google is a part of that with Android and with its Nexus devices. – by Josh Lowensohn – http://www.theverge.com/2015/1/14/7547529/google-project-ara-prototype-hands-ontf