Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
L

LighthouseJ

@LighthouseJ
About
Posts
177
Topics
52
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Getting size of a data structure
    L LighthouseJ

    Looks promising at a glance. I've been looking into just what marshaling is about and it's starting to gel, and this will help, thanks. Looking at the Marshal class seems to be just what I'm looking for, accessing the raw data.

    C# help question csharp lounge

  • File Transfer
    L LighthouseJ

    When I did serial communications, the hardest part was to efficiently handle the data which is what you're against, but that was in VC++ not C# but I'll take a shot in the dark. According to the NetworkStream documentation (which I assume you are using), there's a property called DataAvailable. Why not poll that property, when it's true, read the data? I don't know how you make sure you transmit all the bytes efficiently, but think about this: on a client connection: 1. server -> open file, capture file length as a 64-bit (8-byte) unsigned integer 2. server -> transmit the 8-bytes, client expects the same 8 bytes (at this point, the client knows how many bytes it'll receive) 3. client -> simply loop until the recv'd byte count matches what it's expecting Loop these 3 steps for each file you want to send. The most efficient communications code I've written is code that's very flexible but powerful. This includes making sure both sides are constantly at the same step in communication. In VC++, I used the timeout features of events inside of threads. Good luck.

    C# sysadmin announcement

  • Getting size of a data structure
    L LighthouseJ

    I'm trying to read the size and then get to the bits of any instance of data so I can teach it to a neural network. That way I can not only teach it strings, but also pictures for facial recognition, or other things, like maybe voice, or I can use it for error correction. I'm sure someone else has done it but I'm trying to learn C# and this is my project. If no one else has, I'll likely make it my first submission on here for others to see. I've seen "marshall" in class roots on help pages but I don't know what that is.

    C# help question csharp lounge

  • Getting size of a data structure
    L LighthouseJ

    I know how to overload class and operators but that's not the goal. I'll state what I'm trying to do in the other thread so I only write it once.

    C# help question csharp lounge

  • Getting size of a data structure
    L LighthouseJ

    I'm writing a program and I need to figure out how big any single data structure is but the programs' signature simply allows any thing of "object" type because I want to allow anything. How can I figure out how many bytes whatever is sent to the program is long? I tried looking at sizeof and stuff but it appears sufficiently different from C so I'm stuck and it requires unsafe which doesn't seem like the best thing. I can't find anything using the Type class with <obj>.GetType() or typeof(<obj>). I've done searches and I guess my problem is too general to search so I'm stuck. This object can be a byte, character, string or an instance of a custom class or anything at all. I want to be as unrestrictive as possible. If it can't be done easily or at all, I'll probably revert back to C but I'm trying to learn C#. Thanks in advance, Nate.

    C# help question csharp lounge

  • File Transfer
    L LighthouseJ

    You could get a program like Ethereal and watch the traffic and see which side is corrupting the data for a start. That will let you narrow down which side is causing the problems and give you more information. Other than that, check your properties and make sure your options are set properly. I had to deal with serial communications and it kept on screwing up at a certain character for seemingly no reason. The fix was that I forgot to set some ancient option buried in documentation.

    C# sysadmin announcement

  • When main thread working the Whole Form Freezes
    L LighthouseJ

    I've run into this before. I ended up using creating a single delegate function called ThreadEvent which does everything and derived my own class called ThreadEventArgs from EventArgs to handle communicating what the thread is reporting. Here's my delegate that handles whenever the thread sends any signal: private void ThreadEventDelegate (object sender, ThreadEventArgs e) if (<control>.InvokeRequired) {   this.BeginInvoke(new ThreadEvent (ThreadEventDelegate), new Object[] { sender, e }); } else {   <handle the event properly here> } This is needed because the thread cannot change a control. What this does is it asks the control what unique thread number it is under. Whatever current thread is running is compared and if they are the same, then it doesn't need to invoke and it's safe to change the control. If they are different, the thread calls BeginInvoke to execute a new delegate asynchronously with the same data it was passed inside the thread it should have been.

    C# question

  • car plate recognition
    L LighthouseJ

    I can't think of any other mechanism that would do the trick. I don't have any of my old programs but there are several articles on here that feature neural networks in different ways and a google search for neural network yielded many pages on it. I'm sorry I can't help you further but I haven't used a neural network in a long time.

    C# tutorial question

  • car plate recognition
    L LighthouseJ

    I don't know about DirectX but I figure in DirectX that it simply converts a click and extends a vector basically perpendicular into the screen and the first surface it touches is the selected entity. If that's so, then I'm pretty sure it's not a neural network. You can use Windows fonts I guess but if you're reading license plate letters, you really should teach the network using license plate letters, otherwise your network might think 5's are S's and vice versa if a license plate S or 5 looks like Ariel's 5 or S, respectively. You want to "teach" the network with the best materials to minimize error when it goes to work. That's why I said objects that yield the highest contrast give the best weights to the network and do really well. Weights by the way are individual numbers on how likely any particular node is "on". For instance, if you fed in all the license plate letters and every character occupies a particular pixel, the node that corresponds to that pixel will probably have a weight of 1, meaning that pixel will always be used. When you to go set the network to operate and you give it a picture where that pixel is not used, then the progression of the network will rule out all of it's learned possiblities and result in telling the user that it doesn't know what that image is which is what is supposed to happen.

    C# tutorial question

  • car plate recognition
    L LighthouseJ

    I've programmed a simple neural network in some hardware before and I've simulated it in C++ too. You only need to first demystify the neural network by realizing it's just standard matrix algebra then figure out how to apply the neural network to the problem. I figure you'd have to create an image for each character on a place, feed each into the network so the network "learns" all the images, then scan the plate and pick out each letter. It's best to convert your pictures to black and white because the neural network works best when there's ample contrast. If you can't convert the pictures, then you'll have to increase the qualify of the network by adding new nodes. If you demystify and understand a neural network, the short paragraph above makes much more sense. Good luck. I know two groups of people that used a neural network to correctly identify someone by their voice and by their faces over 99% of the time.

    C# tutorial question

  • Network Email Sniffer in C#?
    L LighthouseJ

    What if you used a program called Ethereal to capture the traffic you want to sniff. Figure out what trigger you are looking for and then program that into your project? Ethereal can get very detailed and can show you where the data is in the packets you are looking for. It parses out the data automatically based on what protocol it's sent and can show you the raw data if you need to see it.

    C# csharp sysadmin business question

  • Help! I can't get it to work!!!!
    L LighthouseJ

    How are you building the list? I think it would be easier to sort the list out as you find data rather than sorting it later. I'm working on a similar problem myself at the moment, I'll let you know what I come up with when I solve it.

    C# question help

  • Running SQL in a Thread
    L LighthouseJ

    As someone suggested to me on here yesterday, you might want to look into System.ComponentModel.BackgroundWorker as an alternative. I haven't used it myself, I stuck to threads because it's what I know much more of anyway but it might be worth looking into yourself.

    C# database winforms question

  • Thread-safe Access to Form Controls
    L LighthouseJ

    I looked at BackgroundWorker after you said it and concluded that using it would require a lot of rewiring of my program, more than I was willing to do. However, I do now know it exists and I'll keep it in mind next time around.

    C# help csharp com question

  • Thread-safe Access to Form Controls
    L LighthouseJ

    I think I found the problem with what I was doing originally, I don't think I was invoking the delegate right. I ran across this page which talks about BeginInvoke. I used the section of code declared as the typical way of using BeginInvoke as my inspiration and got my invoke working pretty well. I thought anyone reading this and interested in a fix might want to know.

    C# help csharp com question

  • Thread-safe Access to Form Controls
    L LighthouseJ

    that's interesting, thanks. I unfortunately got an exception saying not enough arguments were supplied so I added in my arguments for the delegates like this:

    _statusbar.Owner.Invoke((ThreadEvent)delegate
    {
      _statusbar.Text = "test test, started work";
    }, new Object[] { this, ThreadEventArgs("test message", 0, TheadStatusType.thread_started) });

    In my original delegate, I had it declared object, ThreadEventArgs so I guess that's what it wanted. This works, and without the form-side needing a delegate. Is that the best though? With it like this, it requires a status bar to exist in order to work. I liked the idea of triggering an event and the form can receive it if it wants to and deal with it as it sees fit.

    C# help csharp com question

  • Thread-safe Access to Form Controls
    L LighthouseJ

    I'm trying to create a program to make thread-safe calls to form controls, specifically to instances of ToolStripStatusLabel and ToolStripProgressBar. I ran cross this page when VC# told me I was unsafely calling the control. The problem is those two classes aren't derived from Control and don't have the InvokeRequired property. I tried using the forms' own InvokeRequired but it's not working and I don't know what to do. Anyone have any help?

    C# help csharp com question

  • C# Class Inheritance
    L LighthouseJ

    I double checked that several times and I did give all four instances of ToString the override keyword. It's very frustrating that it keeps happening. I also added marks in each ToString to display what class the ToString is being called from and the first three classes are fine, it's just that last one class can't show it's ToString in the combo box like it should. I'll keep hammering at it though, I know it's worked before. I figure I might have a "base.ToString()" instead of a "this.ToString()" or something set wrong like that.

    C# help csharp database data-structures oop

  • C# Class Inheritance
    L LighthouseJ

    Actually, I was wrong and it's a combobox, but class B contains the string and a custom class, and C has an int. My class structure and ToString() method definitions are basically the same thing, you say yours works so I don't know what's different to not work.

    C# help csharp database data-structures oop

  • C# Class Inheritance
    L LighthouseJ

    I thought about that before and tried it but there was no difference in the outcome in runtime.

    C# help csharp database data-structures oop
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups