At the moment I'm coding a small project for my university. I have to create a simple system on C# and Microsoft SQL Server 2005. So, I need a way (and code) to execute MS SQL Server's Stored Procedures from my C# program.
We have some additional letters in the Lithuanian language: ą, č, ę, ė, į, š, ų, ū, ž (if you can't see them - change the encoding of your browser into Unicode). The point is, that cout can not print those letters.
I have the fallowing situation. I have an object. I need to make a Dictionary, which contains all the properties (and it's values) of the object. Then send this Dictionary over the network.
private static void TestIntArray()
{
int [] array = new int[1000];
for (int i = 0; i < 1000; i++)
array[i] = i;
}
private static void TestArrayList()
{
ArrayList array = new ArrayList();
for (int i = 0; i < 1000; i++)
array.Add(i);
}
// Code....
long start = DateTime.Now.Ticks;
TestIntArray();
long end = DateTime.Now.Ticks;
Console.WriteLine("Time with int array: {0}", end - start);
long start2 = DateTime.Now.Ticks;
TestArrayList();
long end2 = DateTime.Now.Ticks;
Console.WriteLine("Time with ArrayList array: {0}", end2 - start2);
I was browsing the web for information about the binary multiplication (also known as "left-to-right multiplication") in Ellipti curves. I wrote a demonstration of the algorithm. Unfortunately, it's very brief version, but it might be interesting for someone :) This demonstration generates the right point multiplication sequency in binary multiplication of point.
First - very short theory. Point multiplication is the operation: Q = k∙P. Point multiplication is the combination of point doubling and point addition.
In C we can use a function printf(), which can take different numbers of parameters. E.g.: printf("%d %s", a, b). How this can be done in C#?
It can be done by keyword params:
int Method(params int[] var)
{
int sum = 0;
foreach (int i in var)
sum += i;
return sum;
}
// Code...
Method(5, 2, 3);
Method(64, 1);
Method(9);
More information: http://msdn.microsoft.com/en-us/library/w5zay9db(VS.71).aspx
I was browsing (ok, lets be honest - Goooogling) the web in order to find some Multiple-Precision Modular Arithmetics algorithms. Our lecturer recomended a very good book - "Handbook of Applied Cryptography".
Naujausi komentarai