-
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: javascript
JS. setTimeout. setInterval Вызов функций с задержкой и интервалом
Демонстрация методов setTimeout и setInterval Main.html
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>main</title> </head> <body> <button id="SetInterval">SetInterval</button> <button id="SetTimeout">SetTimeout</button> <script src="EventHandler.js"></script> <hr> <div id="mydiv"> </div> </body> </html> |
EventHandler.js
|
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 |
/** * @author Stas */ var time; var ON; function CountDown(){ if (ON==true){ document.getElementById('mydiv').innerHTML=time+' seconds left'; if (time!==0){time=time-1;} else if (time===0) {document.getElementById('mydiv').innerHTML='time is over'; ON=false;} } }; function setIntervalDemo(){ time=prompt('What is delay in seconds?','2'); ON=true; setInterval(CountDown,1000); } function WriteToDiv(){ document.getElementById('mydiv').innerHTML= document.getElementById('mydiv').innerHTML+' Its Ready now! Its setTimeoutDemo'; } function setTimeoutDemo(){ document.getElementById('mydiv').innerHTML=''; time=prompt('What is delay in seconds?','2'); document.getElementById('mydiv').innerHTML='Wait... for '+time+' seconds...'; setTimeout(WriteToDiv,time*1000); //location.reload(); } document.getElementById('SetInterval').onclick=function(){setIntervalDemo();}; document.getElementById('SetTimeout').onclick=function(){setTimeoutDemo();}; |
Posted in javascript, Без рубрики
Comments Off on JS. setTimeout. setInterval Вызов функций с задержкой и интервалом
JS. Обработка некоторых событий. Простой пример
Файл Main.html
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>main</title> </head> <body> <button id="ClickEvent">ClickEvent</button> <button id="MouseMove">MouseMove</button> <script src="EventHandler.js"></script> <hr> <div id="mydiv"> </div> </body> </html> |
Файл EventHandler.js
|
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 |
/** * @author Stas */ var SwitchOn=true; //Функция для обработки события onclick function MyClick(){ if (SwitchOn==true){ SwitchOn=false; document.getElementById('mydiv').innerHTML='This is Text after you clicked'; } else { SwitchOn=true; document.getElementById('mydiv').innerHTML='Another Text after your clicked';} } //Функция для обработки события onmousemove function MyMouseMove(){ document.getElementById('mydiv').innerHTML='This is mouse move Text'; } //Функция для обработки события window.onload - сразу после загрузки //Довольно популярный обработчик и часто называется именно init... function init(){ document.getElementById('mydiv').innerHTML='init function on load window has worked correctly'; } //Назначаем обработчики через присваивание document.getElementById('ClickEvent').onclick=MyClick; document.getElementById('MouseMove').onmousemove=MyMouseMove; window.onload=init; /** // ДРУГОЙ ВАРИАНТ. Назначаем обработчики через анонимные функции document.getElementById('ClickEvent').onclick=function(){MyClick();}; document.getElementById('MouseMove').onmousemove=function(){MyMouseMove();}; window.onload=function(){init();}; */ |
Как узнать какие обработчики у элементов? Я пользуюсь на данный момент Aptana Studio 3 – довольно хорошая IDE. Приведу пример, как можно посмотреть какие обработчики есть у элементов? Например, нам нужен обработчик для … Continue reading
Posted in javascript
Comments Off on JS. Обработка некоторых событий. Простой пример
JS. Как добавить информацию на странице без перезагрузки?
Создаем на сервере 2 файла main.html
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>main</title> </head> <body> <button id="mybuttonid">Please press me</button> <!--ссылку на скрипт надо ставить после кнопки --> <script src="somescript.js"></script> <div id="divid"><hr></div> </body> </html> |
somescript.js
|
1 2 3 4 5 6 7 |
function myfunction(){ document.getElementById('divid').innerHTML=document.getElementById('divid').innerHTML+ 'some content added to the page below'+'<br>'; } document.getElementById('mybuttonid').onclick=function(){ myfunction();}; |
Далее тестируем… При открытии main.html жмем на кнопку…
Posted in javascript
Comments Off on JS. Как добавить информацию на странице без перезагрузки?
Как вывести все свойства объекта на страницу?
Пример создания простого объекта во внешнем JS файле и вызов его по кнопке Файл main.html
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>ObjectsExamle</title> </head> <body> <button id="MyButtonID">Start</button> <script src="objects.js"></script> </body> </html> |
Файл objects.js
|
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 |
//Создание простого объекта внутри функции function CreateFiat(){ var fiat={ make:"Fiat", model:"500", year:1957, color:"Medium Blue", passengers:2, convertible:false, mileage:88000, started:false, //Далее пошли методы объекта start:function(){ this.started=true; // слово this необходимо, потому что мы вызываем свойство started оъекта fiat }, stop:function(){ this.started=false; }, drive:function(){ if (this.started==true){alert('zoom zoom');} else if (this.started==false){alert('You need to start an engine');} } }; //Выводим свойства и методы объекта for (var prop in fiat){document.write(prop+':'+fiat[prop]+'<br>');} } // Ставим обработчик на кнопку, чтобы скрипт срабатывал только при нажатии document.getElementById('MyButtonID').onclick=function(){CreateFiat();}; |
Posted in javascript
Comments Off on Как вывести все свойства объекта на страницу?
JS. Объекты. Создание простого объекта и вызов по кнопке из внешнего файла
Пример создания простого объекта во внешнем JS файле и вызов его по кнопке Файл main.html
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>ObjectsExamle</title> </head> <body> <button id="MyButtonID">Start</button> <script src="objects.js"></script> </body> </html> |
Файл objects.js
|
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 |
//Создание простого объекта внутри функции function CreateFiat(){ var fiat={ make:"Fiat", model:"500", year:1957, color:"Medium Blue", passengers:2, convertible:false, mileage:88000, started:false, //Далее пошли методы объекта start:function(){ this.started=true; // слово this необходимо, потому что мы вызываем свойство started оъекта fiat }, stop:function(){ this.started=false; }, drive:function(){ if (this.started==true){alert('zoom zoom');} else if (this.started==false){alert('You need to start an engine');} } }; //Тестируем методы объекта fiat.start(); fiat.drive(); } // Ставим обработчик на кнопку, чтобы скрипт срабатывал только при нажатии document.getElementById('MyButtonID').onclick=function(){CreateFiat();}; |
Если все нормально – должно выскочить сообщение zoom-zoom
Posted in javascript
Comments Off on JS. Объекты. Создание простого объекта и вызов по кнопке из внешнего файла
JS. Как запустить JS из внешнего файла по кнопке?
Простой практический вопрос о том как запустить JS из внешнего файла по кнопке. Пусть у нас есть основной HTML файл с кнопкой, с определенным ID
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>ObjectsExamle</title> </head> <body> <button id="MyButtonID">Start</button> <script src="SomeExternalJSFile.js"></script> </script> </body> </html> |
Пусть у нас есть некоторый скрипт во внешнем файле SomeExternalJSFile.js, в котором мы будем искать … Continue reading
Posted in javascript
Comments Off on JS. Как запустить JS из внешнего файла по кнопке?
JS. Массивы. Сортировка
Сортировка чисел по возрастанию и убыванию
|
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 |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>ArraySort</title> <meta name="author" content="Stas" /> <!-- Date: 2015-12-13 --> </head> <body> <script> document.write('<p>Below you can see array of random numbers</p>'); var array=[]; var i; for (i=0;i<10;i++){array[i]=Math.floor(Math.random()*9);document.write(array[i]+'<br>'); } function AscSort(){ function AscCompareNumeric(a, b) { if (a > b) return 1; if (a < b) return -1; } document.write('<p>Now it is Sorted!</p>'); array.sort(AscCompareNumeric); for (i=0;i<10;i++){document.write(array[i]+'<br>'); } } function DescSort(){ function DescCompareNumeric(a, b) { if (a > b) return -1; if (a < b) return +1; } document.write('<p>Now it is Sorted!</p>'); array.sort(DescCompareNumeric); for (i=0;i<10;i++){document.write(array[i]+'<br>'); } } </script> <button onclick="AscSort()">AscSort (сортировка по возрастанию)</button> <button onclick="DescSort()">DescSort (сортировка по убыванию)</button> </body> </html> |
Posted in javascript
Comments Off on JS. Массивы. Сортировка
JS. Морской бой. Упрощенная версия
Восстановил пример со своими вариациями из книги издательства O’Reilly Пример достаточно тривиальный, но мне, как человеку, который закрепляет свои навыки после изучения теории – самое то. На сервере издательства не нашел готового варианта упрощенной версии Морского Боя, поэтому пришлось поработать … Continue reading
Posted in javascript, Без рубрики
Comments Off on JS. Морской бой. Упрощенная версия
JS. Пишем в консоль
Пишем в консоль…
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
<html> <head> <!--Включаем юникод кодировку, чтобы программа понимала русский --> <meta name="http-equiv" content="Content-type:text/html" charset="UTF-8"> </head> <body> <script> document.write('Open console. F12'); var message='This is message for log. Believe?'; console.log(message); </script> </body> </html> |
Posted in javascript, Без рубрики
Comments Off on JS. Пишем в консоль
JS. Как запустить JS под WordPress?
Известно, что WP блокирует запуск JS в постах – оно и понятно и правильно. Но вот что делать тем, кому JS на своих страницах все-таки необходим? В сети много примеров как это обойти – некоторые довольно сложные – нужно копаться … Continue reading
Posted in javascript
Comments Off on JS. Как запустить JS под WordPress?