|
Mmm, this sounds awfully like you're asking us to do your homework for you. It seems to me that you'd get the most benefit from solving it yourself.
Plus, there's a slight problem in that this is a C# message board, and not a java one.
Anyway, very high level. For the word list, arrange to have the words one per line in a text file. Use Java's standard text file IO to read the file, and use a hash table (or string dictionary, or symbol table, or whatever it's called in java-land). By using such a collection class, you'll get fast lookups of possible words (if found, the word exists, if not, the word doesn't).
For the letter grid problem (that is, finding our all possible letter sequences without repeating a letter), I would look into network or graph algorithms. It sounds like a depth first search might do you best.
For each letter sequence you find, look it up in your hash table.
Cheers, Julian
Program Manager, C#
This posting is provided "AS IS" with no warranties, and confers no rights.
|
|
|
|
|
Julian Bucknall [MSFT] wrote:
Mmm, this sounds awfully like you're asking us to do your homework for you. It seems to me that you'd get the most benefit from solving it yourself.
Plus, there's a slight problem in that this is a C# message board, and not a java one.
Anyway, very high level. For the word list, arrange to have the words one per line in a text file. Use Java's standard text file IO to read the file, and use a hash table (or string dictionary, or symbol table, or whatever it's called in java-land). By using such a collection class, you'll get fast lookups of possible words (if found, the word exists, if not, the word doesn't).
For the letter grid problem (that is, finding our all possible letter sequences without repeating a letter), I would look into network or graph algorithms. It sounds like a depth first search might do you best.
For each letter sequence you find, look it up in your hash table.
Not bad julian
Dont forget to use a BufferedReader and BufferedWriter class to read the files.
use the hastable collection for searching
the Iterator class to step through since Enumerators are horrible
For the grid I would use a JTable, you are using Swing right. You can use AWT but ( its faster ) but involves a deeper understanding of the Java API which I doubt you have.
Study grid layouts and you would have to encompass it all in a Jframe. Use the IO library for the file reading. A buffered Reader makes it easy.
Other questions, please direct them to They can help more with your homework!
nick
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
Hi, friends.
I would like to add a ComboBox(like DropDown mode) in ToolBar.
As the default DropDown mode of ToolBar button doesn't allow user to type anything. So I wander any method I can do this. Or some properties I can set inside toolBar?
If you know any articles related to this, could you tell me, Or give me some examples.
Thank you.
|
|
|
|
|
There are quite a few examples of container ToolBars online, but the CommandBar control by Lutz Roeder is the cleanest implementation I've seen:
http://www.aisto.com/roeder/dotnet/[^]
|
|
|
|
|
Furty wrote:
There are quite a few examples of container ToolBars online, but the CommandBar control by Lutz Roeder is the cleanest implementation I've seen:
Yeah and hes got an even more impressive debug page. LOL
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
|
Nick Parker wrote:
Nope, it was just a bad link, try : http://www.aisto.com/roeder/DotNet/[^]
That one was even more impressive, this time I get a bad page request. at least I dont see his code this time.
haha. good try.
I am curious about this page when you eventually get the address right
nick
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
Ista wrote:
haha. good try.
Nick, why such a short temper? I really don't know what is going on, this link itself doesn't appear to work when being clicked, however if you paste that address into a new browser window it pulls up for me, check it out, hope you can see it now.
-Nick Parker
|
|
|
|
|
theres no temper, I was actually laughing at it.
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
Hi,
I am trying to create a C# interface for a dll with functions. The C++ interface for one of the functions looks like this:
<br />
__declspec(dllimport) long _cdecl GetLiveList(<br />
long, <br />
long*, <br />
long*, <br />
long[]*, <br />
long);<br />
I declared my C# equivalent as:
<br />
public class Ismbus32<br />
{<br />
<br />
[DllImport("ismbus32.dll", CharSet=CharSet.Auto, CallingConvention=CallingConvention.Cdecl)]<br />
private static extern long GetLiveList(<br />
long, <br />
ref long,<br />
ref long,<br />
ref long[],<br />
long);<br />
}<br />
When I try to call the function, using the code below, I get a NullPointerException and the message "Object reference not set to an instance of an object."
<br />
public class Form1 : System.Windows.Forms.Form<br />
{<br />
<br />
private void btn_Click(object sender, System.EventArgs e)<br />
{<br />
long in = 2;<br />
long out1 = 0;<br />
long out2 = 0;<br />
long[] items = new long[635];<br />
long itemsMax = 634;<br />
long lRes = Ismbus32._CDDLG_GetLiveList(in, ref out1, ref out2, ref items, itemsMax);<br />
}<br />
}<br />
Does anyone have a clue?!
Thanks in advance,
/Henrik Johansson
|
|
|
|
|
It looks as if you have a class, Ismbus32 , that wrappers the ismbus32.dll . If so did you create an instance of this class?? For example:
private void Form1_Load(object sender, System.EventArgs e)
{
Ismbus32= new Ismbus32();
}
Also, you have GetLiveList() defined in your C++ dll as dllimport . Shouldn't you have it defined as dllexport ??
Roger Stewart
"I Owe, I Owe, it's off to work I go..."
|
|
|
|
|
Thank you for your reply!
There is no need to create an instance, since the methods are declared static. I'm sure GetLiveList() is declared dllexport in the dll. The C++ code was a header file used when importing the dll into C++ code, which I have used as a model for my C# interface.
The problem turned out to be the difference of the long data type between C++ and C#: C++ long is 4 bytes whereas C# long is 8 bytes and C# int is 4 bytes. So the solution was to replace all occurences of long in the interface with int .
Regards,
/Henrik
|
|
|
|
|
My database is SQL Server 2000.
Thanks to all answer & suggestion.
Future belongs to C#!
|
|
|
|
|
|
How do I make my windows forms run a html page? Thanks!
"To teach is to learn twice"
|
|
|
|
|
Add a COM component name axWebBrowser . For more information about how to use it search this site.
Mazy
No sig. available now.
|
|
|
|
|
How do I transfer files across a network? Does anybody know how? Please help!
"To teach is to learn twice"
|
|
|
|
|
1. Create a share on the target system, and use two FileStreams (one for a file on the local system, the other for a file on the target system) to copy the data over.
2. Use sockets and have a sending application on the source system and a receiving application on the target system. Obviously the target app has to be installed and running before this will work.
3. Use .NET Remoting instead of sockets. Again the target app needs to be installed in the target system.
I'm sure that there are other ways, but that'll get you started.
Cheers, Julian
Program Manager, C#
This posting is provided "AS IS" with no warranties, and confers no rights.
|
|
|
|
|
I'm currently learning C# and Visual Studio and have run into this problem.
I'm reading Petzold's "Programming Windows with C#" and am working with two classes, both of which have Main() methods.
The second class, CsDateInheritance, is an inherited class of the first, CsDateConstuctors, and I want the program to use the Main() method of the second class, CsDateInheritance.
If using a DOS command line, the program can be complied as such:
<br />
C:\(rootfolder)>csc CsDateInheritance.cs CsDateConstructors.cs /main:CsDateInheritance <br />
<br />
Microsoft (R) Visual C# .NET Compiler version 7.10.3052.4 <br />
for Microsoft (R) .NET Framework version 1.1.4322 <br />
Copyright (C) Microsoft Corporation 2001-2002. All rights reserved. <br />
<br />
C:\(rootfolder)> CsDateInheritance.exe <br />
Birthday = 21 Aug 1981 <br />
Today = 24 Aug 2003 <br />
Days since birthday = 8038 <br />
<br />
C:\(rootfolder)>_<br />
Program works perfectly.
Though, I want to be able to run/debug this program in Visual Studio .NET 2003. I'm using the C# Standard Edition.
I have the first class file inserted into the solution as a linked file.
When I compile in VS .NET, I get a "this program has more than one entry point defined" error. How can I fix this in VS .NET, without having to compile from the command line?
I have found that I can set the Main() method of CsDateConstructors "IsShared" value to false, and I get a clean build. Though, this sets the class to basically be "Inheritable" only, and not stand alone.
Anyone know the trick? All help/suggestions welcome.
Joe
realmrat@msn.com
|
|
|
|
|
Problem solved. Thanks to ericgu @ experts-exchange
You can set this in the project properties.
Look for the "startup object" setting, and enter the name of the class that the Main() method is in.
Joe
realmrat@msn.com
|
|
|
|
|
I'd be pleased if somebody could help me on these:
1. OnStart() event get a string[] argument. From where I can send these argument to the service,the service start on start up,so what are these commands for?
2. Some services only run when admin logged in, how can I do it too?
Mazy
No sig. available now.
|
|
|
|
|
1. The string[] contains arguments passed from the command line. If the service starts automatically or is started by teh control manager, there are no arguments. But you can enter commands like "start [service_name] -install".
2. Alter the service, or become an admin
Which srvice do you want to start?
|
|
|
|
|
Thanks for your reply.
Corinna John wrote:
Which srvice do you want to start?
I don't want anything with standard services.I want my service only run when admin login.Just curious to know how to do it.
Corinna John wrote:
But you can enter commands like "start [service_name] -install".
But where is its argumennt.It install the service,ya?
Mazy
No sig. available now.
|
|
|
|
|
1. You can check in the OnStart-Method, whether the active user is in the Administrators-group (start) or not (cancel).
2. -install is only one possible argument. You can pass all arguments you like, if you start your service using the start command instead of the service control manager.
|
|
|
|
|
Well, thank you Corinna. Just one more question. How can I stop service programically inside the service.I know I can do it with ServiceController but is it the way you do inside service too or not?
Thanks
Mazy
No sig. available now.
|
|
|
|
|