topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Friday April 19, 2024, 9:27 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - jumper [ switch to compact view ]

Pages: [1]
1
Frankly, writing GUIs in Java sucks

Yea, it was a very long time ago when I tried to write a GUI. At that time I think the only thing that was available was the SWING libraries.

2
Especially the GUI-part, when not building a web application, can be hard. I try to avoid Java-based-GUI applications where possible :tellme:

Like a lot of Java libraries, it's free and open source, Log4J just like the .NET port Log4Net.

Yep, the GUI part is what I was trying to learn. I didn't do very good and found that understanding it at all had a steep learning curve.

Also, I tried Log4Net and couldn't get it to work. Right now, I'm making a Log class now and besides writing to a file, it will also write to the event log just as soon as I know how to do it :)




3
Hm, being a mostly Java developer, with just some occasional .NET (C#) work, I didn't take a very close look, as I'm used to Log4J as a logging framework, so I intend to use Log4Net in my .NET projects. Though I've written similar loggers in older projects :tellme:

Hi, and thanks for posting. I always respect Java developers. I tried learning it once and just didn't do very good. I've heard of Log4 before. Is it free? I'm sure I can find out by searching though. Have a great day.

4
Hi everyone. I was beginning to wonder why nobody said anything about the code, so I went back to the code to take a look. I'm glad I said it was a long time ago, because the code contained a lot of crap it didn't need in it. I was so worried about what to do if the logfile was gone, I didn't think about the code I was actually writing. So, I apologize for the code, and I will give you the updated version that does everything that the first code does.

And it's only 3 lines.

Code: Visual Basic [Select]
  1. Public Sub LogToFile(LogMessage As String)
  2.         Using sw = AppendText(logfilename)
  3.             sw.WriteLine(LogMessage)
  4.         End Using
  5.     End Sub

I forgot that append would add to the file or create the file.
So yep, I'm dumb.

5
Well, that's good!  The highlighting might not be working, but the code formatting is working, which is one thing.  I guess we should ping mouser about the highlighting.

Yea, I'm glad I found out what was going on. I think it would be a good thing to let someone know, but I vote for you because I only joined today :cool:

6
I can't log in as you but here's a screenshot of what we're talking about.

I was just about to tell you I don't see 'any' of that, but your post reminded me of something. I use No Script for Firefox, and that's the reason I couldn't see it. When I changed it to 'trust this site'... Everything showed. No wonder you thought I was nuts <smile>

I was beginning to think the same thing.

7
skwire, why don't you log in as me? So you can tell me if I'm losing my mind or what.

8
I set the highlighting but it appears that the VB highlighter isn't working properly (or there was nothing to highlight in jumper's code).

I couldn't find the source code "button" or whatever it is so I just put it in code brackets:

What am I supposed to be looking for? That would help. While I'm making this post, I'm looking for something that has to do with code, but I don't see anything, but I'm sure it's pilot error.

Also, I don't see where to select 'quote' either (I made the one I'm using)

We have code highlighting format that can make it even more useful.  There's a drop-down above the post area that has formatting for many different languages.  Visual basic is there.

There IS no pull down menu when I'm making a post.

9
I don't know if this is what you meant. I just put some blocks in there That I've seen elsewhere.

10
I hate to be dumb, but I don't see it.

11
Sorry, I didn't see that. I'll fix it.

12
Developer's Corner / Thanks.
« on: May 29, 2016, 12:17 PM »
Here's what you need in the imports section:

Code: Visual Basic [Select]
  1. Imports System.IO
  2. Imports System.IO.File
  3. Imports System.Reflection

And here's the function. I imagine that some people will notice that I check to see if the file is there. Then in the try block, the first thing I do is try to delete the file. I can't really remember why I did this. It may have been just wanting to make sure it was not there before creating the new file.

Here's the function, also here's what's at the top of the class that defines logfilename
Code: Visual Basic [Select]
  1. Const logFilename As String = "logFile.txt"
  2.  
  3.     Public Function logFile(LogMessage As String, Optional ex As Exception = Nothing) As Boolean
  4.  
  5.         If Not Exists(logFilename) Then
  6.             Try
  7.                 Delete(logFilename)
  8.                 Create(logFilename).Dispose()
  9.  
  10.                 Using sw = AppendText(logFilename)
  11.                     sw.WriteLine(LogMessage)
  12.                 End Using
  13.                 Return True
  14.             Catch
  15.                 Throw New Exception("File Not Found " & ex.Message)
  16.             End Try
  17.         Else
  18.             Using sw = AppendText(logFilename)
  19.                 sw.WriteLine(LogMessage)
  20.             End Using
  21.         End If
  22.         Return False
  23.     End Function

And here's the way you do it if you want to know what function an error came from. Also ex.Message is optional.
Code: Visual Basic [Select]
  1. logFile(MethodBase.GetCurrentMethod.ToString & " Some Error Message " & ex.Message)

Hope someone finds this helpful. I almost forgot... when you define just the logfileName, it writes the information in the working directory. If you want to go somewhere else, just add the path to the const. And, the error text in the catch section should be changed to something else. I just didn't take the time to do it yet.

And... I made this a while ago, so it's not very OO.

13
Developer's Corner / Hi, first post in the developers section
« on: May 29, 2016, 11:37 AM »
I have some code to show, but I'm not sure if I should post it or not. It's not a product/project, but something I use all the time. It's a function that logs to a file. I also use it for debugging because it can tell you what method the error came from. It uses reflection. It's just for developers who might be using vb.net. But I'm sure you could take the code as a skeleton and use it in some other language.

14
General Software Discussion / Re: VB.NET Log to file code
« on: May 29, 2016, 11:30 AM »
Hey, that's great. Think I will stop by and maybe sow it to them

15
General Software Discussion / VB.NET Log to file code
« on: May 29, 2016, 08:46 AM »
Hi, I thought I would ask about something. I have a log to file method for vb.net and thought I would ask if I should post it or not. I use it for debugging and standard logging. One nice thing it does is: If you use it one way, it just logs to a file, but you can also use it, for example, in a try and catch block. And then you can change the way you you log to include what method you are in when it goes to the catch block. Of course you can use the method thing where ever you are in the code.

just wondering. Oh, I'm a c++ guy too but when I retired, I picked up vb.net just to have fun.

16
N.A.N.Y. 2011 / Re: SnapDB: Really nice software
« on: May 29, 2016, 08:24 AM »
ty

17
N.A.N.Y. 2011 / Re: SnapDB: Really nice software
« on: May 29, 2016, 08:00 AM »
Ok that helps -- I've modified the subject lines to reflect it.

Now to part 2 of the confusion:  Your subject says "Got odd results" but your actual posts doesn't seem to mention anything about odd results.

At first I thought I had found an "issue" with the software. I opened the file with notepad++ and it looked "odd". It appeared like the first two fields were both in column. And all the other fields looked like they were inside one column to the left. Here is what it looked like.

V   1.5.1
H   Column 1   Column 2   Column 3   Column 4
W   80   80   80   80
O   1   2   3   4
P   674   397   572   365
F   1
R1   FirstName   LastName   PhoneNumber   Birthday
R2   Joe Barnes 456-5555   may 16 1954

Now you can see why I thought it was "odd". But I tested it loading the file and it worked fine, But I did that in the middle of writing my message and forgot to change the title.

18
N.A.N.Y. 2011 / Re: SnapDB: Really nice software
« on: May 29, 2016, 07:43 AM »
Thank you ATH, I appreciate the info. Of the databases you mentioned, if I were to choose, I would go with SQLite. Plus, I'm already working with XML files in my software, but I've read where if it gets too big, it would be slow. Of course I don't know because I've never tried it.

19
N.A.N.Y. 2011 / Re: SnapDB: Really nice software
« on: May 29, 2016, 06:31 AM »
My apologies, I got here through a link in the software. I'm talking about SnapDB.

20
N.A.N.Y. 2011 / Re: SnapDB: Really nice software
« on: May 29, 2016, 04:24 AM »
It's hard to know what to say without repeating what I wrote previously. I'm a software engineer and I've been looking for a flat-file database for a project I'm working on. I've never worked with database and I'm terrible with SQL queries.

Hope this explains things

21
N.A.N.Y. 2011 / SnapDB: Really nice software
« on: May 28, 2016, 08:00 PM »
Hi, great idea. I've been looking for something like this. I'm using VS 2015 and just want a small database for a program I'm writing.

I'll let you know how it turns out.

jumper

(new member)

Pages: [1]