|
Can somebody give me an idea of how to build multipage dynamically without having it created at design time at all??
rmr
|
|
|
|
|
a multipage (though i haven't used one yet ) is a class as every other designable object in .net. I guess you're talking about creating a multipage in the codeeditor, don't you? If so, you just have to declare a multipage object and assign a new instance of the multipage class to it. that could look like
<br />
MultiPage mymultipage = new MultiPage();<br />
If you want to add controls (Multipage sounds similar to a form ) you will have to use its methods. To access all public multipage members just go on and type
<br />
mymultipage.MEMBER_OF_MULTIPAGE_CLASS<br />
in reality you could do it like this:
<br />
mymultipage.BackColor = System.Colors.Black;<br />
If you don't know much about classes and object oriented programming (oop) you should first read some stuff about it. Since I started writing vb.net and then wrote some php and cpp too, i have inherited some knowledge about c#. thats why i cant recommend you a special tutorial but maybe someone else can
good luck,
mik
|
|
|
|
|
Thanks.
Actually, am trying to use the Tabstrip control with the multipage control.
Am able to bind data to a Tabstrip dynamically when tabstrip and multipage are created at design time. But, am not able to create multipage at run time.
Microsoft.Web.UI.WebControls.MultiPage multipage1 = new Microsoft.Web.UI.WebControls.MultiPage();
Please help me on this.
rmr
|
|
|
|
|
Hi,
I'm completly new to the topic of Remoting in .NET and I have a few questions to find out if this technology is suitable for the needs of my application.
I want to create an application which runs on several different hosts, which work together as if they where one application. The data which have to be given from one object to the next one (or from one host to the next one, where the difference shouldn't matter) is an XML file which is stored in an object of the type XmlDocument. As far as I know this class does not implement the ISerializeable interface. So I would like to know if there is any way to process an instance of there class through the Remoting?
My second question is about the objects which methods are called remotely. I've read some tutorials, but they all take about creating the object at the client. I want to create the object on the server maschines and enable the clients to use these objects by reference. In detail I've created a design where every component looks the same at the outside (they extend the same class). Every host will have an instance of a class which extends this basic class. A client will know decide to which server the data has to be send and call the methods of the object on the specific server. As the initialization process is quite difficult in some cases (as there may be several other "stations" behind the remote objects) I would like to initialize all objects when the server starts. I've read about Server Activated Objects which could by the best solution, but in this case the object will be created when the first client accesses it. Isn't there any way I can make an already initialized ojbect available to all clients?
I'm sorry for the long text, but as I'm new to the topic I wanted to explain everything.
Thank you very much for reading and maybe for some answers!
Stampede
|
|
|
|
|
Hi.
My Goal is: to push the world such that future .NET hashcode concept uses more bit's.
My Question is: where do i have to push?
I think i understand the HashCode concept, and wanted to use it with Hashtable. but it seems the C#/.Net implementation of that concept is bullshit.
First collision of hashcode occured with my 8th element i wanted to insert. (ofc my GetHashCode was bad, using String.GetHashCode())
then i wrote the best possible GetHashCode(); algorithm i could think of.
but on 30'000 elements, again: Collision! (2 different elements with same hashcode).
with "birthday-attack" (which is unfortunatly happening in my code, even if i didnt want that).
you will have a collision each about 65536 elements. 2^(32bit/2)
and i wouldnt like 64 bits, thats bit short.
128 bits? that would be great! but in some years you will be able to create collisions.
so lets use 256 bits, thats what i dream of
Regards,
Random_zh
btw here the implementation of GetHashCode of my ArrayList,
it could be very useful for some others:
i hope i made good choices on RSA numbers, and no mistakes ^^
oh yea GetLargeHashCode() is part of my 64 bit LargeHashtable, i'm currently implementing.
no more collisions and nearly same speed as Hashtable
<code>
public override int GetHashCode()
{
int result = 0;
for (int i = 0; i < Count; i++)
{
result = result ^ Encrypt((int) this[i]);
}
return result;
}
/// <summary>
/// GetLargeHashCode
/// </summary>
/// <returns>int[2]</returns>
public int[] GetLargeHashCode()
{
int[] result = new int[2];
for (int i = 0; i < Count; i++)
{
result[i%2] = result[(i+1)%2] ^ Encrypt((int) this[i]); // remember: ^ is XOR
}
return result;
}
/// <summary>
/// using RSA http://en.wikipedia.org/wiki/Rsa
/// be aware of the birthday attack http://en.wikipedia.org/wiki/Birthday_attack
///
/// with those parameters, Encrypt maps following integer ranges to integer ranges:
/// -2147483648 = int.MinValue -------> 0
/// -2147483647 = int.MinValue+1 -------> 1
/// ...
/// -2147483640 = int.MinValue+8 -------> pow(7,11)=1977326743
/// ... from -2147483640 to 2147483416 -------> very good hash (in this range UNIQUE) for each number in this range. This range contains 99.999994% of all int numbers.
/// 2147483416=p*q-int.MaxValue-8 -------> -pow(7,11)-225 = -1977326968
/// ...
/// 2147483423=p*q-int.MaxValue-1 -------> 0
/// 2147483424=p*q-int.MaxValue -------> 1
/// ...
/// from here it starts repeating the sequence.
/// All bad ranges together contain only 225+8+8 = 241 numbers and are on the negative and positive end.
///
/// p = 65551 prime
/// q = 65521 prime
/// n = p * q // uint.MaxValue-n = 225! thats small =)
/// e = 31; OR e = 11; // 11 is not much weaker, but 3times faster // NEVER try e=1,2,3,4,5,6,7,8,9,10 or such things, check gcd(d,e)==1
/// d = (p - 1) * (q - 1)
/// gcd(d, e) == 1;
/// </summary>
/// <param name="theM">number</param>
/// <returns>'encrypted' number or hash of number</returns>
public int Encrypt(int theM)
{
const int e = 11;
const uint n = 4294967071;
uint m = (uint) theM + (uint) int.MaxValue + 1;
ulong multiplyMod = m;
// the first for-loop is already square
for (int i = 2; i <= e; i++)
{
multiplyMod = multiplyMod * m % n;
}
return (int) multiplyMod;
}
</code>
-- modified at 12:12 Thursday 7th September, 2006 (updated code)
|
|
|
|
|
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
|
|
|
|