|
Hi
I want to apply membership authentication in my asp.net application(c#).
I want to keep the membership information in my existing database. Is there any one who can help me for this?
Regards
MG
|
|
|
|
|
I think this can help you to start [^]
|
|
|
|
|
I need to use the following regular expression from an undocumented sources
<snippet(?<id>\w+)>.*\n(?<tx>(.|\n)*?)\n.*</snippet(\k<id>)>
Can anyone help with a sample region matched by this expression? I have being trying some without success.
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|
Here's a sample:
<br />
<snippetqwer>123<br />
fgfg<br />
sggfbsgbgb<br />
</snippetqwer><br />
The Regulator is a great tool for regexps, consider using it
|
|
|
|
|
Thanks so much for the reply. This is the valid sample.
This seems to be a bug, though - thanks for helping me sought this out.
The original system expected format "eID#sID" (where eID is example ID, and sID is snippet ID) for the "qwer" you used, so I thought the new is also expected in that format.
I will take a look at the regulator, I am currently trying, Expresso, http://www.ultrapico.com/Expresso.htm[^]
Now, I know where the problem is. Again, thanks for the great help.
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|
I'm confused.... If I have two different hash-sets with identical values they yield different hash codes?
static void Main(string[] args)
{
HashSet<int> setA = new HashSet<int>(new int[] { 1, 5, 10 });
HashSet<int> setB = new HashSet<int>(new int[] { 1, 5, 10 });
Console.WriteLine("Hashcode A = "+setA.GetHashCode());
Console.WriteLine("Hashcode B = "+setB.GetHashCode());
}
Actually the hash codes returned are the same whatever values I have in the sets (only sequence of creation matters - is the hash code based on the address of the values?). I thought a good hash function should yield the same return value with the same values - any advice what I'm overlooking?
|
|
|
|
|
Each object has a hash code, that must depend on at least one of its instance values. your setA and setB are two different objects (similar content, but unrelated objects), hence they are allowed to have unrelated hash values.
Also hash values are mainly useful for objects INSIDE collections, not for collections themselves.
See the documentation[^], in particular the remarks and the "Notes to Implementers".
|
|
|
|
|
Thanks a lot for the feedback (reminds my: "If everything else fails read the manual"...)
So I think I'll have to overwrite GetHashCode for HashSet to yield the same values when contents are the same (I'm looking for testing equality between sets and SetEquals doesn't do the job as I apparently have to live with default Comparer for that ).
|
|
|
|
|
ThomasPep wrote: If everything else fails read the manual
Better yet: before you use some class/method, read the manual. When it fails, read it again.
|
|
|
|
|
Did you try creating the hash sets with the comparer you want to use? It appears that if both hash sets are using the same comparer, that comparer should be used from SetEquals.
|
|
|
|
|
I had a HashSet of HashSets - and wanted no duplicates when the elements (the sets) contained the same values. I did succeed (finally) by creating the sets with a non default comparer and SetEquals as you write (and overwriting all "GetHashCode" I could think of potentially being called ).
It seems to me that the HashSet implementation in .net needs some twisting to work with references/nested references when testing on values is needed (I didn't succeed with CreateSetComparer as only "1-level", though should be possible to nest this).
The following also confused me good during debugging:
using System;
using System.Collections.Generic;
HashSet<HashSet<int>> setA = new .....;
HashSet<int> subSetB = new HashSet<int>(new int[]{....});
setA.Contains(subSetB)
This code ran well except I could never find subSetB... - and I was confused (happens a lot to me) as the documentation referred to two methods including one setA.Contains(subSetB,myComparer) which I couldn't find with IntelliSense.
Finally I realized that the namespace for the two methods were System.Linq, so I included System.Linq and I could use myComparer and find subSetB. I guess the code above used an earlier version of HashSet than .NET 3.5 to run - but that took some time to find out.
modified on Thursday, December 31, 2009 12:53 PM
|
|
|
|
|
Hi all,
Hopefully this is the right thread for this question. I was quite uncertain to whether it was a .NET question or a C# question. However, I could see more thread related questions under the c# subject.
Well, I am new to the c# and the .net platform. I wonder if some kind soul could help me with my question. I am trying to develop a monitoring application that will be able to monitor all servers and Oracle databases on a network. I am using SQLITE for the local database and perl to act as the agent that keeps checking things out. For the front end, (The Configuration Assistant tool) I am using C#.
I often need to connect to Oracle Databases from my UI thread. I am avoiding to lock the UI by executing the DML under a second thread as follows:
try
{
foreach (ListViewItem monitoredDatabases in monitoredDatabasesListView.Items)
}
String[] connectionResults = new String[10];
Thread testOracleConnection = new Thread(delegate()
try
{
}
catch (OracleException)
{
throw;
}
});
testOracleConnection.Start();
while (testOracleConnection.IsAlive)
{
Application.DoEvents();
Thread.Sleep(1);
}
}
catch (Exception) CATCH on thread 0
{
progressInfoForm.Close();
Cursor = Cursors.Default;
return (false);
}
As you can see on the above code, the exception never gets to the CATCH statement on thread 0 and causes the entire application to crash.
What I want to do here is have one single place to restore all the normal behaviour of the form once it has encountered an exception. Eg, within the CATCH statement of the thread 0 (UI), I then reset the Cursor style, close the progress bar form and return with the correct status to the calling method.
It would be great if someone could actually show me how I could solve this problem by changing the code snipped above so that I can try it out and definitelly understand the solution.
Thank you very much.
Daniel
|
|
|
|
|
See:
Proper Threading in Winforms .NET[^]
If this doesn't help you solve the problem let us know.
Also do some research on:
AppDomain has an UnhandledException
Application has a ThreadException
Using these you will have the ability to catch any exception before it blows up the application. It's caught in the 'Main' Class of you application.
~TheArch
|
|
|
|
|
hi daniel,
I've read your code and performed following test. looks you can not just throw your exception in the new thread. you can handle it in the worker thread and use delegate to process it in GUI thread.
The following is my test code. 2 buttons in one single form. "Button1" can cause the program crash. "Button2" success capture the error. Hope it helps.
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Thread t = new Thread(delegate()
{
DoWork();
});
try
{
t.Start();
}
catch (Exception ex)
{
commonExceptionHandler(ex);
}
}
private void button2_Click(object sender, EventArgs e)
{
Thread t = new Thread(delegate()
{
try
{
DoWork();
}
catch (Exception ex)
{
commonExceptionHandler(ex);
}
});
t.Start();
}
private void commonExceptionHandler(Exception ex)
{
if (this.InvokeRequired)
{
this.Invoke(new Action(() => commonExceptionHandler(ex)));
}
else
{
MessageBox.Show("[got it!] "+Environment.NewLine+ ex.ToString());
}
}
private void DoWork()
{
throw new InvalidOperationException("this is test");
}
}
|
|
|
|
|
Since you are running this from a UI form, I would use a BackgroundWorker. This allows you to trap an event when the BackgroundWorker ends, and you can tell whether it completed normally, or whether it failed with an exception and if so what exception it received.
|
|
|
|
|
Hi experts,
The easiest way to send email .net for smtp clients is using System.Net.Mail Smtpclient. But I would like to send it through ma proxy server which has IP as 192.168.0.1. Is there any way in .net.
Please let me know how I will be able to send emails from proxy. I have found lot of apps which provide the mechanism to do so. But I don't like to purchase like to make my own.
Thanks & Best Regards
Jay Khatri
|
|
|
|
|
The SMTPClient class does not support using a proxy. You'll either have to write your own implementation of SMTPClient that does support it, or find a 3rd party library that does.
|
|
|
|
|
Hello there,
I am creating a web application and i need to communicate with a server(Mainly it is a mail server). But i want an general answer how could i communicate with these servers??Such as opening connection retrieving data and closing connection
|
|
|
|
|
khKamel wrote: general answer
One way to communicate between machines is by using a socket.
There are only 10 types of people in this world — those who understand binary, and those who don't. |
|
|
|
|
|
Ok thanks,now i have some information thanks to you, but how is communication using socket is done??
|
|
|
|
|
Sockets - try here[^].
Sockets can be used to setup communication between any two machines (need not be client or server).
There are only 10 types of people in this world — those who understand binary, and those who don't. |
|
|
|
|
|
Hey,
When I run a worker thread via an async operation, it get named 'Worker Thread', which forces me to go identify the threads by looking at some id value every time. Is there a way to make an AsyncOperation run on a named worker thread?
Cheers
Jeroen De Dauw
---
Forums ; Blog ; Wiki
---
70 72 6F 67 72 61 6D 6D 69 6E 67 20 34 20 6C 69 66 65!
|
|
|
|
|
jeroen de dauw wrote: When I run a worker thread via an async operation, it get named 'Worker Thread', which forces me to go identify the threads by looking at some id value every time. Is there a way to make an AsyncOperation run on a named worker thread?
It's a bit sealed, and there's no Tag property that you could abuse. The best I can think of would be a Hashtable or a Dictionary, perhaps using an extension-method to make the lookup somewhat easier.
I are Troll
|
|
|
|
|
I have looked high and low trying to name .NET threads, and came up with nothing.
My logging tends to show a 2-hex-digit managed thread ID (except " " for the main tread), that's the best I have; the only alternative I see is with a map, say a Dictionary<int,string> as Eddy suggested.
|
|
|
|
|
Hello everyone! Merry Christmas and Happy New Years!
I have two Regions and I want to join them (they will overlap each other) so that nothing is clipped when drawn?
Ex.
(region 1, region 2, 0 is blank area)
00000111100000
22222111122222
22222222222222
Thank you!
Steve
modified on Sunday, December 27, 2009 6:16 AM
|
|
|
|