|
Hi Peter,
Thanks for that ... so grabbing an int from the dictionary incrementing it and stuffing it back in is all doable and a good route to take with this?
Cheers,
James.
|
|
|
|
|
Sorry - I missed that requirement. It's ok if it's not the key - otherwise you are going to be doing a lot of deleting/creating.
|
|
|
|
|
Gotcha! No its not going to be the key its the value (int) that is held in the dictionary against the key.
so for instance.
Key = Blah
Score = 0
If I find a Blah the score held against Blah = score + 10
etc ...
blah blah ..
|
|
|
|
|
Also have a look at SortedList, it is a sorted dictionary!
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Ahhhh ... now that sounds really interesting! Thanks for the tip!
Jammer
|
|
|
|
|
I have a situation where I have a panel inside another panel (we'll call them innerPanel and outerPanel). outerPanel is anchored on all four sides so it expands and contracts with the window. outerPanel also has the AutoScroll property set to true.
If I put innerPanel inside outerPanel and anchor it left, right, and top then when I make the window very short scroll bars appear on outerPanel. However, innerPanel's height will not expand when I expand the window. This is what I expect to happen.
If I set the anchors on innerPanel to all four sides it expands and contracts with the window. However, sometimes innerPanel shrinks too small to see it's contents. This is the behavior I expect.
Now, if I set a minimum width on innerPanel and anchor to all four sides it will expand with the window like I want, but when I reach that minimum size innerPanel just gets cut off, the scroll bars never appear. This is absolutely not what I expect.
Am I doing something wrong? I want innerPanel to expand freely in all directions and contract to a minimum size, then if it's container is too small for innerPanel I want scroll bars to appear.
Obviously the simple solution here is to set AutoScroll to true on innerPanel and anchor it to all four sides, but in my real application there are several innerPanels and it would look ridiculous to have seven scroll bars on the page.
Thank you in advance.
|
|
|
|
|
Hi,
if anchors, docking, autosize and what have you, don't perform as you would like them to,
there is a straightforward solution: don't use them at all, and write some code instead,
in the OnResize method of the relevant panels. That's what I used to do from day one, until I
discovered some cases (particularly the simple ones) could be solved by setting anchors and so.
The advantage is you can make it do whatever you can come up, you don't have to fight the
built-in functionality, not even read the documentation...
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Thanks for the reply. I figured that is what I would end up needing to do, but I wanted to see if anyone had other ideas. Anchors do what I need them to do 90% of the time so it's frustrating when they don't do what I want :p
|
|
|
|
|
I've got multiple tab delimited files, but they are not the typical format. Here's the type of formatting that's used:
Field1: blah
Field2: blah
Field3: blah
Field4: blah
Field5: blah
Field6: Friday, October 29, 2004
Field7: Friday, February 15, 2008 @ 12:22:26 PM
Then, at the end of the file, there are some fields like this:
2007/11/25 20:41:22 11.111.111.111 on
2007/11/25 23:07:36 11.111.111.111 off
2007/12/20 19:06:00 11.111.111.111 on
2007/12/20 22:48:07 11.111.111.111 off
I'd like to parse these files and put them all either in to a database or one csv file, but I can't figure out how to do this since each row is a field, not a column. I only need the right most field for fields 1-7, and the very last IP address in the file. Any ideas?
|
|
|
|
|
I would use a regular expression...
(?<fieldname>\w*):\s+(?<fieldvalue>.*?)\r\n will get the name and values out of the first part. Not sure how you need to part out the second set, but it wouldn't be too tough there either.
Hogan
|
|
|
|
|
you can split the the lines into an array...
<br />
string[] splitItem = {":"};<br />
string[] field1 = fieldLine1.Split(splitItem);<br />
<br />
to reference the value<br />
string value = field1[1];<br />
<br />
For the second part just define a different char to split the items. In this case the "\t" if it is tabbed.<br />
splitItem = {"\t"};<br />
string[] parts = differntline.Split(splitItems);<br />
<br />
string date = parts[0];<br />
string onoff = parts[parts.Length - 1];<br />
Just because we can; does not mean we should.
|
|
|
|
|
Dear Friends,
I am looking into someones project in C#. What i noticed is that they have XML comments header on the top of every source file. Can you please tell me how to *automate* this process ? I mean, what i want is that whenever i add new class or source file, this header should get generated automatically on the top of the file. If automation not possible then what is the shortcut to generate these XML tags ?Here is the header:
//-----------------------------------------------------------------------
// <copyright file="MyClass.cs" company="ABC">
// Copyright (c) ABC Corporation. All rights reserved.
// <author>Imtiaz(imtiaz)</author>
// <created>3/12/2007</created>
// <LastUpdated>4/12/2007</LastUpdated>
// </copyright>
// <summary>
// Some kind of automation.
// </summary>
//-----------------------------------------------------------------------
Imtiaz
|
|
|
|
|
Are you using Visual Studio? If so look on the menu under Tools/Macros/Macro Explorer
led mike
|
|
|
|
|
I use a code snippet to enter a standard header for my files. Though you can set defaults values I haven't found a way to input dynamic values such as date and file name.
only two letters away from being an asset
|
|
|
|
|
Mark Nischalke wrote: I haven't found a way to input dynamic values such as date and file name.
I think that works from the macros. At least I think it did back in Visual Studio 6. I don't think I've used them since then.
led mike
|
|
|
|
|
You can certainly do dates and in the new version too.
Kevin
|
|
|
|
|
Do you have an example for setting dynamic values in snippets? I'd love to be able to insert the current date automaically.
only two letters away from being an asset
|
|
|
|
|
I am in need of some direction in finding some tools to do context sensitive help in my C# application. To be completely honest I have not personally integrated any help into a windows app since doing it in VB back in 1997, and even then I was only responsible for adding the keys into the application. This time around I need to find a tool for creating and generating the help files as well as figure out how to integrate it into my application. These are areas that I am unfamiliar with and if anyone could point me towards an article on the topic, I would much appreciate it.
Thanks
Sean
|
|
|
|
|
|
first i want to say that this site is the best in the world, i always find what i want in it
it's great,thanks...
i'm facing a problem in opening jar file(by execute batch file which contains java -jar command) in c#
here is the code:
string filepath = Server.MapPath("test.bat");<br />
<br />
<br />
ProcessStartInfo psi = new ProcessStartInfo("cmd.exe");<br />
psi.UseShellExecute = false;<br />
psi.RedirectStandardOutput = true;<br />
psi.RedirectStandardInput = true;<br />
psi.RedirectStandardError = true;<br />
<br />
<br />
Process proc = Process.Start(psi);<br />
StreamReader sr = File.OpenText(filepath);<br />
StreamWriter sw = proc.StandardInput;<br />
StreamReader sre = proc.StandardError;<br />
<br />
while (sr.Peek() != -1)<br />
{<br />
<br />
sw.WriteLine(sr.ReadLine() + Environment.NewLine);<br />
}<br />
<br />
TextBox1.Text = sre.ReadLine();<br />
sr.Close();<br />
proc.Close();<br />
sw.Close();<br />
<br />
the following message appears
Unable to access jarfile *.jar
what do you think the problem is ???
|
|
|
|
|
so jave.exe can't find your jar file . . . did you specify the full path in your batch script? why not just spawn the java process directly?
|
|
|
|
|
I don't know what your problem is, mine is "Unable to access jarfile *.jar" does not
appear in the code you have shown. Maybe it is inside test.bat? Care to show the file's content?
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
this is test.bat content :
java -jar *.jar {options }
i don't think the path of the jar file is the problem
cause i put test.bat and *.jar in the same path
how he could see test.bat , and didn't see the jar file
thanks for reply, i'm so happy to register in this great site ..
|
|
|
|
|
Hi,
IIRC Java uses different rules for locating files/classes it needs.
Normally you must set an environment variable "CLASSPATH" and list the places to look,
very similar to what "PATH" does for native Windows applications.
And I typically put "." as the first location, so this is a possible value:
CLASSPATH=.;C:\Program Files\Java\jre1.5.0_05\lib\ext\QTJava.zip
Of course you must set this before you launch java.exe (or the program that will launch it)
since environment variables get copied when a process gets launched.
Hope this helps.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Luc Pattyn wrote: C:\Program Files\Java\jre1.5.0_05\lib\ext\QTJava.zip
is this the jar file bath ??
that means i must set classPath every time the program will run .. ??
thanks alot
|
|
|
|