|
Hardcoded values, are you serious?
Why don't you just use the SHA (256, 384, 2048, ...) as hash function?
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
coz i forgot to think about sha may be.
and coz it would not solve my problem.
and i needed to hack it fast.
if you used any sha or md5 shortened to integer as Hashtable needs it, you would also find lot of numbers(or elements) with collisions.
i will have to search (and if not exists make) a Hastable accepting keys with more then 32 bits, and i will have to have lots of GetHashCode methods with more than 32 bits for that, for expample with SHA.
regards
EDIT:
no, i decided that using SHA wouldnt be faster than 10 ulong multiplications. (see code)
and my code now generates less collisions than if i had used sha. (if you build my 64bit hash from 2 integers, you will only find 50'625 collisions from 2^64 possibilites) (with sha shortened to 64bit you would have (stistical guess): more than 1'000'000'000 collisions between all 2^64 possibilities.)
-- modified at 12:25 Thursday 7th September, 2006
|
|
|
|
|
Hi,
What event should I catch if I want to replace the minimize button code. I've tried catching the "Sizechanged" event but this fires every time a window is opened or resized, I only want to catch the event caused by the minimize button. I want to use this to create an application specific "taskbar" for all of my MDI client windows.
Thanks in advance for any suggestions made!
|
|
|
|
|
size changed;
and test whether form.WindowState is minimized.
|
|
|
|
|
Ah ok, thanks. That worked. Now we're at it, would anyone happen to know how to make my mdi client window dock to its parent?
Thanks again, cheers.
|
|
|
|
|
I'm not entirely sure what you're asking. Do you mean maximizing it?
|
|
|
|
|
I mean having it stick to a specific side of its parent, just like controls can. Actually, this is easier than I though. Just set an mdi parent and set the dock property for you form to try it out.
|
|
|
|
|
Hello i want to create an answering machine that automatically picks up and responds to calls recieved through the vonage VOIP service. I can't seam to find any documentation on the internet relating to this. I would greatly appreciate it if someone could point me in the right direction.
Thanks,
Steve
|
|
|
|
|
It's highly ulikely that you can do this. Vonage is tied to your adapter's MAC address. The way it works is that when you power up your Vonage adapter, it connects to the Vonage service, and this service knows your device strictly by it's MAC address. This allows it to bypass firewall restrictions, because it calls in to Vonage and keeps a constant connection rather than Vonage trying to connect to you.
--
Where are we going? And why am I in this handbasket?
|
|
|
|
|
Thanks for the info. I am now looking into SIP based VOIP services. My idea is to login to the VOIP service and forward the packets sent from a remote phone through my computer to my SIP phone at another location. This will enable me to examine the SIP messages as they pass backwards and forwards to my phone, and log the call.
P.S There dosen't seam to be any API's for using SIP on .NET or on Windows, i don't know Java so one in C# or C++ would be ideal.
Thanks in advance,
Steve
|
|
|
|
|
Hi
Guys , how can i make client server in C# can any one provide me the code for example, thankx in advnace
|
|
|
|
|
There is more than one way to make client server applications in C#,
u can go for .net remoting technology. u can easily find helping material on net.
this article will help u
www.c-sharpcorner.com/Network/RemotingInNETM.asp
|
|
|
|
|
Hi,
Indeed there are several ways to create an client - server architecture in c#. It only depends on the type of data you want to transmit. If you want data over the Network then you should try using Socket (System.Net.Socket). If you need an example let me know.
Do your best to be the best
|
|
|
|
|
OK
Man provide me the example so i can work it out , thankx in advance
|
|
|
|
|
Well,
It is very important to understand that sockets exchange only byte arrays between them, regardless of what the byte arrays contain (file, string message etc.). So it is very important that when you receive something to know what you receive. At first you should try to create your own communication protocol.
In my example the client send a string message and the server receives it
For the server:
<br />
Socket server = new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);<br />
m_tcpListener.Bind(new IPEndPoint(IPAddress.Any,10000>));
Socket client = server.Accept();
byte []buffer = new byte[1024];<br />
int read = 0;<br />
string receivedMessage = "";<br />
while ( (read = client.Receive(buffer)) != 0 )<br />
{<br />
receivedMessage = String.Concat(Encoding.ASCII.GetString(buffer),receivedMessage);<br />
if (read < buffer.Length)<br />
break;<br />
}<br />
client.Shutdown(SocketShutdown.Both);<br />
For the client:
<br />
Socket client = new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);<br />
client.Connect(new IPEndPoint(Dns.Resolve("127.0.0.1").AddressList[0],10000));<br />
string message = "This is a test";<br />
client.Send(Encoding.ASCII.GetBytes(message));<br />
client.Shutdown(SocketShutdown.Both);<br />
Hope it helps
Do your best to be the best
|
|
|
|
|
Thankx man for ur example when i am using this code snippet of the server it is giving the error on this
m_tcpListener.Bind(new IPEndPoint(IPAddress.Any,10000))
and shows no method of the tcp listener with the name of bind thers is the Server property of TCP Listener which have the method Bind , but its not workin plzzzzzzz, Reply me ASAP,thankx for ur reply.
|
|
|
|
|
Hi,
I must appologise. Please in the server code replace TCPListener with Socket. I confused the server declaration
Do your best to be the best
|
|
|
|
|
...or the easist way if it's sufficient for your purposes is ASP.NET webservices.
Regards,
Rob Philpott.
|
|
|
|
|
Well i don't want to use web services , iknow abt the web services , but i wanna make client Server with out web services, thanks in advance
|
|
|
|
|
hi folks,
i know how to use crystal reports in asp.net with c#. but it connected with only one table at a time but i need to connect different table with single rpt file ,if any one knows about this plz share with me
regards,
ranandbe
|
|
|
|
|
you should create view in database for connect many table a time
|
|
|
|
|
thanx for reply,
plz give me sample code
regards
ranandbe
|
|
|
|
|
Hi,
I am using the following code to encrypt/decrypt a connection string in my app.config file:
private void ProtectConfiguration()<br />
{<br />
<br />
config = ConfigurationManager.OpenExeConfiguration(myGlobalFilePath);<br />
<br />
string provider =<br />
"DataProtectionConfigurationProvider";<br />
<br />
<br />
ConfigurationSection connStrings =<br />
config.ConnectionStrings;<br />
<br />
if (connStrings != null)<br />
{<br />
if (!connStrings.SectionInformation.IsProtected)<br />
{<br />
if (!connStrings.ElementInformation.IsLocked)<br />
{<br />
connStrings.SectionInformation.ProtectSection(provider);<br />
<br />
connStrings.SectionInformation.ForceSave = true;<br />
config.Save(ConfigurationSaveMode.Full);<br />
<br />
Console.WriteLine("Section {0} is now protected by {1}",<br />
connStrings.SectionInformation.Name,<br />
connStrings.SectionInformation.ProtectionProvider.Name);<br />
<br />
}<br />
else<br />
Console.WriteLine(<br />
"Can't protect, section {0} is locked",<br />
connStrings.SectionInformation.Name);<br />
}<br />
else<br />
Console.WriteLine(<br />
"Section {0} is already protected by {1}",<br />
connStrings.SectionInformation.Name,<br />
connStrings.SectionInformation.ProtectionProvider.Name);<br />
<br />
}<br />
else<br />
Console.WriteLine("Can't get the section {0}",<br />
connStrings.SectionInformation.Name);<br />
<br />
}<br />
<br />
<br />
private void UnProtectConfiguration()<br />
{<br />
<br />
config = ConfigurationManager.OpenExeConfiguration(myGlobalFilePath);<br />
<br />
ConfigurationSection connStrings =<br />
config.ConnectionStrings;<br />
<br />
if (connStrings != null)<br />
{<br />
if (connStrings.SectionInformation.IsProtected)<br />
{<br />
if (!connStrings.ElementInformation.IsLocked)<br />
{<br />
connStrings.SectionInformation.UnprotectSection();<br />
<br />
connStrings.SectionInformation.ForceSave = true;<br />
config.Save(ConfigurationSaveMode.Full);<br />
<br />
Console.WriteLine("Section {0} is now unprotected.",<br />
connStrings.SectionInformation.Name);<br />
<br />
}<br />
else<br />
Console.WriteLine(<br />
"Can't unprotect, section {0} is locked",<br />
connStrings.SectionInformation.Name);<br />
}<br />
else<br />
Console.WriteLine(<br />
"Section {0} is already unprotected.",<br />
connStrings.SectionInformation.Name);<br />
<br />
}<br />
else<br />
Console.WriteLine("Can't get the section {0}",<br />
connStrings.SectionInformation.Name);<br />
<br />
}
However whenever I encrypt and decrypt the connectionStrings section of the app.config file, the connection string is not what I entered, it comes out as:
<connectionStrings><br />
<clear /><br />
<add name="LocalSqlServer" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"<br />
providerName="System.Data.SqlClient" /><br />
</connectionStrings>
I am trying to encrypt the following connection string:
<connectionStrings><br />
<add name="MyDbName" connectionString="Data Source=MYDBSERVER;Initial Catalog=MYDBNAME;Integrated Security=False;User ID=MYID ; Password=MYPASSWORD" providerName="System.Data.SqlClient"/><br />
</connectionStrings>
Any ideas what I could be doing wrong?
Thank you in advance.
|
|
|
|
|
solved it. was trying to open config file instead of:-> exe
|
|
|
|
|
can anyone tell me, how can i return values from threads in C#?
Reply will be appreciated
Thanx in advance
|
|
|
|