Oxiegen 88 Basically an Occasional Poster Featured Poster

I did consider using WTS. And although that provides all that you mentioned, it still didn't appeal to me.
Thank you for your reply. Truly. But not what I was asking for.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Hi!
It's been a while since I last posted here.

I've just gotten started with Windows Service, and have created a sort of 24/7 service to update a database.
But because it's my very first project (besides the tutorial one) I feel that I could use some assistance in checking it over.

The intent is to have it run a method from a class at about once every 24 hours.
If anyone of you clever people could spare a moment to see if I've made mistakes.
(Ignore the database connections. Those work)

Imports System
Imports System.Timers
Imports System.Runtime.InteropServices
Public Class FileRenamerSrv
    Private thetvdb As clsTheTVDBv2

    <DllImport("advapi32.dll", SetLastError:=True)>
    Private Shared Function SetServiceStatus(ByVal handle As System.IntPtr, ByRef serviceStatus As ServiceStatus) As Boolean
    End Function

    Public Enum ServiceState
        SERVICE_STOPPED = &H1
        SERVICE_START_PENDING = &H2
        SERVICE_STOP_PENDING = &H3
        SERVICE_RUNNING = &H4
        SERVICE_CONTINUE_PENDING = &H5
        SERVICE_PAUSE_PENDING = &H6
        SERVICE_PAUSED = &H7
    End Enum

    <StructLayout(LayoutKind.Sequential)>
    Public Structure ServiceStatus
        Public dwServiceType As Integer
        Public dwCurrentState As ServiceState
        Public dwControlsAccepted As Integer
        Public dwWin32ExitCode As Integer
        Public dwServiceSpecificExitCode As Integer
        Public dwCheckPoint As Integer
        Public dwWaitHint As Integer
    End Structure

    Public Sub New()
        InitializeComponent()
    End Sub

    Public Sub OnDebug()
        OnStart(Nothing)
    End Sub

    Protected Overrides Sub OnStart(ByVal args() As String)
        Dim serviceStatus1 As ServiceStatus = New ServiceStatus
        serviceStatus1.dwCurrentState = ServiceState.SERVICE_START_PENDING
        serviceStatus1.dwWaitHint = 100000
        SetServiceStatus(Me.ServiceHandle, serviceStatus1)

        InitializeDatabase()
        PreLoadUpdate()

        thetvdb = New clsTheTVDBv2()

        Dim timr As Timer = New Timer
        'timr.Interval = 60000
        timr.Interval = TimeSpan.FromHours(24).TotalMilliseconds
        AddHandler timr.Elapsed, AddressOf Me.OnTimer
        timr.Start()
        OnTimer(Nothing, Nothing)

        serviceStatus1.dwCurrentState = ServiceState.SERVICE_RUNNING
        SetServiceStatus(Me.ServiceHandle, serviceStatus1)
    End Sub

    Protected …
Oxiegen 88 Basically an Occasional Poster Featured Poster

The first thing you need to do is to make sure that the content of both the textboxes are indeed numeric.
The function for that is called IsNumeric and returns a boolean value.

Second. In order to perform any calculations you need to convert the numeric strings in the textboxes. And because you are multiplying with a decimal value, you need to convert them into Double.

So.The calculation would look something like this.

Dim product As Double

If IsNumeric(textbox2.Text) = True Then
    product = CDbl(Val(textbox2.Text)) * 0.75

    If IsNumeric(textbox1.Text) = True Then
        If product <= CDbl(Val(textbox1.Text)) Then
            Shell "notepad", vbNormalFocus
            SendKeys "g152b"
        Else
            Shell "notepad", vbNormalFocus
            SendKeys "cb152b"
    End If
End If

If you need to limit the number of decimals this might produce you can use the Round() function.
product = Round(product, <number of decimals, 0 is default>)

Oxiegen 88 Basically an Occasional Poster Featured Poster

Thanks for the replies. (This has happened to me in both Win7 and now on Win10).

I already knew that I can reboot and delete (as I stated in my OP). I was just hoping for an explanation as to why it happens.

Also. If the font was installed it would show up in Control Panel and Fonts, which by the way is the exact same thing as browsing to C:\Windows\Fonts if you didn't know.
But since the fonts I want to remove are not in there the explanation is that they are not actually installed. As I also said in my OP.
Oh, and also not in the registry.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Hi guys!
It's been a while since I last posted here.

I'm having an issue with not being able to remove non-installed fonts.
Meaning, the fonts are not installed in the Windows/Fonts folder and cannot be uninstalled the proper way.
These fonts came with some kind of hidden-object game that my nephew used to play and got copied into the game folder (ie, not installed into windows), and got left behind after I uninstalled the game.
But for some reason windows still claim that they are in use and thus cannot be removed.

Sure. I can reboot and delete them after that.
But why should I have to do that when the fonts aren't even installed on a system level.

If anyone can provide me with either a solution and/or an explanation, that would be awesome.
Thanks!

Oxiegen 88 Basically an Occasional Poster Featured Poster

Ooh. I understand. :)

Oxiegen 88 Basically an Occasional Poster Featured Poster

Huh. I thought it sort of shared the concept of the creation of the object at the declaration with any other object based language.
You know: Node1 root; creates an object. That was my reasoning.
Anyway. Now I know.
Do go on providing real help. :D

Oxiegen 88 Basically an Occasional Poster Featured Poster

Answer to JamesCherril:
Right here...

Node1 root;

public BST() {
    root = null;
}

Like I said. I'm not really a java coder. I was just following the statement that the error occured on the first line.
But I just realized that I misread that post. :)
Though, I figured it was worth checking out considering that the error message pointed out there were problems with the arguments.

Oxiegen 88 Basically an Occasional Poster Featured Poster

I'm not enterily sure about how java handles constructors.
But could the problem be that the only constructor in Node1 takes arguments, and that you're instantiating it using no arguments as the very first act in the BST constructor?

What would happen if you change the constructor in Node1 to take no arguments, and instead add properties to insert the values those arguments are for?

Oxiegen 88 Basically an Occasional Poster Featured Poster

Failing to understand what my resolution has anything to do with it.
Sure. A low resolution makes everything look big no matter what.
Is 1360x1050 considered a low resolution?

For example, in private messages. I don't think you need to see the message until you actually click to, you know, read it. Which is part of what makes it look bloated, I think.
Like others also has said. The font could be smaller.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Hmm. I'm not entirely liking the new design.
It's looks enlarged as if you're using the accessibility tools in Windows.
We're not blind or elderly. You can tone down the bloatiness of it. And the font size.
In fact, I liked the previous design better than this, and the one before that even more.
To me it seems to be getting worse and worse every time a new design gets published.

JamesCherrill commented: I'm elderly and part-way to going blind +0
Oxiegen 88 Basically an Occasional Poster Featured Poster

I'm not entirely sure if it's possible to have it both ways.
Allow the server to maintain the established connection between each client talking to each other, but to also establish a direct connection between the clients for sending of messages.

That would permit the server to run that connection timer and send instructions to each client ordering them to terminate the connection to each other. And also for the clients to have that close-to-real-time communication you want.
But it requires each client to run two threads, one listening to the server and the other for talking to the other client.

Oxiegen 88 Basically an Occasional Poster Featured Poster

In my opinion it's a bit hard to define "real time" as an actual amount of time.
How would you know the difference between 0.00 seconds and 5 seconds since you're not talking to yourself, nor may the other client not even be in the same building/room as yours.
Especially when text-chatting.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Yeah. My question was retorical. :)
The reason I asked was, if you manage to use the server to initialize the communication and then release it into the hands of the clients, then the server would no longer know anything about what's going on between the clients and thus not know when to kill the connection.
But, if you keep the server as a relay and force the clients to communicate through the server, then you can use those countdown timers. :)

Oxiegen 88 Basically an Occasional Poster Featured Poster

Consider this, two clients are merrily talking to each other. How and when would the server know when to cut the connection?

Odd that you did'nt find any articles at all.
Most articles out there describes how it's done. Listen and send. That's peer-to-peer.
All those types of clients that you can download has that built-in. They listen for an incoming handshake connection, send a response, listen for data, send data.
The server is, sort of, also a peer-to-peer client but with the ability to recieve commands on which it can act on.

Here's a good example of a peer-to-peer solution: http://www.codeproject.com/Articles/1297/Peer-to-Peer-Communicator-and-File-Transfer

Here's a good video tutorial of a client-server solution: https://www.youtube.com/watch?v=MSiBbtxWpI8
He mentions's that the list of clients can come from any type of collection.
For me, that includes a database.

Here's a sample multi-user client server solution: https://code.msdn.microsoft.com/Simple-Multi-User-TCPIP-1ff0da41

Good luck! :)

Oxiegen 88 Basically an Occasional Poster Featured Poster

By using the server as the initial connector between clients and then handing it off to the clients themselves to "talk", you may not be able to have the server restablish control and break the connection.

Your best bet is, as I said, to have the server be the constant relay.
Also, unless you store/log the communications between the clients then all data transfers are private. Considering that the communication also is semi peer-to-peer.
You also might wanna implement some kind of client-side encryption/decryption to ensure that, should the clients wish to go private.
Using a pre-defined random key sent by the requesting client, you can ensure that the recieving client decrypts the data correctly.

The use of Client(index) tells me that you have a fixed array of client IP's.
It needs to be a by-command dynamic call to the datasource, and you only need to remember the client requesting the peer-to-peer connection and the client-requestee.

Oxiegen 88 Basically an Occasional Poster Featured Poster

I think that you have pretty much answered your question yourself already.
If you can send data between the client and server, then the server knows the IP of the client, right?
And also, because you can send data to the server it's quite easy to send a command the server can respond to.
Just add code to read/write the database with the requested username as an argument and start a new thread that communicates with the requested second client, if online.

Threads in VB.NET can be made to talk to each other, so shuffling data between the two (or three or four) is possible in order to allow communication between two clients with the server as the go-between.
There are many examples and tutorials, both here and other sites, that can show you how to accomplish this.
Like this one: Share Information Between Threads

Oxiegen 88 Basically an Occasional Poster Featured Poster

Nothing?

Oxiegen 88 Basically an Occasional Poster Featured Poster

I know that I could use a webservice if this was for iOS (or a webapplication!).
But because I said that I'm porting a Windows program, I would think that it was obvious. Appearently not.
This is for OSX Mavericks and Yosemite, not iOS.

The whole point of creating a program with a database backend, local or remote, is to not have to use webservices.

And while I'm asking.
Is there such a thing as an equivalent of DataSets/DataTables in Cocoa/Swift to make things easier?

Oxiegen 88 Basically an Occasional Poster Featured Poster

Hi.
I'm in the process of learning Swift coding and decided to attempt a porting of one of my existing Windows programs.
The thing is, that program relies heavily on connecting to a remote MySQL server.

I've seen a few attempts to provide various connectors to an assortment of databases, including MySQL.
Most solutions say that it can be done using a bridge to Object C, but none really show how.

Does anyone here have any experience in connecting a Cocoa/Swift application to a MySQL server (or any remote database at all)?

Oxiegen 88 Basically an Occasional Poster Featured Poster

Sooo very true. (Is the power cable plugged in?)

Oxiegen 88 Basically an Occasional Poster Featured Poster

jwenting:
This, I can agree on. :D

Oxiegen 88 Basically an Occasional Poster Featured Poster

This, I can agree on. :D

Oxiegen 88 Basically an Occasional Poster Featured Poster

jwenting:
This, I can agree on. :D

Oxiegen 88 Basically an Occasional Poster Featured Poster

(It's quite curious to see the word "recommended" all the time. Meaning that it's not required.
Also, section 6.2 in the convention clearly states: "...at the beginning of blocks". Which is exactly the same as either on the same line as the method declaration or on it's own line. Just because an example shows one thing, doesn't mean that's how it's done.)

Oxiegen 88 Basically an Occasional Poster Featured Poster

Wouldn't have been easier to use iTextSharp instead?
It's free and already have all the classes and methods for creating/manipulating PDF's and converting them to images.

Oxiegen 88 Basically an Occasional Poster Featured Poster

stultuske:

so your point is: if I write it, it'll never be updated ?
weird philosophy.

That's what you took away from it, that the code would never be updated?
It's your code, you can update it however much you like, or not.

But what does any of this back and forth have to do with where you put the starting curly brace?
And no matter where you put that one single little thing, coders that might view the code after you WILL understand what's going on. And no recoding has to be done, or cleaned up, just for that.
It doesn't matter if some dusty old directive dictates where the curly brace goes. It's readable and can be understood by anyone doing Java.

That was my point. EOF.

Oxiegen 88 Basically an Occasional Poster Featured Poster

Like I said.
Don't jump down my throat just because I have an opinion as an answer to the OP.

stultuske:
Your point of view is based on someone who works as a coder at some company.
My point of view is not.

Oxiegen 88 Basically an Occasional Poster Featured Poster

I wasn't trying to make a sound reason.
It was just me pointing out a certain point of view.

If you are the only coder, and whoever you do the coding for is only interested in the finished product, then why would anyone but the coder care how you use the curly braces?

Just because some dude in some dusty old office cook up some kind of directive, you are not really obligated to neither read it nor conform to it other than to use the general syntax of the programming language in question.

But that's just my opinion, no need to jump down my throat about it.

Oxiegen 88 Basically an Occasional Poster Featured Poster

For me it's either way.
I usually just go with whatever the developer tool do when I hit enter when creating a method or class.
If the bracket moves to a new line, so be it. The compiler will not ever complain, so why should a person?
If someone tells me I'm doing it wrong, I just simply ignore him/her and do it my way anyway.
On the other hand, if you happen to be part of a coding team you should absolutely follow the coding guidelines set forth by the team.