-
MY PROJECTS
-
Recent Posts
- SpringBoot. Exception Management
- Java.Hibernate.JoinTableAnnotation
- SpringBoot.Making our first starter and autoconfiguration
- Spring. Creating main annotation to start business logic
- Spring.Reading from properties file
- Spring.How to define spring version inside springBoot ?
- SpringBoot App inside Docker
- Kafka.FirstExperience
- Docker.MySql and Lost connection to MySQL server at ‘reading initial communication packet’, system error: 0
- Gradle.Tips
- Spring.AppConfig
- Leetcode.Best-time-to-buy-and-sell-stock
- LeetCode.ClimbStairs.Fibbonacci
- Leetcode.Roman-to-integer
- LeetCode.Palindrome-number
- Java.DesignPatterns.Lightweight
- Java.DesignPatterns.Proxy
- Java.DesignPatterns.Facade
- Java.DesignPatterns.Composite
- Java.DesignPatterns.Bridge
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)
- Регулярные выражения
- Тестирование приложений
Monthly Archives: January 2017
Delphi. Алгоритмы. Создание уникального имени через добавление номера в конце в скобках. Например SomeFile(1), SomeFile(2) и др.
Итак, пусть у нас в некоторой директории находится файл SomeFile, сделаем так, чтобы при добавлении следующего файла с именем SomeFile, в директории оказался файл SomeFile(1), SomeFile(2), SomeFile(3). При отсутствии этого файла в директорию копируется просто файл. Данная задача возникла в … Continue reading
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#. Создание и инициализация массивов
Delphi. idHTTP.Get и русские символы
Мне нужно было на свой собственный сервер отправлять запрос на получение картинки, например по адресу
1 |
http://localhost:40000/public/files/1/2017/1/9/Русский{EA1B9B79-AA95-424D-8AD2-AAE5BA023810}.png |
делал это через idHTTP.Get, но все русские символы либо обрезались либо уходили в виде ????????, уже сталкивался с этой проблемой, поэтому решил просто использовать … Continue reading
Posted in Delphi
Comments Off on Delphi. idHTTP.Get и русские символы
Delphi. DBGrid. Как пробежаться и собрать значения определенного поля выделенных записей?
DBGrid включаем в режим multiSelect. На примере сбора поля ID из базы данных
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
procedure TVisualFrame_HTTP.StatusBarClick(Sender: TObject); var idList: TStringList; i: integer; s: string; begin idList := TStringList.Create; try if DBGrid.SelectedRows.Count > 0 then with DBGrid.DataSource.DataSet do for i := 0 to DBGrid.SelectedRows.Count-1 do begin GotoBookmark(pointer(DBGrid.SelectedRows.Items[i])); idList.Add(FieldByName('id').AsInteger.ToString()); end; for i := 0 to idList.Count-1 do s := s + IDList[i] + #13#10; ShowMessage(s); finally IDList.Free; end; end; |
Posted in Delphi
Comments Off on Delphi. DBGrid. Как пробежаться и собрать значения определенного поля выделенных записей?
Delphi. FireDAC. Проверка на NULL и запись NULL значений в базу данных
Проверка на NULL
1 2 3 4 5 6 |
with qSomeQuery do begin if FieldByName('someField').IsNull then //do something end; |
Запись NULL значений, согласно инструкции
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
// setting param to null ... qSomeQuery.SQL.Text:= 'INSERT INTO DATABASE.TABLE (`someParam`) values (:someParam)'; ... //To set the parameter value to Null, specify the parameter data type, then call the Clear method: with qSomeQuery do begin with ParamByName('someParam') do begin DataType:=ftInteger; Clear(); Bound:=true; end; ExecSQL; end; |
Пример из проекта…
1 2 3 4 5 6 |
SET foreign_key_checks = 0; UPDATE `galionsms_db`.`clients` SET `partners_id`=:partners_id WHERE `id`=:id; SET foreign_key_checks = 1; |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
with qUpdatePartners_idInClients do begin Connection:=DBConnection.FDConnection; with ParamByName('partners_id') do begin DataType:=ftInteger; Clear(); Bound:=true; end; Params.ParamValues['id']:=ClientsOfPartner[i]; ExecSQL; end; |