-
MY PROJECTS
-
Recent Posts
- SQL.How can you compare two nullable values safely, and how does IS DISTINCT FROM differ from <>?
- SQL.How are NULL values ordered by ORDER BY, how do defaults differ between databases, and how can you control their placement?
- SQL.How does NULL propagate through arithmetic expressions, and how can COALESCE and NULLIF help handle missing values and division by zero?
- SQL.How does NULL affect join conditions, and why can filtering the right-hand table in WHERE remove unmatched rows from a LEFT JOIN?
- SQL.How do GROUP BY and DISTINCT treat NULL values, even though NULL = NULL evaluates to UNKNOWN?
- SQL.How do aggregate functions handle NULL, and what is the difference between COUNT(*), COUNT(column), and COUNT(DISTINCT column)?
- SQL.How does NULL affect IN and NOT IN, and why can NOT EXISTS be a safer choice when a subquery returns nullable values?
- SQL.How do WHERE, HAVING, and CHECK constraints treat conditions that evaluate to UNKNOWN?
- SQL.Why do column = NULL and column <> NULL not work as expected, and when should you use IS NULL and IS NOT NULL?
- SQL.What is SQL’s three-valued logic (TRUE, FALSE, UNKNOWN), and how do AND, OR, and NOT behave with UNKNOWN?
- ChromeDevTools.Watch all failed requests
- SQL.What are domain types (or constraints on data types), and how do they help enforce data correctness?
- SQL.How does SQL handle comparisons between different data types (for example, string vs number), and why is this dangerous?
- SQL.What is the difference between DATE, TIME, TIMESTAMP, and TIMESTAMPTZ, and which one should be used for business events?
- SQL.How do numeric types like INTEGER, BIGINT, DECIMAL, and FLOAT differ in terms of precision and use cases?
- SQL.What problems can arise from implicit type casting in SQL, and how can it affect indexes?
- SQL.How does NULL differ from 0, an empty string, or FALSE in SQL?
- SQL.What is the difference between CHAR, VARCHAR, and TEXT, and when would you choose each?
- SQL.What is MVCC ?
- SQL.What is AutoVacuum Postgres ?
Categories
- Aptana
- Azure
- C#
- DataSnap
- DBExpress
- Delphi
- Delphi и сети
- Delphi. Язык программирования
- ExtJS
- FastReport
- FireDAC
- FireMonkey
- GIT
- ICS
- IDE
- IIS
- Indy
- InnoSetup
- javascript
- jQuery
- JSON
- LiveBindings
- MSHTML
- MySQL
- PHP
- REST
- Ribbons
- SMS
- SQL инструкции
- SVN
- TRichView
- UniGui
- WebBroker
- WinAPI
- Windows
- Алгоритмы
- Без рубрики
- Деревья
- Ищу ответ
- Компонентостроение
- Мои компоненты
- Начальный уровень
- Обработка исключений
- Парсинг
- Потоки(Threads)
- Регулярные выражения
- Тестирование приложений
Category Archives: C#
C#. Param modificators and overload
123
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
// out modificator private void Add1(int x, int y, out int r) { //do something r = x + y; //out param must be assigned inside scope } // ref modificator int r = 123; private static void Add2(int x, int y, ref int r) { //do something r = x + y; //out param must be assigned inside scope } // params modificator - must be 1 by order private static double CalcAverage(params double[] values) { double r = 0; if (values.Length == 0) return r; double sum = 0; for (var i = 0; i < values.Length; i++) { sum += values[i]; } r = sum / values.Length; return r; } // optional Arguments private static void OptionalArgument(string s1,string s2="default") { Console.WriteLine(s1+"\n\r"+s2); } // overload static void Some(int x, int y) { } static void Some(int x, int y, int z) { } |
Posted in C#
Comments Off on C#. Param modificators and overload
С#. Some remarks alltogether
123
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
using System; using System.Text; namespace Mains { class Program { static int Main(string[] args) { //--- reading args of main for (int i = 0; i < args.Length; i++) { Console.WriteLine("Arg: {0}", args[i]); } // or foreach (string arg in args) Console.WriteLine("Arg: {0},{1}", arg, 123); //or System.Enviroment Console.WriteLine("True {0}", bool.TrueString); //--- char char myChar = 'a'; if (char.IsDigit(myChar)) { Console.WriteLine("digit"); } //--- parse from string bool b = bool.Parse("true"); //--- dateTime DateTime dt = new DateTime(2017, 08, 20); Console.WriteLine(dt.DayOfWeek); string s = "someString"; if (s.Contains("some")) {/*do something*/ } Console.Write("beep\a\n\r"); Console.WriteLine("beep\a\n\r"); //--- verabtim strings Console.Write(@"some\Dir\"); // will // string builder using System.Text StringBuilder sb = new StringBuilder(); sb.Append("\n"); sb.AppendLine("Line1"); sb.AppendLine("Line2"); sb.AppendLine("Line3"); Console.WriteLine(sb.ToString()); // Convert byte myByte = 0; int myInt = 200; myByte = Convert.ToByte(myInt); Console.WriteLine("Value of my Byte {0}", myByte); //----- narrowing and checked directive short myShort; int myInt1 = 100000000; // myShort = myInt1; // Severity Code Description Project File Line Suppression State //Error CS0266 Cannot implicitly convert type 'int' to 'short'.An explicit conversion exists (are you missing a cast?) Mains C:\C#\MyC#StudyProjects\07_DifferentMains\Mains\Mains\Program.cs 64 Active try { checked { myShort = (short)myInt1; } } //{ checked { myShort = Convert.ToUInt16(myInt1); } } catch (OverflowException ex) { Console.WriteLine(ex.Message); } //----- var directive var myInt2 = 0; var myBool = true; var myString = "string"; Console.WriteLine(myInt2.GetType().Name); Console.WriteLine(myBool.GetType().Name); Console.WriteLine(myString.GetType().Name); // for for (var i = 0; i < 10; i++) { /*do something*/} //foreach int[] intArray = { 0, 1, 2, 3 }; foreach (var i in intArray) { /*do something*/} //while var j = 0; while (j < 10) { j++; } //do while do { j++; } while (j < 10); // if else if (j < 10) { } else if (j == 10) { } else if (j == 1) { }; // and or not && || ! if ( (j<=10) && (j>=11) ){ } if ((j <= 10) || (j >= 12)) { } if ((j != 12) || (j >= 12)) { } //switch var n = 12; switch (n) { case 1: { };break; case 2: { };break; default: { };break; } //---------- Console.ReadLine(); return -1; } } } |
Posted in C#
Comments Off on С#. Some remarks alltogether
C#. Value types, Reference types, Object types, String Types, Dynamic Types, Pointer Type
Source The variables in C#, are categorized into the following types: Value types Reference types : object type, string type…. Pointer types Value Type Value type variables can be assigned a value directly. They are derived from the class System.ValueType. The … Continue reading
Posted in C#
Comments Off on C#. Value types, Reference types, Object types, String Types, Dynamic Types, Pointer Type
C#.Processings with args of command line
example
|
1 2 3 4 5 6 7 8 9 10 11 12 |
static int Main( string[] args) { for (int i = 0; i < args.Length; i++) { Console.WriteLine("Arg: {0}", args[i]); } // or foreach (string arg in args) Console.WriteLine("Arg: {0}", arg); return -1; } |
for testing in visual studio Solution Explorer > Debug > Command line Arguments
Posted in C#
Comments Off on C#.Processings with args of command line
C#. Different variants of method Main
returns int and has strings array as arg 1. Returning Main with args
|
1 2 3 4 5 6 7 |
class Program { static int Main(string[] args) { return 0; } } |
2. Returning Main without args
|
1 2 3 4 5 6 7 |
class Program { static int Main() { return 0; } } |
3. Void Main with args
|
1 2 3 4 5 6 7 |
class Program { static void Main(string[] args) { } } |
4. Void Main without args
|
1 2 3 4 5 6 7 |
class Program { static void Main(string[] args) { } } |
Posted in C#
Comments Off on C#. Different variants of method Main
Алгоритмы. Delphi. C#. PHP. JS. Бинарный поиск в массивах на 4 языках
Продолжаем мультиязычные посты. Сегодня бинарный поиск. Все программы будут состоять из 2 частей – рандомное заполнение массивов с сортировкой. И вторая часть – собственно бинарный поиск. Delphi (бинарный поиск) Собственно реализация Функции бинарного поиска Integer и String массивов. Массивы предварительно … Continue reading
Posted in C#, Delphi, javascript, PHP
Comments Off on Алгоритмы. Delphi. C#. PHP. JS. Бинарный поиск в массивах на 4 языках
C#. Создание и инициализация массивов
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace ArrayExamples { public partial class fArrayExamples : Form { public fArrayExamples() { InitializeComponent(); } private void createArray_way1_Click(object sender, EventArgs e) { // Create and initialization of array of 3 elements way 1 int[] someIntArray = new int[3]; someIntArray[0] = 1; someIntArray[1] = 2; someIntArray[2] = 3; textBox.Text += "Create and initialization of array of 3 elements way 1" + Environment.NewLine + ""; textBox.Text += Environment.NewLine + " someIntArray[1]=" + someIntArray[0].ToString() + Environment.NewLine + " someIntArray[2]=" + someIntArray[1].ToString() + Environment.NewLine + " someIntArray[3]=" + someIntArray[2].ToString() + Environment.NewLine; } private void createArray_way2_Click(object sender, EventArgs e) { textBox.Text += Environment.NewLine; // Create and initialization of array of 3 elements way 2 textBox.Text += "Create and initialization of array of 3 elements way 2" + Environment.NewLine+""; int[] someIntArray2 = { 1, 2, 3 }; textBox.Text += Environment.NewLine + " someIntArray[1]=" + someIntArray2[0].ToString() + Environment.NewLine + " someIntArray[2]=" + someIntArray2[1].ToString() + Environment.NewLine + " someIntArray[3]=" + someIntArray2[2].ToString() + Environment.NewLine; } private void create3DimensionalArray_Click(object sender, EventArgs e) { textBox.Text += Environment.NewLine; int[,,] some3DArray = new int[1, 1, 1]; textBox.Text += "Create and initialization of 3 dimensional array" + Environment.NewLine + ""; textBox.Text += Environment.NewLine + " some3DArray[0,0,0]=" + some3DArray[0, 0, 0].ToString() + Environment.NewLine; } } } |
Posted in C#
Comments Off on C#. Создание и инициализация массивов
C#. Пример на перечисления и массивы
Вот что у нас получится А вот собственно код…
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class MainForm : Form { public MainForm() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { int i=10; //i = 1000000; MessageBox.Show("Hello world, just started learn C# " + " I love you C# " + i.ToString() + " times " +"\n"+ sizeof(int).ToString() +"bytes"); } //------------------------------------------------------------------------------ // Describing new enum type here enum WeekDays { Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday }; // Describing new array of strings here string[] WeekDaysRussianNames = { "Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота", "Воскресенье" }; WeekDays day = WeekDays.Thursday; private void bTest_Click(object sender, EventArgs e) { // day in English richTextBox.AppendText("Сегодня " + day+"\n"); // // day in Russsian richTextBox.AppendText( "Сегодня " + WeekDaysRussianNames[(int)day]+"\n" ); // index of day int dayIndex = (int)day + 1; richTextBox.AppendText( "Номер дня " + dayIndex + "\n" ); // check by Comparing if (day == WeekDays.Thursday) { richTextBox.AppendText( "Сегодня день недели " + day + "\n" ); }; } } } |
Posted in C#
Comments Off on C#. Пример на перечисления и массивы