ragingben's Profile User Rating: -----

Reputation: 175 Stalwart
Group:
Authors
Active Posts:
641 (0.28 per day)
Joined:
07-October 08
Profile Views:
23,272
Last Active:
User is offline Dec 23 2014 07:41 AM
Currently:
Offline

Previous Fields

Country:
GB
OS Preference:
Windows
Favorite Browser:
FireFox
Favorite Processor:
Intel
Favorite Gaming Platform:
Nintendo
Your Car:
Volkswagen
Dream Kudos:
250

Latest Visitors

Icon   ragingben has not set their status

Posts I've Made

  1. In Topic: C# FileSystemWatcher The directory name Fonts is invalid.

    Posted 28 Nov 2014

    I would use a combination of the Environment.GetFolderPath() and Environment.SpecialFolder enum to get the font directory path:
    String fontsPath = Environment.GetFolderPath(Environment.SpecialFolder.Fonts);
    
  2. In Topic: Clarification on Static Classes

    Posted 28 Nov 2014

    I regularly use something similar in a system at work. I wrote a class library for controlling a robotics system. This has a Monitor class, that simply takes in routines the system can run, invokes them and monitors the feedback from them, alerting the user of any problems and initiating aborts, pauses etc if it picks up an error. It also allows the user to write data to it's feedback log with a WriteLine method similar to Console.WriteLine(). This data then enters a queue with a capacity of say 500, and this can be logged or whatever at any time, by any of the other projects that use it. It is really useful because then you can keep an application wide log of feedback from the different projects and do whatever you want with it. I have it so that each entry triggers an event if the user desires which allows me to display each feedback element in a terminal style window for the engineers.

    I think this is fine to do safely. Others may disagree, but I can't see any problem doing this at all.
  3. In Topic: Is having empty base classes an OK solution?

    Posted 28 Nov 2014

    It's not common, but I have done this. I wouldn't call it good design though.

    What could do is use an attribute to annotate both of the classes. The thing is, in the future it may pay off for you to use a base class and the inheritance structure that you have done, because there could be common functionality between the classes.

    So, in all honesty if you had fully designed and written this code as a commercial app and there was no chance of there being any commonality between tokens I would say use an attribute, but as it is in early stages and you are writing it non-commercially I would use Token as your base class as I would imagine there will be a need to add more to it at a later date.
  4. In Topic: Best practive ending threads?

    Posted 27 Nov 2014

    What you could do is use a ManualResetEvent to block the calling thread until the event is set, or it times out.
    // create a ManualResetEvent to act as a gate
    ManualResetEvent gate = new ManualResetEvent(false);
    
    Thread thd = new Thread(() =>
        {
            Scanner.ScanFile(fileName);
    
            // use set to allow progress
            gate.Set();
        });
    
    thd.Start();
    
    // wait for either the set, or 1 minute
    if (!gate.WaitOne(60000))
    {
        // if the waitone method returns false it has timed out
    
        // abort here - maybe there is a more elegant way of killing the thread
        thd.Abort();
    }
    
  5. In Topic: Random Select Dictionary values not Displaying

    Posted 10 Apr 2014

    If you put a breakpoint on the following line and hover the mouse over the .Question part what is displayed?
    // Display question for dictionary position selected
    this.lblQuestion.Text = this.questions[this.position].Question;
    

My Information

Member Title:
D.I.C Addict
Age:
29 years old
Birthday:
May 11, 1985
Gender:
Location:
Somerset, England, Uk
Interests:
Football, punk rock, guitar, squash, badminton, retro games, fx building
Full Name:
Ben Pollard
Years Programming:
8
Programming Languages:
VB6, C#, MINT, Flowcode, Python (a bit)

Contact Information

E-mail:
Click here to e-mail me
Website URL:
Website URL  http://www.0xdfx.wordpress.com
Twitter:
0xdfx

Comments

Page 1 of 1
  1. Photo

    Frinavale Icon

    21 Sep 2011 - 09:22
    :)
  2. Photo

    Frinavale Icon

    20 Sep 2011 - 13:50
    ..I figuered if they phrased their question differently I could help...
  3. Photo

    Frinavale Icon

    20 Sep 2011 - 13:50
    The reason I posted my "useless" comment is to pull more information from the OP about the topic. I didn't realize how old the thread was. I simply started answering a few of the newest questions in the forum. I took the OP's code, and played with it: trying to envision what on earth they were trying to accomplish and couldn't. I figured if they phrased their question differ...
  4. Photo

    Frinavale Icon

    20 Sep 2011 - 13:50
    I'm not having a "hissy fit" I just found your comment a harsh and wanted you to be aware of it.
  5. Photo

    Frinavale Icon

    20 Sep 2011 - 06:52
    <sarcasm>Thank you very much for the wonderful "welcome to the forum" message you left me in thread. It's SOOO nice to be back trying to help people</sarcasm>
Page 1 of 1