<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/"><channel><title>2016-03 on Funky Si's Test</title><link>https://blog-test.funkysi1701.com/2016/03/</link><description>Recent content in 2016-03 on Funky Si's Test</description><generator>Hugo -- gohugo.io</generator><language>en-gb</language><managingEditor>funkysi1701@gmail.com (Simon Foster)</managingEditor><webMaster>funkysi1701@gmail.com (Simon Foster)</webMaster><lastBuildDate>Thu, 24 Mar 2016 20:00:45 +0000</lastBuildDate><atom:link href="https://blog-test.funkysi1701.com/2016/03/index.xml" rel="self" type="application/rss+xml"/><item><title>Revisiting Team City</title><link>https://blog-test.funkysi1701.com/posts/2016/revisiting-teamcity/</link><author>funkysi1701@gmail.com (funkysi1701)</author><pubDate>Thu, 24 Mar 2016 20:00:45 +0000</pubDate><guid>https://blog-test.funkysi1701.com/posts/2016/revisiting-teamcity/</guid><category term="CI">CI</category><category term="DevOps">DevOps</category><category term="SourceControl">SourceControl</category><description>&lt;p&gt;Last year I blogged about &lt;a href="https://www.funkysi1701.com/posts/2015/teamcity/" target="_blank" rel="noopener noreferrer"&gt;Team City&lt;/a&gt;
, well I have been looking at it again recently. In that time they have even changed their logo!&lt;/p&gt;
&lt;p&gt;Lets start with thinking about what I want my Continuous Integration server to do.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Check out my code from source control (usually master but all feature branches would be even better)&lt;/li&gt;
&lt;li&gt;Configure specific setting for build&lt;/li&gt;
&lt;li&gt;Build my code&lt;/li&gt;
&lt;li&gt;Build my databases&lt;/li&gt;
&lt;li&gt;Run any unit tests&lt;/li&gt;
&lt;li&gt;(Optional) Run deployment to Azure Test/Live site&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;There are probably other things I want to achieve but I will start with these six.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Checking out code from source control is something Team City does out of the box, so I can safely say I have done this now. It even monitors a branch for changes and initiates a new check out.&lt;/li&gt;
&lt;li&gt;Team City allows you to create specific build steps so in theory you can have multiple builds for every variation of settings that you want for your code. I have not tried this yet apart from building with the default config, but I don’t expect it will be too difficult.&lt;/li&gt;
&lt;li&gt;I have managed to get my code to build with Team City, it took a bit of tweaking the different build steps but wasn’t too difficult. Team City has a visual studio build agent which takes you solution file and does what it needs to. The one problem I have found with this step is that I get errors with my tests if I select a Debug config instead of Release.&lt;/li&gt;
&lt;li&gt;Databases are always the problem part of the deployment. So far I have manually deployed my databases but I intend on revisit this step. A &lt;a href="https://stackoverflow.com/questions/21555038/how-can-i-execute-sql-scripts-using-teamcity" target="_blank" rel="noopener noreferrer"&gt;stackoverflow&lt;/a&gt;
post suggests that I can run SQL code via Team City in the following way by creating a command line executable:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Command executable: c:&lt;span style="color:#ae81ff"&gt;\P&lt;/span&gt;rogram Files&lt;span style="color:#ae81ff"&gt;\M&lt;/span&gt;icrosoft SQL Server&lt;span style="color:#ae81ff"&gt;\1&lt;/span&gt;00&lt;span style="color:#ae81ff"&gt;\T&lt;/span&gt;ools&lt;span style="color:#ae81ff"&gt;\B&lt;/span&gt;inn&lt;span style="color:#ae81ff"&gt;\s&lt;/span&gt;qlcmd.exe
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Command parameters: -S &lt;span style="color:#f92672"&gt;[&lt;/span&gt;ServerName&lt;span style="color:#f92672"&gt;]&lt;/span&gt; -i &lt;span style="color:#f92672"&gt;[&lt;/span&gt;PathToSQLScript&lt;span style="color:#f92672"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I have yet to try this but I am hopefully that it will just work. Dropping a database and restoring a back and then running different SQL scripts is all possible from TSQL, so I should be OK. Watch this space for more details.&lt;/p&gt;
&lt;ol start="5"&gt;
&lt;li&gt;Running the unit tests got me stuck for a while. I tried setting it up using VSTest or MSTest neither worked mainly because a config file wasn’t being copied with the test binaries. When I tried using NUnit it just worked. The tests that failed gave me a few config settings to change.&lt;/li&gt;
&lt;li&gt;I have powershell scripts that deploy to Azure websites, I think that these could form the basis of a deployment to Azure. Again the difficult step here may end up being deploying all the different databases to Azure. This is also the riskiest step as I need to connect to live servers which is why I will leave this to last, at the very least I could generate scripts that do a full deployment.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;That’s it for now. Once I have this all working I will revisit again with details of the database steps as I am expecting a few challenges to overcome. What have you used a CI Server for? Are there other things I want to achieve from a project like this? Why not contact me or leave a comment below&lt;/p&gt;</description></item><item><title>Model View Controller (MVC)</title><link>https://blog-test.funkysi1701.com/posts/2016/model-view-controller-mvc/</link><author>funkysi1701@gmail.com (funkysi1701)</author><pubDate>Thu, 17 Mar 2016 20:00:45 +0000</pubDate><guid>https://blog-test.funkysi1701.com/posts/2016/model-view-controller-mvc/</guid><category term="MVC">MVC</category><description>&lt;p&gt;
&lt;img class="img-fluid" alt="Model View Controller software architecture diagram" src="https://blog-test.funkysi1701.com/images/2016/27.jpg" loading="lazy"
width="327" height="314"
/&gt;
&lt;/p&gt;
&lt;p&gt;Model View Controller or MVC is a software architectural pattern for implementing user interfaces on computers. It divides a given software application into three interconnected parts, so as to separate internal representations of information from the ways that information is presented to or accepted from the user.&lt;/p&gt;
&lt;p&gt;I have been trying to get my head around the concept of MVC for a while, hopefully writing this article will help solidify my understanding of it.&lt;/p&gt;
&lt;p&gt;One of the core concepts of MVC is the ability to separate concerns so you can concentrate your energies on one aspect of the application.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Model&lt;/strong&gt; This is the data. If your application uses a database the model often mirrors what you have in the database and concerns itself retrieving information from the database.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;View&lt;/strong&gt; This concerns itself with displaying the data to the user. Typically this is the html pages of your application.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Controller&lt;/strong&gt; This concerns itself with actually doing things and deals with user interaction. Typically it will get data from the view and send data to the model.&lt;/p&gt;
&lt;p&gt;The three concerns can be developed in isolation as they do not depend on each other, for larger development teams you can even divide up development much easier that a traditional app.&lt;/p&gt;
&lt;p&gt;The basic concept of MVC I get and understand, however I find myself getting bogged down in the details.&lt;/p&gt;
&lt;p&gt;The database doesn’t matter. I need to remember this and not get sidetracked in writing custom methods to connect to the database which end up unmanageable. I know SQL, so can easily write SQL commands to copy data into the format I need for my app. The app I am currently working on involves a large amount of existing data, and I need to concentrate on the MVC parts and worry about the database later.&lt;/p&gt;
&lt;p&gt;In previous attempts I have tried to build my model against many tables, but instead I can write a query against many tables and insert that into one table which the Model can then use.&lt;/p&gt;
&lt;p&gt;Changing the model often results in an error informing you that the context has changed since the database was created. The easy solution to this in my case is to drop the database and allow entity framework to recreate the database each time. As long as my database contains no new data, I won’t loose anything.&lt;/p&gt;
&lt;p&gt;One of the core advantages of MVC is the ability to test it or even use test driven development (TDD). I haven’t really dabbled with testing yet as I am still trying to get my head around the fundamentals, but once I have made some progress with my app I want to test, so next time I get asked to add a new feature I have no fear about breaking stuff.&lt;/p&gt;
&lt;p&gt;For the first time I have got an app with a working Authentication system from the start. And it is remarkably easy to implement with one keyword. Adding &lt;strong&gt;[Authorize]&lt;/strong&gt; to the top of your controller is all that is needed. Building the actual Authentication system is relatively easy from Visual Studio, as it has templates for Azure AD, Forms Based, Open Auth like google/twitter etc.&lt;/p&gt;
&lt;p&gt;It is still very early days for my MVC app and my understanding of it, but I feel I have turned the corner and can actually build something with it now, rather than be stuck in a downward spiral of confusion.&lt;/p&gt;
&lt;p&gt;What do you think about MVC why not leave a comment below? For more info about MVC I have been looking at &lt;a href="https://dotnet.microsoft.com/en-us/apps/aspnet" target="_blank" rel="noopener noreferrer"&gt;https://dotnet.microsoft.com/en-us/apps/aspnet&lt;/a&gt;
which has more information and tutorials.&lt;/p&gt;</description></item><item><title>Surface Book Review</title><link>https://blog-test.funkysi1701.com/posts/2016/surface-book-review/</link><author>funkysi1701@gmail.com (funkysi1701)</author><pubDate>Thu, 10 Mar 2016 20:00:45 +0000</pubDate><guid>https://blog-test.funkysi1701.com/posts/2016/surface-book-review/</guid><category term="Laptop">Laptop</category><category term="Hardware">Hardware</category><category term="Technology">Technology</category><category term="Microsoft">Microsoft</category><category term="Windows">Windows</category><media:content medium="image" type="image/jpeg" url="https://blog-test.funkysi1701.com/images/2016/en-INTL-PDP0-Surface-Book-CR9-00001-P2.jpg"/><description>&lt;p&gt;
&lt;img class="img-fluid" alt="Microsoft Surface Book laptop with detachable keyboard" src="https://blog-test.funkysi1701.com/images/2016/en-INTL-PDP0-Surface-Book-CR9-00001-P2.jpg" loading="lazy"
width="780" height="400"
/&gt;
I have just bought myself a new laptop, but it is not just any laptop it is a &lt;a href="https://www.microsoft.com/en-gb/store/d/product/8TXJ08Q9LXDT" target="_blank" rel="noopener noreferrer"&gt;Microsoft Surface Book&lt;/a&gt;
.&lt;/p&gt;
&lt;p&gt;I think this is probably the first time I have bought myself a top of the range laptop and after a few days of use I am loving it.&lt;/p&gt;
&lt;p&gt;The Surface Book is the latest in Microsoft’s Surface line of tablets but the first to feature a keyboard and be more like a traditional laptop. The keyboard is detachable from the keyboard so you can use the Surface Book like a tablet.&lt;/p&gt;
&lt;p&gt;As it is a top of the range laptop, it was not cheap, so if price is a significant factor in your laptop choice this is not the machine for you. Microsoft are trying to compete with Apple’s Macbook range.&lt;/p&gt;
&lt;p&gt;So what did I get for my money:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Windows 10 Pro&lt;/li&gt;
&lt;li&gt;16Gb RAM&lt;/li&gt;
&lt;li&gt;512Gb SSD (Formatted Size nearer 474Gb)&lt;/li&gt;
&lt;li&gt;6th Generation Intel Core i7 Processor&lt;/li&gt;
&lt;li&gt;Surface Pen&lt;/li&gt;
&lt;li&gt;13.5-inch touch screen&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I have only had the device for a few days but these are my thoughts so far. My primary reason for buying this is for doing development work with Visual Studio and SQL Server.&lt;/p&gt;
&lt;p&gt;I really like the Surface Pen. This is a feature that I didn’t think I would use much. The Pen connects via bluetooth and allows interaction with the touch screen. The pressure sensitive screen allows all sort of touch actions to be performed.&lt;/p&gt;
&lt;p&gt;I especially like the choice of keyboards that are offered when the physical keyboard is detached. You can have either a on screen keyboard which you can type with pen or fingers, an on screen keyboard that splits in half or you can write with the pen. This is an amazing feature. My handwriting is not good but most of the time it understands my scrawl. With this option you can hand write a tweet or fill in a form on a webpage. For speed I would not recommend this form of input for large amounts of text, but for browsing the web of when you are just clicking on links it is great.&lt;/p&gt;
&lt;p&gt;Windows Hello – I can unlock windows just by looking at my screen. How cool is that! It was really easy to setup, it just takes a photo of your face and next time you login all you need to do it look at the screen. Note if you are working in tablet mode, make sure the tablet is the correct way up.&lt;/p&gt;
&lt;p&gt;It’s not all brilliant though. Detaching the screen is fiddly and sometimes takes a few moments to do. A few times I have felt I needed another hand but I am sure the more I do this the easier I will find it to do.&lt;/p&gt;
&lt;p&gt;Battery life isn’t great especially when running off the tablet only. This is due to the machine having two batteries, one in the base and one in the screen so with keyboard attached you have much longer use times. Actually I am finding the battery is lasting longer now that I have used it for a few days.&lt;/p&gt;
&lt;p&gt;The screen has a very high resolution 3000 x 2000 but using clever zooming technology everything is still readable and not tiny. However I use Remote Desktop a lot and this caused me a problem. When RDPing the remote session used the host screen resolution which made everything tiny on my servers. The solution to this can be found on &lt;a href="https://superuser.com/questions/891413/remote-connection-desktop-manager-2-7-does-not-support-dpi-scaling-anymore" target="_blank" rel="noopener noreferrer"&gt;SuperUser&lt;/a&gt;
and involved using Microsoft’s Remote Desktop Connection Manager, a cool bit of software for managing multiple RDP sessions. This is actually an improvement on the way I usually work, but until I found the answer this was annoying.&lt;/p&gt;
&lt;p&gt;Another minor annoyance with the keyboard is that you can’t press Ctrl-Alt-Del with one hand. Normally this isn’t a requirement but if the screen locks while I have my son on my lap I am stuck, but I won’t blame the surface book for this.&lt;/p&gt;
&lt;p&gt;When I got my Surface Book I was also given a Microsoft Wireless Display Adapter. I am not a fan of this bit of tech as I can’t get it to work. I briefly got my old laptop to connect but my Surface Book keeps telling me NO!&lt;/p&gt;
&lt;p&gt;Overall I like the Surface Book. It is certainly the nicest laptop I have ever used. Now that I have the docking station I can connect two monitors, have a wired internet connection and it becomes a proper work horse. What does everyone else think? Better than Apple’s range of laptops?&lt;/p&gt;</description></item><item><title>Trying Out Azure Active Directory</title><link>https://blog-test.funkysi1701.com/posts/2016/trying-out-azure-active-directory/</link><author>funkysi1701@gmail.com (funkysi1701)</author><pubDate>Thu, 03 Mar 2016 20:00:45 +0000</pubDate><guid>https://blog-test.funkysi1701.com/posts/2016/trying-out-azure-active-directory/</guid><category term="ActiveDirectory">ActiveDirectory</category><category term="Azure">Azure</category><category term="Authentication">Authentication</category><category term="AzureActiveDirectory">AzureActiveDirectory</category><category term="DevOps">DevOps</category><media:content medium="image" type="image/png" url="https://blog-test.funkysi1701.com/images/2016/arch.png"/><description>&lt;p&gt;One of my plans is to create new MVC Webapps for my companies databases. Once I publish these I will need to secure them so only staff have access.&lt;/p&gt;
&lt;p&gt;The traditional way to do this would be insert membership tables into my database. The user then has to remember another username and password and I have to secure the storage of these credentials. Lots of work for everyone.&lt;/p&gt;
&lt;p&gt;
&lt;img class="img-fluid" alt="Diagram comparing traditional membership tables with Azure Active Directory authentication" src="https://blog-test.funkysi1701.com/images/2016/arch.png" loading="lazy"
width="600" height="430"
/&gt;
&lt;/p&gt;
&lt;p&gt;There is a better way by using Azure Active Directory. You have probably heard of Active Directory, if you are a SysAdmin you probably use it all the time to manage your corporate users and computers. Azure Active Directory is an extension of this into the Cloud.&lt;/p&gt;
&lt;p&gt;I have blogged in the past about using Azure but this is the first time I have tried connecting my internal domain to Azure. There is a &lt;a href="https://vlabs.holsystems.com/vlabs/technet?eng=VLabs&amp;amp;auth=external&amp;amp;src=vlabs&amp;amp;altadd=true&amp;amp;labid=13535" target="_blank" rel="noopener noreferrer"&gt;Virtual Lab&lt;/a&gt;
which helped me try out some of these ideas.&lt;/p&gt;
&lt;p&gt;The first thing I did was to create a new Directory in Azure. I did this via the old portal (&lt;a href="https://manage.windowsazure.com/" target="_blank" rel="noopener noreferrer"&gt;manage.windowsazure.com&lt;/a&gt;
) it might be possible via the new portal but I don’t know how yet.&lt;/p&gt;
&lt;p&gt;Click New, select App Services &amp;gt; Active Directory &amp;gt; Directory and select Custom Create. Select Create new directory, give it a name and a domain name and select a region from the drop down. Then add a Global Admin for this directory.&lt;/p&gt;
&lt;p&gt;There is a tool called &lt;a href="https://www.microsoft.com/en-us/download/details.aspx?id=47594" target="_blank" rel="noopener noreferrer"&gt;Azure Active Directory Connect&lt;/a&gt;
. Download and Install this with express settings on one of your domain controllers. You need to specify a domain admin account to access your domain and the Azure Global Admin account you just created.&lt;/p&gt;
&lt;p&gt;At this point I went to bed so I am not sure how long it tool to sync all the domain information but by morning it was all showing in the users list on Azure.&lt;/p&gt;
&lt;p&gt;All my user accounts are showing with a @contoso.onmicrosoft.com, it is possible to use custom domains but I haven’t figured out that step yet. I made a change in my Active Directory and a while later that change was showing in Azure AD.&lt;/p&gt;
&lt;p&gt;So now what? Open up Visual Studio and see if I can use Azure to Authenticate.&lt;/p&gt;
&lt;p&gt;I selected to create a new MVC web project and clicked the change authenticate option. One of the options was Work and School Accounts, I then selected Cloud Single Organization and entered contoso.onmicrosoft.com. I then ran this app and it authenticated using Azure using my domain password. Really impressed at how easy that was.&lt;/p&gt;
&lt;p&gt;The app then shows up on Azure in the old portal. In Applications you can see a list of which users have access to your app and configure few other app related settings.&lt;/p&gt;
&lt;p&gt;This is a long way off being useful in my actual app, but it shows that the basics of what I am trying to do does work. Anyone done anything similar with Azure AD? How did you get on?&lt;/p&gt;</description></item></channel></rss>