Tuesday, December 13, 2016

Deep Dive into Dependency Injection and Writing Decoupled Quality Code and Testable Software



Dependency Injection is one of those terms that advanced programmers throw out with an expectation and assumption of full understanding on the part of the receiver. It's easy to get infatuated by a cool buzz phrase, especially when you hear so many others using it, but to truly understand something you need to start by understanding the problem spaces that it is trying to solve. It's important to learn the concepts behind DI so you can write software that can be properly tested. In this session, we explain dependency injection from concept to implementation, and use raw code samples to show you how it works and what problems it solves. We demonstrate how writing abstracted code can help you test your applications much better, whether or not you use a DI container. Then we get into what a DI container is and differences between Unity, MEF, MEF2, CasttleWindsor, Ninject, etc. and the different techniques, like DI thru Constructor, Properties, Interception, object graph LifeTime, and other topics. We finish by showing you implementation examples in three different platforms.


Tuesday, December 6, 2016

Git. Cases, solutions, flows.

1. Задачу Accept. Переводим в статус In Progress.
2. Create branch
3. Вваливаем себе локальную версию ветки в папке с проектом:
git fetch
git checkout "new_brunch_name_on_server"
(если не нужны локальные изменения то можно git checkout "new_brunch_name_on_server" -f)

4. Когда готово:

git status
git add .
git commit -m "BOOKS-444 commentsdfsd"
git push

5. Открываем ветку из таски, create pull request
6. Переводим


7. PS: Если хотим залить мастер в локальную ветку
git merge master
или если с форсом из мастера, перетирая локальные изменения
git merge -X theirs origin master


8. Если мы хотим удалить запушенный коммит:
git rebase -i HEAD~<количество последних коммитов, которые хотим увидеть>
Прим.: git rebase -i HEAD~3
затем то напротив ветки, которую нужно удалить, что открылось в редакторе нуждо вначале поставить d (means drop)
сохранить
затем git pull

-------------
Переключиться на определенную ветку. Запушать мастер в эту ветку. Сделать изменения, порешать конфликты. Запулить обратно с форсом.

git reset --hard dfgsdfgdfgsdf
git merge origin master
git add --all
git push --force
-------------

сброс всех текущих изменений, до последнего коммита
git reset --hard
git clean --force

--
Принудительно запушать ветку в удаленную:

git push remote_full_brunch_name local_brunch_name:remote_brunch_name


git push --set-upstream localmaster master


https://git-scm.com/book/ru/v1/%D0%92%D0%B5%D1%82%D0%B2%D0%BB%D0%B5%D0%BD%D0%B8%D0%B5-%D0%B2-Git-%D0%9E%D1%81%D0%BD%D0%BE%D0%B2%D1%8B-%D0%B2%D0%B5%D1%82%D0%B2%D0%BB%D0%B5%D0%BD%D0%B8%D1%8F-%D0%B8-%D1%81%D0%BB%D0%B8%D1%8F%D0%BD%D0%B8%D1%8F

Monday, December 5, 2016

MSSQL Mirroring. Useful notes.


The mirror server instance is not caught up to the recent changes to database:


http://www.sqlfingers.com/2016/06/msg-1422-mirror-server-instance-is-not.html

Database mirroring

If you connect with ADO.NET or the SQL Native Client to a database that is being mirrored, your application can take advantage of the drivers ability to automatically redirect connections when a database mirroring failover occurs. You must specify the initial principal server and database in the connection string and the failover partner server.
Data Source=myServerAddress;Failover Partner=myMirrorServerAddress;
Initial Catalog
=myDataBase;Integrated Security=True;

There is ofcourse many other ways to write the connection string using database mirroring, this is just one example pointing out the failover functionality. You can combine this with the other connection strings options available.


Models:

https://msdn.microsoft.com/en-us/library/ms189852(v=sql.100).aspx


How to: Minimize Downtime for Mirrored Databases When Upgrading Server Instances

https://msdn.microsoft.com/en-us/library/bb677181(v=sql.100).aspx

How to: Manually Fail Over a Database Mirroring Session (SQL Server Management Studio)



GIT. Change editor to Notepad++

git config --global core.editor "'C:/Program Files (x86)/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -no Plugin"