nighttrain's Profile User Rating: -----

Reputation: 8 Worker
Group:
Active Members
Active Posts:
421 (0.25 per day)
Joined:
22-September 10
Profile Views:
5,724
Last Active:
User is offline Today, 10:21 AM
Currently:
Offline

Previous Fields

Country:
PL
OS Preference:
Windows
Favorite Browser:
Internet Explorer
Favorite Processor:
Intel
Favorite Gaming Platform:
PC
Your Car:
Volkswagen
Dream Kudos:
0
Icon   nighttrain still drilling

Posts I've Made

  1. In Topic: migrate bulk insert from sql server to oracle

    Posted 28 Apr 2015

    I dont want to migrate data from sql server database. What i need is to replace actuall code loader but now for oracle. SQl server bul is good because i am not obligated to defife config file like is within sql loader tool. My vb.net application is gathering a lot of .csv delimeted files with diffrent count of columns etc. Sql server bulk is independent of that but if i would go sql loader then i would need to define for each file its own config and thats what i would like toa avoid.
  2. In Topic: Log class in use by diffrent windows services

    Posted 27 Mar 2015

    Yes i still didn't get appropriate answer, can anyone give some feedback on last question?
  3. In Topic: Log class in use by diffrent windows services

    Posted 27 Mar 2015

    I got solution with couple of projects including 3 windows services projects and one logger project which is shared class. Due to all services are using same logger project class i need a lock to avoid "process cannot access file because of another process..". In this situation 3 separated services writing to this logger. I made mutex and have two question for you.

    1) Is this use of mutex correct and will prevent other service to write but wait till other finish his job?

    2) In my case instead of putting: "Global\MyProjectName_823742384234" - can i put: "Global\" + Guid.NewGuid.ToString()" ?. Changing to dynamic guid does my 3 windows services will be still synchronized in case of logger class? Should i do like i have or with newguid?

    Here's my logger class:

    Imports System.IO
    Imports System.Threading
    
    Public NotInheritable Class Logger
    
        Private Shared ReadOnly _locker As New Mutex(False, "MyProjectName_823742384234")
    
    
          Public Shared Sub LogIt(ByVal engine As String, ByVal msg As String, ByVal logMessage As String, ByVal Path As String, ByVal IsDebug As Boolean)
    
    
                _locker.WaitOne()
    
                Try
                    If File.Exists(Path) Then
                        If IsDebug Then
                            Debug.Print(DateTime.Now & "> " & "| " & engine & " | " & msg & " | " & logMessage)
                            ' Debug.Print(message)
                        Else
                                Using w As TextWriter = File.AppendText(Path)
    
                                    'w.WriteLine(message)
                                    w.WriteLine(DateTime.Now & "> " & "| " & engine & " | " & msg & " | " & logMessage)
                                    w.Flush()
                                End Using
                        End If
                    Else
                        If IsDebug Then
                            '  Debug.Print(message)
                            Debug.Print(DateTime.Now & "> " & "| " & engine & " | " & msg & " | " & logMessage)
                        Else
                                Using w As TextWriter = File.CreateText(Path)
                                    '   w.WriteLine(message)
                                    w.WriteLine(DateTime.Now & "> " & "| " & engine & " | " & msg & " | " & logMessage)
                                    w.Flush()
                                End Using
                        End If
                    End If
    
                Finally
                    _locker.ReleaseMutex()
                End Try
    
            End Sub
    
        End Class
    
    
  4. In Topic: Objects before/in runtime

    Posted 21 Mar 2015

    i know :) but this is the point - instead List(Of String) is it possible to create/Load class/enum based on instead of List(Of String) for instance?
  5. In Topic: Objects before/in runtime

    Posted 18 Mar 2015

    Let me give you real example how it looks like. I decided to create enum because of the names I will use. So in this case I have enum which represents some servers. I have XML file which is describing some attributes of this enum like ip, location and others. Somwhere in code I am using this serialized xml data and using enum to do some things for some specific emsname. For instance in select case but I got more places where I am using this emsname. The problem is whenever I am adding some new ems to xml file I have to always update Enum EMSname and furthermore every place when using of it e.g this select case. This is the problem. That's why I asked is there any way after adding something to my xml config that for instance this enum can be automaticly be created from xml to avoid me to go and add it manually.
    Public Enum EMSname
    
        AMS5520_CUISAMS
        SOEM
        U2000
        SAM_ESS_CFAN7450
        SAM_ESS_REN7450
    
    End Enum
    
    


    then somewhere in code
      Select Case Me.EmsName
                Case Global.EMSname.U2000
                    Dim U2000Run As New U2000(mygeneralConfig, Me.EmsName)
                    U2000Run.RunLoaderDelimeted()
    
                Case Global.EMSname.SOEM
                    Dim SOEM As New SOEM(mygeneralConfig, Me.EmsName)
                    SOEM.RunLoaderDelimeted()
    
                Case Global.EMSname.AMS5520_CUISAMS
                    Dim AMS5520_CUISAMSRun As New AMS5520_CUISAMS(mygeneralConfig, Me.EmsName)
                    AMS5520_CUISAMSRun.RunLoaderDelimeted()
    
                Case Global.EMSname.SAM_ESS_CFAN7450
                    Dim SAM_ESS_CFAN7450 As New SAM_ESS_CFAN7450(mygeneralConfig, Me.EmsName)
                    SAM_ESS_CFAN7450.RunLoaderDelimeted()
    
                Case Global.EMSname.SAM_ESS_REN7450
                    Dim SAM_ESS_REN7450 As New SAM_ESS_REN7450(mygeneralConfig, Me.EmsName)
                    SAM_ESS_REN7450.RunLoaderDelimeted()
    
                Case Else
            End Select
    
    

My Information

Member Title:
D.I.C Regular
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Location:
Poland
Full Name:
Bob
Years Programming:
4
Programming Languages:
VB,NET

Contact Information

E-mail:
Click here to e-mail me
ICQ:
ICQ  637172526

Friends

Comments

Page 1 of 1
  1. Photo

    FlashM Icon

    24 Sep 2010 - 14:17
    no problem... you're welcome anytime...
Page 1 of 1