Ask Question Forum:
Model Library:2025-02-08:A.I. model is online auto reply
C
O
M
P
U
T
E
R
2
8
Show
#
ASK
RECENT
←
- Underline
- Bold
- Italic
- Indent
- Step
- Bullet
- Quote
- Cut
- Copy
- Paste
- Table
- Spelling
- Find & Replace
- Undo
- Redo
- Link
- Attach
- Clear
- Code
Below area will not be traslated by Google,you can input code or other languages
Hint:If find spelling error, You need to correct it,1 by 1 or ignore it (code area won't be checked).
X-position of the mouse cursor
Y-position of the mouse cursor
Y-position of the mouse cursor
Testcursor
caretPos
Attachment:===
Asked by XK8ER
at 2024-08-03 01:21:55
Point:500 Replies:1 POST_ID:828677USER_ID:10
Topic:
Microsoft Visual Basic.Net;.NET;C# Programming Language
Hello there,
I have spent many hours trying to figure out which source code to use.
I have two sources that are totally different but do the exact same thing that I'm looking for.
the code checks for processed log files based on (every minute) basis.
which approach is better if lets say i'm processing 100,000 logs per minute..
I have spent many hours trying to figure out which source code to use.
I have two sources that are totally different but do the exact same thing that I'm looking for.
the code checks for processed log files based on (every minute) basis.
which approach is better if lets say i'm processing 100,000 logs per minute..
Public Class Form1 Dim myValues As New List(Of Dictionary(Of String, Date))() Dim iCount As Long Private Sub cmdButton_Click(sender As Object, e As EventArgs) Handles cmdButton.Click myValues.Add(New Dictionary(Of String, Date)() From {{"logname", DateTime.Now}}) End Sub Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick iCount = 0 For Each value As Dictionary(Of String, Date) In myValues If value.First.Key.ToString = "logname" Then If (value("logname") >= DateTime.Now.AddMinutes(-1)) Then iCount += 1 End If End If Next Label.Text = iCount End SubEnd Class 1:2:3:4:5:6:7:8:9:10:11:12:13:14:15:16:17:18:19:20:21:22:
Public Class Form1 Dim processed_files As List(Of processed_log_file) = New List(Of processed_log_file) Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click processed_files.Add(New processed_log_file("logname", DateTime.Now)) Dim sublist As List(Of processed_log_file) sublist = processed_files.FindAll(AddressOf IsFromLast24h) lblLast24Hrs.Text = sublist.Count End Sub Function IsFromLast24h(ByVal b As processed_log_file) As Boolean If (b.processed_date >"= DateTime.Now.AddDays(-1)) Then Return True Else Return False End If End FunctionEnd ClassPublic Class processed_log_file Public file_name As String Public processed_date As Date Public Sub New(ByVal m_file_name As String, ByVal m_processed_date As Date) file_name = m_file_name processed_date = m_processed_date End SubEnd Class 1:2:3:4:5:6:7:8:9:10:11:12:13:14:15:16:17:18:19:20:21:22:23:24:25:26:27:28:29:30:31:32:
Accepted Solution
Expert: duncanb7 replied at 2024-08-03 01:28:03
500 points EXCELLENT
why not measure the program finish time to judge who is best ?
YOu can test it for two program by adding some code of time/date function at start
and at end of the code, and report how much time is used for each one
if both program are met your output requirement, and then use time finish to
choose the best one
I guess the first is the best since less code or less looping will be faster speed
YOu can test it for two program by adding some code of time/date function at start
and at end of the code, and report how much time is used for each one
if both program are met your output requirement, and then use time finish to
choose the best one
I guess the first is the best since less code or less looping will be faster speed