|
Why not?
Because you may want to know that the mouse is at a relative position of 45,638233%/13,2321334% instead of 46%/13%.
|
|
|
|
|
|
that worked! thanks very much, it really helped me!
sam kline
http://dying.about.com/gi/pages/poll.htm?poll_id=2068629450
YES
|
|
|
|
|
I need to get a list of local Users on a Windows XP machine. I do not need info from Active Directory. I also must get the user id from Windows and not from the Document and Settings Folder as the userid may or may not be mapped to a different profile. Any help is greatly appreciated.
|
|
|
|
|
Here's a method to get user ids.
string machineName = Environment.GetEnvironmentVariable( "COMPUTERNAME" );
DirectoryEntry entry = new DirectoryEntry( "WinNT://" + machineName );
ArrayList names = new ArrayList();
foreach( DirectoryEntry de in entry.Children )
{
if( de.SchemaClassName.Equals( "User" ) )
{
names.Add( de.Name );
}
} If you need more information that that, like human readable names, investigate the DirectoryEntry.Properties collection.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Hello,
I want to use the value from a NumericUpDown control as one of the coordinates to
draw a line on a WinForm. I want to draw the line only when the button is clicked.
How do I tie all these fragments together?? Thanks a lot.
ps- Yes, I posted this question several days ago and was given a very good answer--
i.e. I should do all my drawing in the Paint Event handler, but I can't seem to tie the code fragments together....
//Fragment 1.
private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
Graphics g = e.Graphics;
DrawMyLine(g);
}
//Fragment 2.
public void DrawMyLine(Graphics g)
{
g.DrawLine(somePen, 0, 0, 100, this.numericUpDown1.Value);
}
//Fragment 3. Want to draw line only if Button is clicked...
private void btnDrawA_Click(object sender, System.EventArgs e)
{
//??
}
//Fragment 4. Where do I fit in the bool flag?
Many thanks in advance......
|
|
|
|
|
Would something like this work?
private bool goAheadAndDrawTheLine;
private void Form1_Paint( object sender, System.Windows.Forms.PaintEventArgs e )
{
Graphics g = e.Graphics;
DrawMyLine(g);
}
public void DrawMyLine( Graphics g )
{
if( goAheadAndDrawTheLine )
{
g.DrawLine( somePen, 0, 0, 100, this.numericUpDown1.Value );
}
}
private void DrawA_Click( object sender, System.EventArgs e )
{
goAheadAndDrawTheLine = true;
}
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
-- modified at 20:55 Saturday 26th November, 2005
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
I'm doing a HTTPModule to summarize the text within web pages in my web server. The summarization process is with me but i need a big corpus of words to help on summarization.
My problem is : Where do i put this corpus in memory so it can be acessed quickly in runtime ????
Now i have a static variable that stay in memory with the corpus and the next time a page loads it has already the static corpus in memory. I have this static variable when i call HTTPModule. I still have the problem of loading the corpus in the first time that someone loads the page... I takes a while reading it from a file.
Is there any way to call my HTTPModule when the IIS starts or something like that???
Do you have any other ideas that can help me???
Where do i put the corpus in memory??? A Windows Service Works??? Can i call a Windows Service that has the corpus in memory and be fast enougth???
Thank you very much !!!
Sorry for my English...
Bruno Conde.
pharaoh
|
|
|
|
|
IDEA 1 - Object Serialization
If you have a lot of parsing going on when you read your corpus of words, you may think about loading a structure that has a serialization feature. You can load the corpus, serialize the object, and deserialize it. This should give you some performance benefit since you won't have to parse anything.
I did this for a financial analysis application. I would parse XML documents, store the information in the structures that I needed, then serialized them for use when the application restarted. It improved performance (memory usage and loading speed).
IDEA 2 - OnBeginRequestAsync
You could do the loading of your corpus in the OnBeginRequestAsync method. If needed, it would load in a separate worker thread and, when complete, could store the corpus in your static variable. While the corpus loads, any request that needed it could "wait" or inform the user that the summary feature is loading and will presently be available.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
hi,
After I do this:
ds.Tables["tbl"].find(key) (However the talbe is not sorted by "key" column)
and I get a DataRow,
How can I get the index of that row in table rows collection? (I know a sorted DataView find method can do this but here is not what I want, also, if I sort the "key" column, my original sort order will be lost). Any ideas?
(the table primary key column is "key", and sorted by column "userName". the nearst approach I can think of is I get the userName value by the "key" value, then I create a DataView with same sort order of the table, and I find that DataView with the userName value.)
Thanks!
|
|
|
|
|
Hello,
A few days ago posted a question about how to "tie" a button event to draw a line onto a WinForm. One of the line coordinates will come from the value in a NumericUpDown control.
I was given an answer on how to do this, and it was a very good answer in that I should do all my drawing in the paint event handler and so on. But where I'm stuck is
in getting the line to draw only when the Button is clicked. I know I need some sort of
bool flag to draw the line when the button is clicked.
So to diagram ->
//Fragment 1.
private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
Graphics g = e.Graphics;
DrawMyLine(g);
}
//Fragment 2.
public void DrawMyLine(Graphics g)
{
g.DrawLine(somePen, 0, 0, 100, this.numericUpDown1.Value);
}
//Fragment 3. Want to draw line only if Button is clicked...
private void DrawA_Click(object sender, System.EventArgs e)
{
//??
}
//Fragment 4. How to fit in the bool flag?
Many thanks in advance......
|
|
|
|
|
Would something like this work?
private bool goAheadAndDrawTheLine;
private void Form1_Paint( object sender, System.Windows.Forms.PaintEventArgs e )
{
Graphics g = e.Graphics;
DrawMyLine(g);
}
public void DrawMyLine( Graphics g )
{
if( goAheadAndDrawTheLine )
{
g.DrawLine( somePen, 0, 0, 100, this.numericUpDown1.Value );
}
}
private void DrawA_Click( object sender, System.EventArgs e )
{
goAheadAndDrawTheLine = true;
}
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Hi!
I have a problem to convert a string "4.5" to a int.
I do like this:
double s1=(double.Parse(s.Substring(0,index),System.Globalization.NumberStyles.Any))*1.8532;
double s2=(double.Parse(s.Substring(index+1),System.Globalization.NumberStyles.Any))/10*1.8532;
Console.Write(s1+s2");
but is there a better way to do it?
/ Johan
-- modified at 13:47 Saturday 26th November, 2005
|
|
|
|
|
I assume that the variable index contains the index of the decimal point in the string?
Why not simply:
Console.Write(double.Parse(s, System.Globalization.CultureInfo.InvariantCulture) * 1.8532);
---
b { font-weight: normal; }
|
|
|
|
|
tnx Guffa..
I found another, not so nice, solution
double vel = Convert.ToDouble(fix.Velocity.Replace(",","."))*1.8532;
|
|
|
|
|
When converting a floating point number you should always specify a NumberFormat or a CultureInfo, as the format varies depending on the culture.
If you have a number with a decimal comma, e.g. "4,5", you should specify a culture that uses that. For an example, in sweden we use decimal comma:
CultureInfo se = new CultureInfo(1053);
double vel = Convert.ToDouble(fix.Velocity, se) * 1.8532;
---
b { font-weight: normal; }
|
|
|
|
|
I don't understand your code. However, if I wanted to convert a string to an int, I would write the following code:
string numberString = "4.5";
Convert.ToInt32( Double.Parse( numberString,
System.Globalization.NumberStyles.Any ),
System.Globalization.CultureInfo.CurrentCulture ) Then, you could use that int wherever or for whatever you needed.
Like, mutliply it by 1.8542?
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Hi!
I have a DirectInput class where objects can bind specific keys so that they will be informed when the key state changes. But the Input class needs an identifier about who called the function "MapKey".
Right know I'm doing this:
public void MapKey(Key key, KeyEvent state, ButtonAction action, int who)
where who is the "ID" of the caller of the function. Right now each object uses "this.GetHashCode()" as a unique identifier. However, MSDN says: The default implementation of GetHashCode does not guarantee uniqueness or consistency; therefore, it must not be used as a unique object identifier for hashing purposes.
In C++ I think the best way would be to simply pass this as a void* parameter. What's the best way in C#?
regards
-- modified at 13:46 Saturday 26th November, 2005
modified 12-Sep-18 21:01pm.
|
|
|
|
|
You're right about the GetHashCode function. It should be unique for each instance of a class, not across the application.
If you have control over the classes that use the MapKey function, you could define an interface with a method and implement that across the classes that can use MapKey .
For example, define
public interface IIdentifiable
{
int GetWhoThisIs();
} Now, change your method's function to
public void MapKey( Key key, KeyEvent state, ButtonAction action, IIdentifiable who ) Finally, add IIdentifiable to your class' definitions, implementing a universal identifier system.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
That sounds good, thanks. I'll take a look at it.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Greeeg wrote: In C++ I think the best way would be to simply pass this as a void* parameter. What's the best way in C#?
pass object ie:
public void MapKey(Key key, KeyEvent state, ButtonAction action, object caller)
xacc.ide-0.1 released! Download and screenshots
|
|
|
|
|
That's probably the easiest solution
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hello,
This is a problem I've been having both with VS 2003 and VS 2005 Beta 2.
I want to assign the menu item "File" a shortcut "Alt + F". I also want to see the letter "F" underlined.
I type the following as the name: "&File".
The underline shows up in the Designer but not the form when the application is run. What am I doing wrong?
|
|
|
|
|
You're probably not doing anything wrong. This is an option controlled in the Display Control Panel, Effect's tab. Right-click the background of the Desktop, click Properties. Then click on either the Effects tab on Windows 2000, or the Appearance tab on XP and above, then click on the Effects button. You'll find what you're looking for in there.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
You're right! Thanks!
How obscure...
|
|
|
|