Jūs esatec++
c++
Howto. Execute MS SQL Stored Procedure With C#
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.
C++. How to print non ASCII characters?
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.
C#. Object -> Dictionary -> Object
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.
C#. Int array vs. ArrayList vs. Dictionary
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);The
Point multiplication in Elliptic Curves
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.
Using interfaces in C#
Simple example with interfaces.
Passing parameters in C#
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
Multiple-Precision Modular Arithmetics. Addition
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".
C#. Howto get information about class members dynamicaly
Last weekend I had a problem.
C#. Gijų panaudojimas
Bandžiausi .NETo galimybes - kaip su gijomis draugaujama.
C# Remote Object'o iškvietimas
KTU'ne per .NET modulį davė parašyti dvi programėles. Viena iškviečia kitos Remote Object'ą. Kitaip tariant: veikia programa-serveris. Jinai turi žiauriai gerą ir naudingą metodą, kuriuo baisiai nori pasinaudoti programa-klientas.
Besikeičiančio teksto rašymas C++'e
Turbūt teko matyti įvairias konsolines programas, kuriose vienoje eilutėje rašomas besikeičiantis tekstas. Pavyzdžiui: turime instaliacijos sistemą. Instaliuojama programa. Rašomas progresas - bėga skaičiai nuo 1 iki 100 proc. Tačiau jei besikeičia vienoje eilutėje.
Įrašų įterpimas į surikiuotą masyvą
private static void insertEntryIntoArray(int insertationIndex, int entry, int [] array) {
for (int i = array.length - 1; i > insertationIndex; i--)
array[i] = array[i - 1];
array[insertationIndex] = entry;
}
// Kodas....
int [] array = new int[5];
int numberToInsert = 7;
int entriesFilled = 3;
array[0] = 1;
array[1] = 5;
array[2] = 10;
for (int i = 0; i < entriesFilled; i++)
if (array[i] > numberToInsert) {
insertEntryIntoArray(i, numberToInsert, array);
entriesFilled++;
break;
}
Gal kam pravers :)
C#. Reikšmių išgavimas iš DataTable klasės
DataTable dataTable = new DataTable();
// Užpildome duomenimis
string data = dataTable.Rows[indeksas] [stulpelio_pavadinimas].ToString();
Kažkas tokio:
for (int i = 0; i < dataTable.Rows.Count; i++)
Console.WriteLine(dataTable.Rows[i]["Vardas"].ToString();
C#. Failo vardo gavimas iš OpenFileDialog
Nusiskaitėme visą kelią iki failo, o mums reikia tik failo vardo. Kaip tai padaryti? Galima maždaug taip:
OpenFileDialog openFileDialog = new OpenFileDialog();
if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
FileInfo fi = new FileInfo(openFileDialog.FileName);
fi.Name; // Failo vardas
fi.DirectoryName; // Kelias iki failo
fi.Extension ; // Plėtinys
}
Nors, aišku, galima bandyti karpyti :) Trim() metodas. Tiesa, atsibos žaisti...

