-
MY PROJECTS
-
Recent Posts
- Java.Servlet.What is URL Rewriting?
- Java.Servlet.Can i delete Cookie ?
- Java.Servlet.What are the methods for working with cookies provided in servlets?
- Java.Servlet.What are cookies?
- Java.Servlet.What are the different methods of session management in servlets?
- Java.Servlets.What happens to symbols when i don’t encode them in URL, give example ?
- Java.Servlets.What does URL encoding mean? How can it be implemented in Java?
- Java.Servlet.Explain the SingleThreadModel interface.
- Java.Servlet.Can PrintWriter and ServletOutputStream be used simultaneously in a servlet?
- Java.Servlet.What is the difference between PrintWriter and ServletOutputStream?
- Java.Servlet.What is the difference between GET and POST?
- Java.Servlet.What are the methods for sending data from the client to the server?
- Java.Servlets.Which HTTP method is not immutable?
- Java.Servlet.Should I worry about multithreaded safety when working with servlets?
- Java.Servlet.What are the main methods in the HttpServlet class?
- Java.Servlet.Why is the HttpServlet class declared as abstract?
- Java.Servlet.What are the differences between GenericServlet and HttpServlet?
- Java.Servlet.Examples of listeners
- Java.Servlet.Difference between Filters and Listeners
- Java.Servlet.What servlet wrapper classes do you know?
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#
DesignPatterns. AbstractFactory
Абстрактная фабрика порождает абстрактные продукты. При применении, вызове клиентом, конкретная фабрика порождает конкретные продукты, опираясь на абстракцию. Канонический пример На примере супер героев Delphi Main
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 |
program AbstractFactory; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils, uAbstractFactory in 'uAbstractFactory.pas'; var f: TAbstractSuperHeroesFactory; c: TClient; begin try f := TDisneyFactory.Create(); c := TClient.Create(f); c.SaveMePlease(); Readln; except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; end. |
Фабрика и клиент
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 |
unit uAbstractFactory; interface uses System.SysUtils; type TAbstractFlyingSuperHero = class public procedure SaveTheWorld; virtual; abstract; end; TSuperMan = class(TAbstractFlyingSuperHero) public procedure SaveTheWorld; override; end; TAbstractSuperHeroesFactory = class public function CreateFlyingSuperHero: TAbstractFlyingSuperHero; virtual; abstract; end; TDisneyFactory = class(TAbstractSuperHeroesFactory) public function CreateFlyingSuperHero: TAbstractFlyingSuperHero; override; end; TClient = class private FAbstractFlyingSuperHero: TAbstractFlyingSuperHero; public constructor Create(aFactory: TAbstractSuperHeroesFactory); procedure SaveMePlease(); end; implementation { TDisneyFactory } function TDisneyFactory.CreateFlyingSuperHero: TAbstractFlyingSuperHero; begin Result := TSuperMan.Create(); end; { TClient } constructor TClient.Create(aFactory: TAbstractSuperHeroesFactory); begin FAbstractFlyingSuperHero := aFactory.CreateFlyingSuperHero(); end; procedure TClient.SaveMePlease; begin FAbstractFlyingSuperHero.SaveTheWorld(); Writeln('SuperMan saved me!'); end; { TSuperMan } procedure TSuperMan.SaveTheWorld; begin Writeln('I''m flying to save you... ! '); end; end. |
C#
Algos.Hackerrank.Birthday Cake Candles
You are in charge of the cake for your niece’s birthday and have decided the cake will have one candle for each year of her total age. When she blows out the candles, she’ll only be able to blow out … Continue reading
Posted in C#
Comments Off on Algos.Hackerrank.Birthday Cake Candles
Algos.Hackerrank.Mini – Max Summ
Given five positive integers, find the minimum and maximum values that can be calculated by summing exactly four of the five integers. Then print the respective minimum and maximum values as a single line of two space-separated long integers. For … Continue reading
Posted in C#
Comments Off on Algos.Hackerrank.Mini – Max Summ
C#. Сложение очень больших чисел
Было на одном из собеседований. Сделать сложение очень больших чисел, которые не влезают в long и int64, заходят как строка, при этом должны быть следующие ограничения: -Не отрицательное число -В аргументе только цифры -Нет ведущих нолей -Не пустая строка -Целое … Continue reading
Posted in C#
Comments Off on C#. Сложение очень больших чисел
JS.React. Отправка формы
package.json
1 2 3 4 5 6 7 8 9 10 |
{ "name": "formsapp", "version": "1.0.0", "scripts": { "start": "lite-server" }, "devDependencies": { "lite-server": "^2.2.1" } } |
Далее, в консоли переходим в директорию проекта при помощи cd и вводим npm install
Posted in C#
Comments Off on JS.React. Отправка формы
C#.MVC.React.Первое приложение
Практика по ресурсу Metanit Создадим первый проект и установим через Nuget React.Web.Mvc4 Воспользуемся контроллером Home и его методом Index
1 2 3 4 |
public ActionResult Index() { return View(); } |
В его представлении напишем следующее
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
@{ Layout = null; } <html> <head> <title>Hello React</title> </head> <body> <div id="content"></div> <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.3.2/react.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.3.2/react-dom.js"></script> <script src='@Url.Content("~/Scripts/helloApp.jsx")'></script> </body> </html> |
В скрипты добавим следующий файл helloApp.jsx
1 2 3 4 5 6 7 8 9 |
class Hello extends React.Component { render() { return <h1>Привет, React.JS</h1>; } } ReactDOM.render( <Hello />, document.getElementById("content") ); |
Результат
Posted in C#
Comments Off on C#.MVC.React.Первое приложение
C#.Mvc.Jquery. Подключение обработчиков
Контроллер
1 2 3 4 |
public ActionResult OnClick() { return View(); } |
Представление
Posted in C#
Comments Off on C#.Mvc.Jquery. Подключение обработчиков
C#.Mvc.JS.Window
Открытие нового окна браузера Контроллер
1 2 3 4 |
public ActionResult Window() { return View(); } |
Представление
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
@{ ViewBag.Title = "Window"; } <h2>Window</h2> <script> //var popup = window.open('https://microsoft.com', 'Microsoft', 'width=400, height=400, resizable=yes'); // new window var popup = window.open('https://microsoft.com', 'Microsoft'); // just in new tab function closeWindow() { popup.close(); } setTimeout(closeWindow, 10000); </script> |
Результат Более подробно про окна
Posted in C#
Comments Off on C#.Mvc.JS.Window
Mvc.Js.Отправка запросов на сервер и обработка ответа на клиенте разными способами
Отправка Get запросов в строке запроса Создадим контроллер Requests и создадим в нем метод GetRequest
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace JSLearning.Controllers { public class RequestsController : Controller { // GET: Requests public ActionResult Index() { return View(); } [HttpGet] public ContentResult GetRequest() { return Content("param1=" + Request["param1"] + " param2=" + Request["param2"]); } } } |
Обратимся на сервер со следующим запросом
Posted in C#
Comments Off on Mvc.Js.Отправка запросов на сервер и обработка ответа на клиенте разными способами
C#.MVC.JS. Авторизация
В данном случае напишем авторизацию. Прежде всего создадим базу MS SQL и единственную в ней табличку Users и в ней 3 поля – Id (автоинкрементное) ,Login,Password Следующий шаг В VisualStudio, MVC -установим EntityFramework при помощи Nuget в моделях добавим модели … Continue reading
Posted in C#
Comments Off on C#.MVC.JS. Авторизация