|
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.”
|
|
|
|
|
Hi,
in my project I use:
command = new SqlCommand(SQLStatement, DataBase.SqlDataReader
reader = command.ExecuteReader();
to query "part_ID" from large table. Each part_ID can have more subparts up to n level.
They are all stored in same table. At the moment I use foreach statement to recursivly query
parts from table until they have no sub parts. As there are up to 10000 subparts for some of parts
it takes up to almost a minute to get all subparts (each query takes app. 15 ms).
Is there a faster (more efficient) way to get the same job done?
|
|
|
|
|
|
Use a DataSet and fill it with each table and set a DataRelationship. Although it may use more memory depending on how much data you have it beats 10000 individual queries.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Could you show some of the schema?
|
|
|
|
|
All queries are done from the same table (lets call it "parts_table").
Let say I start with "part_ID" = 1001 --> query returns 120 "subpart_id" (1002, 1004, 2030 ...)
then i execute same query 120 times and get n subparts for each of 120 subpart_ID from first query and so on
until there are no subparts left. As you can see the number of queries can increase very fast ...
Table: "parts_table"
id part_id subpart_id
1 1001 1002
2 1001 1004
3 1002 2150
4 1002 3250
5 1004 1250
.
Part description for "part_id" is in separate table "part_info". I use join to get info for "part_id" ...
|
|
|
|
|
I'm still thinking about it, and one way (with SQL Server 2008) to reduce the number of queries/trips to the database is with a Table Valued Parameter.
|
|
|
|
|
This is the reason we implemented the hierarchy id, using the partid in the hierarchy id has made a tremendous difference. So much so that I am taking the concept to an Oracle database.
I would craft a stored proc that takes a part and returns all the children in one table, using a CTE to do the recursive loop (and I hate CTEs). Then to the presentation formatting in the business layer.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I am working with "SQL Server 2000 SP3 2000.80.760.0" and as I understand it does not support CTE.
Are there any examples for recursive query for "SQL Server 2000" ?
|
|
|
|
|
hi guys, i'm looking for all over the internet i a just cant find it, i am almost giving up... So, how can i desable a menustrip item from another form. ex: i have a form1(mdi) and i open inside it a form2, and from this form2, i wanna desable a form1 menustrip item. thanks
sorry for the bad english.
|
|
|
|