|
I want to create a custom binding navigator control but I have some problems.I want to add some toolstrips(Items) to my control but I don't know how i can reach it
|
|
|
|
|
Hi I've been trying to find some way of have two systems establish a TCP connection via a Relay server so as to support clients behind a firewall/router with having to manually forward ports which can be done via an outbound connection. So the Client program sends socket info to the server which the server stores and passes to another client so that the two client can connect to each other. The problem lies in that I cannot convert System.Net.Socket to a Byte array to send it over a network stream. Any help would be hot.
Thanks in Advance
|
|
|
|
|
Can you explain in more detail as to what you're trying to accomplish because I think you've got confused over what can be done.
|
|
|
|
|
I need to have a server machine accept an incoming TCP connection as a socket. Then duplicate that socket and send it over a network stream to another tcp client.
EG. convert System.Net.Socket to binary and back.
|
|
|
|
|
Are you trying to get all communication to go through this realy server or just the initial stuff?
If option a) then set up a little protocol which sends the target machine in the opening and you'll have to write a "relay" client which looks for this information and simply copies the data from one to the other.
If option b) then you can't simply translate it into binary, send it and convert it back. What you'll have to do is send a message to the relay instructing it to send a message onto the other client which provides the necessary information (i.e. ip address) for it to establish a direct connection with the initiating machine.
|
|
|
|
|
Hi All,
What a great place this is!!!
I’m pretty new to .NET and fairly new to true OOP in general really. I’ve recently made the decision to move the development of an app I’m working on from FoxPro (which I know fairly well) to .NET & C# and I have some questions before I start moving this new version of the project forward.
To give some back ground on the FoxPro version. It basically scans the entire directory structure of the host machine (logical drives C:\, D:\ etc …) for files with certain file extensions and builds a database of them for sorting and querying. It extracts information about each file and stores that as well. All pretty basic stuff really and due to FoxPro being a database language its fairly dictated as to how this data is structured and stored … i.e – Its in tables in a Database.
The problem …
Now that I’m moving this over to the .NET framework (into a WPF App in fact) I have a stack of questions about how I should structure this data.
The recursion is easy using the built in classes DirectoryInfo and FileInfo etc … the question I have is how do you recommend I structure and store the results? The obvious one to me is in an array but I’m sure there is a better way. This is where I’m sure a few of you will laugh. I’m still a bit confused about what I can actually do with Objects which is why I’m here. I want to get this right from the get go. Avoiding anything boxing etc …
Would you create one object with parameters like (for argument sake):
public file
{
public Directoy
public FileName
public FileSize
public Extension
public Date
}
If so how would you add many entries (the equivalent to FoxPro records) to that one instance of an object?
Or would you create an array of objects that each in turn hold the required details about just one file? Or something along the lines of a DataTable maybe?
I think some of the source of my confusion is that I also need to persist this data on the host machine once its built from the directory structure by serializing the object(s) to disk. Can you even do that with an array of objects?
Anyway, I think that’s enough for now, I’m sure that any and all responses will generate more questions from me. Thanks for any input / direction / code examples.
|
|
|
|
|
The easiest way to add multiple records to an object, is to store a list inside the object. My question is, what do you do with this data ? If you need to search it, perhaps a list is more easy to traverse than a tree.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi Christian,
Thanks for a quick reply!
Basically the functionality of the app is:
1. Scan the machine for certain files (based on a lookup file)
2. Grab various bit of information about each file and store those as well
3. Categorise files on things like strings found in the directory location and file name etc ...
4. Display the information in a grid (Directory Location, File Name, File Size, Date etc ...)
5. Provide data bound (bound to the lookup files) controls on the interface to query the complete list of files
When you refer to lists I'm assuming you mean Generics?
Once the software has scanned the machine and built the initial list that data also need to be persisted on the machine and reloaded each time the app is started. I'll also add in functionality to scan for new files. Things like that.
Regards,
James.
|
|
|
|
|
Member 4664921 wrote: When you refer to lists I'm assuming you mean Generics?
Well, a generic list is always best, but generics is far more than list classes.
But, if you store the list, surely it's always out of date, and if you rescan to make sure it's up to date, you may as well rebuild the list ?
Depending on how many different things you want to search on, a dictionary where the key is the search term could be a good idea.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
That is a good point about the list being out of date. In most scenarios that would be true. The app I'm building is targeted towards a really small user base where the list of potential files is pretty static meaning that the persisted data is going to be correct for the majority of the time bearing in mind the small list of file types the app will deal with.
That said I used this model for the FoxPro version of the app due to the scanning process being pretty slow. If it could be sped up it would indeed make more sense to rescan each time the app was loaded and present a fresh set of data to the user. Also in future versions I plan to add in some functionality that could take seconds to process each file meaning the persistence of data might still be a good idea in that scenario.
One major consideration here is also whether to scan the whole machine or limit the scope of the scan to a single drive in the machine or even a single directory on a drive.
As for the making sure its up-to-date ... I haven't got that far in my planning!!
I'm going to have a read up in more depth about generics and dictionaries, do you have any good links on those topics?
Thanks so much for your input on this, much appreciated.
James.
|
|
|
|
|
I would suggest that perhaps you need to show the old data while another thread scans for new data to bring it up to date.
Generics just means being able to specify a type as an argument, so you can build one class and use it in a typesafe way for many classes. A dictionary is a hashtable, so it has two arguments, a key and a value. This allows you to look up items by any key you like, instead of an index. You can then iterate over the keys until you find a match, then use the key to look up your value.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Having read a little on the topics and idea's you've mentioned it seem like I should:
store the file system recursion results in a generic list with all the values for each file
store the look up information in generic dictionaries, I'll need to use a few dictionaries it seems as the current FoxPro look ups contain about 5 items. I'll need 5 dictionaries that all share keys in order to tie them back together coherantly.
|
|
|
|
|
Yes, if you make your core object a class, then you'll be storing references, so it won't be expensive to build 5 dictionaries.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Gotcha ...
I know this may seem ridiculous to someone with your experience but bear with me!
I'm assuming you mean creating a class that defines an object (the core object in the shape of a generic list of files) and all the dictionaries within that same object.
Honestly, I'm still a bit unsure what *exactly* an object is. I've used them, and made them but to say that I truly understand the limits of their application would be an overstatement in the extreme!!
I need an OOP for dummies book.
|
|
|
|
|
Member 4664921 wrote: I'm assuming you mean creating a class that defines an object (the core object in the shape of a generic list of files) and all the dictionaries within that same object.
Correct
An object ( a class ) is really just a combination of properties and methods that work on those properties, that work together to define a single concept, such as a database record, a file entry, or whatever.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Sometimes I surprise myself!
Coming from a FoxPro background (ie: not true OOP as I understand it) I had a vague concept in my mind that you could draw a direct comparison to a computer programming based "Object" as something akin to an object in the real world. Every distinct "thing" in the real world is an object and each have properties (such as size, colour, smell etc ...). However, I guess through lack of reading, that the lines between my understanding of what exactly were/are the differences between a class and an Object were still fuzzy. Your brief clarification has been extremely helpful.
Also getting "into" something like .NET and C# at this stage is no mean feat. I'm still reeling in terms of learning just how BIG the .NET framework is.
Anyway, thank you for this great input. Lots of thinking to do!
Regards,
James.
|
|
|
|
|
np - glad to help
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I'm currently making a game (as always) and can't seem to make a Projectile class work right. Can someone just explain the concept of it. I really just don't understand how you get a sprite from the class. (?)
- I love D-flat!
- Need. More. Code.
modified on Saturday, February 23, 2008 5:26 PM
|
|
|
|
|
MasterSharp wrote: I really just don't understand how you get a sprite from the class. (?)
However you like. You either store an image ( or sequence of images ) statically in the class ( and an image index if you're using a sequence ), or whatever. Are you using DirectX ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Oh sorry, XNA.
- I love D-flat!
- Need. More. Code.
|
|
|
|
|
I see...
- I love D-flat!
- Need. More. Code.
|
|
|
|
|
Hi all,
i was wandering, if it is possible to create a picture of a loaded Form ?
Janko
|
|
|
|
|
You mean a Screen Capture? Click the button on your keyboard that says PrtScn, or something that would mean Print Screen. Then open up your favorite image editing software and paste it in. MSPaint works well.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
I mean doing it programaticaly (in code)
|
|
|
|
|
There are a number of articles on this site on screen capture, I know Nish has one.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|