|
First you have to learn the technique, independently of any programming language. These are two radically different ways of approximating functions, and if it's possible to simulate the series solutions with a neural net, SOMEONE has described this technique SOMEWHERE. Google is your friend (as least for finding information).
|
|
|
|
|
Dear Friends,
I have a datagridview in which there is parent child relationship in rows. I want that If a parent row is checked in the datagrid and any child node corresponding to it is checked then if the user tries to uncheck the Parent Row then the Parent row shouldn't gets uncheck and remains checked.
I have tried to write the code for the same on CELLCONTENTCLICK event and on the CELLVALUECHANGEDEVENT but all in vain
Any kind of help will be appreciable.
Thanks
Varun Sareen (Dot Net Developer)
modified on Wednesday, December 22, 2010 2:02 AM
|
|
|
|
|
Varun Sareen wrote: I have a datagridview in which there is parent child relationship in rows. If a parent row is checked in the datagrid and any child node corresponding to it is checked then if the user tries to uncheck the Parent Row then that row doesn't gets uncheck and
it again gets checked on itself.
Just keep toggling, I mean
If(checked)
uncheck;
else
check;
|
|
|
|
|
Thanks Hiren, for an immediate reply but i am sorry to say that I actually asked the wrong question (there was a little grammar mistake that made the question meaning other way around).
Now I have corrected the question so now if you could look into it and provide me with some answer then that would be appreciable.
Thanks
Varun Sareen (Dot Net Developer)
modified on Wednesday, December 22, 2010 4:21 AM
|
|
|
|
|
No clue off the top of my head how to do it, but...
Look for some treeview examples that have tri-state checkboxes (they do pretty much what you want to do in your gridview...sort of).
You may get some ideas looking at how they do it. (It's going to wind up being a matter of getting all the children and seeing if they're checked before dealing with the parent)
|
|
|
|
|
I've got a bit of code that works nicely, but it's really ugly and it offends my sense of style. To wit,
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private static string Header = @"^(D|""D|T|S|I|E|""Z)";
private static string Blank = @"^$";
private static string Total = @"^""To";
private static string Sum = @"^""\d\d/\d\d/\d\d\d\d"","""",";
private static string NewData = @"^""\d\d/\d\d/\d\d\d\d"",";
private static string Data = @"^"""",""\w";
private string[] SourceFiles = new string[100];
private int FileCount;
public string WkgDirectory;
public DataSet MeterReads = new DataSet();
public Regex RgxHeader = new Regex(Header);
public Regex RgxData = new Regex(Data);
public Regex RgxNewData = new Regex(NewData);
public Regex RgxTotal = new Regex(Total);
public Regex RgxBlank = new Regex(Blank);
public Regex RgxSum = new Regex(Sum);
public Queue<string> OutQueue = new Queue<string>();
private int Classify(string s)
{
Match m;
m= RgxHeader.Match(s);
if (m.Success) return 0;
m= RgxBlank.Match(s);
if (m.Success) return 1;
m= RgxTotal.Match(s);
if (m.Success) return 2;
m= RgxSum.Match(s);
if (m.Success) return 3;
m= RgxData.Match(s);
if (m.Success) return 4;
m= RgxNewData.Match(s);
if (m.Success) return 5;
return 99;
}
Mind you, I was fairly drunk when I wrote it, but it works perfectly and I hesitate to change it. But it's still ugly.
I don't like having variables stuck in the Form when they're only used in one method. I'd slide all the declarations down into the Classify() method, but I'm afraid that this would cause them to be created and destroyed every time the method was called. That could really bog things down. My understanding of static methods is a bit fuzzy, but I suspect that if I put all the declarations in the method, and make the method static, this might eliminate the problem. Is that true, or should I just hide all the ugly bits in a region and get along with finishing the app?
Or is there a better way?
Will Rogers never met me.
|
|
|
|
|
Break it out into a library class. Possibly use a classification enumeration and a Dictionary<RegEx,Classification> -- dang, you could write a RegExMatchOmatic<Classification>.
Whaddaya think? Is tomorrow a good day to drive to L.A.?
|
|
|
|
|
PIEBALDconsult wrote: Is tomorrow a good day to drive to L.A.?
No. If there's any way that you can delay the trip a day, do so. Tonight and tomorrow they're supposed to get the worst of it, but by Thursday they roads should be drained, at least. Where are you heading? By what route? The Grapevine (I-5) will be closed by morning, I'm sure, if the temperature drops. And I-15 at Cajon Pass (North of San Bernardino) always closes when the snow starts to fall below 5,000 feet.
Will Rogers never met me.
|
|
|
|
|
We're heading straight west on the 10 to the 5. My in-laws are just off the 5 near Griffith Park so there's only about a mile of surface streets involved. I just hope their hill doesn't slide.
We've lived in SoCal during some big storms and remember the mayhem. We could hold off until tomorrow, but we don't see much point... although it would be good to spend the night in Laughlin...
|
|
|
|
|
PIEBALDconsult wrote: it would be good to spend the night in Laughlin...
Hehehe... That might be risky, too. They're calling for tremendous rains here, as well. But the fact is, it's 8:00 and we still haven't seen anything but a light, sporadic drizzle. I did get new wipers, though, just in case.
Will Rogers never met me.
|
|
|
|
|
We made it safely. We did stop a couple of times during the worst downpours because visibility was very poor.
|
|
|
|
|
Enjoy your holiday, then! The rain is supposed to stop tomorrow, then sunny to partly cloudy the rest of the week(end).
Will Rogers never met me.
|
|
|
|
|
There is a static Regex.IsMatch(input,pattern) method which could fit the bill, and avoid all class members. I am not sure how it would compare performance wise, I don't expect a significant difference but could be wrong.
|
|
|
|
|
Well, for a start, if you want to continue using this, make Classify static. There's no real reason for it to be an instance method. Then, I would consider creating a Dictionary of the patterns. You could rewrite this as:
private enum DataMatches
{
Header = 0,
Blank = 1,
Total = 2,
Sum = 3,
NewData = 4,
Data = 5,
Unmatched = 99
}
private static void SetupRegex()
{
if (dataPatterns != null && dataPatterns.Count > 0) return;
dataPatterns = new Dictionary<string, DataMatches>();
dataPatterns.Add(@"^(D|""D|T|S|I|E|""Z)", DataMatches.Header);
dataPatterns.Add(@"^$", DataMatches.Blank);
dataPatterns.Add(@"^""To", DataMatches.Total);
dataPatterns.Add(@"^""\d\d/\d\d/\d\d\d\d"","""",", DataMatches.Sum);
dataPatterns.Add(@"^""\d\d/\d\d/\d\d\d\d"",", DataMatches.NewData);
dataPatterns.Add(@"^"""",""\w", DataMatches.Data);
}
private static DataMatches Classify(string s)
{
SetupRegex();
foreach (KeyValuePair<string, DataMatches> kvp in dataPatterns)
{
if (Regex.IsMatch(kvp.Key)) return kvp.Value;
}
return DataMatches.Unmatched;
}
|
|
|
|
|
Yes, that's what I'd do, but I'd wrap it in a class and have an Attribute to associate the RegEx with the enum member.
private enum DataMatches
{
[RegExAttribute("pattern",Options=options)]
Header = 0
,
|
|
|
|
|
This always returns the same hashcode:
static Regex myRegex = new Regex("");
public static int Bar()
{
return myRegex.GetHashCode();
}
This doesn't,
public static int Foo()
{
Regex myRegex = new Regex("");
return myRegex.GetHashCode();
}
So the object is being created and destroyed at each call, which is expected I suppose. Whether this is heavy enough to have impact on the performance significantly is another matter. A suck-it-and-see approach is best in these circumstances (assuming performance is an issue in the first place, otherwise I'd just go for the cleanest code).
|
|
|
|
|
That is correct, and as expected. Of course in VB you could make the variable static and it wouldn't change.
|
|
|
|
|
|
You're in the wrong forum since C# cannot make any use of ATL.
You're looking for the Visual C++ forum, right above the C# forum in the left-side navigation of this page.
|
|
|
|
|
|
I'd like to be able to see the instant a legal banner appears in a remote desktop window and send an enter key to it to dismiss it during logon.
Does anyone know how to read the windows of a remote desktop window? Are they encrypted?
|
|
|
|
|
I'm pretty sure that what I'd try won't work, but I can't try it until I get back to work on Tuesday.
|
|
|
|
|
Is it complicated or can you post something here?
I'm wondering if the remote desktop session is encrypted or not? If it is encrypted, I should be able to figure out the key since I am the initiator of the session? At least I would think so?
|
|
|
|
|
It looks like it is indeed encrypted
Using Encryption
You can use encryption to protect the data that travels between the terminal server and the terminal services client. If you fear unauthorized interception of the data as it travels between the two, you should enable encryption. RSA RC4 encryption is used; encryption can be set to one of the following three levels:
* High: encrypts both the data sent from client to server and the data sent from server to client using a 128 bit key.
* Medium: encrypts both the data sent from client to server and the data sent from server to client using a 56 bit key if the client is a Windows 2000 or above client, or a 40 bit key if the client is an earlier version.
* Low: encrypts only the data sent from client to server, using either a 56 or 40 bit key, depending on the client version. Useful to protect usernames and passwords sent from client to server.
To change the encryption level, you must be an administrator. In Programs | Administrative Tools, select Terminal Services Configuration and perform these steps:
1. In the left console pane, select Connections.
2. In the right details pane, right click RDP-TCP and select Properties.
3. Click the General tab.
4. Under Encryption level, select the desired level in the drop down box and click OK.
|
|
|
|
|
Hi Experts,
I have an issue with the GridView for wich I want to set a column htmlencode property to false.
Here is the data source. I have no databound columns because I'm not using SQLDataSource.
public void LoadStories()
{
SqlConnection con = new SqlConnection("Data Source=dpeta-ro;Initial Catalog=MINTPRINT;Integrated Security=True");
SqlCommand cmdSelect = new SqlCommand("select news_id \"id\", title \"title\", news_text \"story\", created_date \"created on\", active from news", con);
SqlDataReader rd;
try
{
con.Open();
rd = cmdSelect.ExecuteReader();
gwNews.DataSource = rd;
gwNews.DataBind();
con.Close();
}
catch (Exception err)
{
lblError.Text = err.Message;
con.Close();
}
}
The news_text column has HTML code that i want the GridView to render as HTML code, without encoding it. Because the GW has the Encode set to true by default i need to change it dynamically.
Any ideas?
Thank you,
Alex
“Be the change you want to see in the world.”
|
|
|
|
|