|
DwR wrote: So my questions is, in a nutshell, if a host has multiple network interfaces how does one identify the ip addresses associated with each interface?
Well your question does not seem to reflect the block of Java you posted but the NetworkInterface [^]and IPInterfaceProperties [^] examples in their documentation seem to answer your question.
led mike
|
|
|
|
|
As I'm not a java developer what is your interpretation of what that block of code is doing? That's one the problems I have. I'm trying to convert the code without being able to interactively debug it to see what it does.
Regards,
Dave
|
|
|
|
|
DwR wrote: what is your interpretation of what that block of code is doing?
It is looping through all of the network adapters and all of the addresses in each adapter and filtering out the loopback address/adapter. Finally the last ( well each one in turn without any exiting of the loops therefore the last one) adapter.address in the enumerations that is NOT the loopback adapter is assigned to the variable address , which is not declared in the code you posted so I have no idea what it is.
address = addr.getAddress();
led mike
|
|
|
|
|
|
Hi,
I need to pull some table from SQL server; some are for read-only purposes while others will be both for reading and writing. I need to put these tables on laptops which do not have SQL server installed. I was thinking of storing them in XML files. My questions are:
1. What is the best way to store the tables on laptops for application to use? These tables will need to be synchronized with the main server once connectivity is available.
2. I know for pocket pcs there is pull and push mechanism available. What kind of mechanism should I use in my case?
3. What precautions should I take or things I should be aware of for such a project?
Thanks in advance.
|
|
|
|
|
Hi,
You don´t need to install sqlserver in all laptops, just install it in the Master/Server computer.
To pull data from sqlserver tables i think you already created some store procedures (don´t forget to make your threads safe).
On the Client side (laptops) you install the application you designed that only has the acess to edit & read what is in the Server´s database, by triggering the store procedures you created.
(In c# Forms, use the datagridview object to display sql data).
Server -> database
Clients -> application to acess/display database
About your (1st point)
It is good pratice to have only 1 database(meaning Server) in the "web/net" you create.
You don´t store data on the Laptops because you will get 12 diferent databases (both Server and Clients) named the same with diferent data/update.
If you can´t connect to the Server, bad luck try later.
I hope a helped you here. Ask someone else for more advanced help. Good luck
|
|
|
|
|
Thanks for the help but not a good suggestion. Often times we have no connection but that does not mean we can not work.
I will pull the data and store them in xml files and once connection is available the app will synchronize with central db.
I have the stored procedures and you are right about that.
Thanks
|
|
|
|
|
Hello,
I am new to .net n working with Framework 3.5
Currently working on Application developed in Borland Delphi.
We have 2 exe's named as DBPro.exe and Data.exe
I am rewriting Data.exe which deal with Data Interaction with SQL Server.
Now the project work like, We have button in DBPro.exe which Opens up Data.exe n while doing this it Passes the Message to it using Post Message. I dont have code for DBPro.exe
After All work wen we close Data.Exe it is suppose to PostBack message to Calling Exe i.e. DBPro.exe which will reinitialize it.
I found line PostMessage(HWND_BROADCAST, dbmesg, 0, 0); in Data.exe, in the Form End section which is suppose to Post Back the Message. Now I want to do the same with my new Data.exe. So far I found I can use some invoke method but have no idea how to use it.
I'll appriciate any pointers on this issue.
Thanks.
Some declarations look like this..
PostMessage(HWND_BROADCAST, dbmesg, 0, 0);
strpcopy(mstr, 'WM_DBMESG');
dbmesg:=RegisterWindowMessage (mstr);
I am not able to found any declaration for HWND_BROADCAST
Niks
|
|
|
|
|
I posted the Problem.. n found the answer for it.. M calling PostMessage on Button Click!!
private void btnClose_Click(object sender, EventArgs e)
{
const int dbmesg=49706;
const int HWND_BROADCAST=65535;
Win32.PostMessage(HWND_BROADCAST,dbmesg, 0, 0);
this.Close();
}
public class Win32
{
[DllImport("user32", EntryPoint = "PostMessage")]
public static extern int PostMessage(int hwnd, int wMsg, int wParam, int lParam);
}
This will Close the Data.Exe and Broadcast Message. I Defined the same constant I found in Old code, even when I dont really know what they really mean..
But this code is working for me..
To Import Win32.dll need to add using System.Runtime.InteropServices; namespace!!
Guys.. any one know how exactly this work.. to give more understanding..!!
Thanks
Niks
|
|
|
|
|
I am designing a sci-fi game and need to create a "map" of the galaxy (a 8x8 grid) that contains space objects (stars, planets, spaceships, etc) some of these objects contain no more than a name property, but some like the spaceships are more complex having methods as well as properties.
What I am confused about is that a collection holds a list of a-like objects, so it could hold a list of planets or stars but not both.
So, how can I create a Galaxy collection containing all the different types of space objects?
I am not looking for code just some advice on how to implement.
Thanks,
Lee.
|
|
|
|
|
The most elegant solution is to create an interface, like IGalaxyObject, and make all you classes implementing it.
It could look like the following:
public interface IGalaxyObject
{
void DrawYourselfOnTheGrid(Rectangle coords);
}
public class Star : IGalaxyObject
{
public void DrawYourselfOnTheGrid(Rectangle coords)
{
}
}
ICollection<IGalaxyObject> galObjsColl = GetCollection();
foreach (IGalaxyObject galObj in galObjsColl)
{
galObj.DrawYourselfOnTheGrid(someCoords);
}
|
|
|
|
|
Sounds suspiciously like the Summer Code Competition[^]. Just remember, if you receive any help from CP (articles or forum posts):You must specify any resources (code, concepts, research etc.) used in creating your article that were not originally produced by you.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
I was thinking of doing something for this - but having a black hole at the centre of the galaxy and using gravity sling shots to gain higher warp speeds... but then I realized how sad I was!
Dave
|
|
|
|
|
Scott,
It is indeed the Summer Code Competition. I am not actually sure if I will submit it to the competition, I am just using the idea to practice my coding and learn c#. If i was to submit it I would of course aknowledge any help I received, as we all should .
Lee.
|
|
|
|
|
Are you sure a typical galaxy fits in an 8x8 grid?
|
|
|
|
|
sure why not, anything is possible
actually in each of the squares there is another 8x8 grid, thus we have 4096 squares. which is big enough for my purposes.
Lee.
|
|
|
|
|
I can export the database part numbers into an array. I want to be able to search that array with predictive search. a good example is www.yahoo.com's search engine text box on the front page.
How do i achieve this within a windows form and not in a web project. I've searched around for this but have not found much of anything useful.
Thank you guys!
Patrick!
|
|
|
|
|
What have you been able to do so far?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Have you tried using the Custom AutoComplete function of the textbox?
It is said that the most complex structures built by mankind are software systems. This is not generally appreciated because most people cannot see them. Maybe that's a good thing because if we saw them as buildings, we'd deem many of them unsafe.
|
|
|
|
|
|
I don't know if this is the proper way to do it but I usually do it this way.
1. Create a Datatable
2. Fill the Datatable with the column of interest (Select COLUMN from Table)
3. Use a foreach loop to go thru each row
4. Use a StringBuilder to append those rows
5. Attatch the StringBuilder to the textbox.
I usually doesn't any encounter a very long initialization time using this method. I used it in one of my OPAC projects.
It is said that the most complex structures built by mankind are software systems. This is not generally appreciated because most people cannot see them. Maybe that's a good thing because if we saw them as buildings, we'd deem many of them unsafe.
|
|
|
|
|
|
Hi,
Two comments:
1. I suggest you have a look at String.StartsWith()
2. You might want to store the results of cachedPartNumbers[i].ToString() rather than calling
it all the time
|
|
|
|
|
Hi,
My code is looping through records and adding items to a listbox as below:
forloop
{
lstBox1.items.add("item1");
lstBox1.items.add("item2");
}
Question:
How can I change the colour of SOME of the items as they are being added?
Thanks
|
|
|
|
|
Hi,
there are two basic features you need:
- ListBoxes can contain items of any type, not just strings
- you can paint those items yourself (DrawMode OwnerDrawn, event DrawItem)
So the neat way to do this is define a little class (say MyItem) and let it hold a string and
some style field (maybe a Color). Add instances of that class to the ListBox, make it OwnerDrawn,
and provide a DrawItem handler according to your wishes.
As a shortcut, when I only need two variations (say black and red), I skip the MyItem stuff and
prefix the red items with a special character (say '~'), then in DrawItem check the first char,
and if a '~', choose Color.Red and drop the '~'.
|
|
|
|